|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.optional.net.FTP
Basic FTP client that performs the following actions:
Inner Class Summary | |
protected class |
FTP.FTPDirectoryScanner
|
Field Summary | |
protected static java.lang.String[] |
ACTION_STRS
|
protected static java.lang.String[] |
COMPLETED_ACTION_STRS
|
protected static int |
DEL_FILES
|
protected static int |
GET_FILES
|
protected static int |
LIST_FILES
|
protected static int |
SEND_FILES
|
Fields inherited from class org.apache.tools.ant.Task |
description, location, project, target, taskName, taskType, wrapper |
Constructor Summary | |
FTP()
|
Method Summary | |
void |
addFileset(FileSet set)
Adds a set of files (nested fileset attribute). |
protected void |
checkConfiguration()
Checks to see that all required parameters are set. |
protected void |
createParents(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.lang.String filename)
Creates all parent directories specified in a complete relative pathname. |
protected void |
delFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.lang.String filename)
Delete a file from the remote host. |
void |
execute()
Runs the task. |
protected void |
getFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.lang.String dir,
java.lang.String filename)
Retrieve a single file to the remote host. |
protected boolean |
isUpToDate(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.io.File localFile,
java.lang.String remoteFile)
Checks to see if the remote file is current as compared with the local file. |
protected void |
listFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.io.BufferedWriter bw,
java.lang.String filename)
List information about a single file from the remote host. |
protected java.lang.String |
resolveFile(java.lang.String file)
Correct a file path to correspond to the remote host requirements. |
protected void |
sendFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
java.lang.String dir,
java.lang.String filename)
Sends a single file to the remote host. |
void |
setAction(java.lang.String action)
Sets the FTP action to be taken. |
void |
setBinary(boolean binary)
Specifies whether to use binary-mode or text-mode transfers. |
void |
setDepends(boolean depends)
A synonym for setNewer. |
void |
setListing(java.io.File listing)
The output file for the "list" action. |
void |
setNewer(boolean newer)
Set to true to transmit only files that are new or changed from their remote counterparts. |
void |
setPassive(boolean passive)
Specifies whether to use passive mode. |
void |
setPassword(java.lang.String password)
Sets the login password for the given user id. |
void |
setPort(int port)
Sets the FTP port used by the remote server. |
void |
setRemotedir(java.lang.String dir)
Sets the remote directory where files will be placed. |
void |
setSeparator(java.lang.String separator)
Sets the remote file separator character. |
void |
setServer(java.lang.String server)
Sets the FTP server to send files to. |
void |
setUserid(java.lang.String userid)
Sets the login user id to use on the specified server. |
void |
setVerbose(boolean verbose)
Set to true to receive notification about each file as it is transferred. |
protected void |
transferFiles(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp)
Sends all files specified by the configured filesets to the remote server. |
protected int |
transferFiles(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp,
FileSet fs)
For each file in the fileset, do the appropriate action: send, get, delete, or list. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int SEND_FILES
protected static final int GET_FILES
protected static final int DEL_FILES
protected static final int LIST_FILES
protected static final java.lang.String[] ACTION_STRS
protected static final java.lang.String[] COMPLETED_ACTION_STRS
Constructor Detail |
public FTP()
Method Detail |
public void setRemotedir(java.lang.String dir)
public void setServer(java.lang.String server)
public void setPort(int port)
public void setUserid(java.lang.String userid)
public void setPassword(java.lang.String password)
public void setBinary(boolean binary)
public void setPassive(boolean passive)
public void setVerbose(boolean verbose)
public void setNewer(boolean newer)
public void setDepends(boolean depends)
public void setSeparator(java.lang.String separator)
public void addFileset(FileSet set)
public void setAction(java.lang.String action) throws BuildException
public void setListing(java.io.File listing) throws BuildException
protected void checkConfiguration() throws BuildException
protected int transferFiles(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, FileSet fs) throws java.io.IOException, BuildException
protected void transferFiles(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp) throws java.io.IOException, BuildException
protected java.lang.String resolveFile(java.lang.String file)
separator
task parameter. No
attempt is made to determine what syntax is appropriate for the
remote host.protected void createParents(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.lang.String filename) throws java.io.IOException, BuildException
protected boolean isUpToDate(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.io.File localFile, java.lang.String remoteFile) throws java.io.IOException, BuildException
protected void sendFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.lang.String dir, java.lang.String filename) throws java.io.IOException, BuildException
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.protected void delFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.lang.String filename) throws java.io.IOException, BuildException
protected void getFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.lang.String dir, java.lang.String filename) throws java.io.IOException, BuildException
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.protected void listFile(org.apache.tools.ant.taskdefs.optional.net.FTPClient ftp, java.io.BufferedWriter bw, java.lang.String filename) throws java.io.IOException, BuildException
filename
may contain a relative path specification.
The file listing will then be retrieved 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.public void execute() throws BuildException
execute
in class Task
org.apache.tools.ant.Task
BuildException
- if someting goes wrong with the build
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |