[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
This commit is contained in:
Brett Porter 2010-03-10 04:21:54 +00:00
parent 780176f7f5
commit 3f9d3bac3e
2 changed files with 15 additions and 1 deletions

View File

@ -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.<ArtifactMappingProvider>singletonList( new DefaultArtifactMappingProvider() ) );
/**
* {@inheritDoc}

View File

@ -45,6 +45,15 @@ public class Maven2RepositoryPathTranslator
*/
private List<ArtifactMappingProvider> artifactMappingProviders;
public Maven2RepositoryPathTranslator()
{
}
public Maven2RepositoryPathTranslator( List<ArtifactMappingProvider> 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 ) );