diff --git a/docs/manual/OptionalTasks/ftp.html b/docs/manual/OptionalTasks/ftp.html
index 6afecd9aa..1f4e4d3a5 100644
--- a/docs/manual/OptionalTasks/ftp.html
+++ b/docs/manual/OptionalTasks/ftp.html
@@ -172,6 +172,115 @@ coming from your ftp server (ls -l on the ftp prompt).
(Note: Ignored on Java 1.1)
No; defaults to false. |
+
+
+
+ The following attributes require
+ jakarta-commons-net-1.4.0 or greater.
+
+ Use these options when the standard options don't work, because
+ - the server is in a different timezone and you need timestamp
+ dependency checking
+ - the default timestamp formatting doesn't match the server display and
+ list parsing therefore fails
+
+ If none of these is specified, the default mechanism of letting the system
+ auto-detect the server OS type based on the FTP SYST command and assuming
+ standard formatting for that OS type will be used.
+ |
+
+
+ systemTypeKey |
+ Specifies the type of system in use on the server.
+ Supported values are "UNIX", "VMS", "WINDOWS", "OS/2", "OS/400", "MVS".
+ If not specified, and no other xxxConfig attributes are specified, the
+ autodectection mechanism based on the FTP SYST command will be used.
+ |
+ No, but if any of the following xxxConfig
+ attributes is specified, UNIX will be assumed.
+ |
+
+
+ serverTimeZoneConfig |
+ Specify as a java.util.Timezone identifier
+ (e.g. GMT , America/Chicago or
+ Asia/Jakarta ) the timezone
+ used by the server for timestamps. This enables Ant timestamp dependency
+ checking even when the server is in a different timezone than the client.
+ If not specified, the timezone of the client is assumed.
+ |
+ No |
+
+
+ defaultDateFormatConfig |
+ Specify in java.text.SimpleDateFormat notation, (e.g.
+ yyyy-MM-dd ) the date format generally used by the FTP server
+ to parse dates. In some cases this will be the only date format used.
+ In others, (unix for example) this will be used for dates
+ older than a year old. (See recentDateFormatConfig). If not specified,
+ the default date format for the system type indicated by the
+ systemTypeKey attribute will be used.
+ |
+
+ No.
+ |
+
+
+ recentDateFormatConfig |
+ Specify in java.text.SimpleDateFormat notation, the date
+ format used by the FTP server to parse dates less than a year old,
+ (e.g. MMM dd hh:mm
+ If not specified, and if the system type indicated by the system key
+ uses a recent date format, its standard format will be used.
+ |
+ No |
+
+
+ serverLanguageCodeConfig |
+ a
+ two-letter ISO-639 language code used to specify the
+ language used by the server to format month names. This only needs to be
+ specified when the server uses non-numeric abbreviations for months in its
+ date listings in a language other than English. This appears to be
+ becoming rarer and rarer, as commonly distributed ftp servers seem
+ increasingly to use English or all-numeric formats.
+ Languages supported are:
+
+ - en - English
+ - fr - French
+ - de - German
+ - it - Italian
+ - es - Spanish
+ - pt - Portuguese
+ - da - Danish
+ - sv - Swedish
+ - no - Norwegian
+ - nl - Dutch
+ - ro - Romanian
+ - sq - Albanian
+ - sh - Serbo-croatian
+ - sk - Slovak
+ - sl - Slovenian
+
+ If you require a language other than the above, see also the
+ shortMonthNamesConfig attribute.
+ |
+
+ No |
+
+
+ shortMonthNamesConfig |
+ specify the month abbreviations used on the server in file
+ timestamp dates as a pipe-delimited string for each month. For example,
+ a set of month names used by a hypothetical
+ Icelandic FTP server might conceivably be specified as
+ "jan|feb|mar|apr|maí|jún|júl|ágú|sep|okt|nóv|des" .
+ This attribute exists primarily to support languages not supported by
+ the serverLanguageCode attribute.
+ |
+ No |
+
Note about remotedir attribute
depends="yes">
<fileset dir="htdocs/manual"/>
</ftp>
-Logs in to ftp.apache.org
as anonymous
and
+
Logs in to ftp.apache.org
as anonymous
and
uploads all new or changed files in the htdocs/manual
directory
to the incoming
directory relative to the default directory
for anonymous
.
@@ -303,16 +412,37 @@ for anonymous
.
remotedir="/pub/incoming"
userid="coder"
password="java1"
+ passive="yes"
depends="yes"
binary="no">
<fileset dir="htdocs/manual">
<include name="**/*.html"/>
</fileset>
</ftp>
-Logs in to ftp.apache.org
at port 2121
as
-coder
with password java1
and uploads all new or
-changed HTML files in the htdocs/manual
directory to the
-/pub/incoming
directory. The files are transferred in text mode. Passive mode has been switched on to send files from behind a firewall.
+Logs in to ftp.apache.org
at port 2121
as
+coder
with password java1
and uploads all new or
+changed HTML files in the htdocs/manual
directory to the
+/pub/incoming
directory. The files are transferred in text mode.
+Passive mode has been switched on to send files from behind a firewall.
+ <ftp server="ftp.hypothetical.india.org"
+ port="2121"
+ remotedir="/pub/incoming"
+ userid="coder"
+ password="java1"
+ depends="yes"
+ binary="no"
+ systemTypeKey="Windows"
+ serverTimeZoneConfig="India/Calcutta">
+ <fileset dir="htdocs/manual">
+ <include name="**/*.html"/>
+ </fileset>
+ </ftp>
+Logs in to a Windows server at ftp.hypothetical.india.org
+at port 2121
as coder
with password java1
+and uploads all new or changed (accounting for timezone differences)
+HTML files in the htdocs/manual
+directory to the /pub/incoming
directory. The files are transferred
+in text mode.
<ftp server="ftp.nt.org"
remotedir="c:\uploads"
userid="coder"
@@ -346,7 +476,42 @@ into. The file structure from the FTP site is preserved on the local machine.
Logs in to ftp.apache.org
as anonymous
and
recursively downloads all .html files from default directory for that user
into the htdocs/manual
directory on the local machine.
-.
+
+ <ftp action="get"
+ server="ftp.apache.org"
+ userid="anonymous"
+ password="me@myorg.com"
+ systemTypeKey="UNIX"
+ defaultDateFormatConfig="yyyy-MM-dd HH:mm">
+ <fileset dir="htdocs/manual">
+ <include name="**/*.html"/>
+ </fileset>
+ </ftp>
+
+If apache.org ever switches to a unix FTP server that uses the new all-numeric
+format for timestamps, this version would become necessary. It would accomplish
+the same functionality as the previous example but would successfully handle the
+numeric timestamps.
+The systemTypeKey
is not necessary here but helps clarify what is
+going on.
+
+ <ftp action="get"
+ server="ftp.hypthetical.fr"
+ userid="anonymous"
+ password="me@myorg.com"
+ defaultDateFormatConfig="d MMM yyyy"
+ recentDateFormatConfig="d MMM HH:mm"
+ serverLanguageCodeConfig="fr">
+ <fileset dir="htdocs/manual">
+ <include name="**/*.html"/>
+ </fileset>
+ </ftp>
+
+Logs into a UNIX FTP server at ftp.hypothetical.fr
which displays
+dates with French names in Standard European format, as anonymous
, and
+recursively downloads all .html files from default directory for that user
+into the htdocs/manual
directory on the local machine.
+
Deleting Files
As you've probably guessed by now, you use nested fileset elements to
select the files to delete from the remote FTP server. Again, the
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 353c1dcd7..5afbb155e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -109,7 +109,7 @@ public class FTP
private boolean preserveLastModified = false;
private String chmod = null;
private String umask = null;
- private String systemKeyConfig = null;
+ private String systemTypeKey = null;
private String defaultDateFormatConfig = null;
private String recentDateFormatConfig = null;
private String serverLanguageCodeConfig = null;
@@ -1257,11 +1257,11 @@ public class FTP
/**
* Method for setting FTPClientConfig
remote system key.
*
- * @param systemKeyConfig
+ * @param systemTypeKey
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
- public void setSystemKeyConfig(String systemKey) {
- this.systemKeyConfig = systemKey;
+ public void setSystemTypeKey(String systemKey) {
+ this.systemTypeKey = systemKey;
configurationHasBeenSet();
}
@@ -1322,10 +1322,10 @@ public class FTP
/**
- * @return Returns the systemKeyConfig.
+ * @return Returns the systemTypeKey.
*/
- String getSystemKeyConfig() {
- return systemKeyConfig;
+ String getSystemTypeKey() {
+ return systemTypeKey;
}
/**
* @return Returns the defaultDateFormatConfig.
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java
index 0aa49557f..6fda45f1c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java
@@ -38,11 +38,11 @@ class FTPConfigurator {
*/
static FTPClient configure(FTPClient client, FTP task) {
FTPClientConfig config;
- String systemKeyConfig = task.getSystemKeyConfig();
- if (systemKeyConfig != null) {
- config = new FTPClientConfig(systemKeyConfig);
+ String systemTypeKey = task.getSystemTypeKey();
+ if (systemTypeKey != null) {
+ config = new FTPClientConfig(systemTypeKey);
task.log("custom config: system key = "
- + systemKeyConfig, Project.MSG_VERBOSE);
+ + systemTypeKey, Project.MSG_VERBOSE);
} else {
config = new FTPClientConfig();
}