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 | |
parent | 9a102721d6f0e4ef951901427c43f5c0dc936fd7 (diff) | |
download | archiva-f73e942e0ad2406fd81355855eca344fafd29857.tar.gz archiva-f73e942e0ad2406fd81355855eca344fafd29857.zip |
Refactoring of repository feature interface
Diffstat (limited to 'archiva-modules')
41 files changed, 135 insertions, 160 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java index 6ee08b43d..e8fa5c03a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java @@ -138,7 +138,7 @@ public class ConsumerWantsFilePredicate String indexDirectory; if ( managedRepository.supportsFeature( IndexCreationFeature.class ) ) { - IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ); if ( icf.getIndexPath( ) == null ) { indexDirectory = ".index"; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java index a77d0ebc4..e05488b13 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java @@ -127,14 +127,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 ) @@ -187,7 +187,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( ) ) ); @@ -215,14 +215,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; } @@ -249,7 +249,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( ) ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java index 86bf774bf..5240c06b7 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java @@ -148,7 +148,7 @@ public class RepositoryPurgeConsumer if (repository.supportsFeature( ArtifactCleanupFeature.class )) { - ArtifactCleanupFeature acf = repository.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature acf = repository.getFeature( ArtifactCleanupFeature.class ); int retentionPeriodInDays = acf.getRetentionPeriod( ).getDays( ); int retentionCount = acf.getRetentionCount(); if ( retentionPeriodInDays != 0 ) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java index 3cb612339..dcff3d367 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java @@ -133,14 +133,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 ) @@ -196,7 +196,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( ) ) ); @@ -236,14 +236,14 @@ public class RepositoryProviderMock implements RepositoryProvider configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) ); configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) ); configuration.setLayout( managedRepository.getLayout() ); - 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; } @@ -282,7 +282,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( ) ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 9dd1d7639..d87fe01e9 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -152,7 +152,7 @@ public abstract class AbstractRepositoryPurgeTest config = BasicManagedRepository.newFilesystemInstance( repoId, repoName, basePath.resolve(repoId)); config.addActiveReleaseScheme( ReleaseScheme.RELEASE ); config.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT ); - ArtifactCleanupFeature atf = config.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = config.getFeature( ArtifactCleanupFeature.class ); atf.setRetentionPeriod( Period.ofDays( TEST_DAYS_OLDER) ); String path = AbstractRepositoryPurgeTest.fixPath( basePath.resolve( repoId ).toAbsolutePath().toString() ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java index 62a894f0c..4b473f14a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java @@ -69,7 +69,7 @@ public class DaysOldRepositoryPurgeTest throws Exception { org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); when( sessionFactory.createSession( ) ).thenReturn( repositorySession ); @@ -163,7 +163,7 @@ public class DaysOldRepositoryPurgeTest throws Exception { org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); List<RepositoryListener> listeners = Collections.singletonList( listener ); when( sessionFactory.createSession( ) ).thenReturn( repositorySession ); @@ -242,7 +242,7 @@ public class DaysOldRepositoryPurgeTest throws Exception { org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); List<RepositoryListener> listeners = Collections.singletonList( listener ); when( sessionFactory.createSession( ) ).thenReturn( repositorySession ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java index ba5568ad3..2f8288fda 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java @@ -166,7 +166,7 @@ public class RepositoryPurgeConsumerTest RepositoryPurgeConsumer.class ); repoPurgeConsumer.setRepositorySessionFactory( sessionFactory ); org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); atf.setRetentionPeriod( Period.ofDays( 0 ) ); // force days older off to allow retention count purge to execute. atf.setRetentionCount( TEST_RETENTION_COUNT ); addRepoToConfiguration( "retention-count", repoConfiguration ); @@ -277,7 +277,7 @@ public class RepositoryPurgeConsumerTest repoPurgeConsumer.setRepositorySessionFactory( sessionFactory ); org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature atf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); atf.setRetentionPeriod( Period.ofDays( TEST_DAYS_OLDER ) ); addRepoToConfiguration( "days-old", repoConfiguration ); @@ -366,7 +366,7 @@ public class RepositoryPurgeConsumerTest KnownRepositoryContentConsumer.class ); org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); acf.setDeleteReleasedSnapshots( false ); // Set to NOT delete released snapshots. addRepoToConfiguration( "retention-count", repoConfiguration ); @@ -425,7 +425,7 @@ public class RepositoryPurgeConsumerTest RepositoryPurgeConsumer.class ); repoPurgeConsumer.setRepositorySessionFactory( sessionFactory ); org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); - ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); acf.setDeleteReleasedSnapshots( true ); addRepoToConfiguration( "days-old", repoConfiguration ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java index 1081380d9..0483b5204 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java @@ -53,7 +53,7 @@ public class RetentionCountRepositoryPurgeTest org.apache.archiva.repository.ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); List<RepositoryListener> listeners = Collections.singletonList( listener ); - ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature acf = repoConfiguration.getFeature( ArtifactCleanupFeature.class ); Mockito.when( sessionFactory.createSession( ) ).thenReturn( repositorySession ); Mockito.when( repositorySession.getRepository()).thenReturn( metadataRepository ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java index d2cbb499a..cfaa585f4 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java @@ -123,7 +123,7 @@ public abstract class AbstractRepositoryAdmin adminRepo.setDescription( repo.getDescription() ); adminRepo.setType(repo.getType()==null?"MAVEN": repo.getType().name()); if (repo.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); adminRepo.setIndexDirectory( convertUriToString( icf.getIndexPath() ) ); adminRepo.setPackedIndexDirectory(convertUriToString(icf.getPackedIndexPath())); } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java index f30c849a6..bafaafb10 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java @@ -88,7 +88,7 @@ public class DefaultRepositoryGroupAdmin { org.apache.archiva.repository.RepositoryGroup group = repositoryRegistry.getRepositoryGroup(repositoryGroupId); if (group!=null) { - return group.getFeature(IndexCreationFeature.class).get().getLocalIndexPath(); + return group.getFeature( IndexCreationFeature.class ).getLocalIndexPath(); } else { return null; } @@ -397,7 +397,7 @@ public class DefaultRepositoryGroupAdmin RepositoryGroup rg = new RepositoryGroup( group.getId( ), group.getRepositories().stream().map(r -> r.getId()).collect( Collectors.toList()) ); if (group.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature indexCreationFeature = group.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = group.getFeature( IndexCreationFeature.class ); rg.setMergedIndexPath( indexCreationFeature.getIndexPath().getPath() ); } rg.setCronExpression( group.getSchedulingDefinition() ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index 5b6dae25b..99ed422f3 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -150,19 +150,19 @@ public class DefaultManagedRepositoryAdmin adminRepo.setBlockRedeployments( repo.blocksRedeployments() ); adminRepo.setCronExpression( repo.getSchedulingDefinition() ); if (repo.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); adminRepo.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation() ); } adminRepo.setScanned( repo.isScanned() ); if (repo.supportsFeature( ArtifactCleanupFeature.class) ) { - ArtifactCleanupFeature acf = repo.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature acf = repo.getFeature( ArtifactCleanupFeature.class ); adminRepo.setRetentionPeriod( acf.getRetentionPeriod().getDays() ); adminRepo.setRetentionCount( acf.getRetentionCount() ); adminRepo.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots() ); } if (repo.supportsFeature( StagingRepositoryFeature.class )) { - StagingRepositoryFeature stf = repo.getFeature( StagingRepositoryFeature.class ).get(); + StagingRepositoryFeature stf = repo.getFeature( StagingRepositoryFeature.class ); adminRepo.setStageRepoNeeded( stf.isStageRepoNeeded() ); if (stf.getStagingRepository()!=null) { adminRepo.setStagingRepository( convertRepo( stf.getStagingRepository() ) ); @@ -240,7 +240,7 @@ public class DefaultManagedRepositoryAdmin scanRepository( newRepo.getId(), true ); } - org.apache.archiva.repository.ManagedRepository stagingRepo = newRepo.getFeature( StagingRepositoryFeature.class ).get( ).getStagingRepository( ); + org.apache.archiva.repository.ManagedRepository stagingRepo = newRepo.getFeature( StagingRepositoryFeature.class ).getStagingRepository( ); if ( stagingRepo!=null) { if (stagingRepo.isScanned()) { @@ -285,7 +285,7 @@ public class DefaultManagedRepositoryAdmin org.apache.archiva.repository.ManagedRepository stagingRepository = null; if (repo != null) { if (repo.supportsFeature(StagingRepositoryFeature.class)) { - stagingRepository = repo.getFeature(StagingRepositoryFeature.class).get().getStagingRepository(); + stagingRepository = repo.getFeature( StagingRepositoryFeature.class ).getStagingRepository(); } } else { throw new RepositoryAdminException("A repository with that id does not exist"); @@ -427,7 +427,7 @@ public class DefaultManagedRepositoryAdmin org.apache.archiva.repository.ManagedRepository oldRepo = repositoryRegistry.getManagedRepository( managedRepository.getId( ) ); boolean stagingExists = false; if (oldRepo.supportsFeature( StagingRepositoryFeature.class ) ){ - stagingExists = oldRepo.getFeature( StagingRepositoryFeature.class ).get().getStagingRepository() != null; + stagingExists = oldRepo.getFeature( StagingRepositoryFeature.class ).getStagingRepository() != null; } boolean updateIndexContext = !StringUtils.equals( updatedRepoConfig.getIndexDir(), managedRepository.getIndexDirectory() ); org.apache.archiva.repository.ManagedRepository newRepo; @@ -436,7 +436,7 @@ public class DefaultManagedRepositoryAdmin { newRepo = repositoryRegistry.putRepository( updatedRepoConfig ); if (newRepo.supportsFeature( StagingRepositoryFeature.class )) { - org.apache.archiva.repository.ManagedRepository stagingRepo = newRepo.getFeature( StagingRepositoryFeature.class ).get( ).getStagingRepository( ); + org.apache.archiva.repository.ManagedRepository stagingRepo = newRepo.getFeature( StagingRepositoryFeature.class ).getStagingRepository( ); if (stagingRepo!=null && !stagingExists) { triggerAuditEvent( stagingRepo.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java index 7fd43ec3c..f72285a23 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java @@ -135,7 +135,7 @@ public class DefaultNetworkProxyAdmin } for ( RemoteRepository repo : repositoryRegistry.getRemoteRepositories()) { if (repo.supportsFeature( RemoteIndexFeature.class )) { - RemoteIndexFeature rif = repo.getFeature( RemoteIndexFeature.class ).get(); + RemoteIndexFeature rif = repo.getFeature( RemoteIndexFeature.class ); if (networkProxyId.equals(rif.getProxyId())) { rif.setProxyId( null ); try diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index 427f52e27..f089e9de8 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -89,7 +89,7 @@ public class DefaultRemoteRepositoryAdmin } if ( repo.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = repo.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = repo.getFeature( RemoteIndexFeature.class ); adminRepo.setRemoteIndexUrl( convertUriToString( rif.getIndexUri( ) ) ); adminRepo.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) ); adminRepo.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) ); @@ -98,7 +98,7 @@ public class DefaultRemoteRepositoryAdmin } if ( repo.supportsFeature( IndexCreationFeature.class ) ) { - IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); adminRepo.setIndexDirectory( PathUtil.getPathFromUri( icf.getIndexPath( ) ).toString( ) ); } adminRepo.setDescription( repo.getDescription( ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java index 0557fdb7b..def27d1aa 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java @@ -249,7 +249,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { { throw new IndexUpdateFailedException( "The context is not associated to a remote repository with remote index " + context.getId( ) ); } else { - RemoteIndexFeature rif = context.getRepository().getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); @@ -275,7 +275,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); @@ -506,7 +506,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { @Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); try { icf.setLocalIndexPath(getIndexPath(repo)); } catch (IOException e) { @@ -521,7 +521,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { } private StorageAsset getIndexPath( Repository repo) throws IOException { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); Path repoDir = repo.getRoot().getFilePath(); URI indexDir = icf.getIndexPath(); String indexPath = indexDir.getPath(); @@ -574,7 +574,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { // is there configured indexDirectory ? if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); indexDirectory = getIndexPath(remoteRepository); String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif ); try diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/ArtifactCleanupFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/ArtifactCleanupFeature.java index 57c683043..812d73b80 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/ArtifactCleanupFeature.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/ArtifactCleanupFeature.java @@ -43,11 +43,6 @@ public class ArtifactCleanupFeature implements RepositoryFeature<ArtifactCleanup this.retentionCount = retentionCount; } - @Override - public ArtifactCleanupFeature get() { - return this; - } - /** * Returns true, if snapshot artifacts should be deleted, when artifacts with release version * exist in one of the managed repositories. diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/IndexCreationFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/IndexCreationFeature.java index 7f5874edd..fe870a3aa 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/IndexCreationFeature.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/IndexCreationFeature.java @@ -85,11 +85,6 @@ public class IndexCreationFeature extends AbstractFeature implements RepositoryF } } - @Override - public IndexCreationFeature get() { - return this; - } - /** * Returns true, if no packed index files should be created. * @return True, if no packed index files are created, otherwise false. diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RemoteIndexFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RemoteIndexFeature.java index 245b8b07d..d8e28a667 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RemoteIndexFeature.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RemoteIndexFeature.java @@ -47,11 +47,6 @@ public class RemoteIndexFeature implements RepositoryFeature<RemoteIndexFeature> private String proxyId = ""; - @Override - public RemoteIndexFeature get() { - return this; - } - /** * True, if the remote index should be downloaded. * @return True if download, otherwise false. diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java index 813d39d5c..82cc4cfca 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java @@ -69,9 +69,4 @@ public interface RepositoryFeature<T extends RepositoryFeature<T>> { return this.getClass().equals(clazz); } - /** - * Returns the concrete feature instance. - * @return the feature instance. - */ - T get(); } diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/StagingRepositoryFeature.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/StagingRepositoryFeature.java index 3e4ba1257..f919ebeb1 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/StagingRepositoryFeature.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/StagingRepositoryFeature.java @@ -42,11 +42,6 @@ public class StagingRepositoryFeature implements RepositoryFeature<StagingReposi this.stageRepoNeeded = stageRepoNeeded; } - @Override - public StagingRepositoryFeature get() { - return this; - } - /** * Returns the staging repository, if it exists. * 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( ) ); diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/maven/indexer/MavenIndexManager.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/maven/indexer/MavenIndexManager.java index da4d1b779..6a9fb7429 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/maven/indexer/MavenIndexManager.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/maven/indexer/MavenIndexManager.java @@ -272,7 +272,7 @@ public class MavenIndexManager implements ArchivaIndexManager { { throw new IndexUpdateFailedException( "The context is not associated to a remote repository with remote index " + context.getId( ) ); } else { - RemoteIndexFeature rif = context.getRepository().getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); @@ -298,7 +298,7 @@ public class MavenIndexManager implements ArchivaIndexManager { NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); @@ -535,7 +535,7 @@ public class MavenIndexManager implements ArchivaIndexManager { @Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); try { icf.setLocalIndexPath(getIndexPath(repo)); icf.setLocalPackedIndexPath(getPackedIndexPath(repo)); @@ -559,7 +559,7 @@ public class MavenIndexManager implements ArchivaIndexManager { log.error("Could not create temporary directory for merged index: {}", e.getMessage(), e); throw new IndexCreationFailedException("IO error while creating temporary directory for merged index: "+e.getMessage(), e); } - IndexCreationFeature indexCreationFeature = destinationRepo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature indexCreationFeature = destinationRepo.getFeature( IndexCreationFeature.class ); if (indexCreationFeature.getLocalIndexPath()== null) { throw new IllegalArgumentException("The given repository does not have a local index path"); } @@ -643,12 +643,12 @@ public class MavenIndexManager implements ArchivaIndexManager { } private StorageAsset getIndexPath( Repository repo) throws IOException { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); return getIndexPath( icf.getIndexPath(), repo, DEFAULT_INDEX_PATH); } private StorageAsset getPackedIndexPath(Repository repo) throws IOException { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); return getIndexPath(icf.getPackedIndexPath(), repo, DEFAULT_PACKED_INDEX_PATH); } @@ -669,7 +669,7 @@ public class MavenIndexManager implements ArchivaIndexManager { // is there configured indexDirectory ? if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); indexDirectory = getIndexPath(remoteRepository); String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif ); try diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/MavenIndexManagerTest.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/MavenIndexManagerTest.java index c7e5cd55e..57d3034d1 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/MavenIndexManagerTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/MavenIndexManagerTest.java @@ -205,7 +205,7 @@ public class MavenIndexManagerTest { } repository = MavenManagedRepository.newLocalInstance("test-repo", "Test Repo", Paths.get("target/repositories")); // repository.setLocation(new URI("test-repo")); - IndexCreationFeature icf = repository.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repository.getFeature( IndexCreationFeature.class ); icf.setIndexPath(new URI(indexPathName)); ctx = mavenIndexManager.createContext(repository); return ctx; @@ -216,7 +216,7 @@ public class MavenIndexManagerTest { Path repoPath = Paths.get("target/repositories").toAbsolutePath(); repositoryRemote = MavenRemoteRepository.newLocalInstance("test-repo", "Test Repo", repoPath); repositoryRemote.setLocation(repoPath.resolve("test-repo").toUri()); - RemoteIndexFeature icf = repositoryRemote.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature icf = repositoryRemote.getFeature( RemoteIndexFeature.class ); icf.setIndexUri(new URI(indexPath.getFileName().toString())); ctx = mavenIndexManager.createContext(repositoryRemote); return ctx; diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/search/AbstractMavenRepositorySearch.java index 3ff27e379..2514193e1 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/search/AbstractMavenRepositorySearch.java @@ -207,7 +207,7 @@ public abstract class AbstractMavenRepositorySearch throws Exception { final Repository rRepo = repositoryRegistry.getRepository(repository); - IndexCreationFeature icf = rRepo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = rRepo.getFeature( IndexCreationFeature.class ); ArchivaIndexingContext archivaCtx = rRepo.getIndexingContext(); @@ -269,7 +269,7 @@ public abstract class AbstractMavenRepositorySearch repositoryRegistry.reload(); Repository rRepo2 = repositoryRegistry.getRepository( repository ); - icf = rRepo2.getFeature(IndexCreationFeature.class).get(); + icf = rRepo2.getFeature( IndexCreationFeature.class ); archivaCtx = rRepo2.getIndexingContext(); diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/maven/proxy/mock/repository/RepositoryProviderMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/maven/proxy/mock/repository/RepositoryProviderMock.java index 90dfb5824..1b13d9703 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/maven/proxy/mock/repository/RepositoryProviderMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/maven/proxy/mock/repository/RepositoryProviderMock.java @@ -127,14 +127,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 ) @@ -190,13 +190,13 @@ 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( ) ) ); rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) ); rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) ); - IndexCreationFeature icf = remoteRepository.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = remoteRepository.getFeature( IndexCreationFeature.class ); icf.setIndexPath(new URI(".index" )); } catch ( Exception e ) @@ -232,14 +232,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; } @@ -278,7 +278,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( ) ); diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/maven/repository/MavenRepositoryProvider.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/maven/repository/MavenRepositoryProvider.java index 87a263a03..8319e2704 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/maven/repository/MavenRepositoryProvider.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/maven/repository/MavenRepositoryProvider.java @@ -231,17 +231,17 @@ public class MavenRepositoryProvider implements RepositoryProvider { repo.removeActiveReleaseScheme(ReleaseScheme.SNAPSHOT); } - StagingRepositoryFeature stagingRepositoryFeature = repo.getFeature(StagingRepositoryFeature.class).get(); + StagingRepositoryFeature stagingRepositoryFeature = repo.getFeature( StagingRepositoryFeature.class ); stagingRepositoryFeature.setStageRepoNeeded(cfg.isStageRepoNeeded()); - IndexCreationFeature indexCreationFeature = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ); indexCreationFeature.setSkipPackedIndexCreation(cfg.isSkipPackedIndexCreation()); String indexDir = StringUtils.isEmpty( cfg.getIndexDir() ) ? DEFAULT_INDEX_PATH : cfg.getIndexDir(); String packedIndexDir = StringUtils.isEmpty( cfg.getPackedIndexDir() ) ? DEFAULT_PACKED_INDEX_PATH : cfg.getPackedIndexDir(); indexCreationFeature.setIndexPath(getURIFromString(indexDir)); indexCreationFeature.setPackedIndexPath(getURIFromString(packedIndexDir)); - ArtifactCleanupFeature artifactCleanupFeature = repo.getFeature(ArtifactCleanupFeature.class).get(); + ArtifactCleanupFeature artifactCleanupFeature = repo.getFeature( ArtifactCleanupFeature.class ); artifactCleanupFeature.setDeleteReleasedSnapshots(cfg.isDeleteReleasedSnapshots()); artifactCleanupFeature.setRetentionCount(cfg.getRetentionCount()); @@ -285,7 +285,7 @@ public class MavenRepositoryProvider implements RepositoryProvider { throw new RepositoryException("The url config is not a valid uri: " + cfg.getUrl()); } repo.setTimeout(Duration.ofSeconds(cfg.getTimeout())); - RemoteIndexFeature remoteIndexFeature = repo.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature remoteIndexFeature = repo.getFeature( RemoteIndexFeature.class ); remoteIndexFeature.setDownloadRemoteIndex(cfg.isDownloadRemoteIndex()); remoteIndexFeature.setDownloadRemoteIndexOnStartup(cfg.isDownloadRemoteIndexOnStartup()); remoteIndexFeature.setDownloadTimeout(Duration.ofSeconds(cfg.getRemoteDownloadTimeout())); @@ -313,7 +313,7 @@ public class MavenRepositoryProvider implements RepositoryProvider { } else { credentials.setPassword(new char[0]); } - IndexCreationFeature indexCreationFeature = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ); if ( !StringUtils.isEmpty( cfg.getIndexDir( ) ) ) { indexCreationFeature.setIndexPath( getURIFromString( cfg.getIndexDir( ) ) ); @@ -347,7 +347,7 @@ public class MavenRepositoryProvider implements RepositoryProvider { repositoryGroup.setMergedIndexTTL(configuration.getMergedIndexTtl()); repositoryGroup.setSchedulingDefinition(configuration.getCronExpression()); if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); indexCreationFeature.setIndexPath( getURIFromString(configuration.getMergedIndexPath()) ); Path localPath = Paths.get(configuration.getMergedIndexPath()); Path repoGroupPath = repositoryGroup.getRoot().getFilePath().toAbsolutePath(); @@ -395,11 +395,11 @@ public class MavenRepositoryProvider implements RepositoryProvider { cfg.setExtraHeaders(remoteRepository.getExtraHeaders()); cfg.setRefreshCronExpression(remoteRepository.getSchedulingDefinition()); - IndexCreationFeature indexCreationFeature = remoteRepository.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature indexCreationFeature = remoteRepository.getFeature( IndexCreationFeature.class ); cfg.setIndexDir(convertUriToPath(indexCreationFeature.getIndexPath())); cfg.setPackedIndexDir(convertUriToPath(indexCreationFeature.getPackedIndexPath())); - RemoteIndexFeature remoteIndexFeature = remoteRepository.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature remoteIndexFeature = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( remoteIndexFeature.getIndexUri( ) == null ) { cfg.setRemoteIndexUrl( "" ); @@ -442,14 +442,14 @@ public class MavenRepositoryProvider implements RepositoryProvider { cfg.setRefreshCronExpression(managedRepository.getSchedulingDefinition()); cfg.setScanned(managedRepository.isScanned()); cfg.setBlockRedeployments(managedRepository.blocksRedeployments()); - StagingRepositoryFeature stagingRepositoryFeature = managedRepository.getFeature(StagingRepositoryFeature.class).get(); + StagingRepositoryFeature stagingRepositoryFeature = managedRepository.getFeature( StagingRepositoryFeature.class ); cfg.setStageRepoNeeded(stagingRepositoryFeature.isStageRepoNeeded()); - IndexCreationFeature indexCreationFeature = managedRepository.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature indexCreationFeature = managedRepository.getFeature( IndexCreationFeature.class ); cfg.setIndexDir(convertUriToPath(indexCreationFeature.getIndexPath())); cfg.setPackedIndexDir(convertUriToPath(indexCreationFeature.getPackedIndexPath())); cfg.setSkipPackedIndexCreation(indexCreationFeature.isSkipPackedIndexCreation()); - ArtifactCleanupFeature artifactCleanupFeature = managedRepository.getFeature(ArtifactCleanupFeature.class).get(); + ArtifactCleanupFeature artifactCleanupFeature = managedRepository.getFeature( ArtifactCleanupFeature.class ); cfg.setRetentionCount(artifactCleanupFeature.getRetentionCount()); cfg.setRetentionPeriod(artifactCleanupFeature.getRetentionPeriod().getDays()); cfg.setDeleteReleasedSnapshots(artifactCleanupFeature.isDeleteReleasedSnapshots()); @@ -470,7 +470,7 @@ public class MavenRepositoryProvider 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() ); } diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/MavenRepositoryProviderTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/MavenRepositoryProviderTest.java index 98472de02..002dd7e2a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/MavenRepositoryProviderTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/MavenRepositoryProviderTest.java @@ -134,18 +134,18 @@ public class MavenRepositoryProviderTest assertTrue(mr.blocksRedeployments()); assertEquals("4 0 0 ? * TUE", mr.getSchedulingDefinition()); assertTrue(mr.isScanned()); - ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ); assertEquals( Period.ofDays( 37), artifactCleanupFeature.getRetentionPeriod()); assertTrue(artifactCleanupFeature.isDeleteReleasedSnapshots()); assertEquals(33, artifactCleanupFeature.getRetentionCount()); - IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ); assertNotNull(indexCreationFeature.getIndexPath()); assertEquals("testmanaged/.index", indexCreationFeature.getIndexPath().toString()); assertFalse(indexCreationFeature.getIndexPath().isAbsolute()); assertTrue(indexCreationFeature.isSkipPackedIndexCreation()); - StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ).get(); + StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ); assertTrue(stagingRepositoryFeature.isStageRepoNeeded()); assertNull(stagingRepositoryFeature.getStagingRepository()); @@ -202,22 +202,22 @@ public class MavenRepositoryProviderTest assertEquals( "maven2", mr.getLayout()); try { - ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ).get( ); + ArtifactCleanupFeature artifactCleanupFeature = mr.getFeature( ArtifactCleanupFeature.class ); throw new Exception("artifactCleanupFeature should not be available"); } catch ( UnsupportedFeatureException e ) { // correct } - IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature indexCreationFeature = mr.getFeature( IndexCreationFeature.class ); assertEquals("local/.index", indexCreationFeature.getIndexPath().toString()); try { - StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature stagingRepositoryFeature = mr.getFeature( StagingRepositoryFeature.class ); throw new Exception("stagingRepositoryFeature should not be available"); } catch (UnsupportedFeatureException e) { // correct } - RemoteIndexFeature remoteIndexFeature = mr.getFeature( RemoteIndexFeature.class ).get(); + RemoteIndexFeature remoteIndexFeature = mr.getFeature( RemoteIndexFeature.class ); assertNull(remoteIndexFeature.getProxyId()); } @@ -234,12 +234,12 @@ public class MavenRepositoryProviderTest repo.setSchedulingDefinition( "0 0 05 ? * WED" ); repo.addActiveReleaseScheme( ReleaseScheme.RELEASE ); repo.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT ); - StagingRepositoryFeature stagingFeat = repo.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature stagingFeat = repo.getFeature( StagingRepositoryFeature.class ); stagingFeat.setStageRepoNeeded( true ); - IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ); indexCreationFeature.setIndexPath( new URI("test/.indexes") ); indexCreationFeature.setSkipPackedIndexCreation( true ); - ArtifactCleanupFeature artifactCleanupFeature = repo.getFeature( ArtifactCleanupFeature.class ).get(); + ArtifactCleanupFeature artifactCleanupFeature = repo.getFeature( ArtifactCleanupFeature.class ); artifactCleanupFeature.setRetentionPeriod( Period.ofDays( 5 ) ); artifactCleanupFeature.setRetentionCount( 7 ); artifactCleanupFeature.setDeleteReleasedSnapshots( true ); @@ -276,13 +276,13 @@ public class MavenRepositoryProviderTest repo.setLayout( "maven2" ); repo.setName( repo.getPrimaryLocale(), "test0003" ); repo.setSchedulingDefinition( "0 0 05 ? * WED" ); - RemoteIndexFeature remoteIndexFeature = repo.getFeature( RemoteIndexFeature.class ).get(); + RemoteIndexFeature remoteIndexFeature = repo.getFeature( RemoteIndexFeature.class ); remoteIndexFeature.setProxyId( "proxyabc" ); remoteIndexFeature.setDownloadTimeout( Duration.ofSeconds( 54 ) ); remoteIndexFeature.setDownloadRemoteIndex( false ); remoteIndexFeature.setIndexUri( new URI("/this/remote/.index") ); remoteIndexFeature.setDownloadRemoteIndexOnStartup( true ); - IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repo.getFeature( IndexCreationFeature.class ); indexCreationFeature.setIndexPath( new URI("/this/local/.index") ); RemoteRepositoryConfiguration cfg = provider.getRemoteConfiguration( repo ); @@ -310,7 +310,7 @@ public class MavenRepositoryProviderTest repositoryGroup.setDescription(repositoryGroup.getPrimaryLocale(), "Repository group"); repositoryGroup.setLayout("non-default"); - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); indexCreationFeature.setIndexPath( new URI(".index2") ); repositoryGroup.setName(repositoryGroup.getPrimaryLocale(), "Repo Group 1"); repositoryGroup.setMergedIndexTTL(1005); @@ -358,7 +358,7 @@ public class MavenRepositoryProviderTest assertEquals("group2", grp.getId()); assertEquals("Group 2", grp.getName()); assertEquals("0 0 03 ? * MON", grp.getSchedulingDefinition()); - IndexCreationFeature indexCreationFeature = grp.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = grp.getFeature( IndexCreationFeature.class ); try { assertEquals(new URI(".index-abc"), indexCreationFeature.getIndexPath()); } catch (URISyntaxException e) { diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/mock/ArchivaIndexManagerMock.java index e10df3148..2591a344a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/mock/ArchivaIndexManagerMock.java @@ -251,7 +251,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { { throw new IndexUpdateFailedException( "The context is not associated to a remote repository with remote index " + context.getId( ) ); } else { - RemoteIndexFeature rif = context.getRepository().getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); @@ -277,7 +277,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); @@ -517,7 +517,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { @Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); try { icf.setLocalIndexPath(getIndexPath(repo)); } catch (IOException e) { @@ -534,7 +534,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { private StorageAsset getIndexPath( Repository repo) throws IOException { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); Path repoDir = repo.getRoot().getFilePath(); URI indexDir = icf.getIndexPath(); String indexPath = indexDir.getPath(); @@ -587,7 +587,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { // is there configured indexDirectory ? if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); indexDirectory = getIndexPath(remoteRepository); String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif ); try diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutor.java index 036151f6f..4279c4a03 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutor.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutor.java @@ -259,7 +259,7 @@ public class ArchivaIndexingTaskExecutor if ( repository.supportsFeature( IndexCreationFeature.class ) ) { - IndexCreationFeature icf = repository.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = repository.getFeature( IndexCreationFeature.class ); if ( !icf.isSkipPackedIndexCreation( ) && icf.getLocalPackedIndexPath( ) != null && icf.getLocalIndexPath().getFilePath()!=null ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java index a5aee2ebe..9b716ecfa 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java @@ -96,7 +96,7 @@ public class DefaultDownloadRemoteIndexScheduler { continue; } - RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); // TODO record jobs from configuration @@ -133,7 +133,7 @@ public class DefaultDownloadRemoteIndexScheduler log.warn("ignore scheduleDownloadRemote for repo with id {}. Does not support remote index.", repositoryId); return; } - RemoteIndexFeature rif = remoteRepo.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = remoteRepo.getFeature( RemoteIndexFeature.class ); NetworkProxy networkProxy = null; if ( StringUtils.isNotBlank( rif.getProxyId() ) ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTask.java index d853e9644..45df6e05d 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTask.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTask.java @@ -121,7 +121,7 @@ public class DownloadRemoteIndexTask if (!this.remoteRepository.supportsFeature(RemoteIndexFeature.class)) { throw new RepositoryException("Repository does not support RemotIndexFeature "+remoteRepository.getId()); } - RemoteIndexFeature rif = this.remoteRepository.getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = this.remoteRepository.getFeature( RemoteIndexFeature.class ); IndexingContext indexingContext = this.remoteRepository.getIndexingContext().getBaseContext(IndexingContext.class); // create a temp directory to download files tempIndexDirectory = Paths.get(indexingContext.getIndexDirectoryFile().getParent(), ".tmpIndex" ); diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java index 815a8138d..d1d59c570 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java @@ -279,7 +279,7 @@ public class ArchivaIndexingTaskExecutorTest { Path basePath = repo.getRoot().getFilePath(); - IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); StorageAsset packedIndexDirectory = icf.getLocalPackedIndexPath(); StorageAsset indexerDirectory = icf.getLocalIndexPath(); diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTaskTest.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTaskTest.java index 1358a80ee..fd9f39b03 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTaskTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTaskTest.java @@ -189,12 +189,12 @@ public class DownloadRemoteIndexTaskTest Files.createDirectories( indexDirectory ); remoteRepository.setLocation( new URI( "http://localhost:" + port ) ); repoDirectory.toFile().deleteOnExit(); - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get(); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); rif.setDownloadRemoteIndex( true ); rif.setIndexUri( new URI("http://localhost:" + port + "/index-updates/" ) ); createIndexingContext( remoteRepository ); - // IndexCreationFeature icf = remoteRepository.getFeature( IndexCreationFeature.class ).get( ); + // IndexCreationFeature icf = remoteRepository.getFeature( IndexCreationFeature.class ); // icf.setLocalIndexPath( remoteRepository.getAsset( "index" ) ); return remoteRepository; } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/mock/ArchivaIndexManagerMock.java index 25e5c1a35..260543ba0 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/mock/ArchivaIndexManagerMock.java @@ -246,7 +246,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { { throw new IndexUpdateFailedException( "The context is not associated to a remote repository with remote index " + context.getId( ) ); } else { - RemoteIndexFeature rif = context.getRepository().getFeature(RemoteIndexFeature.class).get(); + RemoteIndexFeature rif = context.getRepository().getFeature( RemoteIndexFeature.class ); remoteUpdateUri = context.getRepository().getLocation().resolve(rif.getIndexUri()); } final RemoteRepository remoteRepository = (RemoteRepository) context.getRepository( ); @@ -272,7 +272,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { NetworkProxy networkProxy = null; if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon( new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders( ) ).networkProxy( @@ -493,7 +493,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { @Override public void updateLocalIndexPath(Repository repo) { if (repo.supportsFeature(IndexCreationFeature.class)) { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); try { icf.setLocalIndexPath(getIndexPath(repo)); } catch (IOException e) { @@ -508,7 +508,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { } private StorageAsset getIndexPath( Repository repo) throws IOException { - IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ); Path repoDir = repo.getRoot().getFilePath(); URI indexDir = icf.getIndexPath(); String indexPath = indexDir.getPath(); @@ -561,7 +561,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { // is there configured indexDirectory ? if ( remoteRepository.supportsFeature( RemoteIndexFeature.class ) ) { - RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); + RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ); indexDirectory = getIndexPath(remoteRepository); String remoteIndexUrl = calculateIndexRemoteUrl( remoteRepository.getLocation( ), rif ); try diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/MavenManagedRepository.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/MavenManagedRepository.java index ba76efb85..01ec552c0 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/MavenManagedRepository.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/MavenManagedRepository.java @@ -84,16 +84,16 @@ public class MavenManagedRepository extends Repository repo.setName( beanRepo.getName()); repo.setScanned( beanRepo.isScanned() ); repo.setSchedulingDefinition( beanRepo.getSchedulingDefinition() ); - ArtifactCleanupFeature artifactCleanupFeature = beanRepo.getFeature( ArtifactCleanupFeature.class ).get( ); + ArtifactCleanupFeature artifactCleanupFeature = beanRepo.getFeature( ArtifactCleanupFeature.class ); repo.setDeleteSnapshotsOfRelease( artifactCleanupFeature.isDeleteReleasedSnapshots()); repo.setRetentionCount( artifactCleanupFeature.getRetentionCount()); repo.setRetentionPeriod( artifactCleanupFeature.getRetentionPeriod() ); - IndexCreationFeature icf = beanRepo.getFeature( IndexCreationFeature.class ).get( ); + IndexCreationFeature icf = beanRepo.getFeature( IndexCreationFeature.class ); repo.setIndex( icf.hasIndex( ) ); repo.setIndexPath( icf.getIndexPath( ).getPath( ) ); repo.setPackedIndexPath( icf.getPackedIndexPath( ).getPath( ) ); repo.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation() ); - StagingRepositoryFeature srf = beanRepo.getFeature( StagingRepositoryFeature.class ).get( ); + StagingRepositoryFeature srf = beanRepo.getFeature( StagingRepositoryFeature.class ); repo.setHasStagingRepository( srf.isStageRepoNeeded( ) ); repo.setStagingRepository( srf.getStagingRepository()!=null?srf.getStagingRepository().getId():"" ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/RepositoryGroup.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/RepositoryGroup.java index 1572d7cd6..907b3873c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/RepositoryGroup.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/RepositoryGroup.java @@ -75,7 +75,7 @@ public class RepositoryGroup implements Serializable, RestModel result.setLocation( modelObj.getLocation().toString() ); result.setRepositories( modelObj.getRepositories().stream().map( Repository::getId ).collect( Collectors.toList()) ); if (modelObj.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature icf = modelObj.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature icf = modelObj.getFeature( IndexCreationFeature.class ); mergeConfig.setMergedIndexPath( icf.getIndexPath( ).toString() ); mergeConfig.setMergedIndexTtlMinutes( modelObj.getMergedIndexTTL( ) ); mergeConfig.setIndexMergeSchedule( modelObj.getSchedulingDefinition() ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/map/MavenRepositoryMapper.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/map/MavenRepositoryMapper.java index 305e8e798..d9f00fc4d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/map/MavenRepositoryMapper.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/map/MavenRepositoryMapper.java @@ -74,8 +74,8 @@ public class MavenRepositoryMapper extends RestServiceMapper<MavenManagedReposit public MavenManagedRepository reverseMap( ManagedRepository source ) { MavenManagedRepository result = new MavenManagedRepository( ); - StagingRepositoryFeature srf = source.getFeature( StagingRepositoryFeature.class ).get( ); - ArtifactCleanupFeature acf = source.getFeature( ArtifactCleanupFeature.class ).get( ); + StagingRepositoryFeature srf = source.getFeature( StagingRepositoryFeature.class ); + ArtifactCleanupFeature acf = source.getFeature( ArtifactCleanupFeature.class ); result.setHasStagingRepository( srf.isStageRepoNeeded() ); result.setBlocksRedeployments( source.blocksRedeployments() ); result.setIndex( source.hasIndex() ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index ec79dd5e1..d252e9c2e 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -416,7 +416,7 @@ public class ArchivaDavResourceFactory String mergedIndexPath = "/"; if (repoGroup.supportsFeature( IndexCreationFeature.class )) { - mergedIndexPath = repoGroup.getFeature( IndexCreationFeature.class ).get().getIndexPath().getPath(); + mergedIndexPath = repoGroup.getFeature( IndexCreationFeature.class ).getIndexPath().getPath(); } if ( StringUtils.endsWith( rootPath, mergedIndexPath ) ) @@ -1051,7 +1051,7 @@ public class ArchivaDavResourceFactory String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" ); String mergedIndexPath = "/"; if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) { - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); mergedIndexPath = indexCreationFeature.getIndexPath().getPath(); } @@ -1113,7 +1113,7 @@ public class ArchivaDavResourceFactory if ( resourceFile.exists() && managedRepository.getRepository().supportsFeature( IndexCreationFeature.class )) { // in case of group displaying index directory doesn't have sense !! - IndexCreationFeature idf = managedRepository.getRepository().getFeature(IndexCreationFeature.class).get(); + IndexCreationFeature idf = managedRepository.getRepository().getFeature( IndexCreationFeature.class ); StorageAsset repoIndexDirectory = idf.getLocalIndexPath(); if ( !StringUtils.equals( FilenameUtils.normalize( repoIndexDirectory.getPath() ), FilenameUtils.normalize( logicalResource.getPath() ) ) ) @@ -1369,7 +1369,7 @@ public class ArchivaDavResourceFactory log.info( "generate temporary merged index for repository group '{}' for repositories '{}'", id, authzRepos ); - IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); + IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ); Path indexPath = indexCreationFeature.getLocalIndexPath().getFilePath(); if (indexPath!=null) { |