You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2005/09/15 07:40:38 UTC

svn commit: r289155 - in /jakarta/commons/proper/vfs/trunk: project.xml src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java

Author: imario
Date: Wed Sep 14 22:40:30 2005
New Revision: 289155

URL: http://svn.apache.org/viewcvs?rev=289155&view=rev
Log:
enh: add datatimeout configuration for ftp

Modified:
    jakarta/commons/proper/vfs/trunk/project.xml
    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/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/project.xml?rev=289155&r1=289154&r2=289155&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/project.xml (original)
+++ jakarta/commons/proper/vfs/trunk/project.xml Wed Sep 14 22:40:30 2005
@@ -112,7 +112,7 @@
         <dependency>
             <groupId>commons-compress</groupId>
             <artifactId>commons-compress</artifactId>
-            <version>20050911</version>
+            <version>SNAPSHOT</version>
         </dependency>
 
         <dependency>

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java?rev=289155&r1=289154&r2=289155&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 Wed Sep 14 22:40:30 2005
@@ -84,6 +84,13 @@
                     throw new FileSystemException("vfs.provider.ftp/set-binary.error", hostname);
                 }
 
+                // Set dataTimeout value
+                Integer dataTimeout = FtpFileSystemConfigBuilder.getInstance().getDataTimeout(fileSystemOptions);
+                if (dataTimeout != null)
+                {
+                    client.setDataTimeout(dataTimeout.intValue());
+                }
+
                 // Change to root by default
                 // All file operations a relative to the filesystem-root
                 // String root = getRoot().getName().getPath();

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java?rev=289155&r1=289154&r2=289155&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 Wed Sep 14 22:40:30 2005
@@ -32,6 +32,7 @@
     private final static String FACTORY_KEY = FTPFileEntryParserFactory.class.getName() + ".KEY";
     private final static String PASSIVE_MODE = FTPFileEntryParserFactory.class.getName() + ".PASSIVE";
     private final static String USER_DIR_IS_ROOT = FTPFileEntryParserFactory.class.getName() + ".USER_DIR_IS_ROOT";
+    private final static String DATA_TIMEOUT = FTPFileEntryParserFactory.class.getName() + ".DATA_TIMEOUT";
 
     public static FtpFileSystemConfigBuilder getInstance()
     {
@@ -132,5 +133,28 @@
     public Boolean getUserDirIsRoot(FileSystemOptions opts)
     {
         return (Boolean) getParam(opts, USER_DIR_IS_ROOT);
+    }
+
+    /**
+     * @param opts
+     * @return
+     * @see #setDataTimeout
+     */
+    public Integer getDataTimeout(FileSystemOptions opts)
+    {
+        return (Integer) getParam(opts, DATA_TIMEOUT);
+    }
+
+    /**
+     * set the data timeout for the ftp client.<br />
+     * If you set the dataTimeout to <code>null</code> no dataTimeout will be set on the
+     * ftp client.
+     *
+     * @param opts
+     * @param dataTimeout
+     */
+    public void setDataTimeout(FileSystemOptions opts, Integer dataTimeout)
+    {
+        setParam(opts, DATA_TIMEOUT, dataTimeout);
     }
 }



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