From: Brett Porter Date: Wed, 10 Mar 2010 04:21:54 +0000 (+0000) Subject: [MRM-1360] move type population into Maven 2 plugin X-Git-Tag: archiva-1.4-M1~990 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f9d3bac3ef9215efec0ca10c88cc217e12b025d;p=archiva.git [MRM-1360] move type population into Maven 2 plugin - correct problem with the instantiation of the translator in the legacy code git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@921227 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java index b9e6c674a..abea4a6b7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java @@ -21,12 +21,16 @@ package org.apache.maven.archiva.repository.content; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; +import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; +import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider; import org.apache.archiva.metadata.repository.storage.maven2.Maven2RepositoryPathTranslator; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.layout.LayoutException; +import java.util.Collections; + /** * DefaultPathParser is a parser for maven 2 (default layout) paths to ArtifactReference. * @@ -38,7 +42,8 @@ public class DefaultPathParser implements PathParser { private static final String INVALID_ARTIFACT_PATH = "Invalid path to Artifact: "; - private RepositoryPathTranslator pathTranslator = new Maven2RepositoryPathTranslator(); + private RepositoryPathTranslator pathTranslator = new Maven2RepositoryPathTranslator( + Collections.singletonList( new DefaultArtifactMappingProvider() ) ); /** * {@inheritDoc} diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java index 2ff02478f..5a255c274 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java @@ -45,6 +45,15 @@ public class Maven2RepositoryPathTranslator */ private List artifactMappingProviders; + public Maven2RepositoryPathTranslator() + { + } + + public Maven2RepositoryPathTranslator( List artifactMappingProviders ) + { + this.artifactMappingProviders = artifactMappingProviders; + } + public File toFile( File basedir, String namespace, String projectId, String projectVersion, String filename ) { return new File( basedir, toPath( namespace, projectId, projectVersion, filename ) );