commons-commits mailing list archives

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

URL: http://svn.apache.org/r1578575
Log:
Changed clear() method in NodeModel interface.

A parameter of type NodeKeyResolver was added. This is needed by some concrete
implementations.

Modified:
    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/tree/TestInMemoryNodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModelTrackedNodes.java

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=1578575&r1=1578574&r2=1578575&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
Mon Mar 17 21:09:18 2014
@@ -278,17 +278,23 @@ public class InMemoryNodeModel implement
             final NodeKeyResolver<ImmutableNode> resolver)
     {
         updateModel(new TransactionInitializer() {
-            public boolean initTransaction(ModelTransaction tx) {
+            public boolean initTransaction(ModelTransaction tx)
+            {
                 TreeData currentStructure = tx.getCurrentData();
                 for (QueryResult<ImmutableNode> result : resolver.resolveKey(
-                        tx.getQueryRoot(), key, currentStructure)) {
-                    if (result.isAttributeResult()) {
+                        tx.getQueryRoot(), key, currentStructure))
+                {
+                    if (result.isAttributeResult())
+                    {
                         tx.addRemoveAttributeOperation(result.getNode(),
                                 result.getAttributeName());
-                    } else {
-                        if (result.getNode() == currentStructure.getRootNode()) {
+                    }
+                    else
+                    {
+                        if (result.getNode() == currentStructure.getRootNode())
+                        {
                             // the whole model is to be cleared
-                            clear();
+                            clear(resolver);
                             return false;
                         }
                         tx.addRemoveNodeOperation(
@@ -339,12 +345,13 @@ public class InMemoryNodeModel implement
     }
 
     /**
-     * {@inheritDoc} A new empty root node is created with
-     * the same name as the current root node. Implementation note: Because this
-     * is a hard reset the usual dance for dealing with concurrent updates is
-     * not required here.
+     * {@inheritDoc} A new empty root node is created with the same name as the
+     * current root node. Implementation note: Because this is a hard reset the
+     * usual dance for dealing with concurrent updates is not required here.
+     *
+     * @param resolver the {@code NodeKeyResolver}
      */
-    public void clear()
+    public void clear(NodeKeyResolver<ImmutableNode> resolver)
     {
         ImmutableNode newRoot =
                 new ImmutableNode.Builder().name(getRootNode().getNodeName())

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=1578575&r1=1578574&r2=1578575&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
Mon Mar 17 21:09:18 2014
@@ -128,6 +128,8 @@ public interface NodeModel<T>
 
     /**
      * Removes all data from this model.
+     *
+     * @param resolver the {@code NodeKeyResolver}
      */
-    void clear();
+    void clear(NodeKeyResolver<T> resolver);
 }

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java?rev=1578575&r1=1578574&r2=1578575&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java
Mon Mar 17 21:09:18 2014
@@ -531,7 +531,7 @@ public class TestInMemoryNodeModel
     public void testClear()
     {
         InMemoryNodeModel model = new InMemoryNodeModel(ROOT_AUTHORS_TREE);
-        model.clear();
+        model.clear(createResolver());
         assertFalse("Got still data",
                 model.getNodeHandler().isDefined(model.getRootNode()));
         assertEquals("Root name was changed", ROOT_AUTHORS_TREE.getNodeName(),

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModelTrackedNodes.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModelTrackedNodes.java?rev=1578575&r1=1578574&r2=1578575&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModelTrackedNodes.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModelTrackedNodes.java
Mon Mar 17 21:09:18 2014
@@ -193,7 +193,7 @@ public class TestInMemoryNodeModelTracke
                 NodeStructureHelper.nodeForKey(model, "tables/table(1)");
         NodeKeyResolver<ImmutableNode> resolver = createResolver();
         model.trackNode(selector, resolver);
-        model.clear();
+        model.clear(resolver);
         assertSame("Wrong node", node, model.getTrackedNode(selector));
     }
 
@@ -296,7 +296,7 @@ public class TestInMemoryNodeModelTracke
     {
         NodeKeyResolver<ImmutableNode> resolver = createResolver();
         model.trackNode(selector, resolver);
-        model.clear();
+        model.clear(resolver);
         assertTrue("Node is not detached",
                 model.isTrackedNodeDetached(selector));
     }



Mime
View raw message