jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1357240 - 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/lucene/ main/java/org/apache/jackrabbit/oak/spi/commit/ test...
Date Wed, 04 Jul 2012 13:13:54 GMT
Author: jukka
Date: Wed Jul  4 13:13:54 2012
New Revision: 1357240

URL: http://svn.apache.org/viewvc?rev=1357240&view=rev
Log:
OAK-153: Split the CommitHook interface

Restore post-commit support by adding an Observer reference to KernelNodeStore.
Replace constructor argument with a setter for specifying the CommitEditor instance.

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyObserver.java
      - copied, changed from r1356747, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.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/plugins/lucene/LuceneIndexProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.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/lucene/LuceneEditorTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Wed Jul  4 13:13:54 2012
@@ -45,7 +45,6 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.commit.ValidatingEditor;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,7 +63,7 @@ public class ContentRepositoryImpl imple
     private final LoginContextProvider loginContextProvider;
 
     private final QueryEngine queryEngine;
-    private final NodeStore nodeStore;
+    private final KernelNodeStore nodeStore;
 
     /**
      * Utility constructor that creates a new in-memory repository with default
@@ -91,11 +90,13 @@ public class ContentRepositoryImpl imple
             validatorProvider = createDefaultValidatorProvider();
         }
 
+
+        nodeStore = new KernelNodeStore(microKernel);
+ 
         List<CommitEditor> editors = new ArrayList<CommitEditor>();
         editors.add(new ValidatingEditor(validatorProvider));
-        CompositeEditor editor = new CompositeEditor(editors);
+        nodeStore.setEditor(new CompositeEditor(editors));
 
-        nodeStore = new KernelNodeStore(microKernel, editor);
         QueryIndexProvider qip = (indexProvider == null) ? getDefaultIndexProvider(microKernel)
: indexProvider;
         queryEngine = new QueryEngineImpl(nodeStore, microKernel, qip);
 

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=1357240&r1=1357239&r2=1357240&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 Jul  4 13:13:54 2012
@@ -22,6 +22,9 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitEditor;
+import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
+import org.apache.jackrabbit.oak.spi.commit.EmptyObserver;
+import org.apache.jackrabbit.oak.spi.commit.Observer;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
@@ -38,7 +41,14 @@ public class KernelNodeStore extends Mem
     /**
      * Commit editor.
      */
-    private final CommitEditor editor;
+    @Nonnull
+    private volatile CommitEditor editor = EmptyEditor.INSTANCE;
+
+    /**
+     * Change observer.
+     */
+    @Nonnull
+    private volatile Observer observer = EmptyObserver.INSTANCE;
 
     /**
      * Value factory backed by the {@link #kernel} instance.
@@ -50,23 +60,42 @@ public class KernelNodeStore extends Mem
      */
     private KernelNodeState root;
 
-    public KernelNodeStore(MicroKernel kernel, CommitEditor editor) {
+    public KernelNodeStore(MicroKernel kernel) {
         assert kernel != null;
-        assert editor != null;
-
         this.kernel = kernel;
-        this.editor = editor;
         this.valueFactory = new CoreValueFactoryImpl(kernel);
         this.root = new KernelNodeState(
                 kernel, valueFactory, "/", kernel.getHeadRevision());
     }
 
+    public CommitEditor getEditor() {
+        return editor;
+    }
+
+    public void setEditor(CommitEditor editor) {
+        assert editor != null;
+        this.editor = editor;
+    }
+
+    public Observer getObserver() {
+        return observer;
+    }
+
+    public void setObserver(Observer observer) {
+        assert observer != null;
+        this.observer = observer;
+    }
+
+    //-----------------------------------------------------------< NodeStore >
+
     @Override
     public synchronized NodeState getRoot() {
         String revision = kernel.getHeadRevision();
         if (!revision.equals(root.getRevision())) {
+            NodeState before = root;
             root = new KernelNodeState(
                     kernel, valueFactory, "/", kernel.getHeadRevision());
+            observer.contentChanged(this, before, root);
         }
         return root;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java
Wed Jul  4 13:13:54 2012
@@ -23,14 +23,13 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.spi.QueryIndex;
 import org.apache.jackrabbit.oak.spi.QueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 public class LuceneIndexProvider implements QueryIndexProvider {
 
     @Override
     public List<QueryIndex> getQueryIndexes(MicroKernel mk) {
-        NodeStore store = new KernelNodeStore(mk, EmptyEditor.INSTANCE);
+        NodeStore store = new KernelNodeStore(mk);
         return Collections.<QueryIndex>singletonList(new LuceneIndex(store));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CompositeEditor.java
Wed Jul  4 13:13:54 2012
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -35,6 +36,10 @@ public class CompositeEditor implements 
         this.editors = editors;
     }
 
+    public CompositeEditor(CommitEditor... editors) {
+        this(Arrays.asList(editors));
+    }
+
     @Override
     public NodeState editCommit(
             NodeStore store, NodeState before, NodeState after)

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyObserver.java
(from r1356747, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyObserver.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyObserver.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java&r1=1356747&r2=1357240&rev=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneIndexProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/EmptyObserver.java
Wed Jul  4 13:13:54 2012
@@ -14,24 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.plugins.lucene;
+package org.apache.jackrabbit.oak.spi.commit;
 
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.spi.QueryIndex;
-import org.apache.jackrabbit.oak.spi.QueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
-public class LuceneIndexProvider implements QueryIndexProvider {
 
-    @Override
-    public List<QueryIndex> getQueryIndexes(MicroKernel mk) {
-        NodeStore store = new KernelNodeStore(mk, EmptyEditor.INSTANCE);
-        return Collections.<QueryIndex>singletonList(new LuceneIndex(store));
+/**
+ * Basic content change observer that doesn't do anything. Useful as a
+ * "null object" for cases where another observer has not been configured,
+ * thus avoiding an extra {@code null} check when invoking the observer.
+ */
+public class EmptyObserver implements Observer {
+
+    /**
+     * Static instance of this class, useful as a "null object".
+     */
+    public static final EmptyObserver INSTANCE = new EmptyObserver();
+
+    public void contentChanged(
+            NodeStore store, NodeState before, NodeState after) {
+        // do nothing
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
Wed Jul  4 13:13:54 2012
@@ -20,10 +20,7 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.spi.commit.CommitEditor;
-import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,7 +36,7 @@ public abstract class AbstractOakTest {
     private static final Logger log = LoggerFactory.getLogger(AbstractOakTest.class);
 
     // TODO: use regular oak-repo setup
-    protected NodeStore store;
+    protected KernelNodeStore store;
     protected CoreValueFactory valueFactory;
 
     protected NodeState state;
@@ -47,16 +44,11 @@ public abstract class AbstractOakTest {
     @Before
     public void setUp() {
         MicroKernel microKernel = new MicroKernelImpl();
-        store = new KernelNodeStore(microKernel, createCommitEditor());
+        store = new KernelNodeStore(microKernel);
         valueFactory = store.getValueFactory();
-
         state = createInitialState(microKernel);
     }
 
-    protected CommitEditor createCommitEditor() {
-        return new EmptyEditor();
-    }
-
     protected abstract NodeState createInitialState(MicroKernel microKernel);
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
Wed Jul  4 13:13:54 2012
@@ -30,7 +30,6 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.Rebase;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -79,13 +78,13 @@ public class RootImplFuzzIT {
         counter = 0;
 
         MicroKernel mk1 = new MicroKernelImpl("./target/mk1/" + random.nextInt());
-        store1 = new KernelNodeStore(mk1, EmptyEditor.INSTANCE);
+        store1 = new KernelNodeStore(mk1);
         vf = store1.getValueFactory();
         mk1.commit("", "+\"/root\":{}", mk1.getHeadRevision(), "");
         root1 = new RootImpl(store1, null);
 
         MicroKernel mk2 = new MicroKernelImpl("./target/mk2/" + random.nextInt());
-        store2 = new KernelNodeStore(mk2, EmptyEditor.INSTANCE);
+        store2 = new KernelNodeStore(mk2);
         mk2.commit("", "+\"/root\":{}", mk2.getHeadRevision(), "");
         root2 = new RootImpl(store2, null);
     }

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=1357240&r1=1357239&r2=1357240&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 Jul  4 13:13:54 2012
@@ -24,7 +24,7 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.core.AbstractOakTest;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState;
 import org.apache.jackrabbit.oak.spi.commit.CommitEditor;
-import org.apache.jackrabbit.oak.spi.commit.EmptyEditor;
+import org.apache.jackrabbit.oak.spi.commit.Observer;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -36,7 +36,6 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 
 public class KernelNodeStoreTest extends AbstractOakTest {
-    private final CommitEditorDelegate commitHookDelegate = new CommitEditorDelegate();
 
     private NodeState root;
 
@@ -50,11 +49,6 @@ public class KernelNodeStoreTest extends
         return root;
     }
 
-    @Override
-    protected CommitEditor createCommitEditor() {
-        return commitHookDelegate;
-    }
-
     @Test
     public void getRoot() {
         assertEquals(root, store.getRoot());
@@ -123,6 +117,16 @@ public class KernelNodeStoreTest extends
 
     @Test
     public void afterCommitHook() throws CommitFailedException {
+        final NodeState[] states = new NodeState[2]; // { before, after }
+        store.setObserver(new Observer() {
+            @Override
+            public void contentChanged(
+                    NodeStore store, NodeState before, NodeState after) {
+                states[0] = before;
+                states[1] = after;
+            }
+        });
+
         NodeState root = store.getRoot();
         NodeStateBuilder rootBuilder= store.getBuilder(root);
 
@@ -130,30 +134,46 @@ public class KernelNodeStoreTest extends
         NodeStateBuilder testBuilder = store.getBuilder(test);
 
         NodeStateBuilder newNodeBuilder = store.getBuilder(MemoryNodeState.EMPTY_NODE);
-        final CoreValue fortyTwo = store.getValueFactory().createValue(42);
+        CoreValue fortyTwo = store.getValueFactory().createValue(42);
         newNodeBuilder.setProperty("n", fortyTwo);
 
         testBuilder.setNode("newNode", newNodeBuilder.getNodeState());
         testBuilder.removeNode("a");
 
         rootBuilder.setNode("test", testBuilder.getNodeState());
-        final NodeState newRoot = rootBuilder.getNodeState();
+        NodeState newRoot = rootBuilder.getNodeState();
 
-        commitWithEditor(newRoot, new EmptyEditor() {
-// TODO: OAK-153 - use the Observer interface to observe content changes
-//            @Override
-//            public void afterCommit(NodeStore store, NodeState before, NodeState after)
{
-//                assertNull(before.getChildNode("test").getChildNode("newNode"));
-//                assertNotNull(after.getChildNode("test").getChildNode("newNode"));
-//                assertNull(after.getChildNode("test").getChildNode("a"));
-//                assertEquals(fortyTwo, after.getChildNode("test").getChildNode("newNode").getProperty("n").getValue());
-//                assertEquals(newRoot, after);
-//            }
-        });
+        NodeStoreBranch branch = store.branch();
+        branch.setRoot(newRoot);
+        branch.merge();
+        store.getRoot(); // triggers the observer
+
+        NodeState before = states[0];
+        NodeState after = states[1];
+        assertNotNull(before);
+        assertNotNull(after);
+
+        assertNull(before.getChildNode("test").getChildNode("newNode"));
+        assertNotNull(after.getChildNode("test").getChildNode("newNode"));
+        assertNull(after.getChildNode("test").getChildNode("a"));
+        assertEquals(fortyTwo, after.getChildNode("test").getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(newRoot, after);
     }
 
     @Test
     public void beforeCommitHook() throws CommitFailedException {
+        store.setEditor(new CommitEditor() {
+            @Override
+            public NodeState editCommit(
+                    NodeStore store, NodeState before, NodeState after) {
+                NodeStateBuilder rootBuilder = store.getBuilder(after);
+                NodeStateBuilder testBuilder = store.getBuilder(after.getChildNode("test"));
+                testBuilder.setNode("fromHook", MemoryNodeState.EMPTY_NODE);
+                rootBuilder.setNode("test", testBuilder.getNodeState());
+                return rootBuilder.getNodeState();
+            }
+        });
+
         NodeState root = store.getRoot();
         NodeStateBuilder rootBuilder = store.getBuilder(root);
 
@@ -168,18 +188,11 @@ public class KernelNodeStoreTest extends
         testBuilder.removeNode("a");
 
         rootBuilder.setNode("test", testBuilder.getNodeState());
-        final NodeState newRoot = rootBuilder.getNodeState();
+        NodeState newRoot = rootBuilder.getNodeState();
 
-        commitWithEditor(newRoot, new EmptyEditor() {
-            @Override
-            public NodeState editCommit(NodeStore store, NodeState before, NodeState after)
{
-                NodeStateBuilder rootBuilder = store.getBuilder(after);
-                NodeStateBuilder testBuilder = store.getBuilder(after.getChildNode("test"));
-                testBuilder.setNode("fromHook", MemoryNodeState.EMPTY_NODE);
-                rootBuilder.setNode("test", testBuilder.getNodeState());
-                return rootBuilder.getNodeState();
-            }
-        });
+        NodeStoreBranch branch = store.branch();
+        branch.setRoot(newRoot);
+        branch.merge();
 
         test = store.getRoot().getChildNode("test");
         assertNotNull(test.getChildNode("newNode"));
@@ -189,36 +202,4 @@ public class KernelNodeStoreTest extends
         assertEquals(test, store.getRoot().getChildNode("test"));
     }
 
-    //------------------------------------------------------------< private >---
-
-    private void commitWithEditor(NodeState nodeState, CommitEditor editor)
-            throws CommitFailedException {
-
-        commitHookDelegate.set(editor);
-        try {
-            NodeStoreBranch branch = store.branch();
-            branch.setRoot(nodeState);
-            branch.merge();
-        }
-        finally {
-            commitHookDelegate.set(new EmptyEditor());
-        }
-    }
-
-    private static class CommitEditorDelegate implements CommitEditor {
-        private CommitEditor delegate = new EmptyEditor();
-
-        public void set(CommitEditor editor) {
-            delegate = editor;
-        }
-
-        @Override
-        public NodeState editCommit(NodeStore store, NodeState before, NodeState after)
-                throws CommitFailedException {
-
-            return delegate.editCommit(store, before, after);
-        }
-
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditorTest.java?rev=1357240&r1=1357239&r2=1357240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditorTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditorTest.java
Wed Jul  4 13:13:54 2012
@@ -20,7 +20,6 @@ import static junit.framework.Assert.ass
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -33,16 +32,14 @@ import org.apache.jackrabbit.oak.query.i
 import org.apache.jackrabbit.oak.spi.Cursor;
 import org.apache.jackrabbit.oak.spi.Filter;
 import org.apache.jackrabbit.oak.spi.QueryIndex;
-import org.apache.lucene.store.Directory;
 import org.junit.Test;
 
 public class LuceneEditorTest {
 
     @Test
     public void testLucene() throws Exception {
-        MicroKernel mk = new MicroKernelImpl();
-        KernelNodeStore store = new KernelNodeStore(
-                mk, new LuceneEditor("jcr:system", "oak:lucene"));
+        KernelNodeStore store = new KernelNodeStore(new MicroKernelImpl());
+        store.setEditor(new LuceneEditor("jcr:system", "oak:lucene"));
         Root root = new RootImpl(store, "");
         Tree tree = root.getTree("/");
 



Mime
View raw message