Package org.apache.maven.wagon.repository

Examples of org.apache.maven.wagon.repository.Repository


        server.start();

        try
        {
            Wagon wagon = getWagon();
            wagon.connect( new Repository( "id", "http://localhost:" + server.getConnectors()[0].getLocalPort() ) );

            File dest = File.createTempFile( "huge", "txt" );

            wagon.get( "hugefile.txt", dest );
View Full Code Here


        }

        // preemptive for put
        // TODO: is it a good idea, though? 'Expect-continue' handshake would serve much better

        Repository repo = getRepository();
        HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() );
        AuthScope targetScope = new AuthScope( targetHost );

        if ( credentialsProvider.getCredentials( targetScope ) != null )
        {
            BasicScheme targetAuth = new BasicScheme();
View Full Code Here

        RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
        // WAGON-273: default the cookie-policy to browser compatible
        requestConfigBuilder.setCookieSpec( CookieSpecs.BROWSER_COMPATIBILITY );

        Repository repo = getRepository();
        ProxyInfo proxyInfo = getProxyInfo( repo.getProtocol(), repo.getHost() );
        if ( proxyInfo != null )
        {
            HttpHost proxy = new HttpHost( proxyInfo.getHost(), proxyInfo.getPort() );
            requestConfigBuilder.setProxy( proxy );
        }

        HttpMethodConfiguration config =
            httpConfiguration == null ? null : httpConfiguration.getMethodConfiguration( httpMethod );

        if ( config != null )
        {
            ConfigurationUtils.copyConfig( config, requestConfigBuilder );
        }
        else
        {
            requestConfigBuilder.setSocketTimeout( getReadTimeout() );
        }

        localContext.setRequestConfig( requestConfigBuilder.build() );

        if ( config != null && config.isUsePreemptive() )
        {
            HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() );
            AuthScope targetScope = new AuthScope( targetHost );

            if ( credentialsProvider.getCredentials( targetScope ) != null )
            {
                BasicScheme targetAuth = new BasicScheme();
View Full Code Here

    extends CommandExecutorTestCase
{

    protected Repository getTestRepository()
    {
        return new Repository( "test", "scp://localhost/" );
    }
View Full Code Here

        AuthenticationInfo authInfo = new AuthenticationInfo();
        authInfo.setPrivateKey( file.getAbsolutePath() );

        try
        {
            getWagon().connect( new Repository(), authInfo );
            fail();
        }
        catch ( AuthenticationException e )
        {
            assertTrue( true );
View Full Code Here

        AuthenticationInfo authInfo = new AuthenticationInfo();
        authInfo.setPrivateKey( file.getAbsolutePath() );

        try
        {
            getWagon().connect( new Repository(), authInfo );
            fail();
        }
        catch ( AuthenticationException e )
        {
            assertTrue( true );
View Full Code Here

        proxyInfo.setNonProxyHosts( null );

        Wagon wagon = (Wagon) lookup( Wagon.ROLE, "scp" );
        try
        {
            wagon.connect( new Repository( "id", "scp://localhost/tmp" ), proxyInfo );
            fail();
        }
        catch ( AuthenticationException e )
        {
            assertTrue( handled );
View Full Code Here

        proxyInfo.setNonProxyHosts( null );

        Wagon wagon = (Wagon) lookup( Wagon.ROLE, "scp" );
        try
        {
            wagon.connect( new Repository( "id", "scp://localhost/tmp" ), proxyInfo );
            fail();
        }
        catch ( AuthenticationException e )
        {
            assertTrue( handled );
View Full Code Here

        {
            throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
        }
        getLog().debug( "The site will be deployed to '" + url + "'");

        Repository repository = new Repository( id, url );

        // TODO: work on moving this into the deployer like the other deploy methods

        Wagon wagon;

        try
        {
            wagon = wagonManager.getWagon( repository );
            configureWagon( wagon, repository.getId(), settings, container, getLog() );
        }
        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" );
        }

        try
        {
            Debug debug = new Debug();

            wagon.addSessionListener( debug );

            wagon.addTransferListener( debug );

            /*
            FIXME proxy Info
            ProxyInfo proxyInfo = getProxyInfo( repository, wagonManager );
            if ( proxyInfo != null )
            {
                wagon.connect( repository, wagonManager.getAuthenticationInfo( id ), proxyInfo );
            }
            else
            {
                wagon.connect( repository, wagonManager.getAuthenticationInfo( id ) );
            }
            */
           
            wagon.connect( repository );
           
            wagon.putDirectory( inputDirectory, "." );
           
            if ( chmod && wagon instanceof CommandExecutor )
            {
                CommandExecutor exec = (CommandExecutor) wagon;
                exec.executeCommand( "chmod " + chmodOptions + " " + chmodMode + " " + repository.getBasedir() );
            }
        }
        catch ( ResourceDoesNotExistException e )
        {
            throw new MojoExecutionException( "Error uploading site", e );
View Full Code Here

            }

            return null;
        }

        Repository repository = new Repository( site.getId(), site.getUrl() );
        StringBuffer hierarchy = new StringBuffer( 1024 );
        hierarchy.append( repository.getHost() );
        if ( !StringUtils.isEmpty( repository.getBasedir() ) )
        {
            if ( !repository.getBasedir().startsWith( "/" ) )
            {
                hierarchy.append( '/' );
            }
            hierarchy.append( repository.getBasedir() );
        }

        return hierarchy.toString().replaceAll( "[\\:\\?\\*]", "" );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.repository.Repository

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.