public class FTPTask extends Task
Modifier and Type | Class and Description |
---|---|
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. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
ACTION_STRS |
static java.lang.String[] |
ACTION_TARGET_STRS |
static int |
CHMOD |
static java.lang.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 |
description, location, project
Constructor and Description |
---|
FTPTask() |
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String |
getAccount() |
int |
getAction() |
java.lang.String |
getChmod() |
java.lang.String |
getDefaultDateFormatConfig() |
boolean |
getEnableRemoteVerification() |
java.util.Vector |
getFilesets() |
long |
getGranularityMillis() |
java.lang.String |
getInitialSiteCommand() |
java.io.File |
getListing() |
java.lang.String |
getPassword() |
int |
getPort() |
java.lang.String |
getRecentDateFormatConfig() |
java.lang.String |
getRemotedir() |
int |
getRetriesAllowed() |
java.lang.String |
getSeparator() |
java.lang.String |
getServer() |
java.lang.String |
getServerLanguageCodeConfig() |
java.lang.String |
getServerTimeZoneConfig() |
java.lang.String |
getShortMonthNamesConfig() |
java.lang.String |
getSiteCommand() |
java.lang.String |
getSystemTypeKey() |
long |
getTimeDiffMillis() |
FTPTask.Granularity |
getTimestampGranularity() |
java.lang.String |
getUmask() |
java.lang.String |
getUserid() |
boolean |
isBinary() |
boolean |
isConfigurationSet() |
boolean |
isIgnoreNoncriticalErrors() |
boolean |
isNewer() |
boolean |
isPassive() |
boolean |
isPreserveLastModified() |
boolean |
isSkipFailedTransfers() |
boolean |
isTimeDiffAuto() |
boolean |
isVerbose() |
void |
log(java.lang.String msg,
int level) |
void |
setAccount(java.lang.String pAccount)
Sets the login account to use on the specified server.
|
void |
setAction(FTPTask.Action action)
Sets the FTP action to be taken.
|
void |
setAction(java.lang.String action)
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.
|
void |
setBinary(boolean binary)
If true, uses binary mode, otherwise text mode (default is binary).
|
void |
setChmod(java.lang.String theMode)
Sets the file permission mode (Unix only) for files sent to the
server.
|
void |
setDefaultDateFormatConfig(java.lang.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.
|
void |
setInitialSiteCommand(java.lang.String initialCommand)
Sets the initialSiteCommand attribute.
|
void |
setListing(java.io.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(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 |
setPreserveLastModified(boolean preserveLastModified)
Set to true to preserve modification times for "gotten" files.
|
void |
setRecentDateFormatConfig(java.lang.String recentDateFormat)
Sets the recentDateFormatConfig attribute.
|
void |
setRemotedir(java.lang.String dir)
Sets the remote directory where files will be placed.
|
void |
setRetriesAllowed(java.lang.String retriesAllowed)
Defines how many times to retry executing FTP command before giving up.
|
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 |
setServerLanguageCodeConfig(java.lang.String serverLanguageCode)
Sets the serverLanguageCode attribute.
|
void |
setServerTimeZoneConfig(java.lang.String serverTimeZoneId)
Sets the serverTimeZoneConfig attribute.
|
void |
setShortMonthNamesConfig(java.lang.String shortMonthNames)
Sets the shortMonthNamesConfig attribute
|
void |
setSiteCommand(java.lang.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.
|
void |
setTimestampGranularity(FTPTask.Granularity timestampGranularity)
Sets the timestampGranularity attribute
|
void |
setUmask(java.lang.String theUmask)
Sets the default mask for file creation on a unix server.
|
protected void |
setupFTPDelegate() |
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.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public static final int SEND_FILES
public static final int GET_FILES
public static final int DEL_FILES
public static final int LIST_FILES
public static final int MK_DIR
public static final int CHMOD
public static final int RM_DIR
public static final int SITE_CMD
public static final int DEFAULT_FTP_PORT
public static final java.lang.String[] ACTION_STRS
public static final java.lang.String[] COMPLETED_ACTION_STRS
public static final java.lang.String[] ACTION_TARGET_STRS
public void setRemotedir(java.lang.String dir)
dir
- the remote directory name.public java.lang.String getRemotedir()
public void setServer(java.lang.String server)
server
- the remote server name.public java.lang.String getServer()
public void setPort(int port)
port
- the port on which the remote server is listening.public int getPort()
public void setUserid(java.lang.String userid)
userid
- remote system userid.public java.lang.String getUserid()
public void setPassword(java.lang.String password)
password
- the password on the remote system.public java.lang.String getPassword()
public void setAccount(java.lang.String pAccount)
pAccount
- the account name on remote systempublic java.lang.String getAccount()
public void setBinary(boolean binary)
binary
- if true use binary mode in transfers.public boolean isBinary()
public void setPassive(boolean passive)
passive
- true is passive mode should be used.public boolean isPassive()
public void setVerbose(boolean verbose)
verbose
- true if verbose notifications are required.public boolean isVerbose()
public void setNewer(boolean newer)
newer
- if true only transfer newer files.public boolean isNewer()
public void setTimeDiffMillis(long timeDiffMillis)
newer
timeDiffMillis
- number of millisecondspublic long getTimeDiffMillis()
public void setTimeDiffAuto(boolean timeDiffAuto)
timeDiffAuto
- true = find automatically the time diffpublic boolean isTimeDiffAuto()
public void setPreserveLastModified(boolean preserveLastModified)
preserveLastModified
- if true preserver modification times.public boolean isPreserveLastModified()
public void setDepends(boolean depends)
depends
- if true only transfer newer files.public void setSeparator(java.lang.String separator)
separator
- the file separator on the remote system.public java.lang.String getSeparator()
public void setChmod(java.lang.String theMode)
theMode
- unix style file mode for the files sent to the remote
system.public java.lang.String getChmod()
public void setUmask(java.lang.String theUmask)
theUmask
- unix style umask for files created on the remote server.public java.lang.String getUmask()
public void addFileset(FileSet set)
set
- the set of files to be added to the list of files to be
transferred.public java.util.Vector getFilesets()
public void setAction(java.lang.String action) throws BuildException
action
- the FTP action to be performed.BuildException
- if the action is not a valid action.public void setAction(FTPTask.Action action) throws BuildException
action
- the FTP action to be performed.BuildException
- if the action is not a valid action.public int getAction()
public void setListing(java.io.File listing)
listing
- file in which to store the listing.public java.io.File getListing()
public void setSkipFailedTransfers(boolean skipFailedTransfers)
skipFailedTransfers
- true if failures in transfers are ignored.public boolean isSkipFailedTransfers()
public void setIgnoreNoncriticalErrors(boolean ignoreNoncriticalErrors)
ignoreNoncriticalErrors
- true if non-critical errors should not
cause a failure.public boolean isIgnoreNoncriticalErrors()
public boolean isConfigurationSet()
public void setSystemTypeKey(FTPTask.FTPSystemType systemKey)
FTPClientConfig
remote system key.systemKey
- the key to be set - BUT if blank
the default value of null (which signifies "autodetect") will be kept.FTPClientConfig
public void setDefaultDateFormatConfig(java.lang.String defaultDateFormat)
defaultDateFormat
- configuration to be set, unless it is
null or empty string, in which case ignored.FTPClientConfig
public void setRecentDateFormatConfig(java.lang.String recentDateFormat)
recentDateFormat
- configuration to be set, unless it is
null or empty string, in which case ignored.FTPClientConfig
public void setServerLanguageCodeConfig(java.lang.String serverLanguageCode)
serverLanguageCode
- configuration to be set, unless it is
null or empty string, in which case ignored.FTPClientConfig
public void setServerTimeZoneConfig(java.lang.String serverTimeZoneId)
serverTimeZoneId
- configuration to be set, unless it is
null or empty string, in which case ignored.FTPClientConfig
public void setShortMonthNamesConfig(java.lang.String shortMonthNames)
shortMonthNames
- configuration to be set, unless it is
null or empty string, in which case ignored.FTPClientConfig
public void setRetriesAllowed(java.lang.String retriesAllowed)
retriesAllowed
- number of retries to allow. -1 means
keep trying forever. "forever" may also be specified as a
synonym for -1.public int getRetriesAllowed()
public java.lang.String getSystemTypeKey()
public java.lang.String getDefaultDateFormatConfig()
public java.lang.String getRecentDateFormatConfig()
public java.lang.String getServerLanguageCodeConfig()
public java.lang.String getServerTimeZoneConfig()
public java.lang.String getShortMonthNamesConfig()
public FTPTask.Granularity getTimestampGranularity()
public void setTimestampGranularity(FTPTask.Granularity timestampGranularity)
timestampGranularity
- The timestampGranularity to set.public void setSiteCommand(java.lang.String siteCommand)
siteCommand
- The siteCommand to set.public java.lang.String getSiteCommand()
public void setInitialSiteCommand(java.lang.String initialCommand)
initialCommand
- The initialSiteCommand to set.public java.lang.String getInitialSiteCommand()
public long getGranularityMillis()
public void setGranularityMillis(long granularity)
public void setEnableRemoteVerification(boolean b)
b
- booleanpublic boolean getEnableRemoteVerification()
protected void checkAttributes() throws BuildException
BuildException
- if the configuration is not valid.public void execute() throws BuildException
execute
in class Task
BuildException
- if the task fails or is not configured
correctly.public Path createClasspath()
protected void setupFTPDelegate()
public void log(java.lang.String msg, int level)