jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1390485 - 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/lucene/ m...
Date Wed, 26 Sep 2012 13:44:27 GMT
Author: jukka
Date: Wed Sep 26 13:44:25 2012
New Revision: 1390485

URL: http://svn.apache.org/viewvc?rev=1390485&view=rev
Log:
OAK-344: Move NodeStore.getBuilder(NodeState) to NodeState.getBuilder()

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/kernel/JsopDiff.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/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/PropertyIndexer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/ReadWriteOakDirectory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/BinaryValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/GenericValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/LongValue.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/memory/MemoryNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/unique/UniqueIndexHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/IndexUtils.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/NodeStore.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -230,7 +230,7 @@ public class RootImpl implements Root {
     }
 
     NodeBuilder createRootBuilder() {
-        return store.getBuilder(branch.getRoot());
+        return branch.getRoot().getBuilder();
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
Wed Sep 26 13:44:25 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.kernel
 
 import javax.jcr.PropertyType;
 
+import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.json.JsopBuilder;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
@@ -28,27 +29,30 @@ import org.apache.jackrabbit.oak.spi.sta
 
 class JsopDiff implements NodeStateDiff {
 
+    private final MicroKernel kernel;
+
     protected final JsopBuilder jsop;
 
     protected final String path;
 
-    public JsopDiff(JsopBuilder jsop, String path) {
+    public JsopDiff(MicroKernel kernel, JsopBuilder jsop, String path) {
+        this.kernel = kernel;
         this.jsop = jsop;
         this.path = path;
     }
 
-    public JsopDiff() {
-        this(new JsopBuilder(), "/");
+    public JsopDiff(MicroKernel kernel) {
+        this(kernel, new JsopBuilder(), "/");
     }
 
     public static void diffToJsop(
-            NodeState before, NodeState after,
+            MicroKernel kernel, NodeState before, NodeState after,
             String path, JsopBuilder jsop) {
-        after.compareAgainstBaseState(before, new JsopDiff(jsop, path));
+        after.compareAgainstBaseState(before, new JsopDiff(kernel, jsop, path));
     }
 
     protected JsopDiff createChildDiff(JsopBuilder jsop, String path) {
-        return new JsopDiff(jsop, path);
+        return new JsopDiff(kernel, jsop, path);
     }
 
     //-----------------------------------------------------< NodeStateDiff >--
@@ -100,7 +104,7 @@ class JsopDiff implements NodeStateDiff 
         return PathUtils.concat(path, name);
     }
 
-    private static void toJson(NodeState nodeState, JsopBuilder jsop) {
+    private void toJson(NodeState nodeState, JsopBuilder jsop) {
         jsop.object();
         for (PropertyState property : nodeState.getProperties()) {
             jsop.key(property.getName());
@@ -113,7 +117,7 @@ class JsopDiff implements NodeStateDiff 
         jsop.endObject();
     }
 
-    private static void toJson(PropertyState propertyState, JsopBuilder jsop) {
+    private void toJson(PropertyState propertyState, JsopBuilder jsop) {
         if (propertyState.isArray()) {
             jsop.array();
             for (CoreValue value : propertyState.getValues()) {
@@ -125,14 +129,20 @@ class JsopDiff implements NodeStateDiff 
         }
     }
 
-    private static void toJson(CoreValue value, JsopBuilder jsop) {
+    private void toJson(CoreValue value, JsopBuilder jsop) {
         int type = value.getType();
         if (type == PropertyType.BOOLEAN) {
             jsop.value(value.getBoolean());
         } else if (type == PropertyType.LONG) {
             jsop.value(value.getLong());
         } else {
-            String string = value.getString();
+            String string;
+            if (type == PropertyType.BINARY
+                    && !(value instanceof BinaryValue)) {
+                string = kernel.write(value.getNewStream());
+            } else {
+                string = value.getString();
+            }
             if (type != PropertyType.STRING
                     || CoreValueMapper.startsWithHint(string)) {
                 string = CoreValueMapper.getHintForType(type) + ':' + string;

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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -38,11 +38,13 @@ import org.apache.jackrabbit.mk.json.Jso
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
 import org.apache.jackrabbit.oak.plugins.memory.MultiPropertyState;
 import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
 import org.apache.jackrabbit.oak.spi.state.AbstractChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
@@ -200,6 +202,15 @@ public final class KernelNodeState exten
         return iterable;
     }
 
+    @Override
+    public NodeBuilder getBuilder() {
+        if ("/".equals(getPath())) {
+            return new KernelRootBuilder(kernel, this);
+        } else {
+            return new MemoryNodeBuilder(this);
+        }
+    }
+
     /**
      * Optimised comparison method that can avoid traversing all properties
      * and child nodes if both this and the given base node state come from

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Wed Sep 26 13:44:25 2012
@@ -23,12 +23,10 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyObserver;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -125,17 +123,6 @@ public class KernelNodeStore implements 
     }
 
     @Override
-    public NodeBuilder getBuilder(NodeState base) {
-        if (base instanceof KernelNodeState) {
-            KernelNodeState kbase = (KernelNodeState) base;
-            if ("/".equals(kbase.getPath())) {
-                return new KernelRootBuilder(kernel, kbase);
-            }
-        }
-        return new MemoryNodeBuilder(base);
-    }
-
-    @Override
     public CoreValueFactory getValueFactory() {
         return new CoreValueFactoryImpl(kernel);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreBranch.java
Wed Sep 26 13:44:25 2012
@@ -75,7 +75,7 @@ class KernelNodeStoreBranch implements N
     public void setRoot(NodeState newRoot) {
         if (!currentRoot.equals(newRoot)) {
             currentRoot = newRoot;
-            JsopDiff diff = new JsopDiff();
+            JsopDiff diff = new JsopDiff(store.getKernel());
             currentRoot.compareAgainstBaseState(committed, diff);
             commit(diff.toString());
         }
@@ -125,7 +125,7 @@ class KernelNodeStoreBranch implements N
     public NodeState merge() throws CommitFailedException {
         NodeState oldRoot = base;
         CommitHook commitHook = store.getHook();
-        NodeState toCommit = commitHook.processCommit(store, oldRoot, currentRoot);
+        NodeState toCommit = commitHook.processCommit(oldRoot, currentRoot);
         setRoot(toCommit);
 
         try {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
Wed Sep 26 13:44:25 2012
@@ -85,6 +85,7 @@ class KernelRootBuilder extends MemoryNo
         private final Set<String> deleted;
 
         public CopyAndMoveAwareJsopDiff() {
+            super(kernel);
             added = Maps.newHashMap();
             deleted = Sets.newHashSet();
         }
@@ -92,7 +93,7 @@ class KernelRootBuilder extends MemoryNo
         private CopyAndMoveAwareJsopDiff(
                 JsopBuilder jsop, String path,
                 Map<String, NodeState> added, Set<String> deleted) {
-            super(jsop, path);
+            super(kernel, jsop, path);
             this.added = added;
             this.deleted = deleted;
         }
@@ -114,7 +115,7 @@ class KernelRootBuilder extends MemoryNo
 
                 if (state != kstate) {
                     state.compareAgainstBaseState(
-                            kstate, new JsopDiff(jsop, path));
+                            kstate, new JsopDiff(kernel, jsop, path));
                 }
             }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/PropertyIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/PropertyIndexer.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/PropertyIndexer.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/PropertyIndexer.java
Wed Sep 26 13:44:25 2012
@@ -44,8 +44,8 @@ public class PropertyIndexer implements 
     }
 
     @Override
-    public NodeState processCommit(NodeStore store, NodeState before,
-            NodeState after) throws CommitFailedException {
+    public NodeState processCommit(NodeState before, NodeState after)
+            throws CommitFailedException {
         // TODO update index data see OAK-298
         return after;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
Wed Sep 26 13:44:25 2012
@@ -36,7 +36,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
@@ -84,15 +83,14 @@ class LuceneEditor implements CommitHook
      * reindex call
      */
     @Override
-    public NodeState processCommit(NodeStore store, NodeState before,
-            NodeState after) throws CommitFailedException {
-        NodeBuilder rootBuilder = store.getBuilder(after);
+    public NodeState processCommit(NodeState before, NodeState after)
+            throws CommitFailedException {
+        NodeBuilder rootBuilder = after.getBuilder();
         NodeBuilder builder = rootBuilder;
         for (String name : path) {
             builder = builder.getChildBuilder(name);
         }
-        Directory directory = new ReadWriteOakDirectory(builder,
-                store.getValueFactory());
+        Directory directory = new ReadWriteOakDirectory(builder);
 
         try {
             IndexWriter writer = new IndexWriter(directory, config);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneHook.java
Wed Sep 26 13:44:25 2012
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.query.IndexDefinition;
 import org.apache.jackrabbit.oak.spi.query.IndexUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 public class LuceneHook implements CommitHook, LuceneIndexConstants {
 
@@ -43,20 +42,15 @@ public class LuceneHook implements Commi
     }
 
     @Override
-    public NodeState processCommit(NodeStore store, NodeState before,
-            NodeState after) throws CommitFailedException {
-
+    public NodeState processCommit(NodeState before, NodeState after)
+            throws CommitFailedException {
         List<CommitHook> hooks = new ArrayList<CommitHook>();
-        List<IndexDefinition> indexDefinitions = IndexUtils
-                .buildIndexDefinitions(after, indexConfigPath, TYPE);
+        List<IndexDefinition> indexDefinitions =
+                IndexUtils.buildIndexDefinitions(after, indexConfigPath, TYPE);
         for (IndexDefinition def : indexDefinitions) {
             hooks.add(new LuceneEditor(def));
         }
-        if (hooks.isEmpty()) {
-            return after;
-        }
-
-        return new CompositeHook(hooks).processCommit(store, before, after);
+        return new CompositeHook(hooks).processCommit(before, after);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
Wed Sep 26 13:44:25 2012
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.query.IndexDefinition;
 import org.apache.jackrabbit.oak.spi.query.IndexUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,8 +54,8 @@ public class LuceneReindexHook implement
     }
 
     @Override
-    public NodeState processCommit(NodeStore store, NodeState before,
-            NodeState after) throws CommitFailedException {
+    public NodeState processCommit(NodeState before, NodeState after)
+            throws CommitFailedException {
 
         List<IndexDefinition> defsBefore = IndexUtils.buildIndexDefinitions(
                 before, indexConfigPath, TYPE);
@@ -85,8 +84,7 @@ public class LuceneReindexHook implement
         if (hooks.isEmpty()) {
             return after;
         }
-        NodeState done = new CompositeHook(hooks).processCommit(store, null,
-                after);
+        NodeState done = new CompositeHook(hooks).processCommit(null, after);
         LOG.debug("done reindexing repository content in {} ms.",
                 System.currentTimeMillis() - t);
         return done;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/ReadWriteOakDirectory.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/ReadWriteOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/ReadWriteOakDirectory.java
Wed Sep 26 13:44:25 2012
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.oak.plugins.lucene;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
+import org.apache.jackrabbit.oak.plugins.memory.BinaryValue;
+import org.apache.jackrabbit.oak.plugins.memory.LongValue;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
@@ -31,12 +31,8 @@ import org.apache.lucene.store.IndexOutp
  */
 public class ReadWriteOakDirectory extends ReadOnlyOakDirectory {
 
-    private final CoreValueFactory factory;
-
-    public ReadWriteOakDirectory(NodeBuilder directoryBuilder,
-            CoreValueFactory vf) {
+    public ReadWriteOakDirectory(NodeBuilder directoryBuilder) {
         super(directoryBuilder);
-        this.factory = vf;
     }
 
     @Override
@@ -110,10 +106,10 @@ public class ReadWriteOakDirectory exten
             }
 
             NodeBuilder fileBuilder = directoryBuilder.getChildBuilder(name);
-            fileBuilder.setProperty("jcr:lastModified",
-                    factory.createValue(System.currentTimeMillis()));
-            fileBuilder.setProperty("jcr:data",
-                    factory.createValue(new ByteArrayInputStream(data)));
+            fileBuilder.setProperty(
+                    "jcr:lastModified",
+                    new LongValue(System.currentTimeMillis()));
+            fileBuilder.setProperty("jcr:data", new BinaryValue(data));
         }
 
         @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/BinaryValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/BinaryValue.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/BinaryValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/BinaryValue.java
Wed Sep 26 13:44:25 2012
@@ -21,7 +21,7 @@ import java.io.InputStream;
 
 import javax.jcr.PropertyType;
 
-final class BinaryValue extends MemoryValue {
+public final class BinaryValue extends MemoryValue {
 
     private final byte[] value;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/GenericValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/GenericValue.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/GenericValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/GenericValue.java
Wed Sep 26 13:44:25 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
-final class GenericValue extends MemoryValue {
+public final class GenericValue extends MemoryValue {
 
     private final int type;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/LongValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/LongValue.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/LongValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/LongValue.java
Wed Sep 26 13:44:25 2012
@@ -20,7 +20,7 @@ import java.math.BigDecimal;
 
 import javax.jcr.PropertyType;
 
-final class LongValue extends MemoryValue {
+public final class LongValue extends MemoryValue {
 
     private final long value;
 

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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -550,6 +550,11 @@ public class MemoryNodeBuilder implement
                     modified);
         }
 
+        @Override
+        public NodeBuilder getBuilder() {
+            return new ModifiedNodeState(this).getBuilder();
+        }
+
         /**
          * Since we keep track of an explicit base node state for a
          * {@link ModifiedNodeState} instance, we can do this in two steps:
@@ -653,6 +658,11 @@ public class MemoryNodeBuilder implement
             }
         }
 
+        @Override
+        public NodeBuilder getBuilder() {
+            return new MemoryNodeBuilder(this);
+        }
+
         //----------------------------------------------< MutableNodeState >--
 
         @Override

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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.plugin
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
@@ -95,6 +96,11 @@ public class MemoryNodeState extends Abs
         return MemoryChildNodeEntry.iterable(nodes.entrySet());
     }
 
+    @Override
+    public NodeBuilder getBuilder() {
+        return new MemoryNodeBuilder(this);
+    }
+
     /**
      * We don't keep track of a separate base node state for
      * {@link MemoryNodeState} instances, so this method will just do

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
Wed Sep 26 13:44:25 2012
@@ -20,7 +20,6 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -40,11 +39,6 @@ public class MemoryNodeStore implements 
     }
 
     @Override
-    public NodeBuilder getBuilder(NodeState base) {
-        return new MemoryNodeBuilder(base);
-    }
-
-    @Override
     public NodeStoreBranch branch() {
         return new MemoryNodeStoreBranch(root.get());
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/DefaultTypeEditor.java
Wed Sep 26 13:44:25 2012
@@ -20,13 +20,13 @@ import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.plugins.memory.GenericValue;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * This class updates a Lucene index when node content is changed.
@@ -34,13 +34,12 @@ import org.apache.jackrabbit.oak.spi.sta
 public class DefaultTypeEditor implements CommitHook {
 
     @Override
-    public NodeState processCommit(
-            NodeStore store, NodeState before, NodeState after)
+    public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
         // TODO: Calculate default type from the node definition
-        CoreValue defaultType = store.getValueFactory().createValue(
-                "nt:unstructured", PropertyType.NAME);
-        NodeBuilder builder = store.getBuilder(after);
+        CoreValue defaultType =
+                new GenericValue(PropertyType.NAME, "nt:unstructured");
+        NodeBuilder builder = after.getBuilder();
         after.compareAgainstBaseState(
                 before, new DefaultTypeDiff(builder, defaultType));
         return builder.getNodeState();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/unique/UniqueIndexHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/unique/UniqueIndexHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/unique/UniqueIndexHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/unique/UniqueIndexHook.java
Wed Sep 26 13:44:25 2012
@@ -24,7 +24,6 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 import com.google.common.collect.Lists;
 
@@ -43,10 +42,9 @@ import com.google.common.collect.Lists;
 public class UniqueIndexHook implements CommitHook {
 
     @Override
-    public NodeState processCommit(
-            NodeStore store, NodeState before, NodeState after)
+    public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
-        NodeBuilder builder = store.getBuilder(after);
+        NodeBuilder builder = after.getBuilder();
         NodeBuilder system = builder.getChildBuilder("jcr:system");
         NodeBuilder unique = system.getChildBuilder(":unique");
 
@@ -60,7 +58,7 @@ public class UniqueIndexHook implements 
             return after; // shortcut
         }
 
-        new ValidatingHook(validators).processCommit(store, before, after);
+        new ValidatingHook(validators).processCommit(before, after);
 
         for (UniqueIndexValidator validator : validators) {
             validator.apply(unique);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHook.java
Wed Sep 26 13:44:25 2012
@@ -20,7 +20,6 @@ import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * Extension point for validating and modifying content changes. Available
@@ -41,14 +40,13 @@ public interface CommitHook {
      * Validates and/or modifies the given content change before it gets
      * persisted.
      *
-     * @param store the node store that contains the repository content
      * @param before content tree before the commit
      * @param after content tree prepared for the commit
      * @return content tree to be committed
      * @throws CommitFailedException if the commit should be rejected
      */
     @Nonnull
-    NodeState processCommit(NodeStore store, NodeState before, NodeState after)
+    NodeState processCommit(NodeState before, NodeState after)
         throws CommitFailedException;
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeHook.java
Wed Sep 26 13:44:25 2012
@@ -41,15 +41,12 @@ public class CompositeHook implements Co
     }
 
     @Override
-    public NodeState processCommit(
-            NodeStore store, NodeState before, NodeState after)
+    public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
-
         NodeState newState = after;
         for (CommitHook hook : hooks) {
-            newState = hook.processCommit(store, before, newState);
+            newState = hook.processCommit(before, newState);
         }
-
         return newState;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyHook.java
Wed Sep 26 13:44:25 2012
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.spi.co
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * Basic commit hook implementation that by default doesn't do anything.
@@ -43,8 +42,7 @@ public class EmptyHook implements Commit
     public static final CommitHook INSTANCE = new EmptyHook();
 
     @Override
-    public NodeState processCommit(
-            NodeStore store, NodeState before, NodeState after)
+    public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
         return after;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/ValidatingHook.java
Wed Sep 26 13:44:25 2012
@@ -23,7 +23,6 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 import static org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState.EMPTY_NODE;
 
@@ -68,8 +67,7 @@ public class ValidatingHook implements C
     }
 
     @Override
-    public NodeState processCommit(
-            NodeStore store, NodeState before, NodeState after)
+    public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
         Validator validator = validatorProvider.getRootValidator(before, after);
         ValidatorDiff.validate(validator, before, after);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/IndexUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/IndexUtils.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/IndexUtils.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/IndexUtils.java
Wed Sep 26 13:44:25 2012
@@ -136,7 +136,7 @@ public class IndexUtils {
 
     public static NodeBuilder getChildBuilder(NodeStore store, NodeState state,
             String path) {
-        NodeBuilder builder = store.getBuilder(state);
+        NodeBuilder builder = state.getBuilder();
         for (String p : PathUtils.elements(path)) {
             builder = builder.getChildBuilder(p);
         }

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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -185,6 +185,16 @@ public interface NodeState {
     Iterable<? extends ChildNodeEntry> getChildNodeEntries();
 
     /**
+     * Returns a builder for constructing a new node state based on
+     * this state, i.e. starting with all the properties and child nodes
+     * of this state.
+     *
+     * @return node builder based on this state
+     */
+    @Nonnull
+    NodeBuilder getBuilder();
+
+    /**
      * Compares this node state against the given base state. Any differences
      * are reported by calling the relevant added/changed/deleted methods of
      * the given handler.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
Wed Sep 26 13:44:25 2012
@@ -47,17 +47,6 @@ public interface NodeStore {
     NodeStoreBranch branch();
 
     /**
-     * Returns a builder for constructing a new or modified node state.
-     * The builder is initialized with all the properties and child nodes
-     * from the given base node state.
-     *
-     * @param base  base node state, or {@code null} for building new nodes
-     * @return  builder instance
-     */
-    @Nonnull
-    NodeBuilder getBuilder(NodeState base);
-
-    /**
      * Returns the factory for creating values used for building node states.
      *
      * @return value factory

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java?rev=1390485&r1=1390484&r2=1390485&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/JsopDiffTest.java
Wed Sep 26 13:44:25 2012
@@ -32,23 +32,23 @@ public class JsopDiffTest {
         JsopDiff diff;
         PropertyState before = SinglePropertyState.create("foo", "bar");
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.propertyAdded(before);
         assertEquals("^\"/foo\":\"bar\"", diff.toString());
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.propertyChanged(before, SinglePropertyState.create("foo", 123));
         assertEquals("^\"/foo\":123", diff.toString());
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.propertyChanged(before, SinglePropertyState.create("foo", 1.23));
         assertEquals("^\"/foo\":\"dou:1.23\"", diff.toString()); // TODO: 1.23?
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.propertyChanged(before, SinglePropertyState.create("foo", true));
         assertEquals("^\"/foo\":true", diff.toString());
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.propertyDeleted(before);
         assertEquals("^\"/foo\":null", diff.toString());
     }
@@ -64,15 +64,15 @@ public class JsopDiffTest {
                         "x", MemoryNodeState.EMPTY_NODE));
 
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.childNodeAdded("test", before);
         assertEquals("+\"/test\":{}", diff.toString());
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.childNodeChanged("test", before, after);
         assertEquals("^\"/test/a\":1+\"/test/x\":{}", diff.toString());
 
-        diff = new JsopDiff();
+        diff = new JsopDiff(null);
         diff.childNodeDeleted("test", after);
         assertEquals("-\"/test\"", diff.toString());
     }

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=1390485&r1=1390484&r2=1390485&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
Wed Sep 26 13:44:25 2012
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -71,7 +70,7 @@ public class KernelNodeStoreTest {
     public void branch() throws CommitFailedException {
         NodeStoreBranch branch = store.branch();
 
-        NodeBuilder rootBuilder = store.getBuilder(branch.getRoot());
+        NodeBuilder rootBuilder = branch.getRoot().getBuilder();
         NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
         NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
 
@@ -126,7 +125,7 @@ public class KernelNodeStoreTest {
         });
 
         NodeState root = store.getRoot();
-        NodeBuilder rootBuilder= store.getBuilder(root);
+        NodeBuilder rootBuilder= root.getBuilder();
         NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
         NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
 
@@ -158,18 +157,16 @@ public class KernelNodeStoreTest {
     public void beforeCommitHook() throws CommitFailedException {
         store.setHook(new CommitHook() {
             @Override
-            public NodeState processCommit(
-                    NodeStore store, NodeState before, NodeState after) {
-                NodeBuilder rootBuilder = store.getBuilder(after);
-                NodeBuilder testBuilder = store.getBuilder(after.getChildNode("test"));
-                testBuilder.setNode("fromHook", MemoryNodeState.EMPTY_NODE);
-                rootBuilder.setNode("test", testBuilder.getNodeState());
+            public NodeState processCommit(NodeState before, NodeState after) {
+                NodeBuilder rootBuilder = after.getBuilder();
+                NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
+                testBuilder.getChildBuilder("fromHook");
                 return rootBuilder.getNodeState();
             }
         });
 
         NodeState root = store.getRoot();
-        NodeBuilder rootBuilder = store.getBuilder(root);
+        NodeBuilder rootBuilder = root.getBuilder();
         NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
         NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
 



Mime
View raw message