jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1394601 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/kernel/ main/java/org/apache/jackrabbit/oak/plugins/index/ main/java/org/apache/jackrabbit/oak/plugins/index/luc...
Date Fri, 05 Oct 2012 15:45:36 GMT
Author: jukka
Date: Fri Oct  5 15:45:35 2012
New Revision: 1394601

URL: http://svn.apache.org/viewvc?rev=1394601&view=rev
Log:
OAK-170: Child node state builder

Rename NodeState.getBuilder() to .builder() and NodeBuilder.getChildBuilder() to .child()
for brevity of downstream code.
This also breaks the name pattern that suggests that these methods are simple getters.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyIndexer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefaultTypeEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Fri Oct  5 15:45:35 2012
@@ -271,7 +271,7 @@ public class RootImpl implements Root {
     }
 
     NodeBuilder createRootBuilder() {
-        return branch.getRoot().getBuilder();
+        return branch.getRoot().builder();
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Fri Oct  5 15:45:35 2012
@@ -40,7 +40,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
-import static org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState.EMPTY_NODE;
 
 public class TreeImpl implements Tree, PurgeListener {
 
@@ -232,8 +231,7 @@ public class TreeImpl implements Tree, P
     @Override
     public Tree addChild(String name) {
         if (!hasChild(name)) {
-            NodeBuilder builder = getNodeBuilder();
-            builder.setNode(name, EMPTY_NODE);
+            getNodeBuilder().child(name);
             root.purge();
         }
 
@@ -321,7 +319,7 @@ public class TreeImpl implements Tree, P
         }
 
         if (nodeBuilder == null) {
-            nodeBuilder = parent.getNodeBuilder().getChildBuilder(name);
+            nodeBuilder = parent.getNodeBuilder().child(name);
             root.addListener(this);
         }
         return nodeBuilder;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Fri Oct  5 15:45:35 2012
@@ -203,7 +203,7 @@ public final class KernelNodeState exten
     }
 
     @Override
-    public NodeBuilder getBuilder() {
+    public NodeBuilder builder() {
         if ("/".equals(getPath())) {
             return new KernelRootBuilder(kernel, this);
         } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
Fri Oct  5 15:45:35 2012
@@ -125,9 +125,9 @@ public class IndexUtils implements Index
     }
 
     public static NodeBuilder getChildBuilder(NodeState state, String path) {
-        NodeBuilder builder = state.getBuilder();
+        NodeBuilder builder = state.builder();
         for (String p : PathUtils.elements(path)) {
-            builder = builder.getChildBuilder(p);
+            builder = builder.child(p);
         }
         return builder;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneEditor.java
Fri Oct  5 15:45:35 2012
@@ -82,12 +82,12 @@ class LuceneEditor implements CommitHook
     @Override
     public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
-        NodeBuilder rootBuilder = after.getBuilder();
+        NodeBuilder rootBuilder = after.builder();
         NodeBuilder builder = rootBuilder;
         for (String name : elements(index.getPath())) {
-            builder = builder.getChildBuilder(name);
+            builder = builder.child(name);
         }
-        builder = builder.getChildBuilder(INDEX_DATA_CHILD_NAME);
+        builder = builder.child(INDEX_DATA_CHILD_NAME);
         Directory directory = new ReadWriteOakDirectory(builder);
 
         try {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java
Fri Oct  5 15:45:35 2012
@@ -103,13 +103,13 @@ public class LuceneIndex implements Quer
 
         NodeBuilder builder = new ReadOnlyBuilder(root);
         for (String name : elements(index.getPath())) {
-            builder = builder.getChildBuilder(name);
+            builder = builder.child(name);
         }
         if (!builder.hasChildNode(INDEX_DATA_CHILD_NAME)) {
             // index not initialized yet
             return new PathCursor(Collections.<String> emptySet());
         }
-        builder = builder.getChildBuilder(INDEX_DATA_CHILD_NAME);
+        builder = builder.child(INDEX_DATA_CHILD_NAME);
 
         Directory directory = new ReadOnlyOakDirectory(builder);
         long s = System.currentTimeMillis();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
Fri Oct  5 15:45:35 2012
@@ -69,7 +69,7 @@ class ReadOnlyOakDirectory extends Direc
             return 0;
         }
 
-        NodeBuilder fileBuilder = directoryBuilder.getChildBuilder(name);
+        NodeBuilder fileBuilder = directoryBuilder.child(name);
         PropertyState property = fileBuilder.getProperty("jcr:data");
         if (property == null || property.isArray()) {
             return 0;
@@ -105,7 +105,7 @@ class ReadOnlyOakDirectory extends Direc
             return new byte[0];
         }
 
-        NodeBuilder fileBuilder = directoryBuilder.getChildBuilder(name);
+        NodeBuilder fileBuilder = directoryBuilder.child(name);
         PropertyState property = fileBuilder.getProperty("jcr:data");
         if (property == null || property.isArray()) {
             return new byte[0];

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Fri Oct  5 15:45:35 2012
@@ -103,7 +103,7 @@ public class ReadWriteOakDirectory exten
                 System.arraycopy(buffer, 0, data, 0, size);
             }
 
-            NodeBuilder fileBuilder = directoryBuilder.getChildBuilder(name);
+            NodeBuilder fileBuilder = directoryBuilder.child(name);
             fileBuilder.setProperty("jcr:lastModified", System.currentTimeMillis());
             fileBuilder.setProperty("jcr:data", data);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyIndexer.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyIndexer.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyIndexer.java
Fri Oct  5 15:45:35 2012
@@ -57,22 +57,22 @@ public class PropertyIndexer implements 
                 .buildIndexDefinitions(nodeState, indexConfigPath,
                         INDEX_TYPE_PROPERTY);
         for (IndexDefinition def : indexDefinitions) {
-            NodeBuilder builder = rootBuilder.getChildBuilder(def.getName());
+            NodeBuilder builder = rootBuilder.child(def.getName());
             // create the global :data node
-            builder.getChildBuilder(INDEX_CONTENT);
+            builder.child(INDEX_CONTENT);
             for (String k : builder.getChildNodeNames()) {
                 PropertyIndex prop = PropertyIndex.fromNodeName(indexer, k);
                 if (prop != null) {
                     // create the :data node
-                    builder.getChildBuilder(prop.getIndexNodeName())
-                            .getChildBuilder(INDEX_CONTENT);
+                    builder.child(prop.getIndexNodeName())
+                            .child(INDEX_CONTENT);
                     queryIndexList.add(new PropertyContentIndex(prop));
                 }
                 PrefixIndex pref = PrefixIndex.fromNodeName(indexer, k);
                 if (pref != null) {
                     // create the :data node
-                    builder.getChildBuilder(pref.getIndexNodeName())
-                            .getChildBuilder(INDEX_CONTENT);
+                    builder.child(pref.getIndexNodeName())
+                            .child(INDEX_CONTENT);
                     queryIndexList.add(new PrefixContentIndex(pref));
                 }
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexDiff.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexDiff.java
Fri Oct  5 15:45:35 2012
@@ -52,7 +52,7 @@ class PropertyIndexDiff implements NodeS
         this.updates = updates;
 
         if (node != null && node.hasChildNode("oak:index")) {
-            NodeBuilder index = node.getChildBuilder("oak:index");
+            NodeBuilder index = node.child("oak:index");
             for (String indexName : index.getChildNodeNames()) {
                 List<PropertyIndexUpdate> list = updates.get(indexName);
                 if (list == null) {
@@ -60,7 +60,7 @@ class PropertyIndexDiff implements NodeS
                     updates.put(indexName, list);
                 }
                 list.add(new PropertyIndexUpdate(
-                        getPath(), index.getChildBuilder(indexName)));
+                        getPath(), index.child(indexName)));
             }
         }
     }
@@ -77,7 +77,7 @@ class PropertyIndexDiff implements NodeS
 
     private static NodeBuilder getChildNode(NodeBuilder node, String name) {
         if (node != null && node.hasChildNode(name)) {
-            return node.getChildBuilder(name);
+            return node.child(name);
         } else {
             return null;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexHook.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexHook.java
Fri Oct  5 15:45:35 2012
@@ -33,7 +33,7 @@ public class PropertyIndexHook implement
     @Override @Nonnull
     public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
-        NodeBuilder builder = after.getBuilder();
+        NodeBuilder builder = after.builder();
 
         Map<String, List<PropertyIndexUpdate>> indexes = Maps.newHashMap();
         PropertyIndexDiff diff = new PropertyIndexDiff(builder, indexes);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
Fri Oct  5 15:45:35 2012
@@ -81,7 +81,7 @@ class PropertyIndexUpdate {
 
     public void apply() throws CommitFailedException {
         boolean unique = node.getProperty("unique") != null;
-        NodeBuilder index = node.getChildBuilder(":index");
+        NodeBuilder index = node.child(":index");
 
         for (Map.Entry<String, Set<String>> entry : remove.entrySet()) {
             String encoded = entry.getKey();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Fri Oct  5 15:45:35 2012
@@ -315,7 +315,7 @@ public class MemoryNodeBuilder implement
     }
 
     @Override
-    public NodeBuilder getChildBuilder(String name) {
+    public NodeBuilder child(String name) {
         NodeState state = read();
 
         if (writeState == null) {
@@ -330,8 +330,13 @@ public class MemoryNodeBuilder implement
         MutableNodeState cstate = mstate.nodes.get(name);
         if (cstate != null) {
             cbase = cstate.base;
-        } else if (!mstate.nodes.containsKey(name)
-                && mstate.base.hasChildNode(name)) {
+        } else if (mstate.nodes.containsKey(name)) {
+            // The child node was removed earlier and we're creating
+            // a new child with the same name. Remove the removal marker
+            // so that the new child builder won't try reconnecting with
+            // the previously removed node.
+            mstate.nodes.remove(name);
+        } else if (mstate.base.hasChildNode(name)) {
             return createChildBuilder(name, mstate.base.getChildNode(name));
         }
 
@@ -555,8 +560,8 @@ public class MemoryNodeBuilder implement
         }
 
         @Override
-        public NodeBuilder getBuilder() {
-            return new ModifiedNodeState(this).getBuilder();
+        public NodeBuilder builder() {
+            return new ModifiedNodeState(this).builder();
         }
 
         /**
@@ -663,7 +668,7 @@ public class MemoryNodeBuilder implement
         }
 
         @Override
-        public NodeBuilder getBuilder() {
+        public NodeBuilder builder() {
             return new MemoryNodeBuilder(this);
         }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeState.java
Fri Oct  5 15:45:35 2012
@@ -97,7 +97,7 @@ public class MemoryNodeState extends Abs
     }
 
     @Override
-    public NodeBuilder getBuilder() {
+    public NodeBuilder builder() {
         return new MemoryNodeBuilder(this);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefaultTypeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefaultTypeEditor.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefaultTypeEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/DefaultTypeEditor.java
Fri Oct  5 15:45:35 2012
@@ -33,7 +33,7 @@ public class DefaultTypeEditor implement
     public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
         // TODO: Calculate default type from the node definition
-        NodeBuilder builder = after.getBuilder();
+        NodeBuilder builder = after.builder();
         after.compareAgainstBaseState(
                 before, new DefaultTypeDiff(builder, "nt:unstructured"));
         return builder.getNodeState();
@@ -53,7 +53,7 @@ public class DefaultTypeEditor implement
         @Override
         public void childNodeAdded(String name, NodeState after) {
             if (!NodeStateUtils.isHidden(name)) {
-                NodeBuilder childBuilder = builder.getChildBuilder(name);
+                NodeBuilder childBuilder = builder.child(name);
                 if (after.getProperty("jcr:primaryType") == null) {
                     childBuilder.setProperty("jcr:primaryType", defaultType);
                 }
@@ -70,7 +70,7 @@ public class DefaultTypeEditor implement
         public void childNodeChanged(
                 String name, NodeState before, NodeState after) {
             if (!NodeStateUtils.isHidden(name)) {
-                NodeBuilder childBuilder = builder.getChildBuilder(name);
+                NodeBuilder childBuilder = builder.child(name);
                 DefaultTypeDiff childDiff =
                         new DefaultTypeDiff(childBuilder, defaultType);
                 after.compareAgainstBaseState(before, childDiff);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
Fri Oct  5 15:45:35 2012
@@ -154,11 +154,11 @@ public interface NodeBuilder {
      * between this builder and a previously returned child builder for
      * that child node name will get broken.
      *
-     * @since Oak 0.4
+     * @since Oak 0.6
      * @param name name of the child node
      * @return child builder
      */
     @Nonnull
-    NodeBuilder getChildBuilder(String name);
+    NodeBuilder child(String name);
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeState.java
Fri Oct  5 15:45:35 2012
@@ -189,10 +189,11 @@ public interface NodeState {
      * this state, i.e. starting with all the properties and child nodes
      * of this state.
      *
+     * @since Oak 0.6
      * @return node builder based on this state
      */
     @Nonnull
-    NodeBuilder getBuilder();
+    NodeBuilder builder();
 
     /**
      * Compares this node state against the given base state. Any differences

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
Fri Oct  5 15:45:35 2012
@@ -103,7 +103,7 @@ public class ReadOnlyBuilder implements 
     }
 
     @Override
-    public ReadOnlyBuilder getChildBuilder(String name) {
+    public ReadOnlyBuilder child(String name) {
         NodeState child = state.getChildNode(name);
         if (child != null) {
             return new ReadOnlyBuilder(child);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
Fri Oct  5 15:45:35 2012
@@ -69,9 +69,9 @@ public class KernelNodeStoreTest {
     public void branch() throws CommitFailedException {
         NodeStoreBranch branch = store.branch();
 
-        NodeBuilder rootBuilder = branch.getRoot().getBuilder();
-        NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
-        NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
+        NodeBuilder rootBuilder = branch.getRoot().builder();
+        NodeBuilder testBuilder = rootBuilder.child("test");
+        NodeBuilder newNodeBuilder = testBuilder.child("newNode");
 
         testBuilder.removeNode("x");
 
@@ -122,9 +122,9 @@ public class KernelNodeStoreTest {
         });
 
         NodeState root = store.getRoot();
-        NodeBuilder rootBuilder= root.getBuilder();
-        NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
-        NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
+        NodeBuilder rootBuilder= root.builder();
+        NodeBuilder testBuilder = rootBuilder.child("test");
+        NodeBuilder newNodeBuilder = testBuilder.child("newNode");
 
         newNodeBuilder.setProperty("n", 42);
 
@@ -154,17 +154,17 @@ public class KernelNodeStoreTest {
         store.setHook(new CommitHook() {
             @Override
             public NodeState processCommit(NodeState before, NodeState after) {
-                NodeBuilder rootBuilder = after.getBuilder();
-                NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
-                testBuilder.getChildBuilder("fromHook");
+                NodeBuilder rootBuilder = after.builder();
+                NodeBuilder testBuilder = rootBuilder.child("test");
+                testBuilder.child("fromHook");
                 return rootBuilder.getNodeState();
             }
         });
 
         NodeState root = store.getRoot();
-        NodeBuilder rootBuilder = root.getBuilder();
-        NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
-        NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
+        NodeBuilder rootBuilder = root.builder();
+        NodeBuilder testBuilder = rootBuilder.child("test");
+        NodeBuilder newNodeBuilder = testBuilder.child("newNode");
 
         newNodeBuilder.setProperty("n", 42);
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
Fri Oct  5 15:45:35 2012
@@ -36,17 +36,17 @@ public class PropertyIndexTest {
         NodeState root = MemoryNodeState.EMPTY_NODE;
 
         // Add index definition
-        NodeBuilder builder = root.getBuilder();
-        builder.getChildBuilder("oak:index").getChildBuilder("foo");
+        NodeBuilder builder = root.builder();
+        builder.child("oak:index").child("foo");
         NodeState before = builder.getNodeState();
 
         // Add some content and process it through the property index hook
-        builder = before.getBuilder();
-        builder.getChildBuilder("a").setProperty("foo", "abc");
-        builder.getChildBuilder("b").setProperty("foo", Arrays.asList("abc", "def"), Type.STRINGS);
+        builder = before.builder();
+        builder.child("a").setProperty("foo", "abc");
+        builder.child("b").setProperty("foo", Arrays.asList("abc", "def"), Type.STRINGS);
         // plus lots of dummy content to highlight the benefit of indexing
         for (int i = 0; i < MANY; i++) {
-            builder.getChildBuilder("n" + i).setProperty("foo", "xyz");
+            builder.child("n" + i).setProperty("foo", "xyz");
         }
         NodeState after = builder.getNodeState();
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1394601&r1=1394600&r2=1394601&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Fri Oct  5 15:45:35 2012
@@ -45,8 +45,8 @@ public class MemoryNodeBuilderTest {
     @Test
     public void testConnectOnAddProperty() {
         NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder childA = root.getChildBuilder("x");
-        NodeBuilder childB = root.getChildBuilder("x");
+        NodeBuilder childA = root.child("x");
+        NodeBuilder childB = root.child("x");
 
         assertNull(childA.getProperty("test"));
         childB.setProperty("test", "foo");
@@ -56,8 +56,8 @@ public class MemoryNodeBuilderTest {
     @Test
     public void testConnectOnUpdateProperty() {
         NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder childA = root.getChildBuilder("x");
-        NodeBuilder childB = root.getChildBuilder("x");
+        NodeBuilder childA = root.child("x");
+        NodeBuilder childB = root.child("x");
 
         childB.setProperty("test", "foo");
         childA.setProperty("test", "bar");
@@ -69,8 +69,8 @@ public class MemoryNodeBuilderTest {
     @Test
     public void testConnectOnRemoveProperty() {
         NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder childA = root.getChildBuilder("x");
-        NodeBuilder childB = root.getChildBuilder("x");
+        NodeBuilder childA = root.child("x");
+        NodeBuilder childB = root.child("x");
 
         childB.setProperty("test", "foo");
         childA.removeProperty("test");
@@ -80,18 +80,18 @@ public class MemoryNodeBuilderTest {
     @Test
     public void testConnectOnAddNode() {
         NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder childA = root.getChildBuilder("x");
-        NodeBuilder childB = root.getChildBuilder("x");
+        NodeBuilder childA = root.child("x");
+        NodeBuilder childB = root.child("x");
 
         assertFalse(childA.hasChildNode("test"));
-        childB.setNode("test", MemoryNodeState.EMPTY_NODE);
+        childB.child("test");
         assertTrue(childA.hasChildNode("test"));
     }
 
     @Test(expected = IllegalStateException.class)
     public void testConnectOnRemoveNode() {
         NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder child = root.getChildBuilder("x");
+        NodeBuilder child = root.child("x");
 
         root.removeNode("x");
         child.getChildNodeCount(); // should throw ISE



Mime
View raw message