commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r410817 - in /jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp: FtpClientFactory.java FtpFileSystemConfigBuilder.java
Date Thu, 01 Jun 2006 09:42:23 GMT
Author: imario
Date: Thu Jun  1 02:42:22 2006
New Revision: 410817

URL: http://svn.apache.org/viewvc?rev=410817&view=rev
Log:
added language setup for commons-net configuration

Modified:
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java?rev=410817&r1=410816&r2=410817&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
Thu Jun  1 02:42:22 2006
@@ -60,7 +60,44 @@
             String key = FtpFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions);
             if (key != null)
             {
-            	client.configure(new FTPClientConfig(key));
+            	FTPClientConfig config = new FTPClientConfig(key);
+            	
+            	String serverLanguageCode = FtpFileSystemConfigBuilder.getInstance().getServerLanguageCode(fileSystemOptions);
+            	if (serverLanguageCode != null)
+            	{
+            		config.setServerLanguageCode(serverLanguageCode);
+            	}
+            	String defaultDateFormat = FtpFileSystemConfigBuilder.getInstance().getDefaultDateFormat(fileSystemOptions);
+            	if (defaultDateFormat != null)
+            	{
+            		config.setDefaultDateFormatStr(defaultDateFormat);
+            	}
+            	String recentDateFormat = FtpFileSystemConfigBuilder.getInstance().getRecentDateFormat(fileSystemOptions);
+            	if (recentDateFormat != null)
+            	{
+            		config.setRecentDateFormatStr(recentDateFormat);
+            	}
+            	String serverTimeZoneId = FtpFileSystemConfigBuilder.getInstance().getServerTimeZoneId(fileSystemOptions);
+            	if (serverTimeZoneId != null)
+            	{
+            		config.setServerTimeZoneId(serverTimeZoneId);
+            	}
+            	String[] shortMonthNames = FtpFileSystemConfigBuilder.getInstance().getShortMonthNames(fileSystemOptions);
+            	if (shortMonthNames != null)
+            	{
+            		StringBuffer shortMonthNamesStr = new StringBuffer(40);
+            		for (int i = 0; i<shortMonthNames.length; i++)
+            		{
+            			if (shortMonthNamesStr.length()>0)
+            			{
+            				shortMonthNamesStr.append("|");
+            			}
+            			shortMonthNamesStr.append(shortMonthNames[i]);            			
+            		}
+            		config.setShortMonthNames(shortMonthNamesStr.toString());
+            	}
+            	
+            	client.configure(config);
             }
             
             FTPFileEntryParserFactory myFactory = FtpFileSystemConfigBuilder.getInstance().getEntryParserFactory(fileSystemOptions);

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java?rev=410817&r1=410816&r2=410817&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
Thu Jun  1 02:42:22 2006
@@ -34,6 +34,12 @@
     private final static String USER_DIR_IS_ROOT = FtpFileSystemConfigBuilder.class.getName()
+ ".USER_DIR_IS_ROOT";
     private final static String DATA_TIMEOUT = FtpFileSystemConfigBuilder.class.getName()
+ ".DATA_TIMEOUT";
 
+    private final static String SERVER_LANGUAGE_CODE = FtpFileSystemConfigBuilder.class.getName()
+ ".SERVER_LANGUAGE_CODE";
+    private final static String DEFAULT_DATE_FORMAT = FtpFileSystemConfigBuilder.class.getName()
+ ".DEFAULT_DATE_FORMAT";
+    private final static String RECENT_DATE_FORMAT = FtpFileSystemConfigBuilder.class.getName()
+ ".RECENT_DATE_FORMAT";
+    private final static String SERVER_TIME_ZONE_ID = FtpFileSystemConfigBuilder.class.getName()
+ ".SERVER_TIME_ZONE_ID";
+    private final static String SHORT_MONTH_NAMES = FtpFileSystemConfigBuilder.class.getName()
+ ".SHORT_MONTH_NAMES";
+
     public static FtpFileSystemConfigBuilder getInstance()
     {
         return builder;
@@ -151,5 +157,96 @@
     public void setDataTimeout(FileSystemOptions opts, Integer dataTimeout)
     {
         setParam(opts, DATA_TIMEOUT, dataTimeout);
+    }
+
+    /**
+     * get the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
+     * for details and examples.
+     */
+    public String getServerLanguageCode(FileSystemOptions opts)
+    {
+        return (String) getParam(opts, SERVER_LANGUAGE_CODE);
+    }
+
+    /**
+     * set the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
+     * for details and examples.
+     */
+    public void setServerLanguageCode(FileSystemOptions opts, String serverLanguageCode)
+    {
+        setParam(opts, SERVER_LANGUAGE_CODE, serverLanguageCode);
+    }
+
+    /**
+     * get the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
+     * for details and examples.
+     */
+    public String getDefaultDateFormat(FileSystemOptions opts)
+    {
+        return (String) getParam(opts, DEFAULT_DATE_FORMAT);
+    }
+
+    /**
+     * set the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
+     * for details and examples.
+     */
+    public void setDefaultDateFormat(FileSystemOptions opts, String defaultDateFormat)
+    {
+        setParam(opts, DEFAULT_DATE_FORMAT, defaultDateFormat);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public String getRecentDateFormat(FileSystemOptions opts)
+    {
+        return (String) getParam(opts, RECENT_DATE_FORMAT);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public void setRecentDateFormat(FileSystemOptions opts, String recentDateFormat)
+    {
+        setParam(opts, RECENT_DATE_FORMAT, recentDateFormat);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public String getServerTimeZoneId(FileSystemOptions opts)
+    {
+        return (String) getParam(opts, SERVER_TIME_ZONE_ID);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public void setServerTimeZoneId(FileSystemOptions opts, String serverTimeZoneId)
+    {
+        setParam(opts, SERVER_TIME_ZONE_ID, serverTimeZoneId);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public String[] getShortMonthNames(FileSystemOptions opts)
+    {
+        return (String[]) getParam(opts, SHORT_MONTH_NAMES);
+    }
+
+    /**
+     * see {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
+     */
+    public void setShortMonthNames(FileSystemOptions opts, String[] shortMonthNames)
+    {
+    	String[] clone = null;
+    	if (shortMonthNames != null)
+    	{
+    		clone = new String[shortMonthNames.length];
+    		System.arraycopy(shortMonthNames, 0, clone, 0, shortMonthNames.length);
+    	}
+    	
+        setParam(opts, SHORT_MONTH_NAMES, clone);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message