commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r820435 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/ main/java/org/apache/commons/configuration2/fs/ main/java/org/apache/commons/configuration2/reloading/ main/ja...
Date Wed, 30 Sep 2009 20:32:14 GMT
Author: oheger
Date: Wed Sep 30 20:32:13 2009
New Revision: 820435

URL: http://svn.apache.org/viewvc?rev=820435&view=rev
Log:
Moved FileSystem classes into a new package in order to integrate them with the ConfigurationSource classes.

Added:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java   (contents, props changed)
      - copied, changed from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultFileSystem.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java   (contents, props changed)
      - copied, changed from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileOptionsProvider.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java   (contents, props changed)
      - copied, changed from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystem.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java   (contents, props changed)
      - copied, changed from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystemBased.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java   (contents, props changed)
      - copied, changed from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/VFSFileSystem.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java   (with props)
Removed:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultFileSystem.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileOptionsProvider.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystem.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystemBased.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/VFSFileSystem.java
Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/VFSFileMonitorReloadingStrategy.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestVFSConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestWebdavConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileMonitorReloadingStrategy.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder2.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java Wed Sep 30 20:32:13 2009
@@ -34,6 +34,9 @@
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
 import org.apache.commons.configuration2.expr.NodeList;
+import org.apache.commons.configuration2.fs.DefaultFileSystem;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.FileSystemBased;
 import org.apache.commons.configuration2.reloading.InvariantReloadingStrategy;
 import org.apache.commons.configuration2.reloading.ReloadingStrategy;
 import org.apache.commons.configuration2.tree.ConfigurationNode;
@@ -82,7 +85,7 @@
  */
 public abstract class AbstractHierarchicalFileConfiguration
 extends InMemoryConfiguration
-implements FileConfiguration, ConfigurationListener, FileSystemBased 
+implements FileConfiguration, ConfigurationListener, FileSystemBased
 {
     /** Constant for the configuration reload event.*/
     public static final int EVENT_RELOAD = 20;
@@ -91,7 +94,7 @@
     public static final int EVENT_CONFIG_CHANGED = 21;
 
     /** The root of the file scheme */
-    private static final String FILE_SCHEME = "file:";   
+    private static final String FILE_SCHEME = "file:";
 
     /** Stores the file name.*/
     protected String fileName;
@@ -715,8 +718,8 @@
      */
     public void setURL(URL url)
     {
-        setBasePath(ConfigurationUtils.getBasePath(url));
-        setFileName(ConfigurationUtils.getFileName(url));
+        setBasePath(DefaultFileSystem.getBasePath(url));
+        setFileName(DefaultFileSystem.getFileName(url));
         sourceURL = url;
     }
 
@@ -756,6 +759,7 @@
      * @param key the key of the new property
      * @param value the value
      */
+    @Override
     public void addProperty(String key, Object value)
     {
         super.addProperty(key, value);
@@ -770,12 +774,14 @@
      * @param key the key of the affected property
      * @param value the value
      */
+    @Override
     public void setProperty(String key, Object value)
     {
         super.setProperty(key, value);
         possiblySave();
     }
 
+    @Override
     public void clearProperty(String key)
     {
         super.clearProperty(key);
@@ -898,6 +904,7 @@
      * @param propValue the value of the property
      * @param before the before update flag
      */
+    @Override
     protected void fireEvent(int type, String propName, Object propValue, boolean before)
     {
         enterNoReload();
@@ -911,12 +918,14 @@
         }
     }
 
+    @Override
     public boolean isEmpty()
     {
         reload();
         return super.isEmpty();
     }
 
+    @Override
     public Iterator<String> getKeys()
     {
         reload();
@@ -1002,6 +1011,7 @@
      * @return the copy
      * @since 1.3
      */
+    @Override
     public Object clone()
     {
         AbstractHierarchicalFileConfiguration copy = (AbstractHierarchicalFileConfiguration) super.clone();
@@ -1026,7 +1036,7 @@
     {
         fireEvent(EVENT_CONFIG_CHANGED, null, getURL(), true);
     }
-    
+
     /**
      * Reacts on configuration change events triggered by the delegate. These
      * events are passed to the registered configuration listeners.

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java Wed Sep 30 20:32:13 2009
@@ -34,7 +34,8 @@
 import org.apache.commons.configuration2.event.ConfigurationErrorListener;
 import org.apache.commons.configuration2.event.EventSource;
 import org.apache.commons.configuration2.expr.ExpressionEngine;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.configuration2.fs.DefaultFileSystem;
+import org.apache.commons.configuration2.fs.FileSystem;
 
 /**
  * Miscellaneous utility methods for configurations.
@@ -54,9 +55,6 @@
     /** Constant for the resource path separator.*/
     static final String RESOURCE_PATH_SEPARATOR = "/";
 
-    /** Constanct for the file URL protocol */
-    private static final String FILE_SCHEME = "file:";
-
     /** Constant for the name of the clone() method.*/
     private static final String METHOD_CLONE = "clone";
 
@@ -183,7 +181,7 @@
     public static HierarchicalConfiguration convertToHierarchical(Configuration conf)
     {
         // todo to be changed into convertToHierarchical(conf, null) when HierarchicalConfiguration is removed
-        
+
         if (conf == null)
         {
             return null;
@@ -352,61 +350,6 @@
     }
 
     /**
-     * Helper method for constructing a file object from a base path and a
-     * file name. This method is called if the base path passed to
-     * <code>getURL()</code> does not seem to be a valid URL.
-     *
-     * @param basePath the base path
-     * @param fileName the file name
-     * @return the resulting file
-     */
-    static File constructFile(String basePath, String fileName)
-    {
-        File file;
-
-        File absolute = null;
-        if (fileName != null)
-        {
-            absolute = new File(fileName);
-        }
-
-        if (StringUtils.isEmpty(basePath) || (absolute != null && absolute.isAbsolute()))
-        {
-            file = new File(fileName);
-        }
-        else
-        {
-            StringBuilder fName = new StringBuilder();
-            fName.append(basePath);
-
-            // My best friend. Paranoia.
-            if (!basePath.endsWith(File.separator))
-            {
-                fName.append(File.separator);
-            }
-
-            //
-            // We have a relative path, and we have
-            // two possible forms here. If we have the
-            // "./" form then just strip that off first
-            // before continuing.
-            //
-            if (fileName.startsWith("." + File.separator))
-            {
-                fName.append(fileName.substring(2));
-            }
-            else
-            {
-                fName.append(fileName);
-            }
-
-            file = new File(fName.toString());
-        }
-
-        return file;
-    }
-
-    /**
      * Return the location of the specified resource by searching the user home
      * directory, the current classpath and the system classpath.
      *
@@ -486,7 +429,7 @@
         {
             try
             {
-                File file = constructFile(base, name);
+                File file = DefaultFileSystem.constructFile(base, name);
                 if (file != null && file.exists())
                 {
                     url = file.toURI().toURL();
@@ -508,7 +451,7 @@
         {
             try
             {
-                File file = constructFile(System.getProperty("user.home"), name);
+                File file = DefaultFileSystem.constructFile(System.getProperty("user.home"), name);
                 if (file != null && file.exists())
                 {
                     url = file.toURI().toURL();
@@ -569,61 +512,6 @@
     }
 
     /**
-     * Return the path without the file name, for example http://xyz.net/foo/bar.xml
-     * results in http://xyz.net/foo/
-     *
-     * @param url the URL from which to extract the path
-     * @return the path component of the passed in URL
-     */
-    static String getBasePath(URL url)
-    {
-        if (url == null)
-        {
-            return null;
-        }
-
-        String s = url.toString();
-        if (s.startsWith(FILE_SCHEME) && !s.startsWith("file://"))
-        {
-            s = "file://" + s.substring(FILE_SCHEME.length());
-        }
-
-        if (s.endsWith("/") || StringUtils.isEmpty(url.getPath()))
-        {
-            return s;
-        }
-        else
-        {
-            return s.substring(0, s.lastIndexOf("/") + 1);
-        }
-    }
-
-    /**
-     * Extract the file name from the specified URL.
-     *
-     * @param url the URL from which to extract the file name
-     * @return the extracted file name
-     */
-    static String getFileName(URL url)
-    {
-        if (url == null)
-        {
-            return null;
-        }
-
-        String path = url.getPath();
-
-        if (path.endsWith("/") || StringUtils.isEmpty(path))
-        {
-            return null;
-        }
-        else
-        {
-            return path.substring(path.lastIndexOf("/") + 1);
-        }
-    }
-
-    /**
      * Tries to convert the specified base path and file name into a file object.
      * This method is called e.g. by the save() methods of file based
      * configurations. The parameter strings can be relative files, absolute
@@ -680,7 +568,7 @@
             return fileFromURL(url);
         }
 
-        return constructFile(basePath, fileName);
+        return DefaultFileSystem.constructFile(basePath, fileName);
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java Wed Sep 30 20:32:13 2009
@@ -36,6 +36,8 @@
 import org.apache.commons.configuration2.beanutils.DefaultBeanFactory;
 import org.apache.commons.configuration2.beanutils.XMLBeanDeclaration;
 import org.apache.commons.configuration2.expr.NodeList;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.FileSystemBased;
 import org.apache.commons.configuration2.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration2.tree.ConfigurationNode;
 import org.apache.commons.configuration2.tree.DefaultExpressionEngine;

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java (from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultFileSystem.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultFileSystem.java&r1=799887&r2=820435&rev=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultFileSystem.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java Wed Sep 30 20:32:13 2009
@@ -14,18 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2;
+package org.apache.commons.configuration2.fs;
 
-import java.io.InputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.FileOutputStream;
-import java.io.FileNotFoundException;
-import java.net.URL;
-import java.net.URLConnection;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.commons.configuration2.ConfigurationException;
+import org.apache.commons.configuration2.ConfigurationUtils;
+import org.apache.commons.configuration2.VerifiableOutputStream;
+import org.apache.commons.lang.StringUtils;
 
 /**
  * FileSystem that uses java.io.File or HttpClient
@@ -35,6 +40,10 @@
  */
 public class DefaultFileSystem extends FileSystem
 {
+    /** Constant for the file URL protocol */
+    private static final String FILE_SCHEME = "file:";
+
+    @Override
     public InputStream getInputStream(String basePath, String fileName)
         throws ConfigurationException
     {
@@ -58,6 +67,7 @@
         }
     }
 
+    @Override
     public InputStream getInputStream(URL url) throws ConfigurationException
     {
         // throw an exception if the target URL is a directory
@@ -77,6 +87,7 @@
         }
     }
 
+    @Override
     public OutputStream getOutputStream(URL url) throws ConfigurationException
     {
         // file URLs have to be converted to Files since FileURLConnection is
@@ -118,6 +129,7 @@
         }
     }
 
+    @Override
     public OutputStream getOutputStream(File file) throws ConfigurationException
     {
         try
@@ -132,6 +144,7 @@
         }
     }
 
+    @Override
     public String getPath(File file, URL url, String basePath, String fileName)
     {
         String path = null;
@@ -165,13 +178,14 @@
         return path;
     }
 
+    @Override
     public String getBasePath(String path)
     {
         URL url;
         try
         {
             url = getURL(null, path);
-            return ConfigurationUtils.getBasePath(url);
+            return getBasePath(url);
         }
         catch (Exception e)
         {
@@ -179,13 +193,14 @@
         }
     }
 
+    @Override
     public String getFileName(String path)
     {
         URL url;
         try
         {
             url = getURL(null, path);
-            return ConfigurationUtils.getFileName(url);
+            return getFileName(url);
         }
         catch (Exception e)
         {
@@ -194,6 +209,7 @@
     }
 
 
+    @Override
     public URL getURL(String basePath, String file) throws MalformedURLException
     {
         File f = new File(file);
@@ -216,11 +232,12 @@
         }
         catch (MalformedURLException uex)
         {
-            return ConfigurationUtils.constructFile(basePath, file).toURI().toURL();
+            return constructFile(basePath, file).toURI().toURL();
         }
     }
 
 
+    @Override
     public URL locateFromURL(String basePath, String fileName)
     {
         try
@@ -259,6 +276,116 @@
     }
 
     /**
+     * Helper method for constructing a {@code File} object from a base path and
+     * a file name.
+     *
+     * @param basePath the base path
+     * @param fileName the file name
+     * @return the resulting file
+     */
+    public static File constructFile(String basePath, String fileName)
+    {
+        File file;
+
+        File absolute = null;
+        if (fileName != null)
+        {
+            absolute = new File(fileName);
+        }
+
+        if (StringUtils.isEmpty(basePath)
+                || (absolute != null && absolute.isAbsolute()))
+        {
+            file = new File(fileName);
+        }
+        else
+        {
+            StringBuilder fName = new StringBuilder();
+            fName.append(basePath);
+
+            // My best friend. Paranoia.
+            if (!basePath.endsWith(File.separator))
+            {
+                fName.append(File.separator);
+            }
+
+            //
+            // We have a relative path, and we have
+            // two possible forms here. If we have the
+            // "./" form then just strip that off first
+            // before continuing.
+            //
+            if (fileName.startsWith("." + File.separator))
+            {
+                fName.append(fileName.substring(2));
+            }
+            else
+            {
+                fName.append(fileName);
+            }
+
+            file = new File(fName.toString());
+        }
+
+        return file;
+    }
+
+    /**
+     * Extracts the file name from the specified URL.
+     *
+     * @param url the URL from which to extract the file name
+     * @return the extracted file name
+     */
+    public static String getFileName(URL url)
+    {
+        if (url == null)
+        {
+            return null;
+        }
+
+        String path = url.getPath();
+
+        if (path.endsWith("/") || StringUtils.isEmpty(path))
+        {
+            return null;
+        }
+        else
+        {
+            return path.substring(path.lastIndexOf("/") + 1);
+        }
+    }
+
+    /**
+     * Return the path without the file name, for example http://xyz.net/foo/bar.xml
+     * results in http://xyz.net/foo/
+     *
+     * @param url the URL from which to extract the path
+     * @return the path component of the passed in URL
+     */
+    public static String getBasePath(URL url)
+    {
+        if (url == null)
+        {
+            return null;
+        }
+
+        String s = url.toString();
+        if (s.startsWith(FILE_SCHEME) && !s.startsWith("file://"))
+        {
+            s = "file://" + s.substring(FILE_SCHEME.length());
+        }
+
+        if (s.endsWith("/") || StringUtils.isEmpty(url.getPath()))
+        {
+            return s;
+        }
+        else
+        {
+            return s.substring(0, s.lastIndexOf("/") + 1);
+        }
+    }
+
+    /**
      * Create the path to the specified file.
      *
      * @param file the target file
@@ -304,36 +431,43 @@
             this.connection = connection;
         }
 
+        @Override
         public void write(byte[] bytes) throws IOException
         {
             stream.write(bytes);
         }
 
+        @Override
         public void write(byte[] bytes, int i, int i1) throws IOException
         {
             stream.write(bytes, i, i1);
         }
 
+        @Override
         public void flush() throws IOException
         {
             stream.flush();
         }
 
+        @Override
         public void close() throws IOException
         {
             stream.close();
         }
 
+        @Override
         public void write(int i) throws IOException
         {
             stream.write(i);
         }
 
+        @Override
         public String toString()
         {
             return stream.toString();
         }
 
+        @Override
         public void verify() throws IOException
         {
             if (connection.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST)

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/DefaultFileSystem.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java (from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileOptionsProvider.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileOptionsProvider.java&r1=799887&r2=820435&rev=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileOptionsProvider.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java Wed Sep 30 20:32:13 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2;
+package org.apache.commons.configuration2.fs;
 
 import java.util.Map;
 

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileOptionsProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java (from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystem.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystem.java&r1=799887&r2=820435&rev=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystem.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java Wed Sep 30 20:32:13 2009
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.configuration2;
+package org.apache.commons.configuration2.fs;
 
 import java.io.File;
 import java.io.InputStream;
@@ -25,6 +25,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.commons.configuration2.ConfigurationException;
+
 /**
  * Abstract layer to allow various types of file systems.
  *

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystem.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java (from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystemBased.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystemBased.java&r1=799887&r2=820435&rev=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/FileSystemBased.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java Wed Sep 30 20:32:13 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2;
+package org.apache.commons.configuration2.fs;
 
 /**
  * @since 1.7

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/FileSystemBased.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java (from r799887, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/VFSFileSystem.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/VFSFileSystem.java&r1=799887&r2=820435&rev=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/VFSFileSystem.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java Wed Sep 30 20:32:13 2009
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2;
+package org.apache.commons.configuration2.fs;
 
+import org.apache.commons.configuration2.ConfigurationException;
+import org.apache.commons.configuration2.ConfigurationRuntimeException;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileName;
 import org.apache.commons.vfs.VFS;

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/fs/VFSFileSystem.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/VFSFileMonitorReloadingStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/VFSFileMonitorReloadingStrategy.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/VFSFileMonitorReloadingStrategy.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/VFSFileMonitorReloadingStrategy.java Wed Sep 30 20:32:13 2009
@@ -22,8 +22,8 @@
 import org.apache.commons.configuration2.AbstractHierarchicalFileConfiguration;
 import org.apache.commons.configuration2.ConfigurationRuntimeException;
 import org.apache.commons.configuration2.FileConfiguration;
-import org.apache.commons.configuration2.FileSystem;
-import org.apache.commons.configuration2.FileSystemBased;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.FileSystemBased;
 import org.apache.commons.vfs.FileChangeEvent;
 import org.apache.commons.vfs.FileListener;
 import org.apache.commons.vfs.FileObject;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/resolver/CatalogResolver.java Wed Sep 30 20:32:13 2009
@@ -28,7 +28,7 @@
 
 import org.apache.commons.configuration2.ConfigurationException;
 import org.apache.commons.configuration2.ConfigurationUtils;
-import org.apache.commons.configuration2.FileSystem;
+import org.apache.commons.configuration2.fs.FileSystem;
 import org.apache.commons.lang.text.StrSubstitutor;
 import org.apache.xml.resolver.CatalogException;
 import org.apache.xml.resolver.readers.CatalogReader;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationUtils.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationUtils.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationUtils.java Wed Sep 30 20:32:13 2009
@@ -23,13 +23,14 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.configuration2.flat.BaseConfiguration;
-import org.apache.commons.configuration2.expr.def.DefaultExpressionEngine;
+import junit.framework.TestCase;
+import junitx.framework.ListAssert;
+
 import org.apache.commons.configuration2.expr.ExpressionEngine;
+import org.apache.commons.configuration2.expr.def.DefaultExpressionEngine;
+import org.apache.commons.configuration2.flat.BaseConfiguration;
 
 import com.mockobjects.dynamic.Mock;
-import junit.framework.TestCase;
-import junitx.framework.ListAssert;
 
 /**
  * Tests the ConfigurationUtils class
@@ -105,35 +106,6 @@
         ConfigurationUtils.getURL(absFile.getParent(), "config.xml"));
     }
 
-    public void testGetBasePath() throws Exception
-    {
-        URL url = new URL("http://xyz.net/foo/bar.xml");
-        assertEquals("base path of " + url, "http://xyz.net/foo/", ConfigurationUtils.getBasePath(url));
-
-        url = new URL("http://xyz.net/foo/");
-        assertEquals("base path of " + url, "http://xyz.net/foo/", ConfigurationUtils.getBasePath(url));
-
-        url = new URL("http://xyz.net/foo");
-        assertEquals("base path of " + url, "http://xyz.net/", ConfigurationUtils.getBasePath(url));
-
-        url = new URL("http://xyz.net/");
-        assertEquals("base path of " + url, "http://xyz.net/", ConfigurationUtils.getBasePath(url));
-
-        url = new URL("http://xyz.net");
-        assertEquals("base path of " + url, "http://xyz.net", ConfigurationUtils.getBasePath(url));
-    }
-
-    public void testGetFileName() throws Exception
-    {
-        assertEquals("file name for a null URL", null, ConfigurationUtils.getFileName(null));
-
-        URL url = new URL("http://xyz.net/foo/");
-        assertEquals("file for a directory URL " + url, null, ConfigurationUtils.getFileName(url));
-
-        url = new URL("http://xyz.net/foo/bar.xml");
-        assertEquals("file name for a valid URL " + url, "bar.xml", ConfigurationUtils.getFileName(url));
-    }
-
     public void testCopy()
     {
         // create the source configuration
@@ -326,7 +298,7 @@
         assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));
         assertEquals("Wrong value 3", 3, hc.getInt("test(2)"));
     }
-    
+
     /**
      * Tests cloning a configuration that supports this operation.
      */
@@ -374,6 +346,7 @@
     {
         PropertiesConfiguration config = new PropertiesConfiguration()
         {
+            @Override
             protected void addPropertyDirect(String key, Object value)
             {
                 // always simulate an exception

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestVFSConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestVFSConfigurationBuilder.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestVFSConfigurationBuilder.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestVFSConfigurationBuilder.java Wed Sep 30 20:32:13 2009
@@ -31,6 +31,9 @@
 import org.apache.commons.configuration2.beanutils.BeanHelper;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.FileSystemBased;
+import org.apache.commons.configuration2.fs.VFSFileSystem;
 import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
 import org.apache.commons.configuration2.reloading.VFSFileMonitorReloadingStrategy;
 import org.apache.commons.configuration2.tree.DefaultConfigurationNode;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestWebdavConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestWebdavConfigurationBuilder.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestWebdavConfigurationBuilder.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestWebdavConfigurationBuilder.java Wed Sep 30 20:32:13 2009
@@ -36,6 +36,9 @@
 import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
+import org.apache.commons.configuration2.fs.FileOptionsProvider;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.VFSFileSystem;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemManager;
 import org.apache.commons.vfs.VFS;

Added: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java?rev=820435&view=auto
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java (added)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java Wed Sep 30 20:32:13 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.configuration2.fs;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/**
+ * Test class for DefaultFileSystem.
+ *
+ * @author <a
+ *         href="http://commons.apache.org/configuration/team-list.html">Commons
+ *         Configuration team</a>
+ * @version $Id$
+ */
+public class TestDefaultFileSystem extends TestCase
+{
+    public void testGetBasePath() throws Exception
+    {
+        URL url = new URL("http://xyz.net/foo/bar.xml");
+        assertEquals("base path of " + url, "http://xyz.net/foo/",
+                DefaultFileSystem.getBasePath(url));
+
+        url = new URL("http://xyz.net/foo/");
+        assertEquals("base path of " + url, "http://xyz.net/foo/",
+                DefaultFileSystem.getBasePath(url));
+
+        url = new URL("http://xyz.net/foo");
+        assertEquals("base path of " + url, "http://xyz.net/",
+                DefaultFileSystem.getBasePath(url));
+
+        url = new URL("http://xyz.net/");
+        assertEquals("base path of " + url, "http://xyz.net/",
+                DefaultFileSystem.getBasePath(url));
+
+        url = new URL("http://xyz.net");
+        assertEquals("base path of " + url, "http://xyz.net", DefaultFileSystem
+                .getBasePath(url));
+    }
+
+    public void testGetFileName() throws Exception
+    {
+        assertEquals("file name for a null URL", null, DefaultFileSystem
+                .getFileName((URL) null));
+
+        URL url = new URL("http://xyz.net/foo/");
+        assertEquals("file for a directory URL " + url, null, DefaultFileSystem
+                .getFileName(url));
+
+        url = new URL("http://xyz.net/foo/bar.xml");
+        assertEquals("file name for a valid URL " + url, "bar.xml",
+                DefaultFileSystem.getFileName(url));
+    }
+}

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/fs/TestDefaultFileSystem.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileMonitorReloadingStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileMonitorReloadingStrategy.java?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileMonitorReloadingStrategy.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/reloading/TestVFSFileMonitorReloadingStrategy.java Wed Sep 30 20:32:13 2009
@@ -22,11 +22,11 @@
 
 import junit.framework.TestCase;
 import org.apache.commons.configuration2.AbstractHierarchicalFileConfiguration;
-import org.apache.commons.configuration2.FileSystem;
 import org.apache.commons.configuration2.PropertiesConfiguration;
-import org.apache.commons.configuration2.VFSFileSystem;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
+import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.configuration2.fs.VFSFileSystem;
 
 /**
  * Test case for the VFSFileMonitorReloadingStrategy class.

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder.xml?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder.xml Wed Sep 30 20:32:13 2009
@@ -9,7 +9,7 @@
       <expressionEngine
           config-class="org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine"/>
     </result>
-    <fileSystem config-class="org.apache.commons.configuration2.VFSFileSystem"/>
+    <fileSystem config-class="org.apache.commons.configuration2.fs.VFSFileSystem"/>
     <providers>
       <provider config-tag="multifile"
          config-class="org.apache.commons.configuration2.DefaultConfigurationBuilder$FileConfigurationProvider"

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder2.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder2.xml?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder2.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileMonitorConfigurationBuilder2.xml Wed Sep 30 20:32:13 2009
@@ -9,7 +9,7 @@
       <expressionEngine
           config-class="org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine"/>
     </result>
-    <fileSystem config-class="org.apache.commons.configuration2.VFSFileSystem"/>
+    <fileSystem config-class="org.apache.commons.configuration2.fs.VFSFileSystem"/>
     <providers>
       <provider config-tag="multifile"
          config-class="org.apache.commons.configuration2.DefaultConfigurationBuilder$FileConfigurationProvider"

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml?rev=820435&r1=820434&r2=820435&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml Wed Sep 30 20:32:13 2009
@@ -6,7 +6,7 @@
       <nodeCombiner config-class="org.apache.commons.configuration2.tree.OverrideCombiner"/>
       <expressionEngine config-class="org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine"/>
     </result>
-    <fileSystem config-class="org.apache.commons.configuration2.VFSFileSystem"/>
+    <fileSystem config-class="org.apache.commons.configuration2.fs.VFSFileSystem"/>
     <providers>
       <provider config-tag="test"
                 config-class="org.apache.commons.configuration2.DefaultConfigurationBuilder$FileConfigurationProvider"/>



Mime
View raw message