Java Doc for Sftp.java in  » Net » j2ssh » com » sshtools » ant » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » j2ssh » com.sshtools.ant 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sshtools.ant.SshSubTask
      com.sshtools.ant.Sftp

Sftp
public class Sftp extends SshSubTask (Code)
Basic SFTP client. Performs the following actions:
  • put - send files to a remote server. This is the default action.
  • get - retreive files from a remote server.
  • del - delete files from a remote server.
  • chmod - changes the mode of files on a remote server.

Inner Class :protected class SftpDirectoryScanner extends DirectoryScanner
Inner Class :public static class Action extends EnumeratedAttribute

Field Summary
final protected static  String[]ACTION_STRS
    
final protected static  intCHMOD
    
final protected static  String[]COMPLETED_ACTION_STRS
    
final protected static  intDEL_FILES
    
final protected static  intGET_FILES
    
final protected static  intMK_DIR
    
final protected static  intSEND_FILES
    


Method Summary
public  voidaddFileset(FileSet set)
    
protected  voidcheckConfiguration()
     Checks to see that all required parameters are set.
protected  voidchmod(SftpClient sftp, String filename)
    
protected  voidcreateParents(SftpClient sftp, String filename)
     Creates all parent directories specified in a complete relative pathname.
protected  voiddelFile(SftpClient sftp, String filename)
     Delete a file from the remote host.
public  voidexecute(SshClient ssh)
     Runs the task.
protected  voidexecuteSFTPTask(SshClient ssh)
    
protected  voidgetFile(SftpClient sftp, String dir, String filename)
     Retrieve a single file to the remote host.
protected  booleanisUpToDate(SftpClient sftp, File localFile, String remoteFile)
     Checks to see if the remote file is current as compared with the local file.
protected  voidmakeRemoteDir(SftpClient sftp, String dir)
     Create the specified directory on the remote host.
protected  StringresolveFile(String file)
     Correct a file path to correspond to the remote host requirements.
protected  voidsendFile(SftpClient sftp, String dir, String filename)
     Sends a single file to the remote host.
public  voidsetAction(Action action)
     Sets the FTP action to be taken.
public  voidsetChmod(String theMode)
     Sets the file permission mode (Unix only) for files sent to the server.
public  voidsetDepends(boolean depends)
     Set to true to transmit only files that are new or changed from their remote counterparts.
public  voidsetIgnoreNoncriticalErrors(boolean ignoreNoncriticalErrors)
     set the flag to skip errors on directory creation.
public  voidsetNewer(boolean newer)
     A synonym for depends.
public  voidsetRemotedir(String remotedir)
    
public  voidsetSkipFailedTransfers(boolean skipFailedTransfers)
     If true, enables unsuccessful file put, delete and get operations to be skipped with a warning and the remainder of the files still transferred.
public  voidsetVerbose(boolean verbose)
     Set to true to receive notification about each file as it is transferred.
protected  inttransferFiles(SftpClient sftp, FileSet fs)
     For each file in the fileset, do the appropriate action: send, get, delete, or list.
protected  voidtransferFiles(SftpClient sftp)
     Sends all files specified by the configured filesets to the remote server.

Field Detail
ACTION_STRS
final protected static String[] ACTION_STRS(Code)



CHMOD
final protected static int CHMOD(Code)



COMPLETED_ACTION_STRS
final protected static String[] COMPLETED_ACTION_STRS(Code)



DEL_FILES
final protected static int DEL_FILES(Code)



GET_FILES
final protected static int GET_FILES(Code)



MK_DIR
final protected static int MK_DIR(Code)



SEND_FILES
final protected static int SEND_FILES(Code)





Method Detail
addFileset
public void addFileset(FileSet set)(Code)
A set of files to upload or download



checkConfiguration
protected void checkConfiguration() throws BuildException(Code)
Checks to see that all required parameters are set.



chmod
protected void chmod(SftpClient sftp, String filename) throws IOException, BuildException(Code)



createParents
protected void createParents(SftpClient sftp, String filename) throws IOException, BuildException(Code)
Creates all parent directories specified in a complete relative pathname. Attempts to create existing directories will not cause errors.



delFile
protected void delFile(SftpClient sftp, String filename) throws IOException, BuildException(Code)
Delete a file from the remote host.



execute
public void execute(SshClient ssh) throws BuildException(Code)
Runs the task.



executeSFTPTask
protected void executeSFTPTask(SshClient ssh) throws BuildException(Code)



getFile
protected void getFile(SftpClient sftp, String dir, String filename) throws IOException, BuildException(Code)
Retrieve a single file to the remote host. filename may contain a relative path specification.

The file will then be retreived using the entire relative path spec - no attempt is made to change directories. It is anticipated that this may eventually cause problems with some FTP servers, but it simplifies the coding.




isUpToDate
protected boolean isUpToDate(SftpClient sftp, File localFile, String remoteFile) throws IOException, BuildException(Code)
Checks to see if the remote file is current as compared with the local file. Returns true if the remote file is up to date.



makeRemoteDir
protected void makeRemoteDir(SftpClient sftp, String dir) throws BuildException(Code)
Create the specified directory on the remote host.
Parameters:
  sftp - The SFTP client connection
Parameters:
  dir - The directory to create



resolveFile
protected String resolveFile(String file)(Code)
Correct a file path to correspond to the remote host requirements. This implementation currently assumes that the remote end can handle Unix-style paths with forward-slash separators. This can be overridden with the separator task parameter. No attempt is made to determine what syntax is appropriate for the remote host.



sendFile
protected void sendFile(SftpClient sftp, String dir, String filename) throws IOException, BuildException(Code)
Sends a single file to the remote host. filename may contain a relative path specification. When this is the case, sendFile will attempt to create any necessary parent directories before sending the file. The file will then be sent using the entire relative path spec - no attempt is made to change directories. It is anticipated that this may eventually cause problems with some FTP servers, but it simplifies the coding.



setAction
public void setAction(Action action) throws BuildException(Code)
Sets the FTP action to be taken. Currently accepts "put", "get", "del", "mkdir", "chmod" and "list".



setChmod
public void setChmod(String theMode)(Code)
Sets the file permission mode (Unix only) for files sent to the server.



setDepends
public void setDepends(boolean depends)(Code)
Set to true to transmit only files that are new or changed from their remote counterparts. The default is to transmit all files.



setIgnoreNoncriticalErrors
public void setIgnoreNoncriticalErrors(boolean ignoreNoncriticalErrors)(Code)
set the flag to skip errors on directory creation. (and maybe later other server specific errors)



setNewer
public void setNewer(boolean newer)(Code)
A synonym for depends. Set to true to transmit only new or changed files.



setRemotedir
public void setRemotedir(String remotedir)(Code)
Sets the remote working directory



setSkipFailedTransfers
public void setSkipFailedTransfers(boolean skipFailedTransfers)(Code)
If true, enables unsuccessful file put, delete and get operations to be skipped with a warning and the remainder of the files still transferred.



setVerbose
public void setVerbose(boolean verbose)(Code)
Set to true to receive notification about each file as it is transferred.



transferFiles
protected int transferFiles(SftpClient sftp, FileSet fs) throws IOException, BuildException(Code)
For each file in the fileset, do the appropriate action: send, get, delete, or list.



transferFiles
protected void transferFiles(SftpClient sftp) throws IOException, BuildException(Code)
Sends all files specified by the configured filesets to the remote server.



Fields inherited from com.sshtools.ant.SshSubTask
protected Ssh parent(Code)(Java Doc)
protected String taskString(Code)(Java Doc)

Methods inherited from com.sshtools.ant.SshSubTask
public void execute(SshClient ssh) throws BuildException(Code)(Java Doc)
protected void log(String msg)(Code)(Java Doc)
protected void log(String msg, int i)(Code)(Java Doc)
protected void setParent(Ssh parent)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.