org.apache.maven.artifact.manager
Class DefaultWagonManager

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.artifact.manager.DefaultWagonManager
All Implemented Interfaces:
WagonManager, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable

public class DefaultWagonManager
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements WagonManager, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable


Field Summary
 
Fields inherited from interface org.apache.maven.artifact.manager.WagonManager
ROLE
 
Constructor Summary
DefaultWagonManager()
           
 
Method Summary
 void addAuthenticationInfo(String repositoryId, String username, String password, String privateKey, String passphrase)
           
 void addConfiguration(String repositoryId, org.codehaus.plexus.util.xml.Xpp3Dom configuration)
          Set the configuration for a repository
 void addMirror(String id, String mirrorOf, String url)
           
 void addPermissionInfo(String repositoryId, String filePermissions, String directoryPermissions)
           
 void addProxy(String protocol, String host, int port, String username, String password, String nonProxyHosts)
          Set the proxy used for a particular protocol.
 void contextualize(org.codehaus.plexus.context.Context context)
           
 void getArtifact(Artifact artifact, ArtifactRepository repository)
           
 void getArtifact(Artifact artifact, List remoteRepositories)
           
 void getArtifactMetadata(ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy)
           
 void getArtifactMetadataFromDeploymentRepository(ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy)
           
 org.apache.maven.wagon.authentication.AuthenticationInfo getAuthenticationInfo(String id)
           
 String getHttpUserAgent()
          
 ArtifactRepository getMirror(ArtifactRepository originalRepository)
          This method finds a matching mirror for the selected repository.
 ArtifactRepository getMirrorRepository(ArtifactRepository repository)
           
 org.apache.maven.wagon.proxy.ProxyInfo getProxy(String protocol)
           
 org.apache.maven.wagon.Wagon getWagon(org.apache.maven.wagon.repository.Repository repository)
          Get a Wagon provider for the provided repository.
 org.apache.maven.wagon.Wagon getWagon(String protocol)
          Get a Wagon provider that understands the protocol passed as argument.
 void initialize()
           
 boolean isExternalRepo(ArtifactRepository originalRepository)
          Checks the URL to see if this repository refers to an external repository
 boolean isOnline()
           
 boolean matchPattern(ArtifactRepository originalRepository, String pattern)
          This method checks if the pattern matches the originalRepository.
 void putArtifact(File source, Artifact artifact, ArtifactRepository deploymentRepository)
           
 void putArtifactMetadata(File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository)
           
 void registerWagons(Collection wagons, org.codehaus.plexus.PlexusContainer extensionContainer)
           
 void setDefaultRepositoryPermissions(org.apache.maven.wagon.repository.RepositoryPermissions defaultRepositoryPermissions)
           
 void setDownloadMonitor(org.apache.maven.wagon.events.TransferListener downloadMonitor)
           
 void setHttpUserAgent(String userAgent)
          
 void setInteractive(boolean interactive)
           
 void setOnline(boolean online)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWagonManager

public DefaultWagonManager()
Method Detail

getWagon

public org.apache.maven.wagon.Wagon getWagon(org.apache.maven.wagon.repository.Repository repository)
                                      throws org.apache.maven.wagon.UnsupportedProtocolException,
                                             WagonConfigurationException
Description copied from interface: WagonManager
Get a Wagon provider for the provided repository. It will configure the Wagon for that repository.

Specified by:
getWagon in interface WagonManager
Parameters:
repository - the repository
Returns:
the Wagon instance that can be used to connect to the repository
Throws:
org.apache.maven.wagon.UnsupportedProtocolException - if there is no provider able to handle the protocol
WagonConfigurationException - if the wagon can't be configured for the repository

getWagon

public org.apache.maven.wagon.Wagon getWagon(String protocol)
                                      throws org.apache.maven.wagon.UnsupportedProtocolException
Description copied from interface: WagonManager
Get a Wagon provider that understands the protocol passed as argument. It doesn't configure the Wagon.

Specified by:
getWagon in interface WagonManager
Parameters:
protocol - the protocol the Wagon will handle
Returns:
the Wagon instance able to handle the protocol provided
Throws:
org.apache.maven.wagon.UnsupportedProtocolException - if there is no provider able to handle the protocol

putArtifact

public void putArtifact(File source,
                        Artifact artifact,
                        ArtifactRepository deploymentRepository)
                 throws org.apache.maven.wagon.TransferFailedException
Specified by:
putArtifact in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException

putArtifactMetadata

public void putArtifactMetadata(File source,
                                ArtifactMetadata artifactMetadata,
                                ArtifactRepository repository)
                         throws org.apache.maven.wagon.TransferFailedException
Specified by:
putArtifactMetadata in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException

getArtifact

public void getArtifact(Artifact artifact,
                        List remoteRepositories)
                 throws org.apache.maven.wagon.TransferFailedException,
                        org.apache.maven.wagon.ResourceDoesNotExistException
Specified by:
getArtifact in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException

getArtifact

public void getArtifact(Artifact artifact,
                        ArtifactRepository repository)
                 throws org.apache.maven.wagon.TransferFailedException,
                        org.apache.maven.wagon.ResourceDoesNotExistException
Specified by:
getArtifact in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException

getArtifactMetadata

public void getArtifactMetadata(ArtifactMetadata metadata,
                                ArtifactRepository repository,
                                File destination,
                                String checksumPolicy)
                         throws org.apache.maven.wagon.TransferFailedException,
                                org.apache.maven.wagon.ResourceDoesNotExistException
Specified by:
getArtifactMetadata in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException

getArtifactMetadataFromDeploymentRepository

public void getArtifactMetadataFromDeploymentRepository(ArtifactMetadata metadata,
                                                        ArtifactRepository repository,
                                                        File destination,
                                                        String checksumPolicy)
                                                 throws org.apache.maven.wagon.TransferFailedException,
                                                        org.apache.maven.wagon.ResourceDoesNotExistException
Specified by:
getArtifactMetadataFromDeploymentRepository in interface WagonManager
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException

getMirrorRepository

public ArtifactRepository getMirrorRepository(ArtifactRepository repository)
Specified by:
getMirrorRepository in interface WagonManager

getProxy

public org.apache.maven.wagon.proxy.ProxyInfo getProxy(String protocol)
Specified by:
getProxy in interface WagonManager

getAuthenticationInfo

public org.apache.maven.wagon.authentication.AuthenticationInfo getAuthenticationInfo(String id)
Specified by:
getAuthenticationInfo in interface WagonManager

getMirror

public ArtifactRepository getMirror(ArtifactRepository originalRepository)
This method finds a matching mirror for the selected repository. If there is an exact match, this will be used. If there is no exact match, then the list of mirrors is examined to see if a pattern applies.

Parameters:
originalRepository - See if there is a mirror for this repository.
Returns:
the selected mirror or null if none are found.

matchPattern

public boolean matchPattern(ArtifactRepository originalRepository,
                            String pattern)
This method checks if the pattern matches the originalRepository. Valid patterns: * = everything external:* = everything not on the localhost and not file based. repo,repo1 = repo or repo1 *,!repo1 = everything except repo1

Parameters:
originalRepository - to compare for a match.
pattern - used for match. Currently only '*' is supported.
Returns:
true if the repository is a match to this pattern.

isExternalRepo

public boolean isExternalRepo(ArtifactRepository originalRepository)
Checks the URL to see if this repository refers to an external repository

Parameters:
originalRepository -
Returns:
true if external.

addProxy

public void addProxy(String protocol,
                     String host,
                     int port,
                     String username,
                     String password,
                     String nonProxyHosts)
Set the proxy used for a particular protocol.

Specified by:
addProxy in interface WagonManager
Parameters:
protocol - the protocol (required)
host - the proxy host name (required)
port - the proxy port (required)
username - the username for the proxy, or null if there is none
password - the password for the proxy, or null if there is none
nonProxyHosts - the set of hosts not to use the proxy for. Follows Java system property format: *.foo.com|localhost.

contextualize

public void contextualize(org.codehaus.plexus.context.Context context)
                   throws org.codehaus.plexus.context.ContextException
Specified by:
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Throws:
org.codehaus.plexus.context.ContextException

setDownloadMonitor

public void setDownloadMonitor(org.apache.maven.wagon.events.TransferListener downloadMonitor)
Specified by:
setDownloadMonitor in interface WagonManager

addAuthenticationInfo

public void addAuthenticationInfo(String repositoryId,
                                  String username,
                                  String password,
                                  String privateKey,
                                  String passphrase)
Specified by:
addAuthenticationInfo in interface WagonManager

addPermissionInfo

public void addPermissionInfo(String repositoryId,
                              String filePermissions,
                              String directoryPermissions)
Specified by:
addPermissionInfo in interface WagonManager

addMirror

public void addMirror(String id,
                      String mirrorOf,
                      String url)
Specified by:
addMirror in interface WagonManager

setOnline

public void setOnline(boolean online)
Specified by:
setOnline in interface WagonManager

isOnline

public boolean isOnline()
Specified by:
isOnline in interface WagonManager

setInteractive

public void setInteractive(boolean interactive)
Specified by:
setInteractive in interface WagonManager

registerWagons

public void registerWagons(Collection wagons,
                           org.codehaus.plexus.PlexusContainer extensionContainer)
Specified by:
registerWagons in interface WagonManager

addConfiguration

public void addConfiguration(String repositoryId,
                             org.codehaus.plexus.util.xml.Xpp3Dom configuration)
Description copied from interface: WagonManager
Set the configuration for a repository

Specified by:
addConfiguration in interface WagonManager
Parameters:
repositoryId - id of the repository to set the configuration to
configuration - dom tree of the xml with the configuration for the Wagon

setDefaultRepositoryPermissions

public void setDefaultRepositoryPermissions(org.apache.maven.wagon.repository.RepositoryPermissions defaultRepositoryPermissions)
Specified by:
setDefaultRepositoryPermissions in interface WagonManager

initialize

public void initialize()
                throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
Specified by:
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException

setHttpUserAgent

public void setHttpUserAgent(String userAgent)


getHttpUserAgent

public String getHttpUserAgent()



Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.