]> source.dussan.org Git - archiva.git/commitdiff
Refactoring of repository feature interface
authorMartin Schreier <martin_s@apache.org>
Tue, 11 Jan 2022 22:17:58 +0000 (23:17 +0100)
committerMartin Schreier <martin_s@apache.org>
Tue, 11 Jan 2022 22:17:58 +0000 (23:17 +0100)
41 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/ArtifactCleanupFeature.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/IndexCreationFeature.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RemoteIndexFeature.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/RepositoryFeature.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/features/StagingRepositoryFeature.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/base/DefaultMergedRemoteIndexesScheduler.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/group/RepositoryGroupHandler.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/managed/ManagedRepositoryHandler.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/maven/indexer/MavenIndexManager.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/MavenIndexManagerTest.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/maven/indexer/search/AbstractMavenRepositorySearch.java
archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/maven/proxy/mock/repository/RepositoryProviderMock.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/maven/repository/MavenRepositoryProvider.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/MavenRepositoryProviderTest.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/maven/repository/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutor.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTask.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/maven/scheduler/indexing/DownloadRemoteIndexTaskTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/MavenManagedRepository.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/RepositoryGroup.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/model/map/MavenRepositoryMapper.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java

index 6ee08b43dc6e728cab2f85ce5d9d7fcf76696650..e8fa5c03ac8449d6e20116d19a1eb4be0be3611b 100644 (file)
@@ -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";
index a77d0ebc4bb646a33a5b3953eaf1c3c2e3151733..e05488b13d9d9078b069d23e55f533f330715b28 100644 (file)
@@ -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( ) );
index 86bf774bf1308990ff165f594634c7a3000344a9..5240c06b776fde9e216e348e6607b77d1e75bad8 100644 (file)
@@ -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 )
index 3cb612339bb33b2c8e0ca17075003998f72c0d53..dcff3d3675f19a4c5a780e3242a376de51cef638 100644 (file)
@@ -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( ) );
index 9dd1d76393df63fb8cb8f541abe11f60c7893122..d87fe01e90c86c68f7c89abfff2ef011fc8f6dd5 100644 (file)
@@ -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() );
index 62a894f0c6d27a526074cd913a37288e06e6ca7c..4b473f14a870a5e6517fca47e864bc537bd45a2c 100644 (file)
@@ -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 );
index ba5568ad38d7e2d54fd4602cedf2f8d68938fe03..2f8288fda72417660549b7a2c428a5e3dab30764 100644 (file)
@@ -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 );
 
index 1081380d9f4096ef0c108e9c9c1a10ad61944fac..0483b520448b56c582acd86fdffefd3b4cd95535 100644 (file)
@@ -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 );
index d2cbb499add1ce159a5fb94bdec81a7f1b3e6b65..cfaa585f44f8c3a6b68b6733a8b8a930995a33c3 100644 (file)
@@ -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()));
         }
index f30c849a6259a72f24ecce13989b6fb48b876e6a..bafaafb1045bcf212d4823240d94c5c065a9b2d1 100644 (file)
@@ -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() );
index 5b6dae25b9d89783900ecf6d24bd5694531eb855..99ed422f369013d8250e8ae3a0544e836d845542 100644 (file)
@@ -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 );
index 7fd43ec3c0beade6c32a4c103a9f82dbaeb659bb..f72285a231b58940a3c7d00d66d6160cc2577239 100644 (file)
@@ -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
index 427f52e27af6cde2077d67562e0b17dc906bed7c..f089e9de8e0229ac5b696c70daa1420233786d0f 100644 (file)
@@ -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( ) );
index 0557fdb7b4d6b276add5ea83f6626a9be1d78f3c..def27d1aac67f1909df26219676c6663deec6a3f 100644 (file)
@@ -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
index 57c6830437cd1df6c1dc7218a34243b4c98f5eb5..812d73b800a5abc525cf74863fc414c2531b3cf8 100644 (file)
@@ -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.
index 7f5874edd5a93b1e4f02e0ef82a66a2074bec81a..fe870a3aac123d0f41f7ae3db010913415750a22 100644 (file)
@@ -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.
index 245b8b07dcce48d8fe6a2b38256f7d02b5a17851..d8e28a66704aa7f4598cdef52740e34b0755624e 100644 (file)
@@ -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.
index 813d39d5c8055a300d411cc70b5b0407516e0e5d..82cc4cfcaf55eb51eddf482b1c84e8e5340f5d1f 100644 (file)
@@ -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();
 }
index 3e4ba1257ea6836c455a2e596434e51b06d297bd..f919ebeb1ea4d9c9581a8945bea2a116d59b86ff 100644 (file)
@@ -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.
      *
index 29e63694504f3765ee3bf77e3edc43094b78a843..e960b82b10f7838a49a891eddd9f9531f392982e 100644 (file)
@@ -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)
             {
index 694b36dd17d33db42926bf0d7a7aeb6efa1a4372..ca15e5f31ab2b80cba0a4cd59a9f5d026de0c26f 100644 (file)
@@ -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();
                 }
index 547a666597ce7d49a8fc26691a045041ff2cca97..1d10ef4ce306424fe9e1a387e0450e4433e7fc75 100644 (file)
@@ -179,7 +179,7 @@ public class RepositoryGroupHandler
     {
         if ( group != null )
         {
-            return group.getFeature( IndexCreationFeature.class ).get( ).getLocalIndexPath( );
+            return group.getFeature( IndexCreationFeature.class ).getLocalIndexPath( );
         }
         else
         {
index bdcbf04d80342673264bfbd8820d7496bb559087..f7cf8a46f7bd57b4c3742b0ff40282fbd5c30095 100644 (file)
@@ -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( ) ) );
index 3a07073677d74cf32e39be54e87c79ef16a68e55..35523b9c5c8b9dae6f2ec4f45b5446eb734ae1df 100644 (file)
@@ -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( ) );
index da4d1b779b5d5c3dcb06839d5832c8c579a1b20a..6a9fb742992e9381cdbc2a174c1fd7c202a8af24 100644 (file)
@@ -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
index c7e5cd55e29fe9f0475ae963e696f83b94df480a..57d3034d18c23f8a061986172e06d0cd38fb0bdb 100644 (file)
@@ -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;
index 3ff27e37952a7f568d078297c9edc26d42b729fd..2514193e1390f9445f8ecfb78726995ed70abe1b 100644 (file)
@@ -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();
index 90dfb58242c4a257186f9fb785576d4e5fe2f5fb..1b13d970354253eb318b92b73dfaa456837eaf37 100644 (file)
@@ -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( ) );
index 87a263a03fe12a5f00dd81801072da16de4fb834..8319e2704660b1ee76945f5ddbd3935feed24726 100644 (file)
@@ -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() );
         }
index 98472de02b6c3a94a027e0ab603ed668d29416fb..002dd7e2a95f3665165556af9fd80e7980dec034 100644 (file)
@@ -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) {
index e10df31488106570e4327bcb63d750654fdc2b29..2591a344a1a18b4ea851affc15675ad175805e48 100644 (file)
@@ -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
index 036151f6f3bb7e18977f6b8f97d7418db4704dcb..4279c4a03ccd460703f8f935e03968055e49bf62 100644 (file)
@@ -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 )
                 {
 
index a5aee2ebe91a0b4cba324ff72bd7b27ebadb7bd8..9b716ecfaadeb5afdfc557f8a333696f36576544 100644 (file)
@@ -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() ) )
         {
index d853e9644c2fcca69c83992b83498b2dc24e10b9..45df6e05dcfe0712a4db40e3bda4ad6de4584fb2 100644 (file)
@@ -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" );
index 815a8138d97ea7fe49423410a7cd5a31c8aad732..d1d59c57028b2ae9df515bcde130e262107e2cea 100644 (file)
@@ -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();
 
index 1358a80eebb177916ea48ff24d0425f446f75b26..fd9f39b03136d767dc8757fd7f38da3d32f528d9 100644 (file)
@@ -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;
     }
index 25e5c1a35d54ce86f1611069be1eb0559b822b32..260543ba0380ae6378214c0e9535f4d0817218c1 100644 (file)
@@ -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
index ba76efb8581d46f65dbedcd2a233b1d5fafbcacf..01ec552c0e656df39454e1986e97a1becce4c371 100644 (file)
@@ -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():"" );
     }
index 1572d7cd6fca6c557177962859e64c6cfc65d2be..907b3873c7ef54d0b0ee263f5cb9deb1759cb853 100644 (file)
@@ -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() );
index 305e8e798f423803fbf05ad46a1eb6a9b59c51e5..d9f00fc4d319ec92ea177f772e9ab74e41a6fa16 100644 (file)
@@ -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() );
index ec79dd5e1fd5686260739f618eca81fbab989f27..d252e9c2e1a06baf63a1f1d1cb8d7988d50cc448 100644 (file)
@@ -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)
             {