This class implements an alternate means of configuring the
FTPClient object and
also subordinate objects which it uses. Any class implementing the
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
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 supported by the system.
but uses the "standard" MMM d yyyy date formatting
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).
This class implements an alternate means of configuring the FTPClient object and also subordinate objects which it uses. Any class implementing the 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 thatMM dd yyyyUnpaged (whole list) access on a UNIX server that uses French month names but uses the "standard"
MMM d yyyydate formattingFTPClient 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 supported by the system. but uses the "standard"
MMM d yyyydate formattingFTPClient f=FTPClient(); FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_VMS); conf.setShortMonthNames( "jan|feb|mar|apr|maí|jún|júl|ágú|sep|okt|nóv|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);