Browse Source

Change so that systemTypeKey and all the new xxxConfig attributes work by the convention that setting the attribute to "" leaves the attribute unset, at

whatever value it had before, that is, for all these, the default value of null.  This would enable property-file based development to proceed more easily.
Update documentantation to reflect this.
PR: 34978


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278316 13f79535-47bb-0310-9956-ffa450edef68
master
Steven M. Cohen 20 years ago
parent
commit
22bdc578fc
2 changed files with 80 additions and 35 deletions
  1. +28
    -12
      docs/manual/OptionalTasks/ftp.html
  2. +52
    -23
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java

+ 28
- 12
docs/manual/OptionalTasks/ftp.html View File

@@ -187,18 +187,33 @@ coming from your ftp server (ls -l on the ftp prompt).
</p><p>
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.</p>
</td>
standard formatting for that OS type will be used.
</p><p>
To aid in property-file-based development where a build script is configured
with property files, for any of these attributes, a value of <code>""</code>
is equivalent to not specifying it.
</p><p>
Please understand that these options are incompatible with the autodetection
scheme. If any of these options is specified, (other than with a value of
<code>""</code> ) a system type must be chosen and if systemTypeKey is not
specified, UNIX will be assumed. The philosophy behind this is that these
options are for setting non-standard formats, and a build-script author who
knows what system he is dealing with will know what options to need to be
set. Otherwise, these options should be left alone and the default
autodetection scheme can be used and will work in the majority of cases.
</p></td>
</tr>
<tr>
<td valign="top">systemTypeKey</td>
<td valign="top">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.
Supported values are <code>"UNIX", "VMS", "WINDOWS", "OS/2", "OS/400",
"MVS".</code> If not specified, (or specified as <code>""</code>) and if
no other xxxConfig attributes are specified, the autodectection mechanism
based on the FTP SYST command will be used.
</td>
<td valign="top" align="center">No, but if any of the following xxxConfig
attributes is specified, UNIX will be assumed.
attributes is specified, UNIX will be assumed, even if <code>""</code>
is specified here.
</td>
</tr>
<tr>
@@ -208,7 +223,8 @@ coming from your ftp server (ls -l on the ftp prompt).
<code>Asia/Jakarta</code>) 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.
If not specified, (or specified as <code>""</code>), the timezone of the
client is assumed.
</td>
<td valign="top" align="center">No</td>
</tr>
@@ -219,8 +235,8 @@ coming from your ftp server (ls -l on the ftp prompt).
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.
(or specified as <code>""</code>), the default date format for the system
type indicated by the systemTypeKey attribute will be used.
</td>
<td valign="top" align="center">
No.
@@ -230,9 +246,9 @@ coming from your ftp server (ls -l on the ftp prompt).
<td valign="top">recentDateFormatConfig</td>
<td valign="top">Specify in java.text.SimpleDateFormat notation,
(e.g. <code>MMM dd hh:mm</code>) the date format used by the FTP server
to parse dates less than a year old. If not specified, and if the system
type indicated by the system key uses a recent date format, its standard
format will be used.
to parse dates less than a year old. If not specified (or specified as
<code>""</code>), and if the system type indicated by the system key uses
a recent date format, its standard format will be used.
</td>
<td valign="top" align="center">No</td>
</tr>


+ 52
- 23
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java View File

@@ -1257,67 +1257,96 @@ public class FTP
/**
* Method for setting <code>FTPClientConfig</code> remote system key.
*
* @param systemTypeKey
* @param systemTypeKey the key to be set - BUT if blank
* the default value of null will be kept.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setSystemTypeKey(String systemKey) {
this.systemTypeKey = systemKey;
configurationHasBeenSet();
if (systemKey != null && !systemKey.equals(""))
{
this.systemTypeKey = systemKey;
configurationHasBeenSet();
}
}

/**
* Delegate method for <code>FTPClientConfig.setDefaultDateFormatStr(String)</code>.
* Delegate method for
* <code>FTPClientConfig.setDefaultDateFormatStr(String)</code>.
*
* @param defaultDateFormatConfig
* @param defaultDateFormatConfig configuration to be set, unless it is
* null or empty string, in which case ignored.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setDefaultDateFormatConfig(String defaultDateFormat) {
this.defaultDateFormatConfig = defaultDateFormat;
configurationHasBeenSet();
if (defaultDateFormat != null && !defaultDateFormat.equals(""))
{
this.defaultDateFormatConfig = defaultDateFormat;
configurationHasBeenSet();
}
}

/**
* Delegate method for <code>FTPClientConfig.setRecentDateFormatStr(String)</code>.
* Delegate method for
* <code>FTPClientConfig.setRecentDateFormatStr(String)</code>.
*
* @param recentDateFormatConfig
* @param recentDateFormatConfig configuration to be set, unless it is
* null or empty string, in which case ignored.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setRecentDateFormatConfig(String recentDateFormat) {
this.recentDateFormatConfig = recentDateFormat;
configurationHasBeenSet();
if (recentDateFormat != null && !recentDateFormat.equals(""))
{
this.recentDateFormatConfig = recentDateFormat;
configurationHasBeenSet();
}
}

/**
* Delegate method for <code>FTPClientConfig.setServerLanguageCode(String)</code>.
* Delegate method for
* <code>FTPClientConfig.setServerLanguageCode(String)</code>.
*
* @param serverLanguageCodeConfig
* @param serverLanguageCodeConfig configuration to be set, unless it is
* null or empty string, in which case ignored.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setServerLanguageCodeConfig(String serverLanguageCode) {
this.serverLanguageCodeConfig = serverLanguageCode;
configurationHasBeenSet();
if (serverLanguageCode != null && !serverLanguageCode.equals(""))
{
this.serverLanguageCodeConfig = serverLanguageCode;
configurationHasBeenSet();
}
}

/**
* Delegate method for <code>FTPClientConfig.setServerTimeZoneId(String)</code>.
* Delegate method for
* <code>FTPClientConfig.setServerTimeZoneId(String)</code>.
*
* @param serverTimeZoneConfig
* @param serverTimeZoneConfig configuration to be set, unless it is
* null or empty string, in which case ignored.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setServerTimeZoneConfig(String serverTimeZoneId) {
this.serverTimeZoneConfig = serverTimeZoneId;
configurationHasBeenSet();
if (serverTimeZoneId != null && !serverTimeZoneId.equals(""))
{
this.serverTimeZoneConfig = serverTimeZoneId;
configurationHasBeenSet();
}
}

/**
* Delegate method for <code>FTPClientConfig.setShortMonthNames(String)</code>.
* Delegate method for
* <code>FTPClientConfig.setShortMonthNames(String)</code>.
*
* @param shortMonthNamesConfig
* @param shortMonthNamesConfig configuration to be set, unless it is
* null or empty string, in which case ignored.
* @see org.apache.commons.net.ftp.FTPClientConfig
*/
public void setShortMonthNamesConfig(String shortMonthNames) {
this.shortMonthNamesConfig = shortMonthNames;
configurationHasBeenSet();
if (shortMonthNames != null && !shortMonthNames.equals(""))
{
this.shortMonthNamesConfig = shortMonthNames;
configurationHasBeenSet();
}
}




Loading…
Cancel
Save