maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: cvs commit: maven-wagon/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext ScpExternalWagon.java
Date Sun, 20 Feb 2005 00:35:47 GMT
Michal,

This doesn't even compile. Can you please fix it?

- Brett

Brett Porter wrote:

>Michal,
>
>This won't work. There needs to be both an SSH and an SCP executable, as
>you can see from the commented out TODOs you replaced below.
>
>Also, I think "properties" is a better name than "annotations".
>
>- Brett
>
>michal@apache.org wrote:
>
>  
>
>>michal      2005/02/19 06:20:41
>>
>> Modified:    wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext
>>                       ScpExternalWagon.java
>> Log:
>> obeying both "annotations" and plexus style configuration for scp command
>> 
>> Revision  Changes    Path
>> 1.2       +65 -10    maven-wagon/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
>> 
>> Index: ScpExternalWagon.java
>> ===================================================================
>> RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java,v
>> retrieving revision 1.1
>> retrieving revision 1.2
>> diff -u -r1.1 -r1.2
>> --- ScpExternalWagon.java	18 Feb 2005 04:45:52 -0000	1.1
>> +++ ScpExternalWagon.java	19 Feb 2005 14:20:41 -0000	1.2
>> @@ -51,6 +51,25 @@
>>  {
>>      public static int DEFAULT_SSH_PORT = 22;
>>  
>> +    public static String COMMAND_KEY = "wagon.scp.executable";
>> +
>> +    public static String ARGS_KEY = "wagon.scp.args";
>> +
>> +
>> +    /**
>> +     * Plexus style way of configuring command.
>> +     * @component.configuration
>> +     *    default="scp"
>> +     */
>> +    private String command = "scp";
>> +
>> +    /**
>> +     *  Plexus style way of configuring  args.
>> +     * @component.configuration
>> +     */
>> +    private Strings args;
>> +
>> +
>>      // ----------------------------------------------------------------------
>>      //
>>      // ----------------------------------------------------------------------
>> @@ -154,18 +173,24 @@
>>      {
>>          AuthenticationInfo authenticationInfo = getRepository().getAuthenticationInfo();
>>  
>> -        String args = /* TODO: getRepository().getSshArgs(); */ null;
>> -        String executable = /* TODO: getRepository().getSshExe(); */ "ssh";
>> +        String commandArgs = getArgs( getRepository().getAnnotations() );
>> +
>> +        String commandExecutable = getExectutable( getRepository().getAnnotations()
);
>>  
>>          Commandline cl = new Commandline();
>> -        cl.setExecutable( executable );
>> -        if ( args != null )
>> +
>> +        cl.setExecutable( commandExecutable );
>> +
>> +        if ( commandArgs != null )
>>          {
>> -            cl.createArgument().setLine( args );
>> +            cl.createArgument().setLine( commandArgs );
>>          }
>>          String remoteHost = authenticationInfo.getUserName() + "@" + getRepository().getHost();
>> +
>>          cl.createArgument().setValue( remoteHost );
>> +
>>          cl.createArgument().setValue( command );
>> +
>>          try
>>          {
>>              CommandLineUtils.executeCommandLine( cl, null, null );
>> @@ -176,18 +201,46 @@
>>          }
>>      }
>>  
>> +    private getCommand( Map annotations )
>> +    {
>> +        String retValue = command;
>> +
>> +        if ( annotations.contains( COMMAND_KEY ) );
>> +        {
>> +            retValue = ( String ) annotations.get( COMMAND_KEY ) ;
>> +        }
>> +
>> +        return retValue;
>> +    }
>> +
>> +    private getArgs( Map annotations )
>> +    {
>> +        String retValue = args;
>> +
>> +        if ( annotation.contains( ARGS_KEY ) )
>> +        {
>> +            retValue = ( String ) annotations.get( ARGS_KEY );
>> +        }
>> +
>> +        return retValue;
>> +    }
>> +
>>      private void executeScpCommand( File localFile, String remoteFile, boolean put
)
>>          throws TransferFailedException
>>      {
>>          AuthenticationInfo authenticationInfo = getRepository().getAuthenticationInfo();
>>  
>> -        String args = /* TODO: getRepository().getScpArgs(); */ null;
>> -        String executable = /* TODO: getRepository().getScpExe(); */ "scp";
>> +        String scpArgs = getArgs( getRepository().getAnnotations() );
>> +
>> +        String spcExecutable = getExectutable( getRepository().getAnnotations()
);
>>  
>>          Commandline cl = new Commandline();
>> +
>>          cl.setWorkingDirectory( localFile.getParentFile().getAbsolutePath() );
>> -        cl.setExecutable( executable );
>> -        if ( args != null )
>> +
>> +        cl.setExecutable( scpExecutable );
>> +
>> +        if ( scpArgs != null )
>>          {
>>              cl.createArgument().setLine( args );
>>          }
>> @@ -228,7 +281,9 @@
>>          String basedir = getRepository().getBasedir();
>>  
>>          resourceName = StringUtils.replace( resourceName, "\\", "/" );
>> +
>>          String dir = PathUtils.dirname( resourceName );
>> +
>>          dir = StringUtils.replace( dir, "\\", "/" );
>>  
>>          String mkdirCmd = "mkdir -p " + basedir + "/" + dir + "\n";
>> 
>> 
>> 
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
>>For additional commands, e-mail: wagon-cvs-help@maven.apache.org
>>
>>
>> 
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
>For additional commands, e-mail: wagon-cvs-help@maven.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-cvs-help@maven.apache.org


Mime
View raw message