You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/03/01 07:45:03 UTC

svn commit: r748966 - in /commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs: ./ cache/ impl/ provider/ftp/ provider/http/ provider/ram/ provider/res/ provider/sftp/ provider/webdav/

Author: rgoers
Date: Sun Mar  1 06:45:02 2009
New Revision: 748966

URL: http://svn.apache.org/viewvc?rev=748966&view=rev
Log:
Fix VFS-240 and VFS-221. File system options that are primitives can now be specified as system properties. FileMonitor now notifies at file creation.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/cache/SoftRefFilesCache.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystem.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ram/RamFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/res/ResourceFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.vfs;
 
-
 /**
  * Abstract class which has the right to fill FileSystemOptions
  *
@@ -25,6 +24,19 @@
  */
 public abstract class FileSystemConfigBuilder
 {
+    private static final String PREFIX = "vfs.";
+
+    private final String prefix;
+
+    protected FileSystemConfigBuilder()
+    {
+        this.prefix = PREFIX;
+    }
+    protected FileSystemConfigBuilder(String component)
+    {
+        this.prefix = PREFIX + component;
+    }
+
     protected void setParam(FileSystemOptions opts, String name, Object value)
     {
         opts.setOption(getConfigClass(), name, value);
@@ -42,12 +54,231 @@
 
     protected boolean hasParam(FileSystemOptions opts, String name)
     {
-        if (opts == null)
+        return opts != null && opts.hasOption(getConfigClass(), name);
+    }
+
+    protected boolean hasObject(FileSystemOptions opts, String name)
+    {
+        return hasParam(opts, name) || System.getProperties().containsKey(PREFIX + name);
+    }
+
+    protected Boolean getBoolean(FileSystemOptions opts, String name)
+    {
+        return getBoolean(opts, name, null);
+    }
+
+    protected boolean getBoolean(FileSystemOptions opts, String name, boolean defaultValue)
+    {
+        return getBoolean(opts, name, new Boolean(defaultValue)).booleanValue();
+    }
+
+    protected Boolean getBoolean(FileSystemOptions opts, String name, Boolean defaultValue)
+    {
+        Boolean value = (Boolean)getParam(opts, name);
+        if (value == null)
         {
-            return false;
+            String str = System.getProperty(PREFIX + name);
+            if (str == null)
+            {
+                return defaultValue;
+            }
+            value = Boolean.valueOf(str);
         }
+        return value;
+    }
+
+    protected Byte getByte(FileSystemOptions opts, String name)
+    {
+        return getByte(opts, name, null);
+    }
 
-        return opts.hasOption(getConfigClass(), name);
+    protected byte getByte(FileSystemOptions opts, String name, byte defaultValue)
+    {
+        return getByte(opts, name, new Byte(defaultValue)).byteValue();
+    }
+
+    protected Byte getByte(FileSystemOptions opts, String name, Byte defaultValue)
+    {
+        Byte value = (Byte)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null)
+            {
+                return defaultValue;
+            }
+            value = Byte.valueOf(str);
+        }
+        return value;
+    }
+
+    protected Character getCharacter(FileSystemOptions opts, String name)
+    {
+        return getCharacter(opts, name, null);
+    }
+
+    protected char getCharacter(FileSystemOptions opts, String name, char defaultValue)
+    {
+        return getCharacter(opts, name, new Character(defaultValue)).charValue();
+    }
+
+    protected Character getCharacter(FileSystemOptions opts, String name, Character defaultValue)
+    {
+        Character value = (Character)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null || str.length() <= 0)
+            {
+                return defaultValue;
+            }
+            value = new Character(str.charAt(0));
+        }
+        return value;
+    }
+
+    protected Double getDouble(FileSystemOptions opts, String name)
+    {
+        return getDouble(opts, name, null);
+    }
+
+    protected double getDouble(FileSystemOptions opts, String name, double defaultValue)
+    {
+        return getDouble(opts, name, new Double(defaultValue)).doubleValue();
+    }
+
+    protected Double getDouble(FileSystemOptions opts, String name, Double defaultValue)
+    {
+        Double value = (Double)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null || str.length() <= 0)
+            {
+                return defaultValue;
+            }
+            value = Double.valueOf(str);
+        }
+        return value;
+    }
+
+    protected Float getFloat(FileSystemOptions opts, String name)
+    {
+        return getFloat(opts, name, null);
+    }
+
+    protected float getFloat(FileSystemOptions opts, String name, float defaultValue)
+    {
+        return getFloat(opts, name, new Float(defaultValue)).floatValue();
+    }
+
+    protected Float getFloat(FileSystemOptions opts, String name, Float defaultValue)
+    {
+        Float value = (Float)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null || str.length() <= 0)
+            {
+                return defaultValue;
+            }
+            value = Float.valueOf(str);
+        }
+        return value;
+    }
+
+    protected Integer getInteger(FileSystemOptions opts, String name)
+    {
+        return getInteger(opts, name, null);
+    }
+
+    protected int getInteger(FileSystemOptions opts, String name, int defaultValue)
+    {
+        return getInteger(opts, name, new Integer(defaultValue)).intValue();
+    }
+
+    protected Integer getInteger(FileSystemOptions opts, String name, Integer defaultValue)
+    {
+        Integer value = (Integer)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null)
+            {
+                return defaultValue;
+            }
+            value = Integer.valueOf(str);
+        }
+        return value;
+    }
+
+    protected Long getLong(FileSystemOptions opts, String name)
+    {
+        return getLong(opts, name, null);
+    }
+
+    protected long getLong(FileSystemOptions opts, String name, long defaultValue)
+    {
+        return getLong(opts, name, new Long(defaultValue)).longValue();
+    }
+
+    protected Long getLong(FileSystemOptions opts, String name, Long defaultValue)
+    {
+        Long value = (Long)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null)
+            {
+                return defaultValue;
+            }
+            value = Long.valueOf(str);
+        }
+        return value;
+    }
+
+    protected Short getShort(FileSystemOptions opts, String name)
+    {
+        return getShort(opts, name, null);
+    }
+
+    protected short getShort(FileSystemOptions opts, String name, short defaultValue)
+    {
+        return getShort(opts, name, new Short(defaultValue)).shortValue();
+    }
+
+    protected Short getShort(FileSystemOptions opts, String name, Short defaultValue)
+    {
+        Short value = (Short)getParam(opts, name);
+        if (value == null)
+        {
+            String str = System.getProperty(this.prefix + name);
+            if (str == null)
+            {
+                return defaultValue;
+            }
+            value = Short.valueOf(str);
+        }
+        return value;
+    }
+
+    protected String getString(FileSystemOptions opts, String name)
+    {
+        return getString(opts, name, null);
+    }
+
+    protected String getString(FileSystemOptions opts, String name, String defaultValue)
+    {
+        String value = (String)getParam(opts, name);
+        if (value == null)
+        {
+            value = System.getProperty(this.prefix + name);
+            if (value == null)
+            {
+                return defaultValue;
+            }
+        }
+        return value;
     }
 
     protected abstract Class getConfigClass();

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/cache/SoftRefFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/cache/SoftRefFilesCache.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/cache/SoftRefFilesCache.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/cache/SoftRefFilesCache.java Sun Mar  1 06:45:02 2009
@@ -92,7 +92,9 @@
 					{
 						if (removeFile(key))
 						{
-							filesystemClose(key.getFileSystem());
+                            /* This is not thread safe
+                            filesystemClose(key.getFileSystem());
+                            */
 						}
 					}
 				}
@@ -155,10 +157,14 @@
 
 		synchronized (files)
 		{
-			files.put(file.getName(), ref);
+			Reference old = (Reference)files.put(file.getName(), ref);
 			synchronized(refReverseMap)
 			{
-				refReverseMap.put(ref, key);
+                if (old != null)
+                {
+                    refReverseMap.remove(old);
+                }
+                refReverseMap.put(ref, key);
 			}
 		}
 	}

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java Sun Mar  1 06:45:02 2009
@@ -649,6 +649,18 @@
                     }
 
                 }
+                else if (!this.exists && this.file.exists())
+                {
+                    this.exists = this.file.exists();
+                    this.timestamp = this.file.getContent().getLastModifiedTime();
+                    // Don't fire if it's a folder because new file children
+                    // and deleted files in a folder have their own event triggered.
+                    if (!this.file.getType().hasChildren())
+                    {
+                        ((AbstractFileSystem)
+                                this.file.getFileSystem()).fireFileCreated(this.file);
+                    }
+                }
 
                 this.checkForNewChildren();
 

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -48,6 +48,7 @@
 
     private FtpFileSystemConfigBuilder()
     {
+        super("ftp.");
     }
 
     /**
@@ -90,7 +91,7 @@
      */
     public String getEntryParser(FileSystemOptions opts)
     {
-        return (String) getParam(opts, FACTORY_KEY);
+        return getString(opts, FACTORY_KEY);
     }
 
     protected Class getConfigClass()
@@ -115,7 +116,7 @@
      */
     public Boolean getPassiveMode(FileSystemOptions opts)
     {
-        return (Boolean) getParam(opts, PASSIVE_MODE);
+        return getBoolean(opts, PASSIVE_MODE);
     }
 
     /**
@@ -135,7 +136,7 @@
      */
     public Boolean getUserDirIsRoot(FileSystemOptions opts)
     {
-        return (Boolean) getParam(opts, USER_DIR_IS_ROOT);
+        return getBoolean(opts, USER_DIR_IS_ROOT);
     }
 
     /**
@@ -144,7 +145,7 @@
      */
     public Integer getDataTimeout(FileSystemOptions opts)
     {
-        return (Integer) getParam(opts, DATA_TIMEOUT);
+        return getInteger(opts, DATA_TIMEOUT);
     }
 
     /**
@@ -166,7 +167,7 @@
      */
     public String getServerLanguageCode(FileSystemOptions opts)
     {
-        return (String) getParam(opts, SERVER_LANGUAGE_CODE);
+        return getString(opts, SERVER_LANGUAGE_CODE);
     }
 
     /**
@@ -184,7 +185,7 @@
      */
     public String getDefaultDateFormat(FileSystemOptions opts)
     {
-        return (String) getParam(opts, DEFAULT_DATE_FORMAT);
+        return getString(opts, DEFAULT_DATE_FORMAT);
     }
 
     /**
@@ -201,7 +202,7 @@
      */
     public String getRecentDateFormat(FileSystemOptions opts)
     {
-        return (String) getParam(opts, RECENT_DATE_FORMAT);
+        return getString(opts, RECENT_DATE_FORMAT);
     }
 
     /**
@@ -217,7 +218,7 @@
      */
     public String getServerTimeZoneId(FileSystemOptions opts)
     {
-        return (String) getParam(opts, SERVER_TIME_ZONE_ID);
+        return getString(opts, SERVER_TIME_ZONE_ID);
     }
 
     /**

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java Sun Mar  1 06:45:02 2009
@@ -20,6 +20,9 @@
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 import org.apache.commons.httpclient.methods.HeadMethod;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileSystemOptions;
@@ -39,20 +42,37 @@
     {
     }
 
+    public static HttpClient createConnection(String scheme, String hostname, int port, String username,
+                                              String password, FileSystemOptions fileSystemOptions)
+            throws FileSystemException
+    {
+        return createConnection(HttpFileSystemConfigBuilder.getInstance(), scheme, hostname, port,
+            username, password, fileSystemOptions);
+    }
+
     /**
      * Creates a new connection to the server.
      */
-    public static HttpClient createConnection(String scheme, String hostname, int port, String username, String password, FileSystemOptions fileSystemOptions) throws FileSystemException
+    public static HttpClient createConnection(HttpFileSystemConfigBuilder builder, String scheme,
+                                              String hostname, int port, String username,
+                                              String password, FileSystemOptions fileSystemOptions)
+            throws FileSystemException
     {
         HttpClient client;
         try
         {
-            // client = new HttpClient(new MultiThreadedHttpConnectionManager());
-			client = new HttpClient(new ThreadLocalHttpConnectionManager());
+            HttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
+            HttpConnectionManagerParams connectionMgrParams = mgr.getParams();
+
+            client = new HttpClient(mgr);
+			//client = new HttpClient(new ThreadLocalHttpConnectionManager());
 
 			final HostConfiguration config = new HostConfiguration();
             config.setHost(hostname, port, scheme);
 
+            connectionMgrParams.setMaxConnectionsPerHost(config, builder.getMaxConnectionsPerHost(fileSystemOptions));
+            connectionMgrParams.setMaxTotalConnections(builder.getMaxTotalConnections(fileSystemOptions));
+
             if (fileSystemOptions != null)
             {
                 String proxyHost = HttpFileSystemConfigBuilder.getInstance().getProxyHost(fileSystemOptions);

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystem.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystem.java Sun Mar  1 06:45:02 2009
@@ -18,6 +18,7 @@
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.vfs.FileName;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystem;
@@ -67,7 +68,11 @@
 			{
 				((ThreadLocalHttpConnectionManager) mgr).releaseLocalConnection();
 			}
-		}
+            if (mgr instanceof MultiThreadedHttpConnectionManager)
+            {
+                ((MultiThreadedHttpConnectionManager) mgr).shutdown();
+            }
+        }
 	}
 
 	/**

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -20,6 +20,7 @@
 import org.apache.commons.vfs.FileSystemOptions;
 import org.apache.commons.vfs.UserAuthenticator;
 import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 
 /**
  * Configuration options for HTTP
@@ -36,8 +37,18 @@
         return builder;
     }
 
+    private static final int DEFAULT_MAX_HOST_CONNECTIONS = 5;
+
+    private static final int DEFAULT_MAX_CONNECTIONS = 50;
+
+    protected HttpFileSystemConfigBuilder(String prefix)
+    {
+        super(prefix);
+    }
+
     private HttpFileSystemConfigBuilder()
     {
+        super("http.");
     }
 
     /**
@@ -57,7 +68,7 @@
      */
     public String getUrlCharset(FileSystemOptions opts)
     {
-        return (String) getParam(opts, "urlCharset");
+        return getString(opts, "urlCharset");
     }
 
     /**
@@ -93,7 +104,7 @@
      */
     public String getProxyHost(FileSystemOptions opts)
     {
-        return (String) getParam(opts, "proxyHost");
+        return getString(opts, "proxyHost");
     }
 
     /**
@@ -105,12 +116,7 @@
      */
     public int getProxyPort(FileSystemOptions opts)
     {
-        if (!hasParam(opts, "proxyPort"))
-        {
-            return 0;
-        }
-
-        return ((Number) getParam(opts, "proxyPort")).intValue();
+        return getInteger(opts, "proxyPort", 0);
     }
 
     /**
@@ -144,6 +150,42 @@
     {
         return (Cookie[]) getParam(opts, "cookies");
     }
+
+    /**
+     * The maximum number of connections allowed
+     */
+    public void setMaxTotalConnections(FileSystemOptions opts, int maxTotalConnections)
+    {
+        setParam(opts, HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, new Integer(maxTotalConnections));
+    }
+
+    /**
+     * Retrieve the maximum number of connections allowed.
+     * @param opts The FileSystemOptions.
+     * @return The maximum number of connections allowed.
+     */
+    public int getMaxTotalConnections(FileSystemOptions opts)
+    {
+        return getInteger(opts, HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, DEFAULT_MAX_CONNECTIONS);
+    }
+
+    /**
+     * The maximum number of connections allowed to any host
+     */
+    public void setMaxConnectionsPerHost(FileSystemOptions opts, int maxHostConnections)
+    {
+        setParam(opts, HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, new Integer(maxHostConnections));
+    }
+
+    /**
+     * Retrieve the maximum number of connections allowed per host.
+     * @param opts The FileSystemOptions.
+     * @return The maximum number of connections allowed per host.
+     */
+    public int getMaxConnectionsPerHost(FileSystemOptions opts)
+    {
+        return getInteger(opts, HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, DEFAULT_MAX_HOST_CONNECTIONS);
+    }
     
     protected Class getConfigClass()
     {

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ram/RamFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ram/RamFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ram/RamFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ram/RamFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -36,7 +36,7 @@
 	 */
 	private RamFileSystemConfigBuilder()
 	{
-		super();
+		super("ram.");
 	}
 
 	/**
@@ -62,15 +62,7 @@
 	 */
 	public int getMaxSize(FileSystemOptions opts)
 	{
-		Integer size = (Integer) getParam(opts, MAX_SIZE_KEY);
-		if (size != null)
-		{
-			return size.intValue();
-		}
-		else
-		{
-			return Integer.MAX_VALUE;
-		}
+		return getInteger(opts, MAX_SIZE_KEY, Integer.MAX_VALUE);
 	}
 
 	/**

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/res/ResourceFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/res/ResourceFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/res/ResourceFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/res/ResourceFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -37,6 +37,7 @@
 
     private ResourceFileSystemConfigBuilder()
     {
+        super("resource.");
     }
 
     public void setClassLoader(FileSystemOptions opts, ClassLoader classLoader)

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -84,6 +84,7 @@
 
     private SftpFileSystemConfigBuilder()
     {
+        super("sftp.");
     }
 
     /**
@@ -160,7 +161,7 @@
      */
     public String getCompression(FileSystemOptions opts)
     {
-        return (String) getParam(opts, "compression");
+        return getString(opts, "compression");
     }
 
     /**
@@ -198,7 +199,7 @@
      */
     public String getStrictHostKeyChecking(FileSystemOptions opts)
     {
-        return (String) getParam(opts, "StrictHostKeyChecking");
+        return getString(opts, "StrictHostKeyChecking");
     }
 
     /**
@@ -218,7 +219,7 @@
      */
     public Boolean getUserDirIsRoot(FileSystemOptions opts)
     {
-        return (Boolean) getParam(opts, USER_DIR_IS_ROOT);
+        return getBoolean(opts, USER_DIR_IS_ROOT);
     }
 
     /**
@@ -238,7 +239,7 @@
      */
     public Integer getTimeout(FileSystemOptions opts)
     {
-        return (Integer) getParam(opts, TIMEOUT);
+        return getInteger(opts, TIMEOUT);
     }
     
     protected Class getConfigClass()
@@ -279,7 +280,7 @@
      */
     public String getProxyHost(FileSystemOptions opts)
     {
-        return (String) getParam(opts, "proxyHost");
+        return getString(opts, "proxyHost");
     }
 
     /**
@@ -291,12 +292,7 @@
      */
     public int getProxyPort(FileSystemOptions opts)
     {
-        if (!hasParam(opts, "proxyPort"))
-        {
-            return 0;
-        }
-
-        return ((Number) getParam(opts, "proxyPort")).intValue();
+        return getInteger(opts, "proxyPort", 0);
     }
 
     /**

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java Sun Mar  1 06:45:02 2009
@@ -85,6 +85,7 @@
 			authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES);
 
 			httpClient = HttpClientFactory.createConnection(
+                WebdavFileSystemConfigBuilder.getInstance(),
                 "http",
                 rootName.getHostName(),
 				rootName.getPort(),

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java?rev=748966&r1=748965&r2=748966&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java Sun Mar  1 06:45:02 2009
@@ -19,6 +19,9 @@
 import org.apache.commons.vfs.FileSystemConfigBuilder;
 import org.apache.commons.vfs.FileSystemOptions;
 import org.apache.commons.vfs.UserAuthenticator;
+import org.apache.commons.vfs.provider.http.HttpFileSystemConfigBuilder;
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 
 /**
  * Configuration options for WebDav
@@ -26,106 +29,18 @@
  * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
  * @version $Revision$ $Date$
  */
-public class WebdavFileSystemConfigBuilder extends FileSystemConfigBuilder
+public class WebdavFileSystemConfigBuilder extends HttpFileSystemConfigBuilder
 {
     private final static WebdavFileSystemConfigBuilder builder = new WebdavFileSystemConfigBuilder();
 
-    public static WebdavFileSystemConfigBuilder getInstance()
+    public static HttpFileSystemConfigBuilder getInstance()
     {
         return builder;
     }
 
     private WebdavFileSystemConfigBuilder()
     {
-    }
-
-    /**
-     * Set the charset used for url encoding<br>
-     *
-     * @param chaset the chaset
-     */
-    public void setUrlCharset(FileSystemOptions opts, String chaset)
-    {
-        setParam(opts, "urlCharset", chaset);
-    }
-
-    /**
-     * Set the charset used for url encoding<br>
-     *
-     * @return the chaset
-     */
-    public String getUrlCharset(FileSystemOptions opts)
-    {
-        return (String) getParam(opts, "urlCharset");
-    }
-
-    /**
-     * Set the proxy to use for webdav connection.<br>
-     * You have to set the ProxyPort too if you would like to have the proxy relly used.
-     *
-     * @param proxyHost the host
-     * @see #setProxyPort
-     */
-    public void setProxyHost(FileSystemOptions opts, String proxyHost)
-    {
-        setParam(opts, "proxyHost", proxyHost);
-    }
-
-    /**
-     * Set the proxy-port to use for webdav connection
-     * You have to set the ProxyHost too if you would like to have the proxy relly used.
-     *
-     * @param proxyPort the port
-     * @see #setProxyHost
-     */
-    public void setProxyPort(FileSystemOptions opts, int proxyPort)
-    {
-        setParam(opts, "proxyPort", new Integer(proxyPort));
-    }
-
-    /**
-     * Get the proxy to use for webdav connection
-     * You have to set the ProxyPort too if you would like to have the proxy relly used.
-     *
-     * @return proxyHost
-     * @see #setProxyPort
-     */
-    public String getProxyHost(FileSystemOptions opts)
-    {
-        return (String) getParam(opts, "proxyHost");
-    }
-
-    /**
-     * Get the proxy-port to use for webdav the connection
-     * You have to set the ProxyHost too if you would like to have the proxy relly used.
-     *
-     * @return proxyPort: the port number or 0 if it is not set
-     * @see #setProxyHost
-     */
-    public int getProxyPort(FileSystemOptions opts)
-    {
-        if (!hasParam(opts, "proxyPort"))
-        {
-            return 0;
-        }
-
-        return ((Number) getParam(opts, "proxyPort")).intValue();
-    }
-
-    /**
-     * Set the proxy authenticator where the system should get the credentials from
-     */
-    public void setProxyAuthenticator(FileSystemOptions opts, UserAuthenticator authenticator)
-    {
-        setParam(opts, "proxyAuthenticator", authenticator);
-    }
-
-    /**
-     * Get the proxy authenticator where the system should get the credentials from
-     */
-    public UserAuthenticator getProxyAuthenticator(FileSystemOptions opts)
-    {
-        return (UserAuthenticator) getParam(opts, "proxyAuthenticator");
+        super("webdav.");
     }
     
     protected Class getConfigClass()