Package org.apache.maven.wagon

Examples of org.apache.maven.wagon.Wagon


    public void testPerLookupInstantiation()
        throws Exception
    {
        String protocol = "perlookup";

        Wagon one = wagonManager.getWagon( protocol );
        Wagon two = wagonManager.getWagon( protocol );

        assertNotSame( one, two );
    }
View Full Code Here


    }

    private void assertWagon( String protocol )
        throws Exception
    {
        Wagon wagon = wagonManager.getWagon( protocol );

        assertNotNull( "Check wagon, protocol=" + protocol, wagon );
    }
View Full Code Here

            getLogger().info( emsg );
            return null;
        }
     
        Wagon wagon = null;
        try
       
            RepositoryURL repoUrl = remoteRepository.getURL();
            String protocol = repoUrl.getProtocol();
            wagon = (Wagon) wagons.get( protocol );
            if ( wagon == null )
            {
                throw new ProxyException( "Unsupported target repository protocol: " + protocol );
            }

            boolean connected = connectToRepository( connector, wagon, remoteRepository );
            if ( connected )
            {
                localFile = transferSimpleFile( wagon, remoteRepository, remotePath, localFile );

                transferChecksum( wagon, remoteRepository, remotePath, localFile, ".sha1" );
                transferChecksum( wagon, remoteRepository, remotePath, localFile, ".md5" );
            }
        }
        catch ( NotFoundException e )
        {
            // Do not cache url here.
            throw e;
        }
        catch ( NotModifiedException e )
        {
            // Do not cache url here.
            throw e;
        }
        catch ( ProxyException e )
        {
            urlFailureCache.cacheFailure( url );
            throw e;
        }
        finally
        {
            if ( wagon != null )
            {
                try
                {
                    wagon.disconnect();
                }
                catch ( ConnectionException e )
                {
                    getLogger().warn( "Unable to disconnect wagon.", e );
                }
View Full Code Here

                        } else {
                            URL url = file.getURL();
                            String endPointUrl = url.getProtocol() + "://" + url.getAuthority();
                            // Repository Id should be ignored by Wagon ...
                            Repository repository = new Repository("additonal-configs", endPointUrl);
                            Wagon wagon = wagonManager.getWagon(repository);
                            ;
                            if (logger.isDebugEnabled()) {
                                Debug debug = new Debug();
                                wagon.addSessionListener(debug);
                                wagon.addTransferListener(debug);
                            }
                            wagon.setTimeout(1000);
                            Settings settings = mavenSettingsBuilder.buildSettings();
                            ProxyInfo proxyInfo = null;
                            if (settings != null && settings.getActiveProxy() != null) {
                                Proxy settingsProxy = settings.getActiveProxy();

                                proxyInfo = new ProxyInfo();
                                proxyInfo.setHost(settingsProxy.getHost());
                                proxyInfo.setType(settingsProxy.getProtocol());
                                proxyInfo.setPort(settingsProxy.getPort());
                                proxyInfo.setNonProxyHosts(settingsProxy.getNonProxyHosts());
                                proxyInfo.setUserName(settingsProxy.getUsername());
                                proxyInfo.setPassword(settingsProxy.getPassword());
                            }

                            if (proxyInfo != null) {
                                wagon.connect(repository,
                                              wagonManager.getAuthenticationInfo(repository.getId()),
                                              proxyInfo);
                            } else {
                                wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
                            }

                            wagon.get(url.getPath(), projectRelativeFile);
                        }
                    } else {
                        FileUtils.fileWrite(projectRelativeFile.getAbsolutePath(), file.getContent());
                    }
                } catch (WagonException e) {
View Full Code Here

  
  protected void deploy(final Site site, final File directory, final Repository repository)
      throws MojoExecutionException {
    // TODO: work on moving this into the deployer like the other deploy
    // methods
    final Wagon wagon = getWagon(repository, wagonManager);
   
    try {
      configureWagon(wagon, repository.getId(), settings, container, getLog());
    } catch (WagonConfigurationException e) {
      throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e);
    }

    String relativeDir = site.getRoot();
    if ("".equals(relativeDir)) {
      relativeDir = "./";
    }else if(relativeDir.startsWith("/")){
      relativeDir = relativeDir.substring(1);
    }

    try {
      final ProxyInfo proxyInfo = getProxyInfo(repository, wagonManager);
      push(directory, repository, wagonManager, wagon, proxyInfo, relativeDir, getLog());

      if (chmod) {
        chmod(wagon, repository, chmodOptions, chmodMode);
      }
    } finally {
      try {
        wagon.disconnect();
      } catch (ConnectionException e) {
        getLog().error("Error disconnecting wagon - ignored", e);
      }
    }
  }
View Full Code Here

    }
  }

  private static Wagon getWagon( final Repository repository, final WagonManager manager )
        throws MojoExecutionException{
        final Wagon wagon;

        try{
            wagon = manager.getWagon( repository );
        }
        catch ( UnsupportedProtocolException e ){
            throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
        }
        catch ( WagonConfigurationException e ){
            throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
        }

        if ( !wagon.supportsDirectoryCopy() ) {
            throw new MojoExecutionException("Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" );
        }

        return wagon;
    }
View Full Code Here

            getLogger().info( emsg );
            return null;
        }

        Wagon wagon = null;
        try
        {
            RepositoryURL repoUrl = remoteRepository.getURL();
            String protocol = repoUrl.getProtocol();
            wagon = (Wagon) wagons.get( protocol );
            if ( wagon == null )
            {
                throw new ProxyException( "Unsupported target repository protocol: " + protocol );
            }

            boolean connected = connectToRepository( connector, wagon, remoteRepository );
            if ( connected )
            {
                localFile = transferSimpleFile( wagon, remoteRepository, remotePath, localFile );

                transferChecksum( wagon, remoteRepository, remotePath, localFile, ".sha1" );
                transferChecksum( wagon, remoteRepository, remotePath, localFile, ".md5" );
            }
        }
        catch ( NotFoundException e )
        {
            // Do not cache url here.
            throw e;
        }
        catch ( NotModifiedException e )
        {
            // Do not cache url here.
            throw e;
        }
        catch ( ProxyException e )
        {
            urlFailureCache.cacheFailure( url );
            throw e;
        }
        finally
        {
            if ( wagon != null )
            {
                try
                {
                    wagon.disconnect();
                }
                catch ( ConnectionException e )
                {
                    getLogger().warn( "Unable to disconnect wagon.", e );
                }
View Full Code Here

        // MRM-631 - the lightweight wagon does not reset these - remove if we switch to httpclient based wagon
        String previousHttpProxyHost = System.getProperty( "http.proxyHost" );
        String previousHttpProxyPort = System.getProperty( "http.proxyPort" );
        String previousProxyExclusions = System.getProperty( "http.nonProxyHosts" );

        Wagon wagon = null;
        try
        {
            RepositoryURL repoUrl = remoteRepository.getURL();
            String protocol = repoUrl.getProtocol();
            wagon = (Wagon) wagonFactory.getWagon( "wagon#" + protocol );
            if ( wagon == null )
            {
                throw new ProxyException( "Unsupported target repository protocol: " + protocol );
            }

            boolean connected = connectToRepository( connector, wagon, remoteRepository );
            if ( connected )
            {
                localFile = transferSimpleFile( wagon, remoteRepository, remotePath, repository, localFile );

                // TODO: these should be used to validate the download based on the policies, not always downloaded to
                //   save on connections since md5 is rarely used
                transferChecksum( wagon, remoteRepository, remotePath, repository, localFile, ".sha1" );
                transferChecksum( wagon, remoteRepository, remotePath, repository, localFile, ".md5" );
            }
        }
        catch ( NotFoundException e )
        {
            urlFailureCache.cacheFailure( url );
            throw e;
        }
        catch ( NotModifiedException e )
        {
            // Do not cache url here.
            throw e;
        }
        catch ( ProxyException e )
        {
            urlFailureCache.cacheFailure( url );
            throw e;
        }
        finally
        {
            if ( wagon != null )
            {
                try
                {
                    wagon.disconnect();

                    // MRM-631 - the lightweight wagon does not reset these - remove if we switch to httpclient based wagon
                    if ( previousHttpProxyHost != null )
                    {
                        System.setProperty( "http.proxyHost", previousHttpProxyHost );
View Full Code Here

{
    public void testLookupSuccessiveWagons()
    {
        WagonFactory factory = (WagonFactory) lookup( WagonFactory.class );
       
        Wagon first = factory.getWagon( "wagon#file" );
       
        Wagon second = factory.getWagon( "wagon#file" );
       
        assertNotSame( first, second );
    }
View Full Code Here

{
    public void testLookupSuccessiveWagons()
    {
        WagonFactory factory = (WagonFactory) lookup( WagonFactory.class );
       
        Wagon first = factory.getWagon( "wagon#file" );
       
        Wagon second = factory.getWagon( "wagon#file" );
       
        assertNotSame( first, second );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.Wagon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.