[VFS] [PATCH] Allow configuration of FTP remote verification

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[VFS] [PATCH] Allow configuration of FTP remote verification

Raman Gupta
The attached patch allows the remote verify functionality of the FTP
provider to be configured.

Log msg:

[[[
Allow FTP remote verify to be configured by the client.

In core/src/main/java/org/apache/commons/vfs/provider/ftp:

* FtpFileSystemConfigBuilder.java: Added REMOTE_VERIFICATION constant
     config value.
   (setRemoteVerify),
   (getRemoteVerify): New methods.

* FtpClientFactory.java:
   (createConnection): Use new config value.
]]]


Index: core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java (revision 572365)
+++ core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java (working copy)
@@ -108,6 +108,12 @@
                 client.setParserFactory(myFactory);
             }
 
+            Boolean remoteVerify = FtpFileSystemConfigBuilder.getInstance().getRemoteVerify(fileSystemOptions);
+            if (remoteVerify != null)
+            {
+                client.setRemoteVerificationEnabled(remoteVerify.booleanValue());
+            }
+
             try
             {
                 client.connect(hostname, port);
Index: core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java (revision 572365)
+++ core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java (working copy)
@@ -32,6 +32,7 @@
 
     private final static String FACTORY_KEY = FTPFileEntryParserFactory.class.getName() + ".KEY";
     private final static String PASSIVE_MODE = FtpFileSystemConfigBuilder.class.getName() + ".PASSIVE";
+    private final static String REMOTE_VERIFICATION = FtpFileSystemConfigBuilder.class.getName() + ".REMOTE_VERIFICATION";
     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";
 
@@ -119,6 +120,26 @@
     }
 
     /**
+     * verify the remote server
+     *
+     * @param opts
+     * @param passiveMode
+     */
+    public void setRemoteVerify(FileSystemOptions opts, boolean remoteVerify)
+    {
+        setParam(opts, REMOTE_VERIFICATION, remoteVerify ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @param opts
+     * @see #setRemoteVerify
+     */
+    public Boolean getRemoteVerify(FileSystemOptions opts)
+    {
+        return (Boolean) getParam(opts, REMOTE_VERIFICATION);
+    }
+
+    /**
      * use user directory as root (do not change to fs root)
      *
      * @param opts


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]