jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1325846 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/api/ main/java/org/apache/jackrabbit/oak/kernel/ test/java/org/apache/jackrabbit/oak/kernel/
Date Fri, 13 Apr 2012 17:13:15 GMT
Author: mduerig
Date: Fri Apr 13 17:13:14 2012
New Revision: 1325846

URL: http://svn.apache.org/viewvc?rev=1325846&view=rev
Log:
OAK-18: Define Oak API 
broaden contract of NodeStateEditor.edit to accept path instead of name

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java?rev=1325846&r1=1325845&r2=1325846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/NodeStateEditor.java
Fri Apr 13 17:13:14 2012
@@ -91,13 +91,15 @@ public interface NodeStateEditor {
     void copy(String sourcePath, String destPath);
 
     /**
-     * Edit the child node state with the given {@code name}.
-     * @param name name of the child node state to edit.
-     * @return editor for the child node state of the given name or
+     * Edit the child node state at the given {@code path}.
+     * The path must resolve to a node state located in the subtree
+     * below the transient state this editor is acting upon.
+     *
+     * @param path path of the child node state to edit.
+     * @return editor for the child node state at the given path or
      *         {@code null} if no such node state exists.
-     * TODO broaden to accept a path instead of a name
      */
-    NodeStateEditor edit(String name);
+    NodeStateEditor edit(String path);
 
     /**
      * Return the transient state which this editor is acting upon

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java?rev=1325846&r1=1325845&r2=1325846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditor.java
Fri Apr 13 17:13:14 2012
@@ -156,11 +156,11 @@ public class KernelNodeStateEditor imple
     }
 
     @Override
-    public KernelNodeStateEditor edit(String name) {
-        TransientKernelNodeState childState = transientState.getChildNode(name);
-        return childState == null
+    public KernelNodeStateEditor edit(String path) {
+        TransientKernelNodeState state = getTransientState(path);
+        return state == null
             ? null
-            : childState.getEditor();
+            : state.getEditor();
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java?rev=1325846&r1=1325845&r2=1325846&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateEditorFuzzIT.java
Fri Apr 13 17:13:14 2012
@@ -142,10 +142,7 @@ public class KernelNodeStateEditorFuzzIT
 
             @Override
             void apply(KernelNodeStateEditor editor) {
-                for (String element : PathUtils.elements(parentPath)) {
-                    editor = editor.edit(element);
-                }
-                editor.addNode(name);
+                editor.edit(parentPath).addNode(name);
             }
 
             @Override
@@ -163,10 +160,9 @@ public class KernelNodeStateEditorFuzzIT
 
             @Override
             void apply(KernelNodeStateEditor editor) {
-                for (String element : PathUtils.elements(PathUtils.getParentPath(path)))
{
-                    editor = editor.edit(element);
-                }
-                editor.removeNode(PathUtils.getName(path));
+                String parentPath = PathUtils.getParentPath(path);
+                String name = PathUtils.getName(path);
+                editor.edit(parentPath).removeNode(name);
             }
 
             @Override
@@ -228,10 +224,7 @@ public class KernelNodeStateEditorFuzzIT
 
             @Override
             void apply(KernelNodeStateEditor editor) {
-                for (String element : PathUtils.elements(parentPath)) {
-                    editor = editor.edit(element);
-                }
-                editor.setProperty(propertyName, propertyValue);
+                editor.edit(parentPath).setProperty(propertyName, propertyValue);
             }
 
             @Override
@@ -252,10 +245,7 @@ public class KernelNodeStateEditorFuzzIT
 
             @Override
             void apply(KernelNodeStateEditor editor) {
-                for (String element : PathUtils.elements(parentPath)) {
-                    editor = editor.edit(element);
-                }
-                editor.removeProperty(name);
+                editor.edit(parentPath).removeProperty(name);
             }
 
             @Override



Mime
View raw message