diff options
author | Martin Schreier <martin_s@apache.org> | 2022-01-11 23:17:58 +0100 |
---|---|---|
committer | Martin Schreier <martin_s@apache.org> | 2022-01-11 23:17:58 +0100 |
commit | f73e942e0ad2406fd81355855eca344fafd29857 (patch) | |
tree | 509841ed02cc9b6634b282dd9411a748adc46340 /archiva-modules/archiva-base/archiva-repository-layer | |
parent | 9a102721d6f0e4ef951901427c43f5c0dc936fd7 (diff) | |
download | archiva-f73e942e0ad2406fd81355855eca344fafd29857.tar.gz archiva-f73e942e0ad2406fd81355855eca344fafd29857.zip |
Refactoring of repository feature interface
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-layer')
5 files changed, 17 insertions, 17 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/base/DefaultMergedRemoteIndexesScheduler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/base/DefaultMergedRemoteIndexesScheduler.java index 29e636945..e960b82b1 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/base/DefaultMergedRemoteIndexesScheduler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/base/DefaultMergedRemoteIndexesScheduler.java @@ -76,7 +76,7 @@ public class DefaultMergedRemoteIndexesScheduler if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); Path indexPath = indexCreationFeature.getLocalIndexPath().getFilePath(); if (indexPath!=null) { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java index 694b36dd1..ca15e5f31 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java @@ -319,7 +319,7 @@ public abstract class AbstractRepository implements EditableRepository, EventHan } if (supportsFeature(StagingRepositoryFeature.class)) { - StagingRepositoryFeature sf = getFeature(StagingRepositoryFeature.class).get(); + StagingRepositoryFeature sf = getFeature( StagingRepositoryFeature.class ); if (sf.getStagingRepository() != null) { sf.getStagingRepository().close(); } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java index 547a66659..1d10ef4ce 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java @@ -179,7 +179,7 @@ public class RepositoryGroupHandler { if ( group != null ) { - return group.getFeature( IndexCreationFeature.class ).get( ).getLocalIndexPath( ); + return group.getFeature( IndexCreationFeature.class ).getLocalIndexPath( ); } else { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java index bdcbf04d8..f7cf8a46f 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java @@ -136,7 +136,7 @@ public class ManagedRepositoryHandler result.put( repo.getId( ), repo ); if ( repo.supportsFeature( StagingRepositoryFeature.class ) ) { - StagingRepositoryFeature stagF = repo.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature stagF = repo.getFeature( StagingRepositoryFeature.class ); if ( stagF.getStagingRepository( ) != null ) { ManagedRepository stagingRepo = getStagingRepository( repo ); @@ -191,7 +191,7 @@ public class ManagedRepositoryHandler result.put( id, repo ); if ( repo.supportsFeature( StagingRepositoryFeature.class ) ) { - StagingRepositoryFeature stagF = repo.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature stagF = repo.getFeature( StagingRepositoryFeature.class ); if ( stagF.getStagingRepository( ) != null ) { String stagingId = getStagingId( id ); @@ -272,7 +272,7 @@ public class ManagedRepositoryHandler stageRepo = provider.createStagingInstance( cfg ); if ( stageRepo.supportsFeature( StagingRepositoryFeature.class ) ) { - stageRepo.getFeature( StagingRepositoryFeature.class ).get( ).setStageRepoNeeded( false ); + stageRepo.getFeature( StagingRepositoryFeature.class ).setStageRepoNeeded( false ); } updateReferences( stageRepo, cfg ); } @@ -509,7 +509,7 @@ public class ManagedRepositoryHandler { Configuration configuration = getConfigurationHandler( ).getBaseConfiguration( ); RepositoryProvider provider = getProvider( repo.getType( ) ); - StagingRepositoryFeature feature = repo.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature feature = repo.getFeature( StagingRepositoryFeature.class ); if ( feature.isStageRepoNeeded( ) && feature.getStagingRepository( ) == null ) { ManagedRepository stageRepo = get( getStagingId( repo.getId( ) ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index 3a0707367..35523b9c5 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -126,14 +126,14 @@ public class RepositoryProviderMock implements RepositoryProvider if (configuration.isSnapshots()) { managedRepository.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT ); } - ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( ); + ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ); acf.setRetentionPeriod( Period.ofDays( configuration.getRetentionPeriod( ) ) ); acf.setDeleteReleasedSnapshots( configuration.isDeleteReleasedSnapshots( ) ); acf.setRetentionCount( configuration.getRetentionCount( ) ); - IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ); icf.setIndexPath( new URI( configuration.getIndexDir( ) ) ); icf.setSkipPackedIndexCreation( configuration.isSkipPackedIndexCreation( ) ); - StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ); srf.setStageRepoNeeded( configuration.isStageRepoNeeded( ) ); } catch ( Exception e ) @@ -154,7 +154,7 @@ public class RepositoryProviderMock implements RepositoryProvider throw new RepositoryException(e); } updateManagedInstance( managedRepository, configuration ); - managedRepository.getFeature(StagingRepositoryFeature.class).get().setStageRepoNeeded(false); + managedRepository.getFeature( StagingRepositoryFeature.class ).setStageRepoNeeded(false); return managedRepository; } @@ -189,7 +189,7 @@ public class RepositoryProviderMock implements RepositoryProvider char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray(); remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) ); remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) ); - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) ); rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) ); rif.setIndexUri( new URI( configuration.getIndexDir( ) ) ); @@ -235,14 +235,14 @@ public class RepositoryProviderMock implements RepositoryProvider configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) ); configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) ); configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) ); - ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( ); + ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ); configuration.setRetentionPeriod( acf.getRetentionPeriod( ).getDays( ) ); configuration.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots( ) ); configuration.setRetentionCount( acf.getRetentionCount( ) ); - IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ); configuration.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation( ) ); configuration.setIndexDir( icf.getIndexPath( ) == null ? "" : icf.getIndexPath().toString( ) ); - StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ); configuration.setStageRepoNeeded( srf.isStageRepoNeeded( ) ); return configuration; } @@ -254,7 +254,7 @@ public class RepositoryProviderMock implements RepositoryProvider cfg.setName(repositoryGroup.getName()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); cfg.setMergedIndexPath( indexCreationFeature.getIndexPath().toString() ); } @@ -292,7 +292,7 @@ public class RepositoryProviderMock implements RepositoryProvider configuration.setPassword( new String( pwdCreds.getPassword( ) ) ); } configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) ); - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) ); configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) ); configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) ); |