move artifact transformations out of the resolver so they can be used on any artifact component

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163672 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-23 07:23:23 +00:00
parent 1b4723f972
commit 14acea5e3f
7 changed files with 31 additions and 69 deletions

View File

@ -23,23 +23,29 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.List;
/**
* @todo refactor away
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id: AbstractArtifactComponent.java,v 1.4 2005/03/08 05:34:52 brett
* Exp $
* @todo refactor away
*/
public class AbstractArtifactComponent
extends AbstractLogEnabled
{
private List artifactTransformations;
private ArtifactHandlerManager artifactHandlerManager;
protected ArtifactHandler getArtifactHandler( String type ) throws ArtifactHandlerNotFoundException
protected ArtifactHandler getArtifactHandler( String type )
throws ArtifactHandlerNotFoundException
{
return artifactHandlerManager.getArtifactHandler( type );
}
protected String path( Artifact artifact, ArtifactRepository remoteRepository ) throws ArtifactPathFormatException
protected String path( Artifact artifact, ArtifactRepository remoteRepository )
throws ArtifactPathFormatException
{
return remoteRepository.pathOf( artifact );
}

View File

@ -54,8 +54,4 @@ public interface ArtifactResolver
ArtifactRepository localRepository, ArtifactMetadataSource source,
ArtifactFilter filter )
throws ArtifactResolutionException;
void addArtifactRequestTransformation(
org.apache.maven.artifact.resolver.transform.ArtifactRequestTransformation requestTransformation );
}

View File

@ -25,7 +25,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.transform.ArtifactRequestTransformation;
import org.apache.maven.wagon.TransferFailedException;
import org.codehaus.plexus.logging.Logger;
@ -46,12 +45,6 @@ public class DefaultArtifactResolver
extends AbstractArtifactComponent
implements ArtifactResolver
{
// ----------------------------------------------------------------------
// Fields
// ----------------------------------------------------------------------
private List requestTransformations;
// ----------------------------------------------------------------------
// Components
// ----------------------------------------------------------------------
@ -331,9 +324,4 @@ public class DefaultArtifactResolver
conflicts.add( newArtifact );
}
public void addArtifactRequestTransformation( ArtifactRequestTransformation requestTransformation )
{
}
}

View File

@ -1,40 +0,0 @@
package org.apache.maven.artifact.resolver.transform;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
public class ArtifactRequestTransformationException
extends Exception
{
public ArtifactRequestTransformationException( String message )
{
super( message );
}
public ArtifactRequestTransformationException( Throwable cause )
{
super( cause );
}
public ArtifactRequestTransformationException( String message, Throwable cause )
{
super( message, cause );
}
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.transform;
package org.apache.maven.artifact.transform;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@ -24,12 +24,12 @@ import java.util.Map;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id: ArtifactRequestTransformation.java,v 1.1 2005/03/03 15:37:25
* @version $Id: ArtifactTransformation.java,v 1.1 2005/03/03 15:37:25
* jvanzyl Exp $
*/
public interface ArtifactRequestTransformation
public interface ArtifactTransformation
{
static String ROLE = ArtifactRequestTransformation.class.getName();
static String ROLE = ArtifactTransformation.class.getName();
/**
* Take in a artifact and return the transformed artifact. If no

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.transform;
package org.apache.maven.artifact.transform;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@ -31,11 +31,11 @@ import java.util.TimeZone;
/**
* @author <a href="mailto:mmaczka@interia.pl">Michal Maczka </a>
* @version $Id: SnapshotRequestTransformation.java,v 1.1 2005/03/03 15:37:25
* @version $Id: SnapshotTransformation.java,v 1.1 2005/03/03 15:37:25
* jvanzyl Exp $
*/
public class SnapshotRequestTransformation
implements ArtifactRequestTransformation
public class SnapshotTransformation
implements ArtifactTransformation
{
private ArtifactResolver artifactResolver;

View File

@ -16,6 +16,10 @@
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
@ -46,6 +50,10 @@
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
@ -64,6 +72,10 @@
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
@ -71,7 +83,7 @@
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout</implementation>
<requirements>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
@ -104,7 +116,7 @@
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>ejb</role-hint>