Class 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
    • 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
      • 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
      • getProxy

        public org.apache.maven.wagon.proxy.ProxyInfo getProxy​(String protocol)
        Specified by:
        getProxy 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
      • setOnline

        public void setOnline​(boolean online)
        Specified by:
        setOnline 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()