commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r829384 [1/2] - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/ main/java/org/apache/commons/configuration2/combined/ main/java/org/apache/commons/configuration2/flat/ ...
Date Sat, 24 Oct 2009 15:10:00 GMT
Author: oheger
Date: Sat Oct 24 15:09:58 2009
New Revision: 829384

URL: http://svn.apache.org/viewvc?rev=829384&view=rev
Log:
Refactored DefaultConfigurationBuilder to use the CombinedConfiguration class from the o.a.c.c.combined package in order to remove duplicated classes. This required a bunch of major and minor changes. Especially, all configuration classes supported by DefaultConfigurationBuilder need to be hierarchical. Therefore the AbstractFlatConfiguration base class now extends AbstractHierarchicalConfiguration.

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.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/DynamicCombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfigurationNodeHandler.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/DynamicCombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/AbstractFlatConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatLeafNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatRootNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/TreeUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationFactory.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/TestDefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestMultiFileHierarchicalConfiguration.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/beanutils/TestConfigurationDynaBean.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/flat/FlatConfigurationMockImpl.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/flat/TestAbstractFlatConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/flat/TestFlatNodeHandler.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/flat/TestFlatNodes.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testComplexInitialization.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testConfigurationProvider.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfigurationSysProps.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testExpression.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testExtendedClass.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileReloadConfigurationBuilder.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testFileSystem.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testGlobalLookup.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testMultiTenentConfigurationBuilder.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testMultiTenentConfigurationBuilder2.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testMultiTenentConfigurationBuilder3.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testSystemProperties.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testVFSMultiTenentConfigurationBuilder1.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testValidation.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testValidation2.xml
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testValidation3.xml

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java Sat Oct 24 15:09:58 2009
@@ -38,7 +38,6 @@
 import org.apache.commons.lang.text.StrLookup;
 import org.apache.commons.lang.text.StrSubstitutor;
 import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.impl.NoOpLog;
 
 /**
@@ -503,6 +502,21 @@
 
     public void setProperty(String key, Object value)
     {
+        doSetProperty(key, value);
+    }
+
+    /**
+     * A default implementation of the {@code setProperty()} method. This
+     * implementation implements the setProperty() operation by first clearing
+     * the property and then adding the new value. This is fully functional.
+     * However, derived classes may implement {@code setProperty()} in a more
+     * efficient way.
+     *
+     * @param key the key of the property
+     * @param value the new value
+     */
+    protected final void doSetProperty(String key, Object value)
+    {
         fireEvent(EVENT_SET_PROPERTY, key, value, true);
         setDetailEvents(false);
         try
@@ -589,6 +603,21 @@
 
     public Iterator<String> getKeys(final String prefix)
     {
+        return doGetKeys(prefix);
+    }
+
+    /**
+     * A default implementation of the {@code getKeys(String prefix)} method.
+     * This implementation returns a special prefix iterator for obtaining all
+     * keys starting with the specified prefix. This is fully functional.
+     * However, derived classes may implement {@code getKeys(String)} in a more
+     * efficient way.
+     *
+     * @param prefix the prefix for the keys
+     * @return an iterator with all the keys starting with this prefix
+     */
+    protected final Iterator<String> doGetKeys(String prefix)
+    {
         return new PrefixedKeysIterator(getKeys(), prefix);
     }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.java Sat Oct 24 15:09:58 2009
@@ -93,6 +93,17 @@
     }
 
     /**
+     * Allows setting the {@code NodeHandler}. This method is intended to be
+     * used by sub classes with specific requirements for node handlers.
+     *
+     * @param handler the new {@code NodeHandler}
+     */
+    protected void setNodeHandler(NodeHandler<T> handler)
+    {
+        nodeHandler = handler;
+    }
+
+    /**
      * Returns the root node of this hierarchical configuration.
      *
      * @return the root node
@@ -537,9 +548,9 @@
      * @param key the key of the property to be removed
      */
     @Override
-    public void clearProperty(String key)
+    protected void clearPropertyDirect(String key)
     {
-        removeNodeList(key, EVENT_CLEAR_PROPERTY, true);
+        removeNodeList(key, -1, true);
     }
 
     /**
@@ -581,7 +592,11 @@
      */
     private void removeNodeList(String key, int event, boolean clear)
     {
-        fireEvent(event, key, null, true);
+        if (event >= 0)
+        {
+            fireEvent(event, key, null, true);
+        }
+
         NodeList<T> nodes = fetchNodeList(key);
 
         for (int index = 0; index < nodes.size(); index++)
@@ -589,7 +604,10 @@
             removeListElement(nodes, index, clear);
         }
 
-        fireEvent(event, key, null, false);
+        if (event >= 0)
+        {
+            fireEvent(event, key, null, false);
+        }
     }
 
     /**

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=829384&r1=829383&r2=829384&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 Sat Oct 24 15:09:58 2009
@@ -27,15 +27,16 @@
 import java.net.URL;
 import java.net.URLDecoder;
 import java.util.Iterator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import org.apache.commons.configuration2.event.ConfigurationErrorEvent;
 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.configuration2.flat.AbstractFlatConfiguration;
 import org.apache.commons.configuration2.fs.DefaultFileSystem;
 import org.apache.commons.configuration2.fs.FileSystem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Miscellaneous utility methods for configurations.
@@ -226,16 +227,16 @@
      *         and only if the passed in configuration is <b>null</b>)
      * @since 1.6
      */
-    public static AbstractHierarchicalConfiguration convertToHierarchical(Configuration conf, ExpressionEngine engine)
+    public static AbstractHierarchicalConfiguration<?> convertToHierarchical(Configuration conf, ExpressionEngine engine)
     {
         if (conf == null)
         {
             return null;
         }
 
-        if (conf instanceof AbstractHierarchicalConfiguration)
+        if (conf instanceof AbstractHierarchicalConfiguration<?> && !(conf instanceof AbstractFlatConfiguration))
         {
-            AbstractHierarchicalConfiguration hc = (AbstractHierarchicalConfiguration) conf;
+            AbstractHierarchicalConfiguration<?> hc = (AbstractHierarchicalConfiguration<?>) conf;
             if (engine != null)
             {
                 hc.setExpressionEngine(engine);
@@ -245,7 +246,7 @@
         }
         else
         {
-            AbstractHierarchicalConfiguration hc = new InMemoryConfiguration();
+            AbstractHierarchicalConfiguration<?> hc = new InMemoryConfiguration();
             if (engine != null)
             {
                 hc.setExpressionEngine(engine);

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=829384&r1=829383&r2=829384&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 Sat Oct 24 15:09:58 2009
@@ -25,8 +25,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
 
 import javax.naming.InitialContext;
 import javax.sql.DataSource;
@@ -36,18 +34,21 @@
 import org.apache.commons.configuration2.beanutils.BeanHelper;
 import org.apache.commons.configuration2.beanutils.DefaultBeanFactory;
 import org.apache.commons.configuration2.beanutils.XMLBeanDeclaration;
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
+import org.apache.commons.configuration2.combined.OverrideCombiner;
+import org.apache.commons.configuration2.combined.UnionCombiner;
 import org.apache.commons.configuration2.expr.NodeList;
+import org.apache.commons.configuration2.expr.def.DefaultExpressionEngine;
 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;
-import org.apache.commons.configuration2.tree.OverrideCombiner;
-import org.apache.commons.configuration2.tree.UnionCombiner;
 import org.apache.commons.configuration2.resolver.CatalogResolver;
 import org.apache.commons.configuration2.resolver.EntityRegistry;
 import org.apache.commons.configuration2.resolver.EntityResolverSupport;
+import org.apache.commons.configuration2.tree.ConfigurationNode;
 import org.apache.commons.lang.text.StrLookup;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.xml.sax.EntityResolver;
 
 /**
@@ -669,7 +670,7 @@
                 getLogger().debug("Creating configuration " + decl.getBeanClassName() + " with name " +
                     decl.getConfiguration().getString(ATTR_NAME));
             }
-            AbstractConfiguration newConf = createConfigurationAt(decl);
+            AbstractHierarchicalConfiguration<?> newConf = createConfigurationAt(decl);
             if (newConf != null)
             {
                 config.addConfiguration(newConf, decl.getConfiguration().getString(ATTR_NAME), decl.getAt());
@@ -797,12 +798,12 @@
      * @return the new configuration object
      * @throws ConfigurationException if an error occurs
      */
-    private AbstractConfiguration createConfigurationAt(
+    private AbstractHierarchicalConfiguration<?> createConfigurationAt(
             ConfigurationDeclaration decl) throws ConfigurationException
     {
         try
         {
-            return (AbstractConfiguration) BeanHelper.createBean(decl);
+            return (AbstractHierarchicalConfiguration<?>) BeanHelper.createBean(decl);
         }
         catch (Exception ex)
         {
@@ -1013,11 +1014,11 @@
          * @return the new configuration object
          * @throws Exception if an error occurs
          */
-        public AbstractConfiguration getConfiguration(
+        public AbstractHierarchicalConfiguration<?> getConfiguration(
                 ConfigurationDeclaration decl) throws Exception
         {
-            return (AbstractConfiguration) createBean(fetchConfigurationClass(),
-                    decl, null);
+            return (AbstractHierarchicalConfiguration<?>) createBean(
+                    fetchConfigurationClass(), decl, null);
         }
 
         /**
@@ -1283,7 +1284,7 @@
                     {
                         logger.debug("Load failed for optional configuration " + tagName + ": "
                             + ex.getMessage());
-                    }                    
+                    }
                     // Notify registered error listeners
                     decl.getConfigurationBuilder().fireError(
                             EVENT_ERR_LOAD_OPTIONAL,
@@ -1368,7 +1369,7 @@
          * @throws Exception if an error occurs
          */
         @Override
-        public AbstractConfiguration getConfiguration(
+        public AbstractHierarchicalConfiguration<?> getConfiguration(
                 ConfigurationDeclaration decl) throws Exception
         {
             AbstractConfiguration result = getEmptyConfiguration(decl);
@@ -1381,7 +1382,7 @@
                 }
             }
             ((FileConfiguration) result).load();
-            return result;
+            return (AbstractHierarchicalConfiguration<?>) result;
         }
 
         /**
@@ -1646,7 +1647,7 @@
          * @exception Exception if an error occurs
          */
         @Override
-        public AbstractConfiguration getConfiguration(
+        public AbstractHierarchicalConfiguration<?> getConfiguration(
                 ConfigurationDeclaration decl) throws Exception
         {
             DefaultConfigurationBuilder builder = (DefaultConfigurationBuilder) super
@@ -1679,7 +1680,7 @@
     static class DatabaseConfigurationProvider extends ConfigurationProvider
     {
         @Override
-        public AbstractConfiguration getConfiguration(ConfigurationDeclaration decl) throws Exception
+        public AbstractHierarchicalConfiguration<?> getConfiguration(ConfigurationDeclaration decl) throws Exception
         {
             Map<String, ?> attributes = decl.getBeanProperties();
             String jndi = (String) attributes.get("jndi");

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DynamicCombinedConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DynamicCombinedConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DynamicCombinedConfiguration.java Sat Oct 24 15:09:58 2009
@@ -27,6 +27,11 @@
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.commons.configuration2.AbstractConfiguration;
+import org.apache.commons.configuration2.CombinedConfiguration;
+import org.apache.commons.configuration2.Configuration;
+import org.apache.commons.configuration2.HierarchicalConfiguration;
+import org.apache.commons.configuration2.SubnodeConfiguration;
 import org.apache.commons.configuration2.event.ConfigurationErrorListener;
 import org.apache.commons.configuration2.event.ConfigurationListener;
 import org.apache.commons.configuration2.tree.ConfigurationNode;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfiguration.java Sat Oct 24 15:09:58 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.configuration2.combined;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -35,6 +37,7 @@
 import org.apache.commons.configuration2.expr.NodeList;
 import org.apache.commons.configuration2.expr.def.DefaultConfigurationKey;
 import org.apache.commons.configuration2.expr.def.DefaultExpressionEngine;
+import org.apache.commons.configuration2.tree.TreeUtils;
 
 /**
  * <p>
@@ -195,7 +198,7 @@
     private CombinedNode combinedRoot;
 
     /** Stores a list with the contained configurations. */
-    private List<ConfigData<?>> configurations;
+    private List<ConfigData> configurations;
 
     /** Stores a map with the named configurations. */
     private Map<String, Configuration> namedConfigurations;
@@ -209,6 +212,9 @@
     /** A flag whether an enhanced reload check is to be performed. */
     private boolean forceReloadCheck;
 
+    /** The default behavior is to ignore exceptions that occur during reload */
+    private boolean ignoreReloadExceptions = true;
+
     /**
      * Creates a new instance of <code>CombinedConfiguration</code> and
      * initializes the combiner to be used.
@@ -294,6 +300,26 @@
     }
 
     /**
+     * Retrieves the value of the ignoreReloadExceptions flag.
+     * @return true if exceptions are ignored, false otherwise.
+     */
+    public boolean isIgnoreReloadExceptions()
+    {
+        return ignoreReloadExceptions;
+    }
+
+    /**
+     * If set to true then exceptions that occur during reloading will be
+     * ignored. If false then the exceptions will be allowed to be thrown
+     * back to the caller.
+     * @param ignoreReloadExceptions true if exceptions should be ignored.
+     */
+    public void setIgnoreReloadExceptions(boolean ignoreReloadExceptions)
+    {
+        this.ignoreReloadExceptions = ignoreReloadExceptions;
+    }
+
+    /**
      * Returns the <code>ExpressionEngine</code> for converting flat child
      * configurations to hierarchical ones.
      *
@@ -345,7 +371,6 @@
      * @throws ConfigurationRuntimeException if there is already a configuration
      *         with the given name
      */
-    @SuppressWarnings("unchecked")
     public void addConfiguration(AbstractHierarchicalConfiguration<?> config,
             String name, String at)
     {
@@ -421,7 +446,7 @@
      */
     public Configuration getConfiguration(int index)
     {
-        ConfigData<?> cd = (ConfigData<?>) configurations.get(index);
+        ConfigData cd = configurations.get(index);
         return cd.getConfiguration();
     }
 
@@ -439,14 +464,14 @@
 
     /**
      * Returns a List of all the configurations that have been added.
-     * 
+     *
      * @return A List of all the configurations.
      * @since 1.7
      */
-    public List<AbstractHierarchicalConfiguration> getConfigurations()
+    public List<AbstractHierarchicalConfiguration<?>> getConfigurations()
     {
-        List<AbstractHierarchicalConfiguration> list = new ArrayList<AbstractHierarchicalConfiguration>();
-        for (ConfigData<?> configuration : configurations)
+        List<AbstractHierarchicalConfiguration<?>> list = new ArrayList<AbstractHierarchicalConfiguration<?>>();
+        for (ConfigData configuration : configurations)
         {
             list.add(configuration.getConfiguration());
         }
@@ -457,14 +482,14 @@
      * Returns a List of the names of all the configurations that have been
      * added in the order they were added. A NULL value will be present in
      * the list for each configuration that was added without a name.
-     * 
+     *
      * @return A List of all the configuration names.
      * @since 1.7
      */
     public List<String> getConfigurationNameList()
     {
         List<String> list = new ArrayList<String>();
-        for (ConfigData<?> configuration : configurations)
+        for (ConfigData configuration : configurations)
         {
             list.add((configuration).getName());
         }
@@ -481,7 +506,7 @@
     {
         for (int index = 0; index < getNumberOfConfigurations(); index++)
         {
-            if (((ConfigData<?>) configurations.get(index)).getConfiguration() == config)
+            if (configurations.get(index).getConfiguration() == config)
             {
                 removeConfigurationAt(index);
                 return true;
@@ -499,7 +524,7 @@
      */
     public Configuration removeConfigurationAt(int index)
     {
-        ConfigData<?> cd = (ConfigData<?>) configurations.remove(index);
+        ConfigData cd = configurations.remove(index);
         if (cd.getName() != null)
         {
             namedConfigurations.remove(cd.getName());
@@ -599,7 +624,7 @@
     public void clear()
     {
         fireEvent(EVENT_CLEAR, null, null, true);
-        configurations = new ArrayList<ConfigData<?>>();
+        configurations = new ArrayList<ConfigData>();
         namedConfigurations = new HashMap<String, Configuration>();
         fireEvent(EVENT_CLEAR, null, null, false);
         invalidate();
@@ -621,7 +646,7 @@
         {
             CombinedConfiguration copy = (CombinedConfiguration) super.clone();
             copy.clear();
-            for (ConfigData<?> cd : configurations)
+            for (ConfigData cd : configurations)
             {
                 copy
                         .addConfiguration(
@@ -641,6 +666,42 @@
     }
 
     /**
+     * Returns the value of the specified property. This implementation
+     * evaluates the <em>force reload check</em> flag. If it is set, all
+     * contained configurations will be triggered before the value of the
+     * requested property is retrieved.
+     *
+     * @param key the key of the desired property
+     * @return the value of this property
+     * @since 1.4
+     */
+    @Override
+    public Object getProperty(String key)
+    {
+        if (isForceReloadCheck())
+        {
+            for (ConfigData cd : configurations)
+            {
+                try
+                {
+                    // simply retrieve a property; this is enough for
+                    // triggering a reload
+                    cd.getConfiguration().getProperty(PROP_RELOAD_CHECK);
+                }
+                catch (Exception ex)
+                {
+                    if (!ignoreReloadExceptions)
+                    {
+                        throw new ConfigurationRuntimeException(ex);
+                    }
+                }
+            }
+        }
+
+        return super.getProperty(key);
+    }
+
+    /**
      * Returns the configuration source, in which the specified key is defined.
      * This method will determine the configuration node that is identified by
      * the given key. The following constellations are possible:
@@ -702,7 +763,7 @@
     {
         Map<Class<?>, NodeHandler<?>> result = new HashMap<Class<?>, NodeHandler<?>>();
 
-        for (ConfigData<?> cd : configurations)
+        for (ConfigData cd : configurations)
         {
             result.put(cd.getConfiguration().getRootNode().getClass(), cd
                     .getConfiguration().getNodeHandler());
@@ -741,7 +802,7 @@
      */
     protected void performReloadCheck()
     {
-        for (ConfigData<?> cd : configurations)
+        for (ConfigData cd : configurations)
         {
             try
             {
@@ -773,13 +834,21 @@
 
         else
         {
-            Iterator<ConfigData<?>> it = configurations.iterator();
+            Iterator<ConfigData> it = configurations.iterator();
             CombinedNode node = it.next().getTransformedRoot();
             while (it.hasNext())
             {
                 node = getNodeCombiner().combine(node, getNodeHandler(),
                         it.next().getTransformedRoot(), getNodeHandler());
             }
+
+            if (getLogger().isDebugEnabled())
+            {
+                ByteArrayOutputStream os = new ByteArrayOutputStream();
+                PrintStream stream = new PrintStream(os);
+                TreeUtils.printTree(stream, node, getNodeHandler());
+                getLogger().debug(os.toString());
+            }
             return node;
         }
     }
@@ -818,7 +887,7 @@
         }
 
         // Check with the root nodes of the child configurations
-        for (ConfigData<?> cd : configurations)
+        for (ConfigData cd : configurations)
         {
             if (root == cd.getRootNode())
             {
@@ -859,10 +928,10 @@
      *
      * @param <T> the type of the nodes used by the represented configuration
      */
-    class ConfigData<T>
+    class ConfigData
     {
         /** Stores a reference to the configuration. */
-        private AbstractHierarchicalConfiguration<T> configuration;
+        private AbstractHierarchicalConfiguration<?> configuration;
 
         /** Stores the name under which the configuration is stored. */
         private String name;
@@ -874,7 +943,7 @@
         private String at;
 
         /** Stores the root node for this child configuration. */
-        private T rootNode;
+        private Object rootNode;
 
         /**
          * Creates a new instance of <code>ConfigData</code> and initializes
@@ -884,7 +953,7 @@
          * @param n the name
          * @param at the at position
          */
-        public ConfigData(AbstractHierarchicalConfiguration<T> config,
+        public ConfigData(AbstractHierarchicalConfiguration<?> config,
                 String n, String at)
         {
             configuration = config;
@@ -898,7 +967,7 @@
          *
          * @return the configuration
          */
-        public AbstractHierarchicalConfiguration<T> getConfiguration()
+        public AbstractHierarchicalConfiguration<?> getConfiguration()
         {
             return configuration;
         }
@@ -929,14 +998,14 @@
          * @return the root node of this child configuration
          * @since 1.5
          */
-        public T getRootNode()
+        public Object getRootNode()
         {
             return rootNode;
         }
 
         /**
          * Returns the transformed root node of the stored configuration. The
-         * term &quot;transformed&quot; means that an eventually defined at path
+         * term &quot;transformed&quot; means that an optionally defined at path
          * has been applied.
          *
          * @return the transformed root node
@@ -958,18 +1027,29 @@
                 }
             }
 
-            T root = (T) ConfigurationUtils.convertToHierarchical(getConfiguration(), getConversionExpressionEngine()).getRootNode();
-
-            // Copy data of the root node to the new path
-            atParent.appendChildren(root, getConfiguration().getNodeHandler());
-            atParent
-                    .appendAttributes(root, getConfiguration().getNodeHandler());
-            rootNode = root;
-
+            rootNode = append(atParent, getConfiguration());
             return result;
         }
 
         /**
+         * Appends the content of the root node of the given sub configuration
+         * to the resulting combined root node.
+         *
+         * @param <T> the type of the sub configuration
+         * @param atParent the parent combined node
+         * @param config the sub configuration to be processed
+         * @return the root node of the configuration
+         */
+        private <T> T append(CombinedNode atParent,
+                AbstractHierarchicalConfiguration<T> config)
+        {
+            T root = config.getRootNode();
+            atParent.appendChildren(root, config.getNodeHandler());
+            atParent.appendAttributes(root, config.getNodeHandler());
+            return root;
+        }
+
+        /**
          * Splits the at path into its components.
          *
          * @param at the at string

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfigurationNodeHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfigurationNodeHandler.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfigurationNodeHandler.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/CombinedConfigurationNodeHandler.java Sat Oct 24 15:09:58 2009
@@ -395,19 +395,24 @@
      */
     public NodeHandler<?> lookupHandler(Object node, boolean subClass)
     {
-        NodeHandler<?> result = getHandlers().get(node.getClass());
+        NodeHandler<?> result = null;
 
-        if (result == null && subClass)
+        if (getHandlers() != null)
         {
-            // check for sub classes
-            for (Class<?> cls : getHandlers().keySet())
+            // the map may be null if we are in the initialization phase
+            result = getHandlers().get(node.getClass());
+            if (result == null && subClass)
             {
-                if (cls.isInstance(node))
+                // check for sub classes
+                for (Class<?> cls : getHandlers().keySet())
                 {
-                    result = getHandlers().get(cls);
-                    // store directly in map for faster access the next time
-                    getHandlers().put(node.getClass(), result);
-                    break;
+                    if (cls.isInstance(node))
+                    {
+                        result = getHandlers().get(cls);
+                        // store directly in map for faster access the next time
+                        getHandlers().put(node.getClass(), result);
+                        break;
+                    }
                 }
             }
         }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/DynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/DynamicCombinedConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/DynamicCombinedConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/combined/DynamicCombinedConfiguration.java Sat Oct 24 15:09:58 2009
@@ -17,24 +17,26 @@
 package org.apache.commons.configuration2.combined;
 
 
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Collection;
-import java.util.Set;
-import java.util.Properties;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.apache.commons.configuration2.event.ConfigurationListener;
-import org.apache.commons.configuration2.event.ConfigurationErrorListener;
-import org.apache.commons.configuration2.expr.ExpressionEngine;
 import org.apache.commons.configuration2.AbstractConfiguration;
 import org.apache.commons.configuration2.AbstractHierarchicalConfiguration;
 import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.configuration2.SubConfiguration;
+import org.apache.commons.configuration2.event.ConfigurationErrorListener;
+import org.apache.commons.configuration2.event.ConfigurationListener;
+import org.apache.commons.configuration2.expr.ExpressionEngine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * DynamicCombinedConfiguration allows a set of CombinedConfigurations to be used. Each CombinedConfiguration
@@ -48,6 +50,18 @@
  */
 public class DynamicCombinedConfiguration extends CombinedConfiguration
 {
+    /**
+     * Prevent recursion while resolving unprefixed properties.
+     */
+    private static ThreadLocal<Boolean> recursive = new ThreadLocal<Boolean>()
+    {
+        @Override
+        protected synchronized Boolean initialValue()
+        {
+            return Boolean.FALSE;
+        }
+    };
+
     /** The CombinedConfigurations */
     private ConcurrentMap<String, CombinedConfiguration> configs =
             new ConcurrentHashMap<String, CombinedConfiguration>();
@@ -65,6 +79,9 @@
     /** Stores the combiner. */
     private NodeCombiner nodeCombiner;
 
+    /** The name of the logger to use for each CombinedConfiguration */
+    private String loggerName = DynamicCombinedConfiguration.class.getName();
+
     /**
      * Creates a new instance of <code>CombinedConfiguration</code> and
      * initializes the combiner to be used.
@@ -99,6 +116,15 @@
     }
 
     /**
+     * Set the name of the Logger to use on each CombinedConfiguration.
+     * @param name The Logger name.
+     */
+    public void setLoggerName(String name)
+    {
+        this.loggerName = name;
+    }
+
+    /**
      * Returns the node combiner that is used for creating the combined node
      * structure.
      *
@@ -730,6 +756,33 @@
         }
     }
 
+    /*
+     * Don't allow resolveContainerStore to be called recursively. This happens
+     * when the key pattern does not resolve and the ConfigurationInterpolator
+     * calls resolveContainerStore, which in turn calls getProperty, which then
+     * calls getConfiguration. GetConfiguration then calls the interpolator
+     * which starts it all over again.
+     * @param key The key to resolve.
+     * @return The value of the key.
+     */
+    @Override
+    protected Object resolveContainerStore(String key)
+    {
+        if (recursive.get())
+        {
+            return null;
+        }
+        recursive.set(Boolean.TRUE);
+        try
+        {
+            return super.resolveContainerStore(key);
+        }
+        finally
+        {
+            recursive.set(Boolean.FALSE);
+        }
+    }
+
     private CombinedConfiguration getCurrentConfig()
     {
         String key = getSubstitutor().replace(keyPattern);
@@ -740,23 +793,39 @@
             if (config == null)
             {
                 config = new CombinedConfiguration(getNodeCombiner());
+                if (loggerName != null)
+                {
+                    Log log = LogFactory.getLog(loggerName);
+                    if (log != null)
+                    {
+                        config.setLogger(log);
+                    }
+                }
+                config.setIgnoreReloadExceptions(isIgnoreReloadExceptions());
                 config.setExpressionEngine(this.getExpressionEngine());
-                for (ConfigurationErrorListener listener : config.getErrorListeners())
+                config.setDelimiterParsingDisabled(isDelimiterParsingDisabled());
+                config.setListDelimiter(getListDelimiter());
+                for (ConfigurationErrorListener listener : getErrorListeners())
                 {
                     config.addErrorListener(listener);
                 }
-                for (ConfigurationListener listener : config.getConfigurationListeners())
+                for (ConfigurationListener listener : getConfigurationListeners())
                 {
                     config.addConfigurationListener(listener);
                 }
                 config.setForceReloadCheck(isForceReloadCheck());
                 for (ConfigData data : configurations)
                 {
-                    config.addConfiguration(data.getConfiguration(), data.getName(), data.getAt());
+                    config.addConfiguration(data.getConfiguration(), data.getName(),
+                            data.getAt());
                 }
                 configs.put(key, config);
             }
         }
+        if (getLogger().isDebugEnabled())
+        {
+            getLogger().debug("Returning config for " + key + ": " + config);
+        }
         return config;
     }
 
@@ -767,7 +836,7 @@
     class ConfigData
     {
         /** Stores a reference to the configuration. */
-        private AbstractHierarchicalConfiguration configuration;
+        private AbstractHierarchicalConfiguration<?> configuration;
 
         /** Stores the name under which the configuration is stored. */
         private String name;
@@ -783,7 +852,7 @@
          * @param n the name
          * @param at the at position
          */
-        public ConfigData(AbstractHierarchicalConfiguration config, String n, String at)
+        public ConfigData(AbstractHierarchicalConfiguration<?> config, String n, String at)
         {
             configuration = config;
             name = n;
@@ -795,7 +864,7 @@
          *
          * @return the configuration
          */
-        public AbstractHierarchicalConfiguration getConfiguration()
+        public AbstractHierarchicalConfiguration<?> getConfiguration()
         {
             return configuration;
         }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/AbstractFlatConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/AbstractFlatConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/AbstractFlatConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/AbstractFlatConfiguration.java Sat Oct 24 15:09:58 2009
@@ -21,10 +21,9 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.commons.configuration2.AbstractConfiguration;
+import org.apache.commons.configuration2.AbstractHierarchicalConfiguration;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
-import org.apache.commons.configuration2.expr.NodeHandler;
 
 /**
  * <p>
@@ -63,11 +62,8 @@
  *         Configuration team</a>
  * @version $Id$
  */
-public abstract class AbstractFlatConfiguration extends AbstractConfiguration
+public abstract class AbstractFlatConfiguration extends AbstractHierarchicalConfiguration<FlatNode>
 {
-    /** Stores the <code>NodeHandler</code> used by this configuration. */
-    private FlatNodeHandler nodeHandler;
-
     /** Stores the root node of this configuration. */
     private FlatNode rootNode;
 
@@ -79,23 +75,13 @@
      */
     protected AbstractFlatConfiguration()
     {
+        super(null);
         lockRoot = new ReentrantLock();
         initNodeHandler();
         registerChangeListener();
     }
 
     /**
-     * Returns the <code>NodeHandler</code> used by this configuration. This
-     * is a handler that can deal with flat nodes.
-     *
-     * @return the <code>NodeHandler</code> used
-     */
-    public NodeHandler<FlatNode> getNodeHandler()
-    {
-        return nodeHandler;
-    }
-
-    /**
      * Returns the root node of this configuration. A node hierarchy for this
      * configuration (consisting of <code>FlatNode</code> objects) is created
      * on demand. This method returns the root node of this hierarchy. It checks
@@ -109,6 +95,7 @@
      *
      * @return the root node of this configuration
      */
+    @Override
     public FlatNode getRootNode()
     {
         lockRoot.lock();
@@ -157,6 +144,7 @@
      * @param key the key of the property
      * @return the maximum index of a value of this property
      */
+    @Override
     public int getMaxIndex(String key)
     {
         Object value = getProperty(key);
@@ -176,6 +164,38 @@
     }
 
     /**
+     * An alternative implementation of {@code setProperty()}. We cannot use the
+     * implementation inherited from {@link AbstractHierarchicalConfiguration}
+     * because it makes use of the configuration's node structure. This
+     * implementation delegates to the default implementation in {@code
+     * AbstractConfiguration}.
+     *
+     * @param key the property key
+     * @param value the new value
+     */
+    @Override
+    public void setProperty(String key, Object value)
+    {
+        doSetProperty(key, value);
+    }
+
+    /**
+     * An alternative implementation of {@code getKeys(String)}. We cannot use
+     * the implementation inherited from
+     * {@link AbstractHierarchicalConfiguration} because it makes use of the
+     * configuration's node structure. This implementation delegates to the
+     * default implementation in {@code AbstractConfiguration}.
+     *
+     * @param prefix the prefix for the keys to be returned
+     * @return an iterator with all the keys starting with the given prefix
+     */
+    @Override
+    public Iterator<String> getKeys(String prefix)
+    {
+        return doGetKeys(prefix);
+    }
+
+    /**
      * Creates a hierarchy of <code>FlatNode</code> objects that corresponds
      * to the data stored in this configuration. This implementation relies on
      * the methods <code>getKeys()</code> and <code>getMaxIndex()</code> to
@@ -185,7 +205,7 @@
      */
     protected FlatNode constructNodeHierarchy()
     {
-        FlatRootNode root = new FlatRootNode();
+        FlatRootNode root = new FlatRootNode(this);
         for (Iterator<String> it = getKeys(); it.hasNext();)
         {
             String key = it.next();
@@ -224,7 +244,7 @@
      */
     private void initNodeHandler()
     {
-        nodeHandler = new FlatNodeHandler(this);
+        setNodeHandler(new FlatNodeHandler());
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatLeafNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatLeafNode.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatLeafNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatLeafNode.java Sat Oct 24 15:09:58 2009
@@ -166,9 +166,9 @@
      * @return the value of the represented property
      */
     @Override
-    public Object getValue(Configuration config)
+    public Object getValue()
     {
-        Object value = config.getProperty(getName());
+        Object value = getConfiguration().getProperty(getName());
         if (value instanceof Collection<?>)
         {
             int valueIndex = getValueIndex();
@@ -209,12 +209,11 @@
      * Removes a child from this node. Leaf nodes do not support children, so
      * this implementation always throws a runtime exception.
      *
-     * @param config the associated configuration
      * @param child the node to be removed
      * @throws ConfigurationRuntimeException if the child cannot be removed
      */
     @Override
-    public void removeChild(Configuration config, FlatNode child)
+    public void removeChild(FlatNode child)
     {
         throw new ConfigurationRuntimeException(
                 "Cannot remove a child from a leaf node!");
@@ -226,29 +225,40 @@
      * was newly created), this method adds a new value to the represented
      * property. Otherwise the corresponding property value is overridden.
      *
-     * @param config the associated configuration
      * @param value the new value
      */
     @Override
-    public void setValue(Configuration config, Object value)
+    public void setValue(Object value)
     {
         if (hasValue)
         {
             int index = getValueIndex();
             if (index != INDEX_UNDEFINED)
             {
-                parent.setMultiProperty(config, this, index, value);
+                parent.setMultiProperty(this, index, value);
             }
             else
             {
-                config.setProperty(getName(), value);
+                getConfiguration().setProperty(getName(), value);
             }
         }
 
         else
         {
-            config.addProperty(getName(), value);
+            getConfiguration().addProperty(getName(), value);
             hasValue = true;
         }
     }
+
+    /**
+     * Returns the {@code Configuration} object this node belongs to. This
+     * implementation fetches the {@code Configuration} from the parent node.
+     *
+     * @return the owning {@code Configuration}
+     */
+    @Override
+    public Configuration getConfiguration()
+    {
+        return getParent().getConfiguration();
+    }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNode.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNode.java Sat Oct 24 15:09:58 2009
@@ -72,23 +72,19 @@
     public abstract String getName();
 
     /**
-     * Returns the value of this node. An implementation can access the passed
-     * in configuration to obtain the value.
+     * Returns the value of this node.
      *
-     * @param config the owning configuration
      * @return the value of this node
      */
-    public abstract Object getValue(Configuration config);
+    public abstract Object getValue();
 
     /**
-     * Sets the value of this node. An implementation can access the passed in
-     * configuration to set the value.
+     * Sets the value of this node.
      *
-     * @param config the owning configuration
      * @param value the new value
      * @throws ConfigurationRuntimeException if the value cannot be set
      */
-    public abstract void setValue(Configuration config, Object value);
+    public abstract void setValue(Object value);
 
     /**
      * Returns the index of the value represented by this node. This is needed
@@ -154,12 +150,17 @@
     public abstract FlatNode addChild(String name);
 
     /**
-     * Removes the specified child node from this node. This may also affect the
-     * owning configuration, so this object is also passed to this method.
+     * Removes the specified child node from this node.
      *
-     * @param config the owning configuration
      * @param child the child to be removed
      * @throws ConfigurationRuntimeException if the child cannot be removed
      */
-    public abstract void removeChild(Configuration config, FlatNode child);
+    public abstract void removeChild(FlatNode child);
+
+    /**
+     * Returns the {@code Configuration} object this node belongs to.
+     *
+     * @return the owning {@code Configuration}
+     */
+    public abstract Configuration getConfiguration();
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java Sat Oct 24 15:09:58 2009
@@ -19,10 +19,10 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.configuration2.ConfigurationRuntimeException;
 import org.apache.commons.configuration2.expr.AbstractNodeHandler;
 import org.apache.commons.configuration2.expr.NodeHandler;
+import org.apache.commons.configuration2.expr.NodeHandlerRegistry;
 
 /**
  * <p>
@@ -37,7 +37,7 @@
  * </p>
  * <p>
  * The implementation of the methods required by the
- * <code>{@link NodeHandler}</code> interface is straight forward. In most
+ * {@link NodeHandler} interface is straightforward. In most
  * cases, it is possible to simply delegate to the corresponding
  * <code>FlatNode</code> method. Attributes are not supported by flat nodes,
  * so in this area there are only dummy implementations.
@@ -46,7 +46,7 @@
  * Actions caused by this node handler may modify the associated configuration
  * and thus trigger change events. Per default the configuration will invalidate
  * its node structure if a change event is received. Because of that the node
- * handler has to keep track of the updated caused by itself to avoid
+ * handler has to keep track of the updates caused by itself to avoid
  * unnecessary invalidation of nodes. (The configuration asks the node handler
  * for each change event whether the node structure should be invalidated.) Note
  * that modifications of a configuration are not thread-safe. So no additional
@@ -61,8 +61,8 @@
  */
 class FlatNodeHandler extends AbstractNodeHandler<FlatNode>
 {
-    /** Stores the associated configuration. */
-    private final Configuration configuration;
+    /** Stores the NodeHandlerRegistry. */
+    private NodeHandlerRegistry nodeHandlerRegistry;
 
     /**
      * A flag whether an update of the configuration was caused by an operation
@@ -71,27 +71,6 @@
     private boolean internalUpdate;
 
     /**
-     * Creates a new instance of <code>FlatNodeHandler</code> and initializes
-     * it with the associated configuration.
-     *
-     * @param config the configuration
-     */
-    public FlatNodeHandler(Configuration config)
-    {
-        configuration = config;
-    }
-
-    /**
-     * Returns the configuration associated with this node handler.
-     *
-     * @return the associated configuration
-     */
-    public Configuration getConfiguration()
-    {
-        return configuration;
-    }
-
-    /**
      * Returns a flag whether an update of the associated configuration was
      * caused by this node handler. Whenever the configuration receives a change
      * event, it asks the node hander whether it is responsible for this event.
@@ -229,7 +208,7 @@
      */
     public Object getValue(FlatNode node)
     {
-        return node.getValue(getConfiguration());
+        return node.getValue();
     }
 
     /**
@@ -265,7 +244,7 @@
         internalUpdate = true;
         try
         {
-            node.removeChild(getConfiguration(), child);
+            node.removeChild(child);
         }
         finally
         {
@@ -300,11 +279,69 @@
         internalUpdate = true;
         try
         {
-            node.setValue(getConfiguration(), value);
+            node.setValue(value);
         }
         finally
         {
             internalUpdate = false;
         }
     }
+
+    /**
+     * Initializes the {@code NodeHandlerRegistry}. A {@code FlatNodeHandler}
+     * deals with multiple types of nodes (flat root node and leaf nodes). To be
+     * compatible with a combined configuration it has to tell the parent
+     * {@code NodeHandlerRegistry} that it is responsible for these types of
+     * nodes. It does so by adding a specialized sub {@code NodeHandlerRegistry}
+     * that can lookup all flat node types.
+     *
+     * @param registry the {@code NodeHandlerRegistry}
+     */
+    @Override
+    public void initNodeHandlerRegistry(NodeHandlerRegistry registry)
+    {
+        nodeHandlerRegistry = registry;
+
+        registry.addSubRegistry(new NodeHandlerRegistry()
+        {
+            /**
+             * Resolves the node handler. This is delegated to the parent
+             * registry.
+             *
+             * @param node the node in question
+             * @return a {@code NodeHandler} for this node
+             */
+            public NodeHandler<?> resolveHandler(Object node)
+            {
+                assert nodeHandlerRegistry != null : "No parent registry!";
+                return nodeHandlerRegistry.resolveHandler(node);
+            }
+
+            /**
+             * Checks whether a {@code NodeHandler} for the specified node is
+             * known. This implementation returns this {@code NodeHandler} if
+             * the passed in node is a flat node.
+             *
+             * @param node the node in question
+             * @param subClasses a flag whether subclasses should be taken into
+             *        account
+             * @return a {@code NodeHandler} for this node
+             */
+            public NodeHandler<?> lookupHandler(Object node, boolean subClasses)
+            {
+                return (node instanceof FlatNode) ? FlatNodeHandler.this : null;
+            }
+
+            /**
+             * Adds a sub registry. This is not supported by this
+             * implementation.
+             *
+             * @param subreg the registry to be added
+             */
+            public void addSubRegistry(NodeHandlerRegistry subreg)
+            {
+                throw new UnsupportedOperationException("Not implemented!");
+            }
+        });
+    }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatRootNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatRootNode.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatRootNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatRootNode.java Sat Oct 24 15:09:58 2009
@@ -61,13 +61,20 @@
     /** A map for direct access to child nodes by name. */
     private final Map<String, ChildNodeManager> childrenByName;
 
+    /** Stores the configuration this node belongs to. */
+    private final Configuration configuration;
+
     /**
-     * Creates a new instance of <code>FlatRootNode</code>.
+     * Creates a new instance of {@code FlatRootNode}. The {@code Configuration}
+     * the node belongs to must be passed in.
+     *
+     * @param owningConfiguration the owning {@code Configuration}
      */
-    public FlatRootNode()
+    public FlatRootNode(Configuration owningConfiguration)
     {
         children = new ArrayList<FlatNode>();
         childrenByName = new HashMap<String, ChildNodeManager>();
+        configuration = owningConfiguration;
     }
 
     /**
@@ -186,11 +193,10 @@
      * Returns the value of this node. The root node does not have a value, so
      * result is always <b>null</b>.
      *
-     * @param config the associated configuration
      * @return the value of this node
      */
     @Override
-    public Object getValue(Configuration config)
+    public Object getValue()
     {
         return null;
     }
@@ -211,13 +217,12 @@
      * Removes the specified child node. The corresponding value in the
      * associated configuration will also be removed.
      *
-     * @param config the associated configuration
      * @param child the node to be removed
      * @throws ConfigurationRuntimeException if this node is not a child of this
      *         node
      */
     @Override
-    public void removeChild(Configuration config, FlatNode child)
+    public void removeChild(FlatNode child)
     {
         if (child != null)
         {
@@ -228,11 +233,11 @@
 
             if (index != INDEX_UNDEFINED)
             {
-                changeMultiProperty(config, child, index, null, true);
+                changeMultiProperty(getConfiguration(), child, index, null, true);
             }
             else
             {
-                config.clearProperty(child.getName());
+                getConfiguration().clearProperty(child.getName());
             }
         }
         else
@@ -252,13 +257,25 @@
      * @throws ConfigurationRuntimeException if the value cannot be set
      */
     @Override
-    public void setValue(Configuration config, Object value)
+    public void setValue(Object value)
     {
         throw new ConfigurationRuntimeException(
                 "Cannot set the value of the root node of a flat configuration!");
     }
 
     /**
+     * Returns the owning {@code Configuration}. The {@code Configuration} is
+     * stored as a member of this node. So it can be directly returned.
+     *
+     * @return the {@code Configuration} this node belongs to
+     */
+    @Override
+    public Configuration getConfiguration()
+    {
+        return configuration;
+    }
+
+    /**
      * Returns the value index for the specified child node. This method is used
      * to determine the index of the value of a property with multiple values
      * that corresponds to the given child node. It counts the occurrences of
@@ -279,15 +296,13 @@
      * times. It obtains the list with all values for this property, changes the
      * value with the given index, and sets the new value.
      *
-     * @param config the current configuration
      * @param child the child node that was changed
      * @param index the value index of this child node
      * @param value the new value
      */
-    void setMultiProperty(Configuration config, FlatNode child, int index,
-            Object value)
+    void setMultiProperty(FlatNode child, int index, Object value)
     {
-        changeMultiProperty(config, child, index, value, false);
+        changeMultiProperty(getConfiguration(), child, index, value, false);
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/TreeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/TreeUtils.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/TreeUtils.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/TreeUtils.java Sat Oct 24 15:09:58 2009
@@ -19,9 +19,12 @@
 
 import java.io.PrintStream;
 
+import org.apache.commons.configuration2.expr.ConfigurationNodeHandler;
+import org.apache.commons.configuration2.expr.NodeHandler;
+
 /**
  * Utility methods.
- * 
+ *
  * @author <a href="http://commons.apache.org/configuration/team-list.html">Commons Configuration team</a>
  * @version $Id$
  * @since 1.7
@@ -37,41 +40,59 @@
     {
         if (stream != null)
         {
-            printTree(stream, "", result);
+            printTree(stream, "", result, new ConfigurationNodeHandler());
+        }
+    }
+
+    /**
+     * Prints the data stored in the specified node and its children.
+     *
+     * @param <T> the type of the node
+     * @param stream the output stream
+     * @param result the root node of the tree
+     * @param handler the node handler
+     */
+    public static <T> void printTree(PrintStream stream, T result,
+            NodeHandler<T> handler)
+    {
+        if (stream != null)
+        {
+            printTree(stream, "", result, handler);
         }
     }
 
-    private static void printTree(PrintStream stream, String indent, ConfigurationNode result)
+    private static <T> void printTree(PrintStream stream, String indent, T result, NodeHandler<T> handler)
     {
-        StringBuilder buffer = new StringBuilder(indent).append("<").append(result.getName());
-        for (ConfigurationNode node : result.getAttributes())
+        StringBuilder buffer = new StringBuilder(indent).append("<").append(handler.nodeName(result));
+
+        for (String attr : handler.getAttributes(result))
         {
-            buffer.append(" ").append(node.getName()).append("='").append(node.getValue()).append("'");
+            buffer.append(" ").append(attr).append("='").append(handler.getAttributeValue(result, attr)).append("'");
         }
         buffer.append(">");
         stream.print(buffer.toString());
-        
-        if (result.getValue() != null)
+
+        if (handler.getValue(result) != null)
         {
-            stream.print(result.getValue());
+            stream.print(handler.getValue(result));
         }
-        
+
         boolean newline = false;
-        if (result.getChildrenCount() > 0)
+        if (handler.getChildrenCount(result, null) > 0)
         {
             stream.print("\n");
-            for (ConfigurationNode node : result.getChildren())
+            for (T node : handler.getChildren(result))
             {
-                printTree(stream, indent + "  ", node);
+                printTree(stream, indent + "  ", node, handler);
             }
             newline = true;
         }
-        
+
         if (newline)
         {
             stream.print(indent);
         }
-        
-        stream.println("</" + result.getName() + ">");
+
+        stream.println("</" + handler.nodeName(result) + ">");
     }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationFactory.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationFactory.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestConfigurationFactory.java Sat Oct 24 15:09:58 2009
@@ -19,11 +19,13 @@
 
 import java.io.File;
 import java.io.FileWriter;
+import java.net.URI;
 import java.util.Collection;
 import java.util.List;
-import java.net.URI;
 
 import junit.framework.TestCase;
+
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
 import org.xml.sax.SAXException;
 
 /**
@@ -64,6 +66,7 @@
 
     private DefaultConfigurationBuilder factory;
 
+    @Override
     public void setUp() throws Exception
     {
         System.setProperty("java.naming.factory.initial", "org.apache.commons.configuration2.MockInitialContextFactory");
@@ -225,8 +228,8 @@
         assertTrue(subset.getBoolean("onlyinjndi"));
 
         // test SystemConfiguration
-        assertNotNull(config.getProperty("java.version"));
-        assertEquals(System.getProperty("java.version"), config.getString("java.version"));
+        assertNotNull(config.getProperty("java..version"));
+        assertEquals(System.getProperty("java.version"), config.getString("java..version"));
     }
 
     // Checks if optional configurations work

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=829384&r1=829383&r2=829384&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 Sat Oct 24 15:09:58 2009
@@ -293,7 +293,7 @@
     {
         BaseConfiguration config = new BaseConfiguration();
         config.addProperty("test", "1,2,3");
-        AbstractHierarchicalConfiguration hc = ConfigurationUtils.convertToHierarchical(config, null);
+        AbstractHierarchicalConfiguration<?> hc = ConfigurationUtils.convertToHierarchical(config, null);
         assertEquals("Wrong value 1", 1, hc.getInt("test(0)"));
         assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));
         assertEquals("Wrong value 3", 3, hc.getInt("test(2)"));

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java Sat Oct 24 15:09:58 2009
@@ -21,25 +21,27 @@
 import java.io.StringWriter;
 import java.net.URL;
 import java.util.Collection;
-import java.util.Set;
-import java.util.Map;
 import java.util.HashMap;
 import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4JLogger;
+import java.util.Map;
+import java.util.Set;
 
 import junit.framework.TestCase;
 
 import org.apache.commons.configuration2.beanutils.BeanHelper;
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
+import org.apache.commons.configuration2.combined.DynamicCombinedConfiguration;
+import org.apache.commons.configuration2.expr.NodeHandler;
+import org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine;
 import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
 import org.apache.commons.configuration2.tree.DefaultConfigurationNode;
-import org.apache.commons.configuration2.tree.ConfigurationNode;
-import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine;
 import org.apache.commons.lang.text.StrLookup;
-import org.apache.log4j.WriterAppender;
-import org.apache.log4j.SimpleLayout;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.impl.Log4JLogger;
 import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.WriterAppender;
 
 /**
  * Test class for DefaultConfigurationBuilder.
@@ -418,7 +420,7 @@
 
         // Test if union was constructed correctly
         Object prop = compositeConfiguration.getProperty("tables.table.name");
-        assertTrue(prop instanceof Collection);
+        assertTrue(prop instanceof Collection<?>);
         assertEquals(3, ((Collection<?>) prop).size());
         assertEquals("users", compositeConfiguration
                 .getProperty("tables.table(0).name"));
@@ -429,7 +431,7 @@
 
         prop = compositeConfiguration
                 .getProperty("tables.table.fields.field.name");
-        assertTrue(prop instanceof Collection);
+        assertTrue(prop instanceof Collection<?>);
         assertEquals(17, ((Collection<?>) prop).size());
 
         assertEquals("smtp.mydomain.org", compositeConfiguration
@@ -626,8 +628,8 @@
         assertTrue(subset.getBoolean("onlyinjndi"));
 
         // test SystemConfiguration
-        assertNotNull(config.getProperty("java.version"));
-        assertEquals(System.getProperty("java.version"), config.getString("java.version"));
+        assertNotNull(config.getProperty("java..version"));
+        assertEquals(System.getProperty("java.version"), config.getString("java..version"));
 
         // test EnvironmentConfiguration
         assertNotNull("JAVA_HOME property not found", config.getProperty("JAVA_HOME"));
@@ -831,7 +833,7 @@
     public void testSystemProperties() throws Exception
     {
         factory.setFile(SYSTEM_PROPS_FILE);
-        CombinedConfiguration cc = factory.getConfiguration(true);
+        factory.getConfiguration(true);
         String value = System.getProperty("key1");
         assertNotNull("The test key was not located", value);
         assertEquals("Incorrect value retrieved","value1",value);
@@ -841,13 +843,12 @@
     public void testValidation() throws Exception
     {
         factory.setFile(VALIDATION_FILE);
-        CombinedConfiguration cc = factory.getConfiguration(true);
+        factory.getConfiguration(true);
         String value = System.getProperty("key1");
         assertNotNull("The test key was not located", value);
         assertEquals("Incorrect value retrieved","value1",value);
     }
 
-
     public void testValidation3() throws Exception
     {
         System.getProperties().remove("Id");
@@ -911,7 +912,7 @@
         verify("1001", config, 15);
         String xml = writer.getBuffer().toString();
         assertNotNull("No XML returned", xml);
-        assertTrue("Incorect configuration data", xml.indexOf("<rowsPerPage>15</rowsPerPage>") >= 0);
+        assertTrue("Incorect configuration data: " + xml, xml.indexOf("<rowsPerPage>15</rowsPerPage>") >= 0);
         logger.removeAppender(app);
         logger.setLevel(org.apache.log4j.Level.OFF);
         verify("1002", config, 25);
@@ -925,10 +926,10 @@
         factory.setFile(MULTI_TENENT_FILE);
         System.setProperty("Id", "1001");
         CombinedConfiguration config = factory.getConfiguration(true);
-        HierarchicalConfiguration sub1 = config.configurationAt("Channels/Channel[@id='1']");
+        SubConfiguration<?> sub1 = config.configurationAt("Channels/Channel[@id='1']");
         assertEquals("My Channel", sub1.getString("Name"));
         assertEquals("test 1 data", sub1.getString("ChannelData"));
-        HierarchicalConfiguration sub2 = config.configurationAt("Channels/Channel[@id='2']");
+        SubConfiguration<?> sub2 = config.configurationAt("Channels/Channel[@id='2']");
         assertEquals("Channel 2", sub2.getString("Name"));
         assertEquals("more test 2 data", sub2.getString("MoreChannelData"));
     }
@@ -946,17 +947,17 @@
         CombinedConfiguration config = factory.getConfiguration(true);
         assertTrue("Incorrect configuration", config instanceof DynamicCombinedConfiguration);
 
-        List<HierarchicalConfiguration> list = config.configurationsAt("colors/*");
-        for (HierarchicalConfiguration sub : list)
+        List<SubConfiguration<Object>> list = config.configurationsAt("colors/*");
+        for (SubConfiguration<Object> sub : list)
         {
-            ConfigurationNode node = sub.getRootNode();
-            String value = (node.getValue() == null) ? "null" : node.getValue().toString();
-            if (map.containsKey(node.getName()))
+            NodeHandler<Object> nodeHandler = sub.getNodeHandler();
+            Object node = sub.getRootNode();
+            String value = (nodeHandler.getValue(node) == null) ? "null" : nodeHandler.getValue(node).toString();
+            if (map.containsKey(nodeHandler.nodeName(node)))
             {
-                assertEquals(map.get(node.getName()), value);
+                assertEquals(map.get(nodeHandler.nodeName(node)), value);
             }
         }
-
     }
 
     public void testDelimiterParsingDisabled() throws Exception
@@ -1022,7 +1023,7 @@
 
     public static class TestLookup extends StrLookup
     {
-        Map map = new HashMap();
+        Map<String, String> map = new HashMap<String, String>();
 
         public TestLookup()
         {
@@ -1031,6 +1032,7 @@
             map.put("test_key", "test.value");
         }
 
+        @Override
         public String lookup(String key)
         {
             if (key == null)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java Sat Oct 24 15:09:58 2009
@@ -21,6 +21,9 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.configuration2.combined.DynamicCombinedConfiguration;
+import org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine;
+
 /**
  *
  */
@@ -33,14 +36,12 @@
     public void testConfiguration() throws Exception
     {
         DynamicCombinedConfiguration config = new DynamicCombinedConfiguration();
-        org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine engine1 =
-            new  org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine();
+        XPathExpressionEngine engine1 = new XPathExpressionEngine();
         config.setExpressionEngine(engine1);
         config.setKeyPattern(PATTERN);
         config.setDelimiterParsingDisabled(true);
         MultiFileHierarchicalConfiguration multi = new MultiFileHierarchicalConfiguration(PATTERN1);
-        org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine engine2 =
-            new  org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine();
+        XPathExpressionEngine engine2 = new XPathExpressionEngine();
         multi.setExpressionEngine(engine2);
         config.addConfiguration(multi, "Multi");
         XMLConfiguration xml = new XMLConfiguration();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java Sat Oct 24 15:09:58 2009
@@ -26,11 +26,12 @@
 import java.net.URL;
 import java.util.Properties;
 
+import junit.framework.TestCase;
+
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
 import org.apache.commons.configuration2.reloading.FileAlwaysReloadingStrategy;
 import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
 
-import junit.framework.TestCase;
-
 /**
  * @author Emmanuel Bourg
  * @version $Revision$, $Date$

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestMultiFileHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestMultiFileHierarchicalConfiguration.java?rev=829384&r1=829383&r2=829384&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestMultiFileHierarchicalConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestMultiFileHierarchicalConfiguration.java Sat Oct 24 15:09:58 2009
@@ -17,17 +17,18 @@
 
 package org.apache.commons.configuration2;
 
-import junit.framework.TestCase;
-//import org.apache.commons.configuration2.combined.CombinedConfiguration;
-import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
-import org.xml.sax.SAXParseException;
-
 import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Reader;
-import java.io.FileReader;
 import java.io.Writer;
-import java.io.FileWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
+import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
+import org.xml.sax.SAXParseException;
 
 /**
  * Unit test for simple MultiConfigurationTest.

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=829384&r1=829383&r2=829384&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 Sat Oct 24 15:09:58 2009
@@ -28,15 +28,18 @@
 import java.util.Set;
 
 import junit.framework.TestCase;
+
 import org.apache.commons.configuration2.beanutils.BeanHelper;
+import org.apache.commons.configuration2.combined.CombinedConfiguration;
+import org.apache.commons.configuration2.combined.DynamicCombinedConfiguration;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
+import org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine;
 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.tree.DefaultConfigurationNode;
-import org.apache.commons.configuration2.tree.xpath.XPathExpressionEngine;
 
 /**
  * Test class for DefaultConfigurationBuilder.
@@ -128,6 +131,7 @@
         factory.clearErrorListeners();  // avoid exception messages
     }
 
+    @Override
     protected void tearDown() throws Exception
     {
         FileSystem.resetDefaultFileSystem();
@@ -649,8 +653,8 @@
         assertTrue(subset.getBoolean("onlyinjndi"));
 
         // test SystemConfiguration
-        assertNotNull(config.getProperty("java.version"));
-        assertEquals(System.getProperty("java.version"), config.getString("java.version"));
+        assertNotNull(config.getProperty("java..version"));
+        assertEquals(System.getProperty("java.version"), config.getString("java..version"));
 
         // test EnvironmentConfiguration
         assertNotNull("JAVA_HOME property not found", config.getProperty("JAVA_HOME"));
@@ -934,7 +938,7 @@
         System.getProperties().remove("Id");
 
         CombinedConfiguration config = factory.getConfiguration(true);
-        List<AbstractConfiguration> list = config.getConfigurations();
+        List<AbstractHierarchicalConfiguration<?>> list = config.getConfigurations();
         assertTrue("Incorrect number of configurations - " + list.size(), list.size() == 4);
         for (AbstractConfiguration conf : list)
         {
@@ -967,7 +971,7 @@
         FileSystem fs = factory.getFileSystem();
         assertNotNull("No File System",fs);
         assertTrue("Incorrect File System", fs instanceof VFSFileSystem);
-        List<AbstractConfiguration> list = config.getConfigurations();
+        List<AbstractHierarchicalConfiguration<?>> list = config.getConfigurations();
         assertTrue("Incorrect number of configurations - " + list.size(), list.size() == 4);
         for (Configuration conf : list)
         {



Mime
View raw message