commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1578586 - in /commons/proper/configuration/branches/immutableNodes/src: main/java/org/apache/commons/configuration/ test/java/org/apache/commons/configuration/
Date Mon, 17 Mar 2014 21:14:24 GMT
Author: oheger
Date: Mon Mar 17 21:14:24 2014
New Revision: 1578586

URL: http://svn.apache.org/r1578586
Log:
Changed constructor of SubnodeConfiguration.

The NodeSelector argument was redundant and could be removed. Also removed the
unnecessary createSubnodeConfiguration() method.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestBaseHierarchicalConfigurationSynchronization.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java?rev=1578586&r1=1578585&r2=1578586&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
Mon Mar 17 21:14:24 2014
@@ -297,7 +297,7 @@ public class BaseHierarchicalConfigurati
         NodeSelector selector = getSubConfigurationNodeSelector(key);
         myModel.trackNode(selector, this);
         return new SubnodeConfiguration(this, new TrackedNodeModel(myModel,
-                selector, true), selector);
+                selector, true));
     }
 
     /**

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java?rev=1578586&r1=1578585&r2=1578586&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
Mon Mar 17 21:14:24 2014
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.configuration;
 
-import org.apache.commons.configuration.tree.ConfigurationNode;
 import org.apache.commons.configuration.tree.ImmutableNode;
 import org.apache.commons.configuration.tree.InMemoryNodeModel;
 import org.apache.commons.configuration.tree.NodeModel;
@@ -124,13 +123,13 @@ public class SubnodeConfiguration extend
      * Creates a new instance of {@code SubnodeConfiguration} and initializes it
      * with all relevant properties.
      *
+     *
      * @param parent the parent configuration
      * @param model the {@code TrackedNodeModel} to be used for this configuration
-     * @param selector the {@code NodeSelector} selecting the root node
-     *                 @throws IllegalArgumentException if a required argument is missing
+     * @throws IllegalArgumentException if a required argument is missing
      */
     public SubnodeConfiguration(BaseHierarchicalConfiguration parent,
-            TrackedNodeModel model, NodeSelector selector)
+                                TrackedNodeModel model)
     {
         super(model);
         if (parent == null)
@@ -142,13 +141,9 @@ public class SubnodeConfiguration extend
         {
             throw new IllegalArgumentException("Node model must not be null!");
         }
-        if(selector == null)
-        {
-            throw new IllegalArgumentException("Node selector must not be null!");
-        }
 
         this.parent = parent;
-        rootSelector = selector;
+        rootSelector = model.getSelector();
     }
 
     /**
@@ -186,31 +181,4 @@ public class SubnodeConfiguration extend
         parentModel.trackNode(getRootSelector(), getParent());
         return new TrackedNodeModel(parentModel, getRootSelector(), true);
     }
-
-    /**
-     * Returns a hierarchical configuration object for the given sub node that
-     * is aware of structural changes of its parent. Works like the method with
-     * the same name, but also sets the subnode key for the new subnode
-     * configuration, so it can check whether the parent has been changed. This
-     * only works if this subnode configuration has itself a valid subnode key.
-     * So if a subnode configuration that should be aware of structural changes
-     * is created from an already existing subnode configuration, this subnode
-     * configuration must also be aware of such changes.
-     *
-     * @param node the sub node, for which the configuration is to be created
-     * @param subKey the construction key
-     * @return a hierarchical configuration for this sub node
-     * @since 1.5
-     */
-    @Override
-    protected SubnodeConfiguration createSubnodeConfiguration(
-            ConfigurationNode node, String subKey)
-    {
-//        String key =
-//                (subKey != null && subnodeKey != null) ? constructSubKeyForSubnodeConfig(node)
-//                        : null;
-//        return new SubnodeConfiguration(getParent(), node, key);
-        //TODO implementation
-        throw new UnsupportedOperationException("Not yet implemented!");
-    }
 }

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestBaseHierarchicalConfigurationSynchronization.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestBaseHierarchicalConfigurationSynchronization.java?rev=1578586&r1=1578585&r2=1578586&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestBaseHierarchicalConfigurationSynchronization.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestBaseHierarchicalConfigurationSynchronization.java
Mon Mar 17 21:14:24 2014
@@ -272,7 +272,7 @@ public class TestBaseHierarchicalConfigu
                     protected SubnodeConfiguration createSubnodeConfiguration(
                             ConfigurationNode node, String subnodeKey)
                     {
-                        return new SubnodeConfiguration(this, node, subnodeKey)
+                        return new SubnodeConfiguration(this, node)
                         {
                             private static final long serialVersionUID = 1L;
 

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java?rev=1578586&r1=1578585&r2=1578586&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
Mon Mar 17 21:14:24 2014
@@ -153,8 +153,8 @@ public class TestSubnodeConfiguration
     public void testInitSubNodeConfigWithNullParent()
     {
         config =
-                new SubnodeConfiguration(null, setUpTrackedModel(SELECTOR),
-                        SELECTOR);
+                new SubnodeConfiguration(null, setUpTrackedModel(SELECTOR)
+                );
     }
 
     /**
@@ -164,16 +164,7 @@ public class TestSubnodeConfiguration
     @Test(expected = IllegalArgumentException.class)
     public void testInitSubNodeConfigWithNullNode()
     {
-        config = new SubnodeConfiguration(parent, null, SELECTOR);
-    }
-
-    /**
-     * Tries to create an instance without a selector.
-     */
-    @Test(expected = IllegalArgumentException.class)
-    public void testInitSubNodeConfigWithNullSelector()
-    {
-        new SubnodeConfiguration(parent, setUpTrackedModel(SELECTOR), null);
+        config = new SubnodeConfiguration(parent, null);
     }
 
     /**



Mime
View raw message