commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1575763 - in /commons/proper/configuration/branches/immutableNodes/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/tree/ test/java/org/apache/commons/configuration/
Date Sun, 09 Mar 2014 21:01:55 GMT
Author: oheger
Date: Sun Mar  9 21:01:55 2014
New Revision: 1575763

URL: http://svn.apache.org/r1575763
Log:
NodeModel no longer defines the getRootNode() method.

The root node now has to be obtained from the NodeHandler. This is necessary at
least for implementations like InMemoryNodeModel which use immutable structures
that can be replaced by new instances. A NodeHandler is a kind of snapshot of
such a structure at a certain point in time. If the root node is obtained in a
different method call, it may no longer be compatible with the snapshot used by
the node handler.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/AbstractHierarchicalConfiguration.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestAbstractHierarchicalConfiguration.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/AbstractHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/AbstractHierarchicalConfiguration.java?rev=1575763&r1=1575762&r2=1575763&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/AbstractHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/AbstractHierarchicalConfiguration.java
Sun Mar  9 21:01:55 2014
@@ -213,7 +213,7 @@ public abstract class AbstractHierarchic
      */
     public T getRootNode()
     {
-        return getModel().getRootNode();
+        return getModel().getNodeHandler().getRootNode();
     }
 
     /**
@@ -599,7 +599,7 @@ public abstract class AbstractHierarchic
     protected Iterator<String> getKeysInternal()
     {
         DefinedKeysVisitor<T> visitor = new DefinedKeysVisitor<T>();
-        NodeTreeWalker.INSTANCE.walkDFS(getModel().getRootNode(), visitor,
+        NodeTreeWalker.INSTANCE.walkDFS(getRootNode(), visitor,
                 getModel().getNodeHandler());
 
         return visitor.getKeyList().iterator();

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java?rev=1575763&r1=1575762&r2=1575763&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
Sun Mar  9 21:01:55 2014
@@ -84,6 +84,11 @@ public class InMemoryNodeModel implement
                         createTreeData(initialRootNode(root), null));
     }
 
+    /**
+     * Returns the root node of this mode.
+     *
+     * @return the current root node
+     */
     public ImmutableNode getRootNode()
     {
         return getTreeData().getRootNode();

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java?rev=1575763&r1=1575762&r2=1575763&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
Sun Mar  9 21:01:55 2014
@@ -46,13 +46,6 @@ import java.util.Collection;
 public interface NodeModel<T>
 {
     /**
-     * Returns the root node of this model.
-     *
-     * @return the root node
-     */
-    T getRootNode();
-
-    /**
      * Sets a new root node for this model. The whole structure is replaced by
      * the new node and its children.
      *

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestAbstractHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestAbstractHierarchicalConfiguration.java?rev=1575763&r1=1575762&r2=1575763&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestAbstractHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestAbstractHierarchicalConfiguration.java
Sun Mar  9 21:01:55 2014
@@ -908,7 +908,7 @@ public class TestAbstractHierarchicalCon
         @Override
         protected NodeModel<ImmutableNode> cloneNodeModel()
         {
-            return new InMemoryNodeModel(getModel().getRootNode());
+            return new InMemoryNodeModel(getModel().getNodeHandler().getRootNode());
         }
 
         public SubnodeConfiguration configurationAt(String key,



Mime
View raw message