commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1406255 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/event/ test/java/org/apache/commons/configuration/ test/java/org/apache/commons/configuration/bean...
Date Tue, 06 Nov 2012 18:04:50 GMT
Author: oheger
Date: Tue Nov  6 18:04:49 2012
New Revision: 1406255

URL: http://svn.apache.org/viewvc?rev=1406255&view=rev
Log:
Extracted interfaces for HierarchicalConfiguration and ImmutableHierarchicalConfiguration.

Added:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
      - copied, changed from r1396283, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java   (with props)
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java   (with props)
Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationFactory.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestHierarchicalConfigurationEvents.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/AbstractCombinerTest.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java Tue Nov  6 18:04:49 2012
@@ -1216,7 +1216,7 @@ public abstract class AbstractConfigurat
      * hierarchical configurations because it is not able to copy information
      * about the properties' structure (i.e. the parent-child-relationships will
      * get lost). So when dealing with hierarchical configuration objects their
-     * {@link HierarchicalConfiguration#clone() clone()} methods
+     * {@link BaseHierarchicalConfiguration#clone() clone()} methods
      * should be used.
      *
      * @param c the configuration to copy (can be <b>null</b>, then this
@@ -1257,7 +1257,7 @@ public abstract class AbstractConfigurat
      * copy information about the properties' structure (i.e. the
      * parent-child-relationships will get lost). So when dealing with
      * hierarchical configuration objects their
-     * {@link HierarchicalConfiguration#clone() clone()} methods
+     * {@link BaseHierarchicalConfiguration#clone() clone()} methods
      * should be used.
      *
      * @param c the configuration to be appended (can be <b>null</b>, then this

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractHierarchicalFileConfiguration.java Tue Nov  6 18:04:49 2012
@@ -48,7 +48,7 @@ import org.apache.commons.configuration.
  * @version $Id$
  */
 public abstract class AbstractHierarchicalFileConfiguration
-extends HierarchicalConfiguration
+extends BaseHierarchicalConfiguration
 implements FileConfiguration, ConfigurationListener, ConfigurationErrorListener, FileSystemBased,
         Reloadable
 {

Copied: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java (from r1396283, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java?p2=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java&p1=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java&r1=1396283&r2=1406255&rev=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java Tue Nov  6 18:04:49 2012
@@ -81,7 +81,7 @@ import org.apache.commons.configuration.
  * </pre>
  *
  * </p><p>If this document is parsed and stored in a
- * {@code HierarchicalConfiguration} object (which can be done by one of
+ * {@code BaseHierarchicalConfiguration} object (which can be done by one of
  * the sub classes), there are enhanced possibilities of accessing properties.
  * The keys for querying information can contain indices that select a certain
  * element if there are multiple hits.</p><p>For instance the key
@@ -99,7 +99,7 @@ import org.apache.commons.configuration.
  * configurations support an <em>expression engine</em>. This expression engine
  * is responsible for evaluating the passed in configuration keys and map them
  * to the stored properties. The examples above are valid for the default
- * expression engine, which is used when a new {@code HierarchicalConfiguration}
+ * expression engine, which is used when a new {@code BaseHierarchicalConfiguration}
  * instance is created. With the {@code setExpressionEngine()} method a
  * different expression engine can be set. For instance with
  * {@link org.apache.commons.configuration.tree.xpath.XPathExpressionEngine}
@@ -121,10 +121,10 @@ import org.apache.commons.configuration.
  * by multiple threads. However if one of these threads modifies the object,
  * synchronization has to be performed manually.</p>
  *
- * @author Oliver Heger
  * @version $Id$
  */
-public class HierarchicalConfiguration extends AbstractConfiguration implements Serializable, Cloneable
+public class BaseHierarchicalConfiguration extends AbstractConfiguration
+    implements Serializable, Cloneable, HierarchicalConfiguration
 {
     /**
      * Constant for the clear tree event.
@@ -159,15 +159,15 @@ public class HierarchicalConfiguration e
     private transient ExpressionEngine expressionEngine;
 
     /**
-     * Creates a new instance of {@code HierarchicalConfiguration}.
+     * Creates a new instance of {@code BaseHierarchicalConfiguration}.
      */
-    public HierarchicalConfiguration()
+    public BaseHierarchicalConfiguration()
     {
         setRootNode(new DefaultConfigurationNode());
     }
 
     /**
-     * Creates a new instance of {@code HierarchicalConfiguration} and
+     * Creates a new instance of {@code BaseHierarchicalConfiguration} and
      * copies all data contained in the specified configuration into the new
      * one.
      *
@@ -175,7 +175,7 @@ public class HierarchicalConfiguration e
      * constructor will behave like the standard constructor)
      * @since 1.4
      */
-    public HierarchicalConfiguration(HierarchicalConfiguration c)
+    public BaseHierarchicalConfiguration(HierarchicalConfiguration c)
     {
         this();
         if (c != null)
@@ -343,7 +343,7 @@ public class HierarchicalConfiguration e
      * tree. This method works similar to {@code addProperty()}, but
      * instead of a single property a whole collection of nodes can be added -
      * and thus complete configuration sub trees. E.g. with this method it is
-     * possible to add parts of another {@code HierarchicalConfiguration}
+     * possible to add parts of another {@code BaseHierarchicalConfiguration}
      * object to this object. (However be aware that a
      * {@code ConfigurationNode} object can only belong to a single
      * configuration. So if nodes from one configuration are directly added to
@@ -416,7 +416,7 @@ public class HierarchicalConfiguration e
     /**
      * Creates a new {@code Configuration} object containing all keys
      * that start with the specified prefix. This implementation will return a
-     * {@code HierarchicalConfiguration} object so that the structure of
+     * {@code BaseHierarchicalConfiguration} object so that the structure of
      * the keys will be saved. The nodes selected by the prefix (it is possible
      * that multiple nodes are selected) are mapped to the root node of the
      * returned configuration, i.e. their children and attributes will become
@@ -437,11 +437,11 @@ public class HierarchicalConfiguration e
         Collection<ConfigurationNode> nodes = fetchNodeList(prefix);
         if (nodes.isEmpty())
         {
-            return new HierarchicalConfiguration();
+            return new BaseHierarchicalConfiguration();
         }
 
-        final HierarchicalConfiguration parent = this;
-        HierarchicalConfiguration result = new HierarchicalConfiguration()
+        final BaseHierarchicalConfiguration parent = this;
+        BaseHierarchicalConfiguration result = new BaseHierarchicalConfiguration()
         {
             // Override interpolate to always interpolate on the parent
             @Override
@@ -479,7 +479,7 @@ public class HierarchicalConfiguration e
         {
             result.getRootNode().setValue(value);
         }
-        return (result.isEmpty()) ? new HierarchicalConfiguration() : result;
+        return (result.isEmpty()) ? new BaseHierarchicalConfiguration() : result;
     }
 
     /**
@@ -572,7 +572,7 @@ public class HierarchicalConfiguration e
      * List fields = config.configurationsAt("tables.table(0).fields.field");
      * for(Iterator it = fields.iterator(); it.hasNext();)
      * {
-     *     HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();
+     *     BaseHierarchicalConfiguration sub = (BaseHierarchicalConfiguration) it.next();
      *     // now the children and attributes of the field node can be
      *     // directly accessed
      *     String fieldName = sub.getString("name");
@@ -857,7 +857,7 @@ public class HierarchicalConfiguration e
     {
         try
         {
-            HierarchicalConfiguration copy = (HierarchicalConfiguration) super
+            BaseHierarchicalConfiguration copy = (BaseHierarchicalConfiguration) super
                     .clone();
 
             // clone the nodes, too
@@ -887,7 +887,7 @@ public class HierarchicalConfiguration e
     @Override
     public Configuration interpolatedConfiguration()
     {
-        HierarchicalConfiguration c = (HierarchicalConfiguration) clone();
+        BaseHierarchicalConfiguration c = (BaseHierarchicalConfiguration) clone();
         c.getRootNode().visit(new ConfigurationNodeVisitorAdapter()
         {
             @Override

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationFactory.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationFactory.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationFactory.java Tue Nov  6 18:04:49 2012
@@ -791,7 +791,7 @@ public class ConfigurationFactory
         /**
          * Creates a configuration object with the union of all properties
          * defined in the <code>&lt;additional&gt;</code> section. This
-         * implementation returns a {@code HierarchicalConfiguration}
+         * implementation returns a {@code BaseHierarchicalConfiguration}
          * object.
          *
          * @param configs a collection with
@@ -800,7 +800,7 @@ public class ConfigurationFactory
          */
         protected Configuration createAdditionalConfiguration(Collection<AdditionalConfigurationData> configs)
         {
-            HierarchicalConfiguration result = new HierarchicalConfiguration();
+            BaseHierarchicalConfiguration result = new BaseHierarchicalConfiguration();
 
             for (AdditionalConfigurationData cdata : configs)
             {
@@ -819,7 +819,7 @@ public class ConfigurationFactory
          */
         private ConfigurationNode createRootNode(AdditionalConfigurationData cdata)
         {
-            if (cdata.getConfiguration() instanceof HierarchicalConfiguration)
+            if (cdata.getConfiguration() instanceof BaseHierarchicalConfiguration)
             {
                 // we can directly use this configuration's root node
                 return ((HierarchicalConfiguration) cdata.getConfiguration()).getRootNode();
@@ -827,7 +827,7 @@ public class ConfigurationFactory
             else
             {
                 // transform configuration to a hierarchical root node
-                HierarchicalConfiguration hc = new HierarchicalConfiguration();
+                BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
                 ConfigurationUtils.copy(cdata.getConfiguration(), hc);
                 return hc.getRootNode();
             }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java Tue Nov  6 18:04:49 2012
@@ -188,7 +188,7 @@ public final class ConfigurationUtils
      * and only if the passed in configuration is <b>null</b>)
      * @since 1.3
      */
-    public static HierarchicalConfiguration convertToHierarchical(
+    public static BaseHierarchicalConfiguration convertToHierarchical(
             Configuration conf)
     {
         return convertToHierarchical(conf, null);
@@ -217,7 +217,7 @@ public final class ConfigurationUtils
      *         and only if the passed in configuration is <b>null</b>)
      * @since 1.6
      */
-    public static HierarchicalConfiguration convertToHierarchical(
+    public static BaseHierarchicalConfiguration convertToHierarchical(
             Configuration conf, ExpressionEngine engine)
     {
         if (conf == null)
@@ -225,20 +225,20 @@ public final class ConfigurationUtils
             return null;
         }
 
-        if (conf instanceof HierarchicalConfiguration)
+        if (conf instanceof BaseHierarchicalConfiguration)
         {
-            HierarchicalConfiguration hc;
+            BaseHierarchicalConfiguration hc;
             if (conf instanceof Reloadable)
             {
                 Object lock = ((Reloadable) conf).getReloadLock();
                 synchronized (lock)
                 {
-                    hc = new HierarchicalConfiguration((HierarchicalConfiguration) conf);
+                    hc = new BaseHierarchicalConfiguration((HierarchicalConfiguration) conf);
                 }
             }
             else
             {
-                hc = (HierarchicalConfiguration) conf;
+                hc = (BaseHierarchicalConfiguration) conf;
             }
             if (engine != null)
             {
@@ -249,7 +249,7 @@ public final class ConfigurationUtils
         }
         else
         {
-            HierarchicalConfiguration hc = new HierarchicalConfiguration();
+            BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
             if (engine != null)
             {
                 hc.setExpressionEngine(engine);

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java Tue Nov  6 18:04:49 2012
@@ -698,7 +698,7 @@ public class DefaultConfigurationBuilder
      * @throws ConfigurationException if an error occurs
      */
     protected void initCombinedConfiguration(CombinedConfiguration config,
-            List<? extends HierarchicalConfiguration> containedConfigs,
+            List<? extends BaseHierarchicalConfiguration> containedConfigs,
             String keyListNodes) throws ConfigurationException
     {
         List<Object> listNodes = getList(keyListNodes);

Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java?rev=1406255&view=auto
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java (added)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java Tue Nov  6 18:04:49 2012
@@ -0,0 +1,184 @@
+/*
+ * 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.configuration;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.configuration.tree.ConfigurationNode;
+import org.apache.commons.configuration.tree.ExpressionEngine;
+
+/**
+ * <p>
+ * An interface for mutable hierarchical configurations.
+ * </p>
+ * <p>
+ * This interface introduces methods for manipulating tree-like structured
+ * configuration sources. Also, all methods defined by the
+ * {@code Configuration} interface are available.
+ * </p>
+ *
+ * @version $Id$
+ * @since 2.0
+ */
+public interface HierarchicalConfiguration
+    extends Configuration, ImmutableHierarchicalConfiguration
+{
+    /**
+     * Returns the root node of this hierarchical configuration.
+     *
+     * @return the root node
+     */
+    ConfigurationNode getRootNode();
+
+    /**
+     * Sets the root node of this hierarchical configuration.
+     *
+     * @param rootNode the root node
+     */
+    void setRootNode(ConfigurationNode rootNode);
+
+    /**
+     * Sets the expression engine to be used by this configuration. All property
+     * keys this configuration has to deal with will be interpreted by this
+     * engine.
+     *
+     * @param expressionEngine the new expression engine; can be <b>null</b>,
+     * then the default expression engine will be used
+     */
+    void setExpressionEngine(ExpressionEngine expressionEngine);
+
+    /**
+     * Adds a collection of nodes at the specified position of the configuration
+     * tree. This method works similar to {@code addProperty()}, but
+     * instead of a single property a whole collection of nodes can be added -
+     * and thus complete configuration sub trees. E.g. with this method it is
+     * possible to add parts of another {@code BaseHierarchicalConfiguration}
+     * object to this object. (However be aware that a
+     * {@code ConfigurationNode} object can only belong to a single
+     * configuration. So if nodes from one configuration are directly added to
+     * another one using this method, the structure of the source configuration
+     * will be broken. In this case you should clone the nodes to be added
+     * before calling {@code addNodes()}.) If the passed in key refers to
+     * an existing and unique node, the new nodes are added to this node.
+     * Otherwise a new node will be created at the specified position in the
+     * hierarchy.
+     *
+     * @param key the key where the nodes are to be added; can be <b>null </b>,
+     * then they are added to the root node
+     * @param nodes a collection with the {@code Node} objects to be
+     * added
+     */
+    void addNodes(String key, Collection<? extends ConfigurationNode> nodes);
+
+    /**
+     * <p>
+     * Returns a hierarchical subnode configuration object that wraps the
+     * configuration node specified by the given key. This method provides an
+     * easy means of accessing sub trees of a hierarchical configuration. In the
+     * returned configuration the sub tree can directly be accessed, it becomes
+     * the root node of this configuration. Because of this the passed in key
+     * must select exactly one configuration node; otherwise an
+     * {@code IllegalArgumentException} will be thrown.
+     * </p>
+     * <p>
+     * The difference between this method and the
+     * {@link #subset(String)} method is that
+     * {@code subset()} supports arbitrary subsets of configuration nodes
+     * while {@code configurationAt()} only returns a single sub tree.
+     * Please refer to the documentation of the
+     * {@code SubnodeConfiguration} class to obtain further information
+     * about subnode configurations and when they should be used.
+     * </p>
+     * <p>
+     * With the {@code supportUpdate} flag the behavior of the returned
+     * {@code SubnodeConfiguration} regarding updates of its parent
+     * configuration can be determined. A subnode configuration operates on the
+     * same nodes as its parent, so changes at one configuration are normally
+     * directly visible for the other configuration. There are however changes
+     * of the parent configuration, which are not recognized by the subnode
+     * configuration per default. An example for this is a reload operation (for
+     * file-based configurations): Here the complete node set of the parent
+     * configuration is replaced, but the subnode configuration still references
+     * the old nodes. If such changes should be detected by the subnode
+     * configuration, the {@code supportUpdates} flag must be set to
+     * <b>true</b>. This causes the subnode configuration to reevaluate the key
+     * used for its creation each time it is accessed. This guarantees that the
+     * subnode configuration always stays in sync with its key, even if the
+     * parent configuration's data significantly changes. If such a change
+     * makes the key invalid - because it now no longer points to exactly one
+     * node -, the subnode configuration is not reconstructed, but keeps its
+     * old data. It is then quasi detached from its parent.
+     * </p>
+     *
+     * @param key the key that selects the sub tree
+     * @param supportUpdates a flag whether the returned subnode configuration
+     * should be able to handle updates of its parent
+     * @return a hierarchical configuration that contains this sub tree
+     * @see SubnodeConfiguration
+     */
+    SubnodeConfiguration configurationAt(String key, boolean supportUpdates);
+
+    /**
+     * Returns a hierarchical subnode configuration for the node specified by
+     * the given key. This is a short form for {@code configurationAt(key,
+     * <b>false</b>)}.
+     *
+     * @param key the key that selects the sub tree
+     * @return a hierarchical configuration that contains this sub tree
+     * @see SubnodeConfiguration
+     */
+    SubnodeConfiguration configurationAt(String key);
+
+    /**
+     * Returns a list of sub configurations for all configuration nodes selected
+     * by the given key. This method will evaluate the passed in key (using the
+     * current {@code ExpressionEngine}) and then create a subnode
+     * configuration for each returned node (like
+     * {@link #configurationAt(String)}}). This is especially
+     * useful when dealing with list-like structures. As an example consider the
+     * configuration that contains data about database tables and their fields.
+     * If you need access to all fields of a certain table, you can simply do
+     *
+     * <pre>
+     * List fields = config.configurationsAt("tables.table(0).fields.field");
+     * for(Iterator it = fields.iterator(); it.hasNext();)
+     * {
+     *     BaseHierarchicalConfiguration sub = (BaseHierarchicalConfiguration) it.next();
+     *     // now the children and attributes of the field node can be
+     *     // directly accessed
+     *     String fieldName = sub.getString("name");
+     *     String fieldType = sub.getString("type");
+     *     ...
+     * </pre>
+     *
+     * @param key the key for selecting the desired nodes
+     * @return a list with hierarchical configuration objects; each
+     * configuration represents one of the nodes selected by the passed in key
+     */
+    List<SubnodeConfiguration> configurationsAt(String key);
+
+    /**
+     * Removes all values of the property with the given name and of keys that
+     * start with this name. So if there is a property with the key
+     * &quot;foo&quot; and a property with the key &quot;foo.bar&quot;, a call
+     * of {@code clearTree("foo")} would remove both properties.
+     *
+     * @param key the key of the property to be removed
+     */
+    void clearTree(String key);
+}

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java Tue Nov  6 18:04:49 2012
@@ -29,7 +29,7 @@ import org.apache.commons.configuration.
  * @since 1.7
  * @version $Id$
  */
-public class HierarchicalReloadableConfiguration extends HierarchicalConfiguration
+public class HierarchicalReloadableConfiguration extends BaseHierarchicalConfiguration
     implements Reloadable
 {
     /** Constant for the name used for the lock object. */

Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java?rev=1406255&view=auto
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java (added)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java Tue Nov  6 18:04:49 2012
@@ -0,0 +1,61 @@
+/*
+ * 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.configuration;
+
+import org.apache.commons.configuration.tree.ExpressionEngine;
+
+/**
+ * <p>
+ * An interface for immutable hierarchical configurations.
+ * </p>
+ * <p>
+ * There are some sources of configuration data that cannot be stored very well
+ * in a flat configuration object (like {@link BaseConfiguration}) because then
+ * their structure is lost. A prominent example are XML documents.
+ * </p>
+ * <p>
+ * This interface extends the basic {@link ImmutableConfiguration} interface by
+ * structured access to configuration properties. An {@link ExpressionEngine} is
+ * used to evaluate complex property keys and to map them to nodes of a
+ * tree-like structure.
+ * </p>
+ *
+ * @version $Id$
+ * @since 2.0
+ */
+public interface ImmutableHierarchicalConfiguration extends ImmutableConfiguration
+{
+    /**
+     * Returns the expression engine used by this configuration. This method
+     * will never return <b>null</b>; if no specific expression engine was set,
+     * the default expression engine will be returned.
+     *
+     * @return the current expression engine
+     */
+    ExpressionEngine getExpressionEngine();
+
+    /**
+     * Returns the maximum defined index for the given key. This is useful if
+     * there are multiple values for this key. They can then be addressed
+     * separately by specifying indices from 0 to the return value of this
+     * method.
+     *
+     * @param key the key to be checked
+     * @return the maximum defined index for this key
+     */
+    int getMaxIndex(String key);
+}

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableHierarchicalConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java Tue Nov  6 18:04:49 2012
@@ -31,7 +31,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.tree.ExpressionEngine;
 
 /**
- * Wraps a HierarchicalConfiguration and allows subtrees to be access via a configured path with
+ * Wraps a BaseHierarchicalConfiguration and allows subtrees to be access via a configured path with
  * replaceable tokens derived from the ConfigurationInterpolator. When used with injection frameworks
  * such as Spring it allows components to be injected with subtrees of the configuration.
  * @since 1.6
@@ -487,7 +487,7 @@ public class PatternSubtreeConfiguration
         }
     }
 
-    private HierarchicalConfiguration getConfig()
+    private BaseHierarchicalConfiguration getConfig()
     {
         return config.configurationAt(makePath());
     }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java Tue Nov  6 18:04:49 2012
@@ -72,8 +72,8 @@ import org.apache.commons.configuration.
  * instance a subnode configuration is only used for a temporary convenient
  * access to a complex configuration, there is no need to make it aware for
  * structural changes of its parent. If a subnode configuration is created
- * using the {@link HierarchicalConfiguration#configurationAt(String, boolean)
- * configurationAt()} method of {@code HierarchicalConfiguration}
+ * using the {@link BaseHierarchicalConfiguration#configurationAt(String, boolean)
+ * configurationAt()} method of {@code BaseHierarchicalConfiguration}
  * (which should be the preferred way), with an additional boolean parameter it
  * can be specified whether the resulting subnode configuration should be
  * aware of structural changes or not. Then the configuration key will be
@@ -124,7 +124,7 @@ public class SubnodeConfiguration extend
     private static final long serialVersionUID = 3105734147019386480L;
 
     /** Stores the parent configuration. */
-    private HierarchicalConfiguration parent;
+    private BaseHierarchicalConfiguration parent;
 
     /** Stores the key that was used to construct this configuration.*/
     private String subnodeKey;
@@ -136,7 +136,7 @@ public class SubnodeConfiguration extend
      * @param parent the parent configuration
      * @param root the root node of this subnode configuration
      */
-    public SubnodeConfiguration(HierarchicalConfiguration parent, ConfigurationNode root)
+    public SubnodeConfiguration(BaseHierarchicalConfiguration parent, ConfigurationNode root)
     {
         super(parent instanceof Reloadable ? ((Reloadable) parent).getReloadLock() : null);
         if (parent == null)
@@ -159,7 +159,7 @@ public class SubnodeConfiguration extend
      *
      * @return the parent configuration
      */
-    public HierarchicalConfiguration getParent()
+    public BaseHierarchicalConfiguration getParent()
     {
         return parent;
     }
@@ -341,7 +341,7 @@ public class SubnodeConfiguration extend
      *
      * @param parentConfig the parent configuration
      */
-    protected void initFromParent(HierarchicalConfiguration parentConfig)
+    protected void initFromParent(BaseHierarchicalConfiguration parentConfig)
     {
         setExpressionEngine(parentConfig.getExpressionEngine());
         setListDelimiter(parentConfig.getListDelimiter());

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java Tue Nov  6 18:04:49 2012
@@ -49,7 +49,7 @@ import java.util.concurrent.CopyOnWriteA
  * (which is the default), detail events are suppressed, so only property set
  * events will be received. Note that the number of received detail events may
  * differ for different configuration implementations.
- * {@link org.apache.commons.configuration.HierarchicalConfiguration HierarchicalConfiguration}
+ * {@link org.apache.commons.configuration.BaseHierarchicalConfiguration BaseHierarchicalConfiguration}
  * for instance has a custom implementation of {@code setProperty()},
  * which does not generate any detail events.
  * </p>

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java Tue Nov  6 18:04:49 2012
@@ -531,7 +531,7 @@ public class TestCombinedConfiguration
      */
     private void setUpSourceTest()
     {
-        HierarchicalConfiguration c1 = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration c1 = new BaseHierarchicalConfiguration();
         PropertiesConfiguration c2 = new PropertiesConfiguration();
         c1.addProperty(TEST_KEY, TEST_NAME);
         c2.addProperty("another.key", "test");
@@ -954,7 +954,7 @@ public class TestCombinedConfiguration
      */
     private AbstractConfiguration setUpTestConfiguration()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config.addProperty(TEST_KEY, Boolean.TRUE);
         config.addProperty("test.comment", "This is a test");
         return config;

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java Tue Nov  6 18:04:49 2012
@@ -263,7 +263,7 @@ public class TestConfigurationUtils
             conf.addProperty("test.list", "item" + i);
         }
 
-        HierarchicalConfiguration hc = ConfigurationUtils
+        BaseHierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(conf);
         for (Iterator<String> it = conf.getKeys(); it.hasNext();)
         {
@@ -280,7 +280,7 @@ public class TestConfigurationUtils
     @Test
     public void testConvertHierarchicalToHierarchical()
     {
-        Configuration conf = new HierarchicalConfiguration();
+        Configuration conf = new BaseHierarchicalConfiguration();
         conf.addProperty("test", "yes");
         assertSame("Wrong configuration returned", conf, ConfigurationUtils
                 .convertToHierarchical(conf));
@@ -308,7 +308,7 @@ public class TestConfigurationUtils
         conf.addProperty("test.key", "1\\,2\\,3");
         assertEquals("Wrong property value", "1,2,3", conf
                 .getString("test.key"));
-        HierarchicalConfiguration hc = ConfigurationUtils
+        BaseHierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(conf);
         assertEquals("Escaped list delimiters not correctly handled", "1,2,3",
                 hc.getString("test.key"));
@@ -327,7 +327,7 @@ public class TestConfigurationUtils
         DefaultExpressionEngine engine = new DefaultExpressionEngine();
         engine.setIndexStart("[");
         engine.setIndexEnd("]");
-        HierarchicalConfiguration hc = ConfigurationUtils
+        BaseHierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(conf, engine);
         assertTrue("Wrong value for test(a)", hc.getBoolean("test(a)"));
         assertFalse("Wrong value for test(b)", hc.getBoolean("test(b)"));
@@ -340,7 +340,7 @@ public class TestConfigurationUtils
     @Test
     public void testConvertHierarchicalToHierarchicalEngine()
     {
-        HierarchicalConfiguration hc = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
         ExpressionEngine engine = new DefaultExpressionEngine();
         assertSame("Created new configuration", hc, ConfigurationUtils
                 .convertToHierarchical(hc, engine));
@@ -355,7 +355,7 @@ public class TestConfigurationUtils
     @Test
     public void testConvertHierarchicalToHierarchicalNullEngine()
     {
-        HierarchicalConfiguration hc = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
         ExpressionEngine engine = new DefaultExpressionEngine();
         hc.setExpressionEngine(engine);
         assertSame("Created new configuration", hc, ConfigurationUtils
@@ -373,7 +373,7 @@ public class TestConfigurationUtils
     {
         BaseConfiguration config = new BaseConfiguration();
         config.addProperty("test", "1,2,3");
-        HierarchicalConfiguration hc = ConfigurationUtils
+        BaseHierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(config);
         assertEquals("Wrong value 1", 1, hc.getInt("test(0)"));
         assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));
@@ -386,9 +386,9 @@ public class TestConfigurationUtils
     @Test
     public void testCloneConfiguration()
     {
-        HierarchicalConfiguration conf = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration conf = new BaseHierarchicalConfiguration();
         conf.addProperty("test", "yes");
-        HierarchicalConfiguration copy = (HierarchicalConfiguration) ConfigurationUtils
+        BaseHierarchicalConfiguration copy = (BaseHierarchicalConfiguration) ConfigurationUtils
                 .cloneConfiguration(conf);
         assertNotSame("Same object was returned", conf, copy);
         assertEquals("Property was not cloned", "yes", copy.getString("test"));

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java Tue Nov  6 18:04:49 2012
@@ -44,7 +44,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * Test class for HierarchicalConfiguration.
+ * Test class for BaseHierarchicalConfiguration.
  *
  * @version $Id$
  */
@@ -58,7 +58,7 @@ public class TestHierarchicalConfigurati
         { "docid", "name", "creationDate", "authorID", "version" }
     };
 
-    private HierarchicalConfiguration config;
+    private BaseHierarchicalConfiguration config;
 
     @Before
     public void setUp() throws Exception
@@ -75,7 +75,7 @@ public class TestHierarchicalConfigurati
          *             field
          *                 name
          */
-        config = new HierarchicalConfiguration();
+        config = new BaseHierarchicalConfiguration();
         ConfigurationNode nodeTables = createNode("tables", null);
         for(int i = 0; i < tables.length; i++)
         {
@@ -114,7 +114,7 @@ public class TestHierarchicalConfigurati
     public void testIsEmpty()
     {
         assertFalse(config.isEmpty());
-        HierarchicalConfiguration conf2 = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration conf2 = new BaseHierarchicalConfiguration();
         assertTrue(conf2.isEmpty());
         ConfigurationNode child1 = new DefaultConfigurationNode("child1");
         ConfigurationNode child2 = new DefaultConfigurationNode("child2");
@@ -547,7 +547,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testConfigurationAt()
     {
-        HierarchicalConfiguration subConfig = config
+        BaseHierarchicalConfiguration subConfig = config
                 .configurationAt("tables.table(1)");
         assertEquals("Wrong table name", tables[1], subConfig.getString("name"));
         List<Object> lstFlds = subConfig.getList("fields.field.name");
@@ -631,7 +631,7 @@ public class TestHierarchicalConfigurati
         assertEquals("Wrong size of fields", fields[1].length, lstFlds.size());
         for (int i = 0; i < fields[1].length; i++)
         {
-            HierarchicalConfiguration sub = lstFlds.get(i);
+            BaseHierarchicalConfiguration sub = lstFlds.get(i);
             assertEquals("Wrong field at position " + i, fields[1][i], sub
                     .getString("name"));
         }
@@ -652,7 +652,7 @@ public class TestHierarchicalConfigurati
     public void testClone()
     {
         Configuration copy = (Configuration) config.clone();
-        assertTrue(copy instanceof HierarchicalConfiguration);
+        assertTrue(copy instanceof BaseHierarchicalConfiguration);
         checkContent(copy);
     }
 
@@ -670,7 +670,7 @@ public class TestHierarchicalConfigurati
                 // just a dummy
             }
         });
-        HierarchicalConfiguration copy = (HierarchicalConfiguration) config
+        BaseHierarchicalConfiguration copy = (BaseHierarchicalConfiguration) config
                 .clone();
         assertTrue("Event listener registered at clone", copy
                 .getConfigurationListeners().isEmpty());
@@ -726,7 +726,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testAddNodesCopy()
     {
-        HierarchicalConfiguration configDest = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration configDest = new BaseHierarchicalConfiguration();
         configDest.addProperty("test", "TEST");
         Collection<ConfigurationNode> nodes = config.getRootNode().getChildren();
         assertEquals("Wrong number of children", 1, nodes.size());
@@ -769,7 +769,7 @@ public class TestHierarchicalConfigurati
     {
         config.setExpressionEngine(null);
         assertNotNull("Expression engine is null", config.getExpressionEngine());
-        assertSame("Default engine is not used", HierarchicalConfiguration
+        assertSame("Default engine is not used", BaseHierarchicalConfiguration
                 .getDefaultExpressionEngine(), config.getExpressionEngine());
 
         config.setExpressionEngine(createAlternativeExpressionEngine());
@@ -783,11 +783,11 @@ public class TestHierarchicalConfigurati
     @Test
     public void testSetDefaultExpressionEngine()
     {
-        ExpressionEngine engineOld = HierarchicalConfiguration.getDefaultExpressionEngine();
-        HierarchicalConfiguration
+        ExpressionEngine engineOld = BaseHierarchicalConfiguration.getDefaultExpressionEngine();
+        BaseHierarchicalConfiguration
                 .setDefaultExpressionEngine(createAlternativeExpressionEngine());
         checkAlternativeSyntax();
-        HierarchicalConfiguration.setDefaultExpressionEngine(engineOld);
+        BaseHierarchicalConfiguration.setDefaultExpressionEngine(engineOld);
     }
 
     /**
@@ -797,7 +797,7 @@ public class TestHierarchicalConfigurati
     @Test(expected = IllegalArgumentException.class)
     public void testSetDefaultExpressionEngineNull()
     {
-        HierarchicalConfiguration.setDefaultExpressionEngine(null);
+        BaseHierarchicalConfiguration.setDefaultExpressionEngine(null);
     }
 
     /**
@@ -806,7 +806,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testInitCopy()
     {
-        HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
+        BaseHierarchicalConfiguration copy = new BaseHierarchicalConfiguration(config);
         checkContent(copy);
     }
 
@@ -817,7 +817,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testInitCopyUpdate()
     {
-        HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
+        BaseHierarchicalConfiguration copy = new BaseHierarchicalConfiguration(config);
         config.setProperty("tables.table(0).name", "NewTable");
         checkContent(copy);
     }
@@ -945,7 +945,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testInterpolatedConfiguration()
     {
-        HierarchicalConfiguration c = (HierarchicalConfiguration) InterpolationTestHelper
+        BaseHierarchicalConfiguration c = (BaseHierarchicalConfiguration) InterpolationTestHelper
                 .testInterpolatedConfiguration(config);
 
         // tests whether the hierarchical structure has been maintained
@@ -959,7 +959,7 @@ public class TestHierarchicalConfigurati
     @Test
     public void testInitCopyNull()
     {
-        HierarchicalConfiguration copy = new HierarchicalConfiguration(null);
+        BaseHierarchicalConfiguration copy = new BaseHierarchicalConfiguration(null);
         assertTrue("Configuration not empty", copy.isEmpty());
     }
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java Tue Nov  6 18:04:49 2012
@@ -70,7 +70,7 @@ public class TestSubnodeConfiguration
     public TemporaryFolder folder = new TemporaryFolder();
 
     /** The parent configuration. */
-    private HierarchicalConfiguration parent;
+    private BaseHierarchicalConfiguration parent;
 
     /** The subnode configuration to be tested. */
     private SubnodeConfiguration config;
@@ -428,7 +428,7 @@ public class TestSubnodeConfiguration
         {
             assertEquals("Wrong configuration", config, e.getSource());
             assertEquals("Wrong event type",
-                    HierarchicalConfiguration.EVENT_SUBNODE_CHANGED, e
+                    BaseHierarchicalConfiguration.EVENT_SUBNODE_CHANGED, e
                             .getType());
             assertNull("Got a property name", e.getPropertyName());
             assertNull("Got a property value", e.getPropertyValue());
@@ -557,9 +557,9 @@ public class TestSubnodeConfiguration
      *
      * @return the parent configuration
      */
-    protected HierarchicalConfiguration setUpParentConfig()
+    protected BaseHierarchicalConfiguration setUpParentConfig()
     {
-        HierarchicalConfiguration conf = new HierarchicalConfiguration()
+        BaseHierarchicalConfiguration conf = new BaseHierarchicalConfiguration()
         {
             /**
              * Serial version UID.

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java Tue Nov  6 18:04:49 2012
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTru
 
 import java.util.Map;
 
+import org.apache.commons.configuration.BaseHierarchicalConfiguration;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.SubnodeConfiguration;
 import org.apache.commons.configuration.tree.ConfigurationNode;
@@ -84,7 +85,7 @@ public class TestXMLBeanDeclaration
     @Test(expected = IllegalArgumentException.class)
     public void testInitFromNullNode()
     {
-        decl = new XMLBeanDeclaration(new HierarchicalConfiguration().configurationAt(null),
+        decl = new XMLBeanDeclaration(new BaseHierarchicalConfiguration().configurationAt(null),
                 (ConfigurationNode) null);
     }
 
@@ -115,7 +116,7 @@ public class TestXMLBeanDeclaration
     @Test(expected = IllegalArgumentException.class)
     public void testInitFromNullConfigurationAndNode()
     {
-        decl = new XMLBeanDeclaration(null, new HierarchicalConfiguration()
+        decl = new XMLBeanDeclaration(null, new BaseHierarchicalConfiguration()
                 .getRootNode());
     }
 
@@ -125,7 +126,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanClassName()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config.addProperty(KEY + "[@config-class]", getClass().getName());
         decl = new XMLBeanDeclaration(config, KEY);
         assertEquals("Wrong class name", getClass().getName(), decl
@@ -138,7 +139,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanClassNameUndefined()
     {
-        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
+        decl = new XMLBeanDeclaration(new BaseHierarchicalConfiguration());
         assertNull(decl.getBeanClassName());
     }
 
@@ -148,7 +149,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanFactoryName()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config.addProperty(KEY + "[@config-factory]", "myFactory");
         decl = new XMLBeanDeclaration(config, KEY);
         assertEquals("Wrong factory name", "myFactory", decl
@@ -161,7 +162,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanFactoryNameUndefined()
     {
-        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
+        decl = new XMLBeanDeclaration(new BaseHierarchicalConfiguration());
         assertNull(decl.getBeanFactoryName());
     }
 
@@ -171,7 +172,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanFactoryParameter()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config
                 .addProperty(KEY + "[@config-factoryParam]",
                         "myFactoryParameter");
@@ -186,7 +187,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanFactoryParameterUndefined()
     {
-        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
+        decl = new XMLBeanDeclaration(new BaseHierarchicalConfiguration());
         assertNull(decl.getBeanFactoryParameter());
     }
 
@@ -197,7 +198,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanProperties()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         decl = new XMLBeanDeclaration(config, KEY);
         checkProperties(decl, TEST_PROPS, TEST_VALUES);
@@ -210,7 +211,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanPropertiesWithReservedAttributes()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         config.addProperty(KEY + "[@config-testattr]", "yes");
         config.addProperty(KEY + "[@config-anothertest]", "this, too");
@@ -224,7 +225,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetBeanPropertiesEmpty()
     {
-        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
+        decl = new XMLBeanDeclaration(new BaseHierarchicalConfiguration());
         Map<String, Object> props = decl.getBeanProperties();
         assertTrue("Properties found", props == null || props.isEmpty());
     }
@@ -235,7 +236,7 @@ public class TestXMLBeanDeclaration
      */
     private HierarchicalConfiguration prepareNestedBeanDeclarations()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         for (int i = 0; i < COMPLEX_PROPS.length; i++)
         {
@@ -305,7 +306,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetNestedBeanDeclarationsEmpty()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         decl = new XMLBeanDeclaration(config, KEY);
         Map<String, Object> nested = decl.getNestedBeanDeclarations();
@@ -319,7 +320,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testGetInterpolatedBeanProperties()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         String[] varValues = new String[TEST_PROPS.length];
         for(int i = 0; i < TEST_PROPS.length; i++)
         {
@@ -338,7 +339,7 @@ public class TestXMLBeanDeclaration
     @Test(expected = IllegalArgumentException.class)
     public void testInitFromUndefinedKey()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         decl = new XMLBeanDeclaration(config, "undefined_key");
     }
@@ -352,7 +353,7 @@ public class TestXMLBeanDeclaration
     @Test
     public void testInitFromUndefinedKeyOptional()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
         decl = new XMLBeanDeclaration(config, "undefined_key", true);
         assertNull("Found a bean class", decl.getBeanClassName());
@@ -365,7 +366,7 @@ public class TestXMLBeanDeclaration
     @Test(expected = IllegalArgumentException.class)
     public void testInitFromMultiValueKey()
     {
-        HierarchicalConfiguration config = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config.addProperty(KEY, "myFirstKey");
         config.addProperty(KEY, "mySecondKey");
         decl = new XMLBeanDeclaration(config, KEY);
@@ -380,7 +381,7 @@ public class TestXMLBeanDeclaration
      * @param names an array with the names of the properties
      * @param values an array with the corresponding values
      */
-    private void setupBeanDeclaration(HierarchicalConfiguration config,
+    private void setupBeanDeclaration(BaseHierarchicalConfiguration config,
             String key, String[] names, String[] values)
     {
         for (int i = 0; i < names.length; i++)

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestHierarchicalConfigurationEvents.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestHierarchicalConfigurationEvents.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestHierarchicalConfigurationEvents.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/event/TestHierarchicalConfigurationEvents.java Tue Nov  6 18:04:49 2012
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.BaseHierarchicalConfiguration;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.SubnodeConfiguration;
 import org.apache.commons.configuration.tree.ConfigurationNode;
@@ -40,7 +41,7 @@ public class TestHierarchicalConfigurati
     @Override
     protected AbstractConfiguration createConfiguration()
     {
-        return new HierarchicalConfiguration();
+        return new BaseHierarchicalConfiguration();
     }
 
     /**
@@ -54,9 +55,9 @@ public class TestHierarchicalConfigurati
         Collection<ConfigurationNode> nodes = hc.getExpressionEngine()
                 .query(hc.getRootNode(), key);
         hc.clearTree(key);
-        l.checkEvent(HierarchicalConfiguration.EVENT_CLEAR_TREE, key, null,
+        l.checkEvent(BaseHierarchicalConfiguration.EVENT_CLEAR_TREE, key, null,
                 true);
-        l.checkEvent(HierarchicalConfiguration.EVENT_CLEAR_TREE, key, nodes,
+        l.checkEvent(BaseHierarchicalConfiguration.EVENT_CLEAR_TREE, key, nodes,
                 false);
         l.done();
     }
@@ -71,9 +72,9 @@ public class TestHierarchicalConfigurati
         Collection<ConfigurationNode> nodes = new ArrayList<ConfigurationNode>(1);
         nodes.add(new DefaultConfigurationNode("a_key", TEST_PROPVALUE));
         hc.addNodes(TEST_PROPNAME, nodes);
-        l.checkEvent(HierarchicalConfiguration.EVENT_ADD_NODES, TEST_PROPNAME,
+        l.checkEvent(BaseHierarchicalConfiguration.EVENT_ADD_NODES, TEST_PROPNAME,
                 nodes, true);
-        l.checkEvent(HierarchicalConfiguration.EVENT_ADD_NODES, TEST_PROPNAME,
+        l.checkEvent(BaseHierarchicalConfiguration.EVENT_ADD_NODES, TEST_PROPNAME,
                 nodes, false);
         l.done();
     }
@@ -101,10 +102,10 @@ public class TestHierarchicalConfigurati
                 .configurationAt(EXIST_PROPERTY);
         sub.addProperty("newProp", "newValue");
         checkSubnodeEvent(l
-                .nextEvent(HierarchicalConfiguration.EVENT_SUBNODE_CHANGED),
+                .nextEvent(BaseHierarchicalConfiguration.EVENT_SUBNODE_CHANGED),
                 true);
         checkSubnodeEvent(l
-                .nextEvent(HierarchicalConfiguration.EVENT_SUBNODE_CHANGED),
+                .nextEvent(BaseHierarchicalConfiguration.EVENT_SUBNODE_CHANGED),
                 false);
         l.done();
     }
@@ -124,7 +125,7 @@ public class TestHierarchicalConfigurati
         ConfigurationEvent evSub = (ConfigurationEvent) event
                 .getPropertyValue();
         assertEquals("Wrong event type",
-                HierarchicalConfiguration.EVENT_ADD_PROPERTY, evSub.getType());
+                BaseHierarchicalConfiguration.EVENT_ADD_PROPERTY, evSub.getType());
         assertEquals("Wrong property name", "newProp", evSub.getPropertyName());
         assertEquals("Wrong property value", "newValue", evSub
                 .getPropertyValue());

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/AbstractCombinerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/AbstractCombinerTest.java?rev=1406255&r1=1406254&r2=1406255&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/AbstractCombinerTest.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/AbstractCombinerTest.java Tue Nov  6 18:04:49 2012
@@ -23,7 +23,7 @@ import java.io.File;
 
 import org.apache.commons.configuration.ConfigurationAssert;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.BaseHierarchicalConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
 import org.junit.Before;
 import org.junit.Test;
@@ -67,7 +67,7 @@ public abstract class AbstractCombinerTe
      * @return the union configuration
      * @throws ConfigurationException if an error occurs
      */
-    protected HierarchicalConfiguration createCombinedConfiguration()
+    protected BaseHierarchicalConfiguration createCombinedConfiguration()
             throws ConfigurationException
     {
         XMLConfiguration conf1 = new XMLConfiguration(CONF1);
@@ -75,7 +75,7 @@ public abstract class AbstractCombinerTe
         ConfigurationNode cn = combiner.combine(conf1.getRootNode(), conf2
                 .getRootNode());
 
-        HierarchicalConfiguration result = new HierarchicalConfiguration();
+        BaseHierarchicalConfiguration result = new BaseHierarchicalConfiguration();
         result.setRootNode(cn);
 
         return result;



Mime
View raw message