Java Doc for FTPClientConfig.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » ftp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.ftp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.net.ftp.FTPClientConfig

FTPClientConfig
public class FTPClientConfig (Code)

This class implements an alternate means of configuring the org.apache.commons.net.ftp.FTPClient FTPClient object and also subordinate objects which it uses. Any class implementing the org.apache.commons.net.ftp.Configurable Configurable interface can be configured by this object.

In particular this class was designed primarily to support configuration of FTP servers which express file timestamps in formats and languages other than those for the US locale, which although it is the most common is not universal. Unfortunately, nothing in the FTP spec allows this to be determined in an automated way, so manual configuration such as this is necessary.

This functionality was designed to allow existing clients to work exactly as before without requiring use of this component. This component should only need to be explicitly invoked by the user of this package for problem cases that previous implementations could not solve.

Examples of use of FTPClientConfig

Use cases: You are trying to access a server that
  • lists files with timestamps that use month names in languages other than English
  • lists files with timestamps that use date formats other than the American English "standard" MM dd yyyy
  • is in different timezone and you need accurate timestamps for dependency checking as in Ant

Unpaged (whole list) access on a UNIX server that uses French month names but uses the "standard" MMM d yyyy date formatting

 FTPClient f=FTPClient();
 FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
 conf.setServerLanguageCode("fr");
 f.configure(conf);
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = listFiles(directory);
 

Paged access on a UNIX server that uses Danish month names and "European" date formatting in Denmark's time zone, when you are in some other time zone.

 FTPClient f=FTPClient();
 FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
 conf.setServerLanguageCode("da");
 conf.setDefaultDateFormat("d MMM yyyy");
 conf.setRecentDateFormat("d MMM HH:mm");
 conf.setTimeZoneId("Europe/Copenhagen");
 f.configure(conf);
 f.connect(server);
 f.login(username, password);
 FTPListParseEngine engine =
 f.initiateListParsing("com.whatever.YourOwnParser", directory);
 while (engine.hasNext()) {
 FTPFile[] files = engine.getNext(25);  // "page size" you want
 //do whatever you want with these files, display them, etc.
 //expensive FTPFile objects not created until needed.
 }
 

Unpaged (whole list) access on a VMS server that uses month names in a language not FTPClientConfig.getSupportedLanguageCodes() supported by the system. but uses the "standard" MMM d yyyy date formatting

 FTPClient f=FTPClient();
 FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_VMS);
 conf.setShortMonthNames(
 "jan|feb|mar|apr|ma\u00ED|j\u00FAn|j\u00FAl|\u00e1g\u00FA|sep|okt|n\u00F3v|des");
 f.configure(conf);
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = listFiles(directory);
 

Unpaged (whole list) access on a Windows-NT server in a different time zone. (Note, since the NT Format uses numeric date formatting, language issues are irrelevant here).

 FTPClient f=FTPClient();
 FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_NT);
 conf.setTimeZoneId("America/Denver");
 f.configure(conf);
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = listFiles(directory);
 

Unpaged (whole list) access on a Windows-NT server in a different time zone but which has been configured to use a unix-style listing format.
 FTPClient f=FTPClient();
 FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
 conf.setTimeZoneId("America/Denver");
 f.configure(conf);
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = listFiles(directory);
 


since:
   1.4
See Also:   org.apache.commons.net.ftp.Configurable
See Also:   org.apache.commons.net.ftp.FTPClient
See Also:   org.apache.commons.net.ftp.parser.FTPTimestampParserImpl.configure(FTPClientConfig)
See Also:   org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl


Field Summary
final public static  StringSYST_MVS
     Identifier by which an MVS-based ftp server is known throughout the commons-net ftp system.
final public static  StringSYST_NT
     Identifier by which a WindowsNT-based ftp server is known throughout the commons-net ftp system.
final public static  StringSYST_OS2
     Identifier by which an OS/2-based ftp server is known throughout the commons-net ftp system.
final public static  StringSYST_OS400
     Identifier by which an OS/400-based ftp server is known throughout the commons-net ftp system.
final public static  StringSYST_UNIX
     Identifier by which a unix-based ftp server is known throughout the commons-net ftp system.
final public static  StringSYST_VMS
     Identifier by which a vms-based ftp server is known throughout the commons-net ftp system.

Constructor Summary
public  FTPClientConfig(String systemKey)
     The main constructor for an FTPClientConfig object
Parameters:
  systemKey - key representing system type of the server being connected to.
public  FTPClientConfig()
     Convenience constructor mainly for use in testing. Constructs a UNIX configuration.
public  FTPClientConfig(String systemKey, String defaultDateFormatStr, String recentDateFormatStr, String serverLanguageCode, String shortMonthNames, String serverTimeZoneId)
     Constructor which allows setting of all member fields
Parameters:
  systemKey - key representing system type of the server being connected to.

Method Summary
public static  DateFormatSymbolsgetDateFormatSymbols(String shortmonths)
    
public  StringgetDefaultDateFormatStr()
     getter for the FTPClientConfig.setDefaultDateFormatStr(String) defaultDateFormatStr property.
public  StringgetRecentDateFormatStr()
     getter for the FTPClientConfig.setRecentDateFormatStr(String) recentDateFormatStr property.
public  StringgetServerLanguageCode()
    

getter for the FTPClientConfig.setServerLanguageCode(String) serverLanguageCode property.

public  StringgetServerSystemKey()
     Getter for the serverSystemKey property.
public  StringgetServerTimeZoneId()
     getter for the FTPClientConfig.setServerTimeZoneId(String) serverTimeZoneId property.
public  StringgetShortMonthNames()
    

getter for the FTPClientConfig.setShortMonthNames(String) shortMonthNames property.

public static  CollectiongetSupportedLanguageCodes()
     Returns a Collection of all the language codes currently supported by this class.
public static  DateFormatSymbolslookupDateFormatSymbols(String languageCode)
     Looks up the supplied language code in the internally maintained table of language codes.
public  voidsetDefaultDateFormatStr(String defaultDateFormatStr)
    

setter for the defaultDateFormatStr property.

public  voidsetRecentDateFormatStr(String recentDateFormatStr)
    

setter for the recentDateFormatStr property.

public  voidsetServerLanguageCode(String serverLanguageCode)
    

setter for the serverLanguageCode property.

public  voidsetServerTimeZoneId(String serverTimeZoneId)
    

setter for the serverTimeZoneId property.

public  voidsetShortMonthNames(String shortMonthNames)
    

setter for the shortMonthNames property.


Field Detail
SYST_MVS
final public static String SYST_MVS(Code)
Identifier by which an MVS-based ftp server is known throughout the commons-net ftp system.



SYST_NT
final public static String SYST_NT(Code)
Identifier by which a WindowsNT-based ftp server is known throughout the commons-net ftp system.



SYST_OS2
final public static String SYST_OS2(Code)
Identifier by which an OS/2-based ftp server is known throughout the commons-net ftp system.



SYST_OS400
final public static String SYST_OS400(Code)
Identifier by which an OS/400-based ftp server is known throughout the commons-net ftp system.



SYST_UNIX
final public static String SYST_UNIX(Code)
Identifier by which a unix-based ftp server is known throughout the commons-net ftp system.



SYST_VMS
final public static String SYST_VMS(Code)
Identifier by which a vms-based ftp server is known throughout the commons-net ftp system.




Constructor Detail
FTPClientConfig
public FTPClientConfig(String systemKey)(Code)
The main constructor for an FTPClientConfig object
Parameters:
  systemKey - key representing system type of the server being connected to. See FTPClientConfig.getServerSystemKey() serverSystemKey



FTPClientConfig
public FTPClientConfig()(Code)
Convenience constructor mainly for use in testing. Constructs a UNIX configuration.



FTPClientConfig
public FTPClientConfig(String systemKey, String defaultDateFormatStr, String recentDateFormatStr, String serverLanguageCode, String shortMonthNames, String serverTimeZoneId)(Code)
Constructor which allows setting of all member fields
Parameters:
  systemKey - key representing system type of the server being connected to. See FTPClientConfig.getServerSystemKey() serverSystemKey
Parameters:
  defaultDateFormatStr - See FTPClientConfig.setDefaultDateFormatStr(String) defaultDateFormatStr
Parameters:
  recentDateFormatStr - SeeFTPClientConfig.setRecentDateFormatStr(String) recentDateFormatStr
Parameters:
  serverLanguageCode - SeeFTPClientConfig.setServerLanguageCode(String) serverLanguageCode
Parameters:
  shortMonthNames - SeeFTPClientConfig.setShortMonthNames(String) shortMonthNames
Parameters:
  serverTimeZoneId - SeeFTPClientConfig.setServerTimeZoneId(String) serverTimeZoneId




Method Detail
getDateFormatSymbols
public static DateFormatSymbols getDateFormatSymbols(String shortmonths)(Code)
Returns a DateFormatSymbols object configured with short month names as in the supplied string
Parameters:
  shortmonths - This should be as described in FTPClientConfig.setShortMonthNames(String) shortMonthNames a DateFormatSymbols object configured with short month namesas in the supplied string



getDefaultDateFormatStr
public String getDefaultDateFormatStr()(Code)
getter for the FTPClientConfig.setDefaultDateFormatStr(String) defaultDateFormatStr property. Returns the defaultDateFormatStr property.



getRecentDateFormatStr
public String getRecentDateFormatStr()(Code)
getter for the FTPClientConfig.setRecentDateFormatStr(String) recentDateFormatStr property. Returns the recentDateFormatStr property.



getServerLanguageCode
public String getServerLanguageCode()(Code)

getter for the FTPClientConfig.setServerLanguageCode(String) serverLanguageCode property.

Returns the serverLanguageCode property.



getServerSystemKey
public String getServerSystemKey()(Code)
Getter for the serverSystemKey property. This property specifies the general type of server to which the client connects. Should be either one of the FTPClientConfig.SYST_* codes or else the fully qualified class name of a parser implementing both the FTPFileEntryParser and Configurable interfaces. Returns the serverSystemKey property.



getServerTimeZoneId
public String getServerTimeZoneId()(Code)
getter for the FTPClientConfig.setServerTimeZoneId(String) serverTimeZoneId property. Returns the serverTimeZoneId property.



getShortMonthNames
public String getShortMonthNames()(Code)

getter for the FTPClientConfig.setShortMonthNames(String) shortMonthNames property.

Returns the shortMonthNames.



getSupportedLanguageCodes
public static Collection getSupportedLanguageCodes()(Code)
Returns a Collection of all the language codes currently supported by this class. See FTPClientConfig.setServerLanguageCode(String) serverLanguageCode for a functional descrption of language codes within this system. a Collection of all the language codes currently supportedby this class



lookupDateFormatSymbols
public static DateFormatSymbols lookupDateFormatSymbols(String languageCode)(Code)
Looks up the supplied language code in the internally maintained table of language codes. Returns a DateFormatSymbols object configured with short month names corresponding to the code. If there is no corresponding entry in the table, the object returned will be that for Locale.US
Parameters:
  languageCode - See FTPClientConfig.setServerLanguageCode(String) serverLanguageCode a DateFormatSymbols object configured with short month names corresponding to the supplied code, or with month names for Locale.US if there is no corresponding entry in the internaltable.



setDefaultDateFormatStr
public void setDefaultDateFormatStr(String defaultDateFormatStr)(Code)

setter for the defaultDateFormatStr property. This property specifies the main date format that will be used by a parser configured by this configuration to parse file timestamps. If this is not specified, such a parser will use as a default value, the most commonly used format which will be in as used in en_US locales.

This should be in the format described for java.text.SimpleDateFormat. property.


Parameters:
  defaultDateFormatStr - The defaultDateFormatStr to set.



setRecentDateFormatStr
public void setRecentDateFormatStr(String recentDateFormatStr)(Code)

setter for the recentDateFormatStr property. This property specifies a secondary date format that will be used by a parser configured by this configuration to parse file timestamps, typically those less than a year old. If this is not specified, such a parser will not attempt to parse using an alternate format.

This is used primarily in unix-based systems.

This should be in the format described for java.text.SimpleDateFormat.


Parameters:
  recentDateFormatStr - The recentDateFormatStr to set.



setServerLanguageCode
public void setServerLanguageCode(String serverLanguageCode)(Code)

setter for the serverLanguageCode property. This property allows user to specify a two-letter ISO-639 language code that will be used to configure the set of month names used by the file timestamp parser. If neither this nor the FTPClientConfig.setShortMonthNames(String) shortMonthNames is specified, parsing will assume English month names, which may or may not be significant, depending on whether the date format(s) specified via FTPClientConfig.setDefaultDateFormatStr(String) defaultDateFormatStr and/or FTPClientConfig.setRecentDateFormatStr(String) recentDateFormatStr are using numeric or alphabetic month names.

If the code supplied is not supported here, en_US month names will be used. We are supporting here those language codes which, when a java.util.Locale is constucted using it, and a java.text.SimpleDateFormat is constructed using that Locale, the array returned by the SimpleDateFormat's getShortMonths() method consists solely of three 8-bit ASCII character strings. Additionally, languages which do not meet this requirement are included if a common alternative set of short month names is known to be used. This means that users who can tell us of additional such encodings may get them added to the list of supported languages by contacting the jakarta-commons-net team.

Please note that this attribute will NOT be used to determine a locale-based date format for the language. Experience has shown that many if not most FTP servers outside the United States employ the standard en_US date format orderings of MMM d yyyy and MMM d HH:mm and attempting to deduce this automatically here would cause more problems than it would solve. The date format must be changed via the FTPClientConfig.setDefaultDateFormatStr(String) defaultDateFormatStr and/or FTPClientConfig.setRecentDateFormatStr(String) recentDateFormatStr parameters.


Parameters:
  serverLanguageCode - The value to set to the serverLanguageCode property.



setServerTimeZoneId
public void setServerTimeZoneId(String serverTimeZoneId)(Code)

setter for the serverTimeZoneId property. This property allows a time zone to be specified corresponding to that known to be used by an FTP server in file listings. This might be particularly useful to clients such as Ant that try to use these timestamps for dependency checking.

This should be one of the identifiers used by java.util.TimeZone to refer to time zones, for example, America/Chicago or Asia/Rangoon.


Parameters:
  serverTimeZoneId - The serverTimeZoneId to set.



setShortMonthNames
public void setShortMonthNames(String shortMonthNames)(Code)

setter for the shortMonthNames property. This property allows the user to specify a set of month names used by the server that is different from those that may be specified using the FTPClientConfig.setServerLanguageCode(String) serverLanguageCode property.

This should be a string containing twelve strings each composed of three characters, delimited by pipe (|) characters. Currently, only 8-bit ASCII characters are known to be supported. 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".


Parameters:
  shortMonthNames - The value to set to the shortMonthNames property.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.