scaffolding for remote transformation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-23 15:03:39 +00:00
parent 2727721b11
commit 701911f219
4 changed files with 27 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public class DefaultArtifactHandlerManager
for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); )
{
ArtifactTransformation transform = (ArtifactTransformation) i.next();
// TODO: perform transformation
artifact = transform.transformRemoteArtifact( artifact, remoteRepository );
}
return remoteRepository.pathOf( artifact );
@ -79,7 +79,6 @@ public class DefaultArtifactHandlerManager
{
ArtifactTransformation transform = (ArtifactTransformation) i.next();
artifact = transform.transformLocalArtifact( artifact, localRepository );
// TODO: perform transformation
}
return localRepository.getBasedir() + "/" + localRepository.pathOf( artifact );

View File

@ -158,6 +158,7 @@ public class DefaultWagonManager
wagon.connect( repository, getProxy( repository.getProtocol() ) );
// TODO: should we avoid doing the transforms on this every time, and instead transform outside the loop?
String remotePath = artifactHandlerManager.getRemoteRepositoryArtifactPath( artifact, repository );
wagon.get( remotePath, temp );

View File

@ -36,4 +36,13 @@ public interface ArtifactTransformation
* @return The transformed Artifact
*/
Artifact transformLocalArtifact( Artifact artifact, ArtifactRepository localRepository );
/**
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no
* transformation has occured the original artifact is returned.
*
* @param artifact Artifact to be transformed.
* @return The transformed Artifact
*/
Artifact transformRemoteArtifact( Artifact artifact, ArtifactRepository remoteRepository );
}

View File

@ -30,7 +30,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
public class SnapshotTransformation
implements ArtifactTransformation
{
/*
/* TODO: use and remove
public Artifact transform( Artifact artifact, ArtifactRepository localRepository, List repositories,
Map parameters )
throws Exception
@ -187,7 +187,7 @@ public class SnapshotTransformation
*/
public Artifact transformLocalArtifact( Artifact artifact, ArtifactRepository localRepository )
{
if ( isSnapshot( artifact ) && "pom".equals( artifact.getType() ) )
if ( shouldProcessArtifact( artifact ) )
{
// only store the snapshot-version-local.txt file for POMs as every file has an associated POM
ArtifactMetadata metadata = SnapshotArtifactMetadata.createLocalSnapshotMetadata( artifact );
@ -196,6 +196,20 @@ public class SnapshotTransformation
return artifact;
}
public Artifact transformRemoteArtifact( Artifact artifact, ArtifactRepository remoteRepository )
{
if ( shouldProcessArtifact( artifact ) )
{
// TODO: implement
}
return artifact;
}
private static boolean shouldProcessArtifact( Artifact artifact )
{
return isSnapshot( artifact ) && "pom".equals( artifact.getType() );
}
private static boolean isSnapshot( Artifact artifact )
{
return artifact.getVersion().endsWith( "SNAPSHOT" );