Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 90214 invoked from network); 12 May 2005 04:05:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2005 04:05:08 -0000 Received: (qmail 13126 invoked by uid 500); 12 May 2005 04:08:57 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 12960 invoked by uid 500); 12 May 2005 04:08:56 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 12851 invoked by uid 500); 12 May 2005 04:08:56 -0000 Received: (qmail 12836 invoked by uid 99); 12 May 2005 04:08:56 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 11 May 2005 21:08:54 -0700 Received: (qmail 89690 invoked by uid 1632); 12 May 2005 04:04:59 -0000 Date: 12 May 2005 04:04:59 -0000 Message-ID: <20050512040459.89689.qmail@minotaur.apache.org> From: scohen@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/docs/manual install.html X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N scohen 2005/05/11 21:04:59 Modified: src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java docs/manual install.html Log: Adapt Ant to use the new functionalities of commons-net 1.4.0 to enable greater configurability of the server: Month names other than English, date formats other than the standard ones (such as all-numeric timestamps on unix), and different server time zones can now be supported in Ant. PR:30706, 33443 Submitted by: Neeme Praks Reviewed by: Steve Cohen CVS: ---------------------------------------------------------------------- CVS: PR: CVS: If this change addresses a PR in the problem report tracking CVS: database, then enter the PR number(s) here. CVS: Obtained from: CVS: If this change has been taken from another system, such as NCSA, CVS: then name the system in this line, otherwise delete it. CVS: Submitted by: CVS: If this code has been contributed to Apache by someone else; i.e., CVS: they sent us a patch or a new module, then include their name/email CVS: address here. If this is your work then delete this line. CVS: Reviewed by: CVS: If we are doing pre-commit code reviews and someone else has CVS: reviewed your changes, include their name(s) here. CVS: If you have not had it reviewed then delete this line. Revision Changes Path 1.68 +118 -0 ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Index: FTP.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- FTP.java 14 Mar 2005 19:24:58 -0000 1.67 +++ FTP.java 12 May 2005 04:04:59 -0000 1.68 @@ -17,6 +17,7 @@ package org.apache.tools.ant.taskdefs.optional.net; import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPClientConfig; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; import java.io.BufferedInputStream; @@ -109,6 +110,13 @@ private boolean preserveLastModified = false; private String chmod = null; private String umask = null; + private String systemKeyConfig = null; + private String defaultDateFormatConfig = null; + private String recentDateFormatConfig = null; + private String serverLanguageCodeConfig = null; + private String serverTimeZoneConfig = null; + private String shortMonthNamesConfig = null; + private boolean isConfigurationSet = false; protected static final String[] ACTION_STRS = { "sending", @@ -1243,6 +1251,76 @@ this.ignoreNoncriticalErrors = ignoreNoncriticalErrors; } + private void configurationHasBeenSet() { + this.isConfigurationSet = true; + } + + /** + * Method for setting FTPClientConfig remote system key. + * + * @param systemKeyConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setSystemKeyConfig(String systemKey) { + this.systemKeyConfig = systemKey; + configurationHasBeenSet(); + } + + /** + * Delegate method for FTPClientConfig.setDefaultDateFormatStr(String). + * + * @param defaultDateFormatConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setDefaultDateFormatConfig(String defaultDateFormat) { + this.defaultDateFormatConfig = defaultDateFormat; + configurationHasBeenSet(); + } + + /** + * Delegate method for FTPClientConfig.setRecentDateFormatStr(String). + * + * @param recentDateFormatConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setRecentDateFormatConfig(String recentDateFormat) { + this.recentDateFormatConfig = recentDateFormat; + configurationHasBeenSet(); + } + + /** + * Delegate method for FTPClientConfig.setServerLanguageCode(String). + * + * @param serverLanguageCodeConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setServerLanguageCodeConfig(String serverLanguageCode) { + this.serverLanguageCodeConfig = serverLanguageCode; + configurationHasBeenSet(); + } + + /** + * Delegate method for FTPClientConfig.setServerTimeZoneId(String). + * + * @param serverTimeZoneConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setServerTimeZoneConfig(String serverTimeZoneId) { + this.serverTimeZoneConfig = serverTimeZoneId; + configurationHasBeenSet(); + } + + /** + * Delegate method for FTPClientConfig.setShortMonthNames(String). + * + * @param shortMonthNamesConfig + * @see org.apache.commons.net.ftp.FTPClientConfig + */ + public void setShortMonthNamesConfig(String shortMonthNames) { + this.shortMonthNamesConfig = shortMonthNames; + configurationHasBeenSet(); + } + /** * Checks to see that all required parameters are set. @@ -1945,6 +2023,45 @@ } } + private void configure(FTPClient ftp) { + if (this.isConfigurationSet) { + FTPClientConfig config; + if (this.systemKeyConfig != null) { + config = new FTPClientConfig(this.systemKeyConfig); + log("custom config: system key = " + + this.systemKeyConfig, Project.MSG_VERBOSE); + } else { + config = new FTPClientConfig(); + } + if (this.defaultDateFormatConfig != null) { + config.setDefaultDateFormatStr(this.defaultDateFormatConfig); + log("custom config: default date format = " + + this.defaultDateFormatConfig, Project.MSG_VERBOSE); + } + if (this.recentDateFormatConfig != null) { + config.setRecentDateFormatStr(this.recentDateFormatConfig); + log("custom config: recent date format = " + + this.recentDateFormatConfig, Project.MSG_VERBOSE); + } + if (this.serverLanguageCodeConfig != null) { + config.setServerLanguageCode(this.serverLanguageCodeConfig); + log("custom config: server language code = " + + this.serverLanguageCodeConfig, Project.MSG_VERBOSE); + } + if (this.serverTimeZoneConfig != null) { + config.setServerTimeZoneId(this.serverTimeZoneConfig); + log("custom config: server time zone ID = " + + this.serverTimeZoneConfig, Project.MSG_VERBOSE); + } + if (this.shortMonthNamesConfig != null) { + config.setShortMonthNames(this.shortMonthNamesConfig); + log("custom config: short month names = " + + this.shortMonthNamesConfig, Project.MSG_VERBOSE); + } + ftp.configure(config); + } + } + /** * Runs the task. * @@ -1960,6 +2077,7 @@ log("Opening FTP connection to " + server, Project.MSG_VERBOSE); ftp = new FTPClient(); + configure(ftp); ftp.connect(server, port); if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) { 1.82 +1 -2 ant/docs/manual/install.html Index: install.html =================================================================== RCS file: /home/cvs/ant/docs/manual/install.html,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- install.html 2 May 2005 15:30:17 -0000 1.81 +++ install.html 12 May 2005 04:04:59 -0000 1.82 @@ -425,8 +425,7 @@ commons-net.jar ftp, rexec and telnet tasks
jakarta-oro 2.0.1 or later is required in any case together with commons-net.
- For all users, a minimum version of commons-net of 1.2.2 is recommended. Earlier - versions did not support autodetection of system type or had significant bugs. + For all users, a minimum version of commons-net of 1.4.0 is now required.
http://jakarta.apache.org/commons/net/index.html --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org