mirror of https://github.com/apache/maven.git
o Prevented crappy plugins from messing with container-managed artifact handlers
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@990345 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
53cd87f2d9
commit
7b9b88effc
|
@ -33,5 +33,6 @@ public interface ArtifactHandlerManager
|
||||||
|
|
||||||
ArtifactHandler getArtifactHandler( String type );
|
ArtifactHandler getArtifactHandler( String type );
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
void addHandlers( Map<String, ArtifactHandler> handlers );
|
void addHandlers( Map<String, ArtifactHandler> handlers );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.artifact.handler.manager;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||||
|
@ -35,16 +36,24 @@ import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
public class DefaultArtifactHandlerManager
|
public class DefaultArtifactHandlerManager
|
||||||
implements ArtifactHandlerManager
|
implements ArtifactHandlerManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@Requirement( role = ArtifactHandler.class )
|
@Requirement( role = ArtifactHandler.class )
|
||||||
private Map<String, ArtifactHandler> artifactHandlers;
|
private Map<String, ArtifactHandler> artifactHandlers;
|
||||||
|
|
||||||
|
private Map<String, ArtifactHandler> unmanagedHandlers = new ConcurrentHashMap<String, ArtifactHandler>();
|
||||||
|
|
||||||
public ArtifactHandler getArtifactHandler( String type )
|
public ArtifactHandler getArtifactHandler( String type )
|
||||||
{
|
{
|
||||||
ArtifactHandler handler = artifactHandlers.get( type );
|
ArtifactHandler handler = unmanagedHandlers.get( type );
|
||||||
|
|
||||||
if ( handler == null )
|
if ( handler == null )
|
||||||
{
|
{
|
||||||
handler = new DefaultArtifactHandler( type );
|
handler = artifactHandlers.get( type );
|
||||||
|
|
||||||
|
if ( handler == null )
|
||||||
|
{
|
||||||
|
handler = new DefaultArtifactHandler( type );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
|
@ -52,11 +61,14 @@ public class DefaultArtifactHandlerManager
|
||||||
|
|
||||||
public void addHandlers( Map<String, ArtifactHandler> handlers )
|
public void addHandlers( Map<String, ArtifactHandler> handlers )
|
||||||
{
|
{
|
||||||
artifactHandlers.putAll( handlers );
|
// legacy support for maven-gpg-plugin:1.0
|
||||||
|
unmanagedHandlers.putAll( handlers );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Set<String> getHandlerTypes()
|
public Set<String> getHandlerTypes()
|
||||||
{
|
{
|
||||||
return artifactHandlers.keySet();
|
return artifactHandlers.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue