bodewig     2004/04/13 04:09:01

  Modified:    docs/manual/OptionalTasks scp.html
               src/main/org/apache/tools/ant/taskdefs/optional/ssh Scp.java
  Log:
  Add special local/remote variants of the file and todir attributes to
  explicitly state what is local or remote.
  
  Document verbose attribute.
  
  Submitted by: Rami Ojares
  
  Revision  Changes    Path
  1.13      +45 -3     ant/docs/manual/OptionalTasks/scp.html
  
  Index: scp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/scp.html,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- scp.html  9 Feb 2004 21:50:08 -0000       1.12
  +++ scp.html  13 Apr 2004 11:09:01 -0000      1.13
  @@ -20,7 +20,7 @@
   in the Ant distribution.  See <a
   href="../install.html#librarydependencies">Library Dependencies</a>
   for more information.  This task has been tested with jsch-0.1.2 to
  -jsch-0.1.9.</p>
  +jsch-0.1.14.</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -34,19 +34,54 @@
       <td valign="top">The file to copy.  This can be a local path or a
       remote path of the form <i>user[:[EMAIL PROTECTED]:/directory/path</i>.
       <i>:password</i> can be ommitted if you use key based
  -    authentication or specify the password attribute.</td>
  +    authentication or specify the password attribute.  The way remote
  +    path is recognized is whether it contains @ character or not. This
  +    will not work if your localPath contains @ character.</td>
       <td valign="top" align="center">Yes, unless a nested
       <code>&lt;fileset&gt;</code> element is used.</td>
     </tr>
     <tr>
  +    <td valign="top">localFile</td>
  +    <td valign="top">This is an alternative to the file attribute. But
  +    this must always point to a local file. The reason this was added
  +    was that when you give file attribute it is treated as remote if
  +    it contains @ character. This character can exist also in local
  +    paths.  <em>since Ant 1.6.2</em></td>
  +    <td valign="top" align="center">Alternative to file attribute.</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">remoteFile</td>
  +    <td valign="top">This is an alternative to the file attribute. But
  +    this must always point to a remote file.  <em>since Ant 1.6.2</em></td>
  +    <td valign="top" align="center">Alternative to file attribute.</td>
  +  </tr>
  +  <tr>
       <td valign="top">todir</td>
       <td valign="top">The directory to copy to.  This can be a local path
       or a remote path of the form <i>user[:[EMAIL 
PROTECTED]:/directory/path</i>.
       <i>:password</i> can be ommitted if you use key based
  -    authentication or specify the password attribute.</td>
  +    authentication or specify the password attribute.  The way remote
  +    path is recognized is whether it contains @ character or not. This
  +    will not work if your localPath contains @ character.</td>
       <td valian="top" align="center">Yes</td>
     </tr>
     <tr>
  +    <td valign="top">localTodir</td>
  +    <td valign="top">This is an alternative to the todir
  +    attribute. But this must always point to a local directory. The
  +    reason this was added was that when you give todir attribute it is
  +    treated as remote if it contains @ character. This character can
  +    exist also in local paths.  <em>since Ant 1.6.2</em></td>
  +    <td valian="top" align="center">Alternative to todir attribute.</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">remoteTodir</td>
  +    <td valign="top">This is an alternative to the todir
  +    attribute. But this must always point to a remote directory.
  +    <em>since Ant 1.6.2</em></td>
  +    <td valian="top" align="center">Alternative to todir attribute.</td>
  +  </tr>
  +  <tr>
       <td valign="top">port</td>
       <td valign="top">The port to connect to on the remote host.</td>
       <td valian="top" align="center">No, defaults to 22.</td>
  @@ -91,6 +126,13 @@
        <td valign="top">Passphrase for your private key.</td>
        <td valign="top" align="center">Yes, if you are using key based
        authentication.</td>
  +  </tr>
  +  <tr>
  +    <td valign="top">verbose</td>
  +    <td valign="top">Determines whether SCP outputs verbosely to the
  +    user. Currently this means outputting dots/stars showing the
  +    progress of a file transfer.  <em>since Ant 1.6.2</em></td>
  +    <td valign="top" align="center">No; defaults to false.</td>
     </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
  
  
  
  1.16      +43 -5     
ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
  
  Index: Scp.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Scp.java  7 Apr 2004 13:30:30 -0000       1.15
  +++ Scp.java  13 Apr 2004 11:09:01 -0000      1.16
  @@ -43,6 +43,7 @@
       private String fromUri;
       private String toUri;
       private List fileSets = null;
  +    private boolean isFromRemote, isToRemote;
   
       /**
        * Sets the file to be transferred.  This can either be a remote
  @@ -55,6 +56,7 @@
        */
       public void setFile(String aFromUri) {
           this.fromUri = aFromUri;
  +        this.isFromRemote = isRemoteUri(this.fromUri);
       }
   
       /**
  @@ -68,9 +70,50 @@
        */
       public void setTodir(String aToUri) {
           this.toUri = aToUri;
  +        this.isToRemote = isRemoteUri(this.toUri);
       }
   
  +    /**
  +     * Similiar to [EMAIL PROTECTED] #setFile setFile} but explicitly states 
that
  +     * the file is a local file.  This is the only way to specify a
  +     * local file with a @ character.
  +     * @since Ant 1.6.2
  +     */
  +    public void setLocalFile(String aFromUri) {
  +        this.fromUri = aFromUri;
  +        this.isFromRemote = false;
  +    }
  +
  +    /**
  +     * Similiar to [EMAIL PROTECTED] #setFile setFile} but explicitly states 
that
  +     * the file is a remote file.
  +     * @since Ant 1.6.2
  +     */
  +    public void setRemoteFile(String aFromUri) {
  +        this.fromUri = aFromUri;
  +        this.isFromRemote = true;
  +     }
  +
  +    /**
  +     * Similiar to [EMAIL PROTECTED] #setTodir setTodir} but explicitly 
states
  +     * that the directory is a local.  This is the only way to specify
  +     * a local directory with a @ character.
  +     * @since Ant 1.6.2
  +     */
  +    public void setLocalTodir(String aToUri) {
  +        this.toUri = aToUri;
  +        this.isToRemote = false;
  +    }
   
  +    /**
  +     * Similiar to [EMAIL PROTECTED] #setTodir setTodir} but explicitly 
states
  +     * that the directory is a remote.
  +     * @since Ant 1.6.2
  +     */
  +    public void setRemoteTodir(String aToUri) {
  +        this.toUri = aToUri;
  +        this.isToRemote = true;
  +    }
   
       /**
        * Adds a FileSet tranfer to remote host.  NOTE: Either
  @@ -102,11 +145,6 @@
                   + "FileSet is required.");
           }
   
  -        boolean isFromRemote = false;
  -        if (fromUri != null) {
  -            isFromRemote = isRemoteUri(fromUri);
  -        }
  -        boolean isToRemote = isRemoteUri(toUri);
           try {
               if (isFromRemote && !isToRemote) {
                   download(fromUri, toUri);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to