Package org.apache.maven.wagon

Examples of org.apache.maven.wagon.Streams


    {
        try
        {
            String path = getPath( repository.getBasedir(), destinationDirectory );
            //Streams streams = executor.executeCommand( "ls -FlA " + path, false );
            Streams streams = executor.executeCommand( "ls -FlA \"" + path + "\"", false );

            List<String> ret = new LSParser().parseFiles( streams.getOut() );
            if ( ret == null || ret.isEmpty() )
            {
                throw new ResourceDoesNotExistException( "No such file or directory" );
            }
            return ret;
View Full Code Here


        try
        {
            CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
            int exitCode = CommandLineUtils.executeCommandLine( cl, out, err );
            Streams streams = new Streams();
            streams.setOut( out.getOutput() );
            streams.setErr( err.getOutput() );
            fireSessionDebug( streams.getOut() );
            fireSessionDebug( streams.getErr() );
            if ( exitCode != 0 )
            {
                if ( !ignoreFailures || exitCode == SSH_FATAL_EXIT_CODE )
                {
                    throw new CommandExecutionException( "Exit code " + exitCode + " - " + err.getOutput() );
View Full Code Here

    }

    public static Streams processStreams( BufferedReader stderrReader, BufferedReader stdoutReader )
        throws IOException
    {
        Streams streams = new Streams();

        while ( true )
        {
            String line = stderrReader.readLine();

            if ( line == null )
            {
                break;
            }

            // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that
            // don't have exit codes ignore this error. TODO: output a warning
            if ( !line.startsWith( "Could not chdir to home directory" )
                 && !line.endsWith( "ttyname: Operation not supported" ) )
            {
                streams.setErr( streams.getErr() + line + "\n" );
            }
        }

        while ( true )
        {
            String line = stdoutReader.readLine();

            if ( line == null )
            {
                break;
            }

            streams.setOut( streams.getOut() + line + "\n" );
        }

        // drain the output stream.
        // TODO: we'll save this for the 1.0-alpha-8 line, so we can test it more. the -q arg in the
        // unzip command should keep us until then...
View Full Code Here

            commandline.createArg().setValue( "700" );
            commandline.createArg().setValue( sshKeysTarget.getCanonicalPath() );
            CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
            int exitCode = CommandLineUtils.executeCommandLine( commandline, out, err );
            Streams streams = new Streams();
            streams.setOut( out.getOutput() );
            streams.setErr( err.getOutput() );
            if ( exitCode != 0 )
            {
                throw new RuntimeException(
                    "fail to chmod exit code " + exitCode + ", error" + streams.getErr() + ", out "
                        + streams.getOut() );
            }

            authInfo.setPrivateKey( new File( sshKeysTarget, "id_rsa" ).getCanonicalPath() );

            return authInfo;
View Full Code Here

            channel.connect();

            stdoutReader = new BufferedReader( new InputStreamReader( stdout ) );
            stderrReader = new BufferedReader( new InputStreamReader( stderr ) );

            Streams streams = CommandExecutorStreamProcessor.processStreams( stderrReader, stdoutReader );

            if ( streams.getErr().length() > 0 && !ignoreFailures )
            {
                int exitCode = channel.getExitStatus();
                throw new CommandExecutionException( "Exit code: " + exitCode + " - " + streams.getErr() );
            }

            return streams;
        }
        catch ( IOException e )
View Full Code Here

        throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
    {
        try
        {
            String path = getPath( getRepository().getBasedir(), destinationDirectory );
            Streams streams = executeCommand( "ls -la " + path, false );
           
            return new LSParser().parseFiles( streams.getOut() );
        }
        catch ( CommandExecutionException e )
        {
            if ( e.getMessage().trim().endsWith( "No such file or directory" ) )
            {
View Full Code Here

    }

    public static Streams processStreams( BufferedReader stderrReader, BufferedReader stdoutReader )
        throws IOException, CommandExecutionException
    {
        Streams streams = new Streams();

        while ( true )
        {
            String line = stderrReader.readLine();
            if ( line == null )
            {
                break;
            }

            // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that don't have exit codes
            // ignore this error. TODO: output a warning
            if ( !line.startsWith( "Could not chdir to home directory" ) &&
                !line.endsWith( "ttyname: Operation not supported" ) )
            {
                streams.setErr( streams.getErr() + line + "\n" );
            }
        }

        while ( true )
        {
            String line = stdoutReader.readLine();
            if ( line == null )
            {
                break;
            }

            streams.setOut( streams.getOut() + line + "\n" );
        }

        // drain the output stream.
        // TODO: we'll save this for the 1.0-alpha-8 line, so we can test it more. the -q arg in the
        // unzip command should keep us until then...
View Full Code Here

    {
        try
        {
            String path = getPath( repository.getBasedir(), destinationDirectory );
            //Streams streams = executor.executeCommand( "ls -FlA " + path, false );
            Streams streams = executor.executeCommand( "ls -FlA \"" + path + "\"", false );

            List<String> ret = new LSParser().parseFiles( streams.getOut() );
            if ( ret == null || ret.isEmpty() )
            {
                throw new ResourceDoesNotExistException( "No such file or directory" );
            }
            return ret;
View Full Code Here

    }

    public static Streams processStreams( BufferedReader stderrReader, BufferedReader stdoutReader )
        throws IOException
    {
        Streams streams = new Streams();

        while ( true )
        {
            String line = stderrReader.readLine();

            if ( line == null )
            {
                break;
            }

            // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that
            // don't have exit codes ignore this error. TODO: output a warning
            if ( !line.startsWith( "Could not chdir to home directory" )
                 && !line.endsWith( "ttyname: Operation not supported" ) )
            {
                streams.setErr( streams.getErr() + line + "\n" );
            }
        }

        while ( true )
        {
            String line = stdoutReader.readLine();

            if ( line == null )
            {
                break;
            }

            streams.setOut( streams.getOut() + line + "\n" );
        }

        // drain the output stream.
        // TODO: we'll save this for the 1.0-alpha-8 line, so we can test it more. the -q arg in the
        // unzip command should keep us until then...
View Full Code Here

            commandline.createArg().setValue( "700" );
            commandline.createArg().setValue( sshKeysTarget.getCanonicalPath() );
            CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
            int exitCode = CommandLineUtils.executeCommandLine( commandline, out, err );
            Streams streams = new Streams();
            streams.setOut( out.getOutput() );
            streams.setErr( err.getOutput() );
            if ( exitCode != 0 )
            {
                throw new RuntimeException(
                    "fail to chmod exit code " + exitCode + ", error" + streams.getErr() + ", out "
                        + streams.getOut() );
            }

            authInfo.setPrivateKey( new File( sshKeysTarget, "id_rsa" ).getCanonicalPath() );

            return authInfo;
View Full Code Here

TOP

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

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.