From 3e1fb17f0a77eb3693b2090b5a94f07edc5e3d27 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 2 Aug 2012 16:23:18 +0000 Subject: [PATCH] extract our own repository connector factory to an external file git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1368581 13f79535-47bb-0310-9956-ffa450edef68 --- .../plugins/maven2-repository/pom.xml | 11 ++-- .../maven2/Maven3DependencyTreeBuilder.java | 58 +------------------ 2 files changed, 7 insertions(+), 62 deletions(-) diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 4a10197ca..5b6337ff0 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -232,18 +232,19 @@ org.dom4j*;version="[1.6,2)", org.springframework*;version="[3,4)", org.slf4j;resolution:=optional, - org.apache.maven, - org.apache.maven.project, + org.apache.maven.repository.internal, + org.sonatype.aether.connector.file, + org.sonatype.aether.impl, + org.sonatype.aether.spi.connector, + org.sonatype.aether.transfer, org.sonatype.aether, org.sonatype.aether.artifact, org.sonatype.aether.collection, org.sonatype.aether.graph, org.sonatype.aether.impl.internal, org.sonatype.aether.repository, - org.sonatype.aether.resolution, org.sonatype.aether.util, - org.sonatype.aether.util.artifact, - org.sonatype.aether.version + org.sonatype.aether.util.artifact diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java index 04ec05999..af9877e9c 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java @@ -47,7 +47,6 @@ import org.sonatype.aether.RepositorySystemSession; import org.sonatype.aether.collection.CollectRequest; import org.sonatype.aether.collection.CollectResult; import org.sonatype.aether.collection.DependencyCollectionException; -import org.sonatype.aether.connector.file.FileRepositoryConnectorFactory; import org.sonatype.aether.graph.Dependency; import org.sonatype.aether.graph.DependencyVisitor; import org.sonatype.aether.impl.ArtifactDescriptorReader; @@ -55,13 +54,7 @@ import org.sonatype.aether.impl.VersionRangeResolver; import org.sonatype.aether.impl.VersionResolver; import org.sonatype.aether.impl.internal.DefaultServiceLocator; import org.sonatype.aether.repository.LocalRepository; -import org.sonatype.aether.spi.connector.ArtifactDownload; -import org.sonatype.aether.spi.connector.ArtifactUpload; -import org.sonatype.aether.spi.connector.MetadataDownload; -import org.sonatype.aether.spi.connector.MetadataUpload; -import org.sonatype.aether.spi.connector.RepositoryConnector; import org.sonatype.aether.spi.connector.RepositoryConnectorFactory; -import org.sonatype.aether.transfer.NoRepositoryConnectorException; import org.sonatype.aether.util.artifact.DefaultArtifact; import org.springframework.stereotype.Service; @@ -70,7 +63,6 @@ import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -206,59 +198,11 @@ public class Maven3DependencyTreeBuilder } - public static class MyFileRepositoryConnectorFactory - extends FileRepositoryConnectorFactory - { - - public MyFileRepositoryConnectorFactory() - { - - } - - public RepositoryConnector newInstance( RepositorySystemSession session, - org.sonatype.aether.repository.RemoteRepository repository ) - throws NoRepositoryConnectorException - { - - try - { - return super.newInstance( session, repository ); - } - catch ( NoRepositoryConnectorException e ) - { - - } - - return new RepositoryConnector() - { - - private Logger log = LoggerFactory.getLogger( getClass() ); - - public void get( Collection artifactDownloads, - Collection metadataDownloads ) - { - log.debug( "get" ); - } - - public void put( Collection artifactUploads, - Collection metadataUploads ) - { - log.debug( "put" ); - } - - public void close() - { - log.debug( "close" ); - } - }; - } - } - public static RepositorySystem newRepositorySystem() { DefaultServiceLocator locator = new DefaultServiceLocator(); locator.addService( RepositoryConnectorFactory.class, - MyFileRepositoryConnectorFactory.class );// FileRepositoryConnectorFactory.class ); + ArchivaRepositoryConnectorFactory.class );// FileRepositoryConnectorFactory.class ); locator.addService( VersionResolver.class, DefaultVersionResolver.class ); locator.addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class ); locator.addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class ); -- 2.39.5