diff options
10 files changed, 92 insertions, 158 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index 1275ca1e0..5fc0b780c 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -136,11 +136,7 @@ <artifactId>log4j-jcl</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.archiva.components.cache</groupId> - <artifactId>archiva-components-spring-cache-ehcache</artifactId> - <scope>test</scope> - </dependency> + </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 893033486..24a726ddf 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -48,16 +48,6 @@ <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-scheduler-indexing</artifactId> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>org.apache.archiva.components.registry</groupId> @@ -68,90 +58,60 @@ <artifactId>archiva-components-spring-taskqueue</artifactId> </dependency> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-queryparser</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-analyzers-common</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.maven.indexer</groupId> - <artifactId>indexer-core</artifactId> - <classifier>shaded-lucene</classifier> - <exclusions> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-queryparser</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-analyzers-common</artifactId> - </exclusion> - </exclusions> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-common</artifactId> </dependency> <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-repository-api</artifactId> </dependency> <dependency> <groupId>org.apache.archiva</groupId> - <artifactId>archiva-repository-admin-api</artifactId> + <artifactId>archiva-repository-layer</artifactId> </dependency> - - <!-- Test scope --> <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-test-utils</artifactId> - <version>${project.version}</version> - <scope>test</scope> + <groupId>org.apache.archiva.redback</groupId> + <artifactId>redback-rbac-model</artifactId> </dependency> <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-repository-admin-default</artifactId> - <scope>test</scope> + <groupId>org.apache.archiva.redback</groupId> + <artifactId>redback-rbac-role-manager</artifactId> </dependency> + <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-http-lightweight</artifactId> - <scope>provided</scope> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> </dependency> <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-scheduler-repository</artifactId> - <scope>test</scope> + <groupId>javax.annotation</groupId> + <artifactId>javax.annotation-api</artifactId> </dependency> + <dependency> - <groupId>org.apache.archiva.maven</groupId> - <artifactId>archiva-maven-repository</artifactId> - <scope>test</scope> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> </dependency> + + <!-- Test scope --> <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>metadata-store-jcr</artifactId> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.archiva.maven</groupId> - <artifactId>archiva-maven-indexer</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-test-utils</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>metadata-store-jcr</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.archiva.components.cache</groupId> - <artifactId>archiva-components-spring-cache-ehcache</artifactId> + <groupId>org.apache.archiva.maven</groupId> + <artifactId>archiva-maven-indexer</artifactId> <scope>test</scope> </dependency> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index 89c3a9758..e03557ebf 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -26,15 +26,12 @@ import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.consumers.AbstractMonitoredConsumer; import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.archiva.indexer.UnsupportedBaseContextException; import org.apache.archiva.components.registry.Registry; import org.apache.archiva.components.registry.RegistryListener; import org.apache.archiva.components.taskqueue.TaskQueueException; import org.apache.archiva.repository.ManagedRepository; -import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; -import org.apache.maven.index.context.IndexingContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Scope; @@ -71,8 +68,6 @@ public class NexusIndexerConsumer private ArchivaTaskScheduler<ArtifactIndexingTask> scheduler; - private IndexingContext indexingContext; - private List<String> includes = new ArrayList<>( 0 ); private ManagedRepository repository; @@ -106,18 +101,6 @@ public class NexusIndexerConsumer this.repository = repository; managedRepository = PathUtil.getPathFromUri( repository.getLocation() ); - try - { - log.info( "Creating indexing context for repo : {}", repository.getId() ); - if (repository.getType()== RepositoryType.MAVEN) { - indexingContext = repository.getIndexingContext().getBaseContext(IndexingContext.class); - } else { - indexingContext= null; - } - } catch (UnsupportedBaseContextException e) { - log.error("Bad repository type. Not nexus indexer compatible."); - throw new ConsumerException("Bad repository type "+repository.getType()); - } } @Override @@ -259,20 +242,5 @@ public class NexusIndexerConsumer } - private IndexingContext getIndexingContext() - throws ConsumerException - { - if ( this.indexingContext == null ) - { - try - { - indexingContext = repository.getIndexingContext().getBaseContext(IndexingContext.class); - } catch (UnsupportedBaseContextException e) { - log.error("Bad repository type. Not nexus indexer compatible. "+repository.getType()); - throw new ConsumerException("Bad repository type "+repository.getType()); - } - } - return indexingContext; - } } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index 3662968df..c8c11fd9c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -54,12 +54,26 @@ <artifactId>metadata-repository-api</artifactId> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-repository-api</artifactId> </dependency> <dependency> <groupId>org.apache.archiva.components.registry</groupId> <artifactId>archiva-components-spring-registry-api</artifactId> </dependency> + + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>javax.annotation-api</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> </dependencies> </project> diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index 449033581..edeeb89eb 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -65,26 +65,18 @@ <dependency> <groupId>org.apache.archiva.components.cache</groupId> <artifactId>archiva-components-spring-cache-api</artifactId> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> </dependency> - <!-- Test scope --> + <!-- This runtime dependency is needed because the cache bean is + added to the spring context. --> <dependency> <groupId>org.apache.archiva.components.cache</groupId> <artifactId>archiva-components-spring-cache-ehcache</artifactId> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - <scope>test</scope> + <scope>runtime</scope> </dependency> + + <!-- Test scope --> + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java index 1c10a2a49..4bd19998c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java @@ -1280,8 +1280,13 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa @Override public Repository getRepositoryOfAsset( StorageAsset asset ) { - return getManagedRepositories( ).stream( ).filter( r -> r.getAsset( "" ) - .getStorage( ).equals( asset.getStorage( ) ) ).findFirst( ).orElse( null ); + if (asset instanceof Repository) { + return (Repository)asset; + } else + { + return getRepositories( ).stream( ).filter( r -> r.getAsset( "" ) + .getStorage( ).equals( asset.getStorage( ) ) ).findFirst( ).orElse( null ); + } } diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml b/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml index 449806933..11b0471b5 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml @@ -33,11 +33,12 @@ </properties> <dependencies> - + <!-- <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin-api</artifactId> </dependency> + --> <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-common</artifactId> @@ -48,6 +49,10 @@ </dependency> <dependency> <groupId>org.apache.archiva</groupId> + <artifactId>archiva-proxy-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> <artifactId>archiva-proxy</artifactId> </dependency> <dependency> @@ -182,10 +187,16 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.archiva.maven</groupId> + <artifactId>archiva-maven-repository</artifactId> + </dependency> + <!-- + <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin-default</artifactId> <scope>test</scope> </dependency> + --> <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-test-utils</artifactId> diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java index 9c76451ab..ff594757c 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java @@ -19,9 +19,6 @@ package org.apache.archiva.indexer.maven.search; * under the License. */ -import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.ProxyConnector; -import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; import org.apache.archiva.indexer.UnsupportedBaseContextException; import org.apache.archiva.indexer.search.ArtifactInfoFilter; import org.apache.archiva.indexer.search.NoClassifierArtifactInfoFilter; @@ -33,6 +30,8 @@ import org.apache.archiva.indexer.search.SearchResultLimits; import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.archiva.model.ArchivaArtifactModel; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.model.ProxyConnector; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.RepositoryRegistry; @@ -82,9 +81,9 @@ public class MavenRepositorySearch private QueryCreator queryCreator; - RepositoryRegistry repositoryRegistry; + private RepositoryRegistry repositoryRegistry; - private ProxyConnectorAdmin proxyConnectorAdmin; + private ProxyRegistry proxyRegistry; protected MavenRepositorySearch() { @@ -93,13 +92,12 @@ public class MavenRepositorySearch @Inject public MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry, - - ProxyConnectorAdmin proxyConnectorAdmin, QueryCreator queryCreator ) + ProxyRegistry proxyRegistry, QueryCreator queryCreator ) { this.indexer = nexusIndexer; this.queryCreator = queryCreator; this.repositoryRegistry = repositoryRegistry; - this.proxyConnectorAdmin = proxyConnectorAdmin; + this.proxyRegistry = proxyRegistry; } /** @@ -339,10 +337,6 @@ public class MavenRepositorySearch { throw new RepositorySearchException( e.getMessage(), e ); } - catch ( RepositoryAdminException e ) - { - throw new RepositorySearchException( e.getMessage(), e ); - } } @@ -460,14 +454,7 @@ public class MavenRepositorySearch Set<String> ids = new HashSet<>(); List<ProxyConnector> proxyConnectors = null; - try - { - proxyConnectors = proxyConnectorAdmin.getProxyConnectorAsMap().get( managedRepoId ); - } - catch ( RepositoryAdminException e ) - { - throw new RepositorySearchException( e.getMessage(), e ); - } + proxyConnectors = proxyRegistry.getProxyConnectorAsMap( ).get( managedRepoId ); if ( proxyConnectors == null || proxyConnectors.isEmpty() ) { @@ -476,8 +463,8 @@ public class MavenRepositorySearch for ( ProxyConnector proxyConnector : proxyConnectors ) { - String remoteId = "remote-" + proxyConnector.getTargetRepoId(); - RemoteRepository repo = repositoryRegistry.getRemoteRepository(proxyConnector.getTargetRepoId()); + String remoteId = "remote-" + proxyConnector.getTargetRepository().getId(); + RemoteRepository repo = repositoryRegistry.getRemoteRepository(proxyConnector.getTargetRepository().getId()); if (repo.getType()==RepositoryType.MAVEN) { try { IndexingContext context = repo.getIndexingContext() != null ? repo.getIndexingContext().getBaseContext(IndexingContext.class) : null; @@ -523,7 +510,6 @@ public class MavenRepositorySearch private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits, List<? extends ArtifactInfoFilter> artifactInfoFilters, List<String> selectedRepos, boolean includePoms ) - throws RepositoryAdminException { SearchResults results = new SearchResults(); Set<ArtifactInfo> artifactInfos = response.getResults(); @@ -605,7 +591,6 @@ public class MavenRepositorySearch * @return */ protected String getBaseUrl( ArtifactInfo artifactInfo, List<String> selectedRepos ) - throws RepositoryAdminException { StringBuilder sb = new StringBuilder(); if ( StringUtils.startsWith( artifactInfo.getContext(), "remote-" ) ) @@ -653,12 +638,10 @@ public class MavenRepositorySearch * @param remoteRepo * @param selectedRepos * @return - * @throws RepositoryAdminException */ private String getManagedRepoId( String remoteRepo, List<String> selectedRepos ) - throws RepositoryAdminException { - Map<String, List<ProxyConnector>> proxyConnectorMap = proxyConnectorAdmin.getProxyConnectorAsMap(); + Map<String, List<ProxyConnector>> proxyConnectorMap = proxyRegistry.getProxyConnectorAsMap(); if ( proxyConnectorMap == null || proxyConnectorMap.isEmpty() ) { return null; @@ -671,9 +654,9 @@ public class MavenRepositorySearch { for ( ProxyConnector proxyConnector : entry.getValue() ) { - if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepoId() ) ) + if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepository().getId() ) ) { - return proxyConnector.getSourceRepoId(); + return proxyConnector.getSourceRepository().getId(); } } } @@ -686,9 +669,9 @@ public class MavenRepositorySearch for ( ProxyConnector proxyConnector : entry.getValue() ) { - if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepoId() ) ) + if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepository().getId() ) ) { - return proxyConnector.getSourceRepoId(); + return proxyConnector.getSourceRepository().getId(); } } diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java index 542681e42..b94e6b8e5 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java @@ -20,7 +20,6 @@ package org.apache.archiva.indexer.maven.search; */ import junit.framework.TestCase; -import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin; import org.apache.archiva.common.utils.FileUtils; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; @@ -29,6 +28,7 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.search.SearchResultHit; import org.apache.archiva.indexer.search.SearchResults; +import org.apache.archiva.proxy.ProxyRegistry; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.Repository; import org.apache.archiva.repository.features.IndexCreationFeature; @@ -93,6 +93,9 @@ public abstract class AbstractMavenRepositorySearch ArchivaRepositoryRegistry repositoryRegistry; @Inject + ProxyRegistry proxyRegistry; + + @Inject private IndexerEngine indexerEngine; IMocksControl archivaConfigControl; @@ -125,11 +128,9 @@ public abstract class AbstractMavenRepositorySearch archivaConfig = archivaConfigControl.createMock( ArchivaConfiguration.class ); - DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin(); - defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig ); repositoryRegistry.setArchivaConfiguration( archivaConfig ); - search = new MavenRepositorySearch( indexer, repositoryRegistry, defaultProxyConnectorAdmin, + search = new MavenRepositorySearch( indexer, repositoryRegistry, proxyRegistry, queryCreator ); assertNotNull( repositoryRegistry ); diff --git a/status-dep.txt b/status-dep.txt index 57e5042d2..259da5cb6 100644 --- a/status-dep.txt +++ b/status-dep.txt @@ -21,6 +21,10 @@ archiva-modules archiva-security-common archiva-consumers archiva-consumers-api + archiva-core-consumers + archiva-metadata-consumer + archiva-signature-consumer + archiva-lucene-consumer |