Return-Path: Delivered-To: apmail-maven-wagon-cvs-archive@www.apache.org Received: (qmail 68029 invoked from network); 20 Feb 2005 00:35:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Feb 2005 00:35:56 -0000 Received: (qmail 7314 invoked by uid 500); 20 Feb 2005 00:35:55 -0000 Delivered-To: apmail-maven-wagon-cvs-archive@maven.apache.org Received: (qmail 7295 invoked by uid 500); 20 Feb 2005 00:35:55 -0000 Mailing-List: contact wagon-cvs-help@maven.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list wagon-cvs@maven.apache.org Received: (qmail 7282 invoked by uid 99); 20 Feb 2005 00:35:55 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from mail-09.iinet.net.au (HELO mail.iinet.net.au) (203.59.3.41) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 19 Feb 2005 16:35:55 -0800 Received: (qmail 27455 invoked from network); 20 Feb 2005 00:35:49 -0000 Received: from unknown (HELO ?10.1.1.28?) (203.217.79.166) by mail.iinet.net.au with SMTP; 20 Feb 2005 00:35:49 -0000 Message-ID: <4217DB63.9010205@apache.org> Date: Sun, 20 Feb 2005 11:35:47 +1100 From: Brett Porter User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brett Porter CC: michal@apache.org, maven-wagon-cvs@apache.org Subject: Re: cvs commit: maven-wagon/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext ScpExternalWagon.java References: <20050219142041.65698.qmail@minotaur.apache.org> <4217D53B.4000304@apache.org> In-Reply-To: <4217D53B.4000304@apache.org> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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