org.apache.tools.ant.taskdefs.optional.net
public class FTPTask extends Task implements FTPTaskConfig
Since: Ant 1.3
Nested Class Summary | |
---|---|
static class | FTPTask.Action
an action to perform, one of
"send", "put", "recv", "get", "del", "delete", "list", "mkdir", "chmod",
"rmdir" |
static class | FTPTask.FTPSystemType
one of the valid system type keys recognized by the systemTypeKey
attribute. |
static class | FTPTask.Granularity
represents one of the valid timestamp adjustment values
recognized by the timestampGranularity attribute.A timestamp adjustment may be used in file transfers for checking uptodateness. |
Field Summary | |
---|---|
static String[] | ACTION_STRS |
static String[] | ACTION_TARGET_STRS |
static int | CHMOD |
static String[] | COMPLETED_ACTION_STRS |
static int | DEFAULT_FTP_PORT Default port for FTP |
static int | DEL_FILES |
static int | GET_FILES |
static int | LIST_FILES |
static int | MK_DIR |
static int | RM_DIR |
static int | SEND_FILES |
static int | SITE_CMD |
Method Summary | |
---|---|
void | addFileset(FileSet set)
A set of files to upload or download
|
protected void | checkAttributes()
Checks to see that all required parameters are set.
|
Path | createClasspath() |
void | execute()
Runs the task.
|
String | getAccount() |
int | getAction() |
String | getChmod() |
String | getDefaultDateFormatConfig() |
boolean | getEnableRemoteVerification() |
Vector | getFilesets() |
long | getGranularityMillis() |
String | getInitialSiteCommand() |
File | getListing() |
String | getPassword() |
int | getPort() |
String | getRecentDateFormatConfig() |
String | getRemotedir() |
int | getRetriesAllowed() |
String | getSeparator() |
String | getServer() |
String | getServerLanguageCodeConfig() |
String | getServerTimeZoneConfig() |
String | getShortMonthNamesConfig() |
String | getSiteCommand() |
String | getSystemTypeKey() |
long | getTimeDiffMillis() |
FTPTask.Granularity | getTimestampGranularity() |
String | getUmask() |
String | getUserid() |
boolean | isBinary() |
boolean | isConfigurationSet() |
boolean | isIgnoreNoncriticalErrors() |
boolean | isNewer() |
boolean | isPassive() |
boolean | isPreserveLastModified() |
boolean | isSkipFailedTransfers() |
boolean | isTimeDiffAuto() |
boolean | isVerbose() |
void | setAccount(String pAccount)
Sets the login account to use on the specified server.
|
void | setAction(String action)
Sets the FTP action to be taken. |
void | setAction(FTPTask.Action action)
Sets the FTP action to be taken. |
void | setBinary(boolean binary)
If true, uses binary mode, otherwise text mode (default is binary).
|
void | setChmod(String theMode)
Sets the file permission mode (Unix only) for files sent to the
server.
|
void | setDefaultDateFormatConfig(String defaultDateFormat)
Sets the defaultDateFormatConfig attribute. |
void | setDepends(boolean depends)
Set to true to transmit only files that are new or changed from their
remote counterparts. |
void | setEnableRemoteVerification(boolean b)
Whether to verify that data and control connections are
connected to the same remote host.
|
void | setGranularityMillis(long granularity) |
void | setIgnoreNoncriticalErrors(boolean ignoreNoncriticalErrors)
set the flag to skip errors on directory creation.
(and maybe later other server specific errors)
|
void | setInitialSiteCommand(String initialCommand)
Sets the initialSiteCommand attribute. |
void | setListing(File listing)
The output file for the "list" action. |
void | setNewer(boolean newer)
A synonym for depends. |
void | setPassive(boolean passive)
Specifies whether to use passive mode. |
void | setPassword(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 | setPreserveLastModified(boolean preserveLastModified)
Set to true to preserve modification times for "gotten" files.
|
void | setRecentDateFormatConfig(String recentDateFormat)
Sets the recentDateFormatConfig attribute. |
void | setRemotedir(String dir)
Sets the remote directory where files will be placed. |
void | setRetriesAllowed(String retriesAllowed)
Defines how many times to retry executing FTP command before giving up.
|
void | setSeparator(String separator)
Sets the remote file separator character. |
void | setServer(String server)
Sets the FTP server to send files to.
|
void | setServerLanguageCodeConfig(String serverLanguageCode)
Sets the serverLanguageCode attribute. |
void | setServerTimeZoneConfig(String serverTimeZoneId)
Sets the serverTimeZoneConfig attribute. |
void | setShortMonthNamesConfig(String shortMonthNames)
Sets the shortMonthNamesConfig attribute
|
void | setSiteCommand(String siteCommand)
Sets the siteCommand attribute. |
void | setSkipFailedTransfers(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.
|
void | setSystemTypeKey(FTPTask.FTPSystemType systemKey)
Sets the systemTypeKey attribute.
|
void | setTimeDiffAuto(boolean timeDiffAuto)
"true" to find out automatically the time difference
between local and remote machine.
|
void | setTimeDiffMillis(long timeDiffMillis)
number of milliseconds to add to the time on the remote machine
to get the time on the local machine.
use in conjunction with newer
|
void | setTimestampGranularity(FTPTask.Granularity timestampGranularity)
Sets the timestampGranularity attribute |
protected void | setupFTPDelegate() |
void | setUmask(String theUmask)
Sets the default mask for file creation on a unix server.
|
void | setUserid(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.
|
Parameters: set the set of files to be added to the list of files to be transferred.
Throws: BuildException if the configuration is not valid.
Throws: BuildException if the task fails or is not configured correctly.
Returns: Returns the defaultDateFormatConfig.
Returns: Returns the recentDateFormatConfig.
Returns: Returns the serverLanguageCodeConfig.
Returns: Returns the serverTimeZoneConfig.
Returns: Returns the shortMonthNamesConfig.
Returns: Returns the systemTypeKey.
Returns: Returns the timestampGranularity.
Parameters: pAccount the account name on remote system
Since: Ant 1.7
Deprecated: since 1.5.x. setAction(String) is deprecated and is replaced with setAction(FTP.Action) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
Sets the FTP action to be taken. Currently accepts "put", "get", "del", "mkdir", "chmod", "list", and "site".Parameters: action the FTP action to be performed.
Throws: BuildException if the action is not a valid action.
UNKNOWN: ignore="true"
Parameters: action the FTP action to be performed.
Throws: BuildException if the action is not a valid action.
Parameters: binary if true use binary mode in transfers.
Parameters: theMode unix style file mode for the files sent to the remote system.
Parameters: defaultDateFormat configuration to be set, unless it is null or empty string, in which case ignored.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: depends if true only transfer newer files.
Since: Ant 1.8.0
Parameters: ignoreNoncriticalErrors true if non-critical errors should not cause a failure.
Parameters: initialCommand The initialSiteCommand to set.
Parameters: listing file in which to store the listing.
Parameters: newer if true only transfer newer files.
Parameters: passive true is passive mode should be used.
Parameters: password the password on the remote system.
Parameters: port the port on which the remote server is listening.
Parameters: preserveLastModified if true preserver modification times.
Parameters: recentDateFormat configuration to be set, unless it is null or empty string, in which case ignored.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: dir the remote directory name.
Parameters: retriesAllowed number of retries to allow. -1 means keep trying forever. "forever" may also be specified as a synonym for -1.
Parameters: separator the file separator on the remote system.
Parameters: server the remote server name.
Parameters: serverLanguageCode configuration to be set, unless it is null or empty string, in which case ignored.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: serverTimeZoneId configuration to be set, unless it is null or empty string, in which case ignored.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: shortMonthNames configuration to be set, unless it is null or empty string, in which case ignored.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: siteCommand The siteCommand to set.
Parameters: skipFailedTransfers true if failures in transfers are ignored.
FTPClientConfig
remote system key.
Parameters: systemKey the key to be set - BUT if blank the default value of null (which signifies "autodetect") will be kept.
See Also: org.apache.commons.net.ftp.FTPClientConfig
Parameters: timeDiffAuto true = find automatically the time diff
Since: ant 1.6
newer
Parameters: timeDiffMillis number of milliseconds
Since: ant 1.6
Parameters: timestampGranularity The timestampGranularity to set.
Parameters: theUmask unix style umask for files created on the remote server.
Parameters: userid remote system userid.
Parameters: verbose true if verbose notifications are required.