jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1446515 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/ main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/kernel/ main/java/org/apache/jackrabbit/oak/plugins/memory/ main/java/org/a...
Date Fri, 15 Feb 2013 11:23:18 GMT
Author: jukka
Date: Fri Feb 15 11:23:17 2013
New Revision: 1446515

URL: http://svn.apache.org/r1446515
Log:
OAK-627: Move CommitHook(s) from KernelNodeStore to RootImpl

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
    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/core/ContentSessionImpl.java
    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/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/plugins/memory/MemoryNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/CallbackHandlerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.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/kernel/LargeKernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java Fri Feb 15 11:23:17 2013
@@ -50,6 +50,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.collect.Lists.newArrayList;
@@ -245,7 +246,7 @@ public class Oak {
     }
 
     public ContentRepository createContentRepository() {
-        KernelNodeStore store = new KernelNodeStore(kernel);
+        NodeStore store = new KernelNodeStore(kernel);
 
         IndexHookProvider indexHooks = CompositeIndexHookProvider
                 .compose(indexHookProviders);
@@ -256,10 +257,10 @@ public class Oak {
 
         withValidatorHook();
         withSecurityHooks();
-        store.setHook(CompositeHook.compose(commitHooks));
 
         return new ContentRepositoryImpl(
                 store,
+                CompositeHook.compose(commitHooks),
                 defaultWorkspaceName,
                 CompositeQueryIndexProvider.compose(queryIndexProviders),
                 securityProvider);

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=1446515&r1=1446514&r2=1446515&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 Fri Feb 15 11:23:17 2013
@@ -24,6 +24,7 @@ import javax.security.auth.login.LoginEx
 
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
@@ -42,21 +43,25 @@ public class ContentRepositoryImpl imple
     private final SecurityProvider securityProvider;
     private final QueryIndexProvider indexProvider;
     private final NodeStore nodeStore;
+    private final CommitHook commitHook;
 
     /**
      * Creates an content repository instance based on the given, already
      * initialized components.
      *
      * @param nodeStore            the node store this repository is based upon.
+     * @param commitHook           the hook to use for processing commits
      * @param defaultWorkspaceName the default workspace name;
      * @param indexProvider        index provider
      * @param securityProvider     The configured security provider.
      */
     public ContentRepositoryImpl(@Nonnull NodeStore nodeStore,
+                                 @Nonnull CommitHook commitHook,
                                  @Nonnull String defaultWorkspaceName,
                                  @Nullable QueryIndexProvider indexProvider,
                                  @Nonnull SecurityProvider securityProvider) {
         this.nodeStore = nodeStore;
+        this.commitHook = commitHook;
         this.defaultWorkspaceName = defaultWorkspaceName;
         this.indexProvider = indexProvider != null ? indexProvider : new CompositeQueryIndexProvider();
         this.securityProvider = securityProvider;
@@ -75,13 +80,13 @@ public class ContentRepositoryImpl imple
             throw new NoSuchWorkspaceException(workspaceName);
         }
 
-        LoginContextProvider lcProvider = securityProvider.getAuthenticationConfiguration().getLoginContextProvider(nodeStore, indexProvider);
+        LoginContextProvider lcProvider = securityProvider.getAuthenticationConfiguration().getLoginContextProvider(nodeStore, commitHook, indexProvider);
         LoginContext loginContext = lcProvider.getLoginContext(credentials, workspaceName);
         loginContext.login();
 
         AccessControlConfiguration acConfiguration = securityProvider.getAccessControlConfiguration();
         return new ContentSessionImpl(loginContext, acConfiguration, workspaceName,
-                nodeStore, indexProvider);
+                nodeStore, commitHook, indexProvider);
     }
 
     public NodeStore getNodeStore() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java Fri Feb 15 11:23:17 2013
@@ -25,6 +25,7 @@ import javax.security.auth.login.LoginEx
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.LoginContext;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
@@ -45,17 +46,19 @@ class ContentSessionImpl implements Cont
     private final AccessControlConfiguration accConfiguration;
     private final String workspaceName;
     private final NodeStore store;
+    private final CommitHook hook;
     private final QueryIndexProvider indexProvider;
 
     private volatile boolean live = true;
 
     public ContentSessionImpl(LoginContext loginContext,
             AccessControlConfiguration accConfiguration, String workspaceName,
-            NodeStore store, QueryIndexProvider indexProvider) {
+            NodeStore store, CommitHook hook, QueryIndexProvider indexProvider) {
         this.loginContext = loginContext;
         this.accConfiguration = accConfiguration;
         this.workspaceName = workspaceName;
         this.store = store;
+        this.hook = hook;
         this.indexProvider = indexProvider;
     }
 
@@ -85,7 +88,9 @@ class ContentSessionImpl implements Cont
     @Override
     public Root getLatestRoot() {
         checkLive();
-        RootImpl root = new RootImpl(store, workspaceName, loginContext.getSubject(), accConfiguration, indexProvider) {
+        RootImpl root = new RootImpl(
+                store, hook, workspaceName, loginContext.getSubject(),
+                accConfiguration, indexProvider) {
             @Override
             protected void checkLive() {
                 ContentSessionImpl.this.checkLive();

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=1446515&r1=1446514&r2=1446515&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 Feb 15 11:23:17 2013
@@ -36,6 +36,8 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.index.diffindex.UUIDDiffIndexProviderWrapper;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.observation.ChangeExtractor;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
@@ -66,6 +68,8 @@ public class RootImpl implements Root {
      */
     private final NodeStore store;
 
+    private final CommitHook hook;
+
     private final Subject subject;
 
     /**
@@ -102,11 +106,13 @@ public class RootImpl implements Root {
      */
     @SuppressWarnings("UnusedParameters")
     public RootImpl(NodeStore store,
+                    CommitHook hook,
                     String workspaceName,
                     Subject subject,
                     AccessControlConfiguration accConfiguration,
                     QueryIndexProvider indexProvider) {
         this.store = checkNotNull(store);
+        this.hook = checkNotNull(hook);
         this.subject = checkNotNull(subject);
         this.accConfiguration = checkNotNull(accConfiguration);
         this.indexProvider = indexProvider;
@@ -121,6 +127,7 @@ public class RootImpl implements Root {
     // TODO: review if this constructor really makes sense and cannot be replaced.
     public RootImpl(NodeStore store, QueryIndexProvider indexProvider) {
         this.store = checkNotNull(store);
+        this.hook = EmptyHook.INSTANCE;
         this.subject = new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE), Collections.<Object>emptySet(), Collections.<Object>emptySet());
         this.accConfiguration = new OpenAccessControlConfiguration();
         this.indexProvider = indexProvider;
@@ -136,7 +143,7 @@ public class RootImpl implements Root {
      */
     public Root getLatest() {
         checkLive();
-        RootImpl root = new RootImpl(store, null, subject, accConfiguration, getIndexProvider()) {
+        RootImpl root = new RootImpl(store, hook, null, subject, accConfiguration, getIndexProvider()) {
             @Override
             protected void checkLive() {
                 RootImpl.this.checkLive();
@@ -237,7 +244,7 @@ public class RootImpl implements Root {
             @Override
             public CommitFailedException run() {
                 try {
-                    branch.merge();
+                    branch.merge(hook);
                     return null;
                 } catch (CommitFailedException e) {
                     return e;

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=1446515&r1=1446514&r2=1446515&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 Fri Feb 15 11:23:17 2013
@@ -27,8 +27,6 @@ import com.google.common.cache.CacheLoad
 import com.google.common.cache.LoadingCache;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
-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.NodeState;
@@ -48,12 +46,6 @@ public class KernelNodeStore implements 
     private final MicroKernel kernel;
 
     /**
-     * Commit hook.
-     */
-    @Nonnull
-    private volatile CommitHook hook = EmptyHook.INSTANCE;
-
-    /**
      * Change observer.
      */
     @Nonnull
@@ -87,15 +79,6 @@ public class KernelNodeStore implements 
     }
 
     @Nonnull
-    public CommitHook getHook() {
-        return hook;
-    }
-
-    public void setHook(@Nonnull CommitHook hook) {
-        this.hook = checkNotNull(hook);
-    }
-
-    @Nonnull
     public Observer getObserver() {
         return observer;
     }

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=1446515&r1=1446514&r2=1446515&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 Fri Feb 15 11:23:17 2013
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
 import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
 import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
@@ -122,10 +123,9 @@ class KernelNodeStoreBranch implements N
     }
 
     @Override
-    public NodeState merge() throws CommitFailedException {
+    public NodeState merge(CommitHook hook) throws CommitFailedException {
         checkNotMerged();
-        CommitHook commitHook = store.getHook();
-        NodeState toCommit = commitHook.processCommit(base, head);
+        NodeState toCommit = checkNotNull(hook).processCommit(base, head);
         NodeState oldRoot = head;
         setRoot(toCommit);
 

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=1446515&r1=1446514&r2=1446515&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 Fri Feb 15 11:23:17 2013
@@ -23,12 +23,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.concurrent.atomic.AtomicReference;
 
-import javax.annotation.Nonnull;
-
 import com.google.common.io.ByteStreams;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -42,12 +39,6 @@ public class MemoryNodeStore implements 
     private final AtomicReference<NodeState> root =
             new AtomicReference<NodeState>(MemoryNodeState.EMPTY_NODE);
 
-    /**
-     * Commit hook.
-     */
-    @Nonnull
-    private volatile CommitHook hook = EmptyHook.INSTANCE;
-
     @Override
     public NodeState getRoot() {
         return root.get();
@@ -71,10 +62,6 @@ public class MemoryNodeStore implements 
         }
     }
 
-    public void setHook(CommitHook hook) {
-        this.hook = checkNotNull(hook);
-    }
-
     private static class MemoryNodeStoreBranch implements NodeStoreBranch {
 
         /** The underlying store to which this branch belongs */
@@ -110,10 +97,10 @@ public class MemoryNodeStore implements 
         }
 
         @Override
-        public NodeState merge() throws CommitFailedException {
+        public NodeState merge(CommitHook hook) throws CommitFailedException {
             checkNotMerged();
-            while (!store.root.compareAndSet(base,
-                    store.hook.processCommit(base, root))) {
+            while (!store.root.compareAndSet(
+                    base, checkNotNull(hook).processCommit(base, root))) {
                 // TODO: rebase();
                 throw new UnsupportedOperationException();
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java Fri Feb 15 11:23:17 2013
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.oak.core.Ro
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
 import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -75,7 +76,7 @@ public class InitialContent implements R
         NodeStoreBranch branch = store.branch();
         branch.setRoot(root.getNodeState());
         try {
-            branch.merge();
+            branch.merge(EmptyHook.INSTANCE);
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStore.java Fri Feb 15 11:23:17 2013
@@ -22,8 +22,6 @@ import java.io.InputStream;
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.Blob;
-import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -34,8 +32,6 @@ public class SegmentNodeStore implements
 
     private final SegmentReader reader;
 
-    private CommitHook hook = new EmptyHook();
-
     public SegmentNodeStore(SegmentStore store) {
         this.store = store;
         this.reader = new SegmentReader(store);
@@ -48,7 +44,7 @@ public class SegmentNodeStore implements
 
     @Override @Nonnull
     public NodeStoreBranch branch() {
-        return new SegmentNodeStoreBranch(store, reader, hook);
+        return new SegmentNodeStoreBranch(store, reader);
     }
 
     @Override
@@ -59,8 +55,4 @@ public class SegmentNodeStore implements
         return new SegmentBlob(reader, recordId);
     }
 
-    public void setHook(CommitHook hook) {
-        this.hook = hook;
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java Fri Feb 15 11:23:17 2013
@@ -47,18 +47,14 @@ class SegmentNodeStoreBranch implements 
 
     private final SegmentWriter writer;
 
-    private final CommitHook hook;
-
     private RecordId baseId;
 
     private RecordId rootId;
 
-    SegmentNodeStoreBranch(
-            SegmentStore store, SegmentReader reader, CommitHook hook) {
+    SegmentNodeStoreBranch(SegmentStore store, SegmentReader reader) {
         this.store = store;
         this.reader = reader;
         this.writer = new SegmentWriter(store);
-        this.hook = hook;
         this.baseId = store.getJournalHead();
         this.rootId = baseId;
     }
@@ -173,7 +169,8 @@ class SegmentNodeStoreBranch implements 
     }
 
     @Override @Nonnull
-    public synchronized NodeState merge() throws CommitFailedException {
+    public synchronized NodeState merge(CommitHook hook)
+            throws CommitFailedException {
         RecordId originalBaseId = baseId;
         RecordId originalRootId = rootId;
         for (int i = 0; i < 10; i++) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java Fri Feb 15 11:23:17 2013
@@ -21,6 +21,7 @@ import javax.security.auth.login.Configu
 
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
@@ -55,7 +56,7 @@ public class AuthenticationConfiguration
 
     @Nonnull
     @Override
-    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider indexProvider) {
+    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, CommitHook commitHook, QueryIndexProvider indexProvider) {
         String appName = config.getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
         Configuration loginConfig = null;
         try {
@@ -73,7 +74,7 @@ public class AuthenticationConfiguration
             // TODO: review if having a default is desirable or if login should fail without valid login configuration.
             loginConfig = ConfigurationUtil.getDefaultConfiguration(config);
         }
-        return new LoginContextProviderImpl(appName, loginConfig, nodeStore, indexProvider, securityProvider);
+        return new LoginContextProviderImpl(appName, loginConfig, nodeStore, commitHook, indexProvider, securityProvider);
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/CallbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/CallbackHandlerImpl.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/CallbackHandlerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/CallbackHandlerImpl.java Fri Feb 15 11:23:17 2013
@@ -25,6 +25,7 @@ import javax.security.auth.callback.Name
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.callback.CredentialsCallback;
@@ -49,15 +50,17 @@ public class CallbackHandlerImpl impleme
     private final Credentials credentials;
     private final String workspaceName;
     private final NodeStore nodeStore;
+    private final CommitHook commitHook;
     private final QueryIndexProvider indexProvider;
     private final SecurityProvider securityProvider;
 
     public CallbackHandlerImpl(Credentials credentials, String workspaceName,
-                               NodeStore nodeStore, QueryIndexProvider indexProvider,
+                               NodeStore nodeStore, CommitHook commitHook, QueryIndexProvider indexProvider,
                                SecurityProvider securityProvider) {
         this.credentials = credentials;
         this.workspaceName = workspaceName;
         this.nodeStore = nodeStore;
+        this.commitHook = commitHook;
         this.indexProvider = indexProvider;
         this.securityProvider = securityProvider;
     }
@@ -77,6 +80,7 @@ public class CallbackHandlerImpl impleme
             } else if (callback instanceof RepositoryCallback) {
                 RepositoryCallback repositoryCallback = (RepositoryCallback) callback;
                 repositoryCallback.setNodeStore(nodeStore);
+                repositoryCallback.setCommitHook(commitHook);
                 repositoryCallback.setIndexProvider(indexProvider);
                 repositoryCallback.setWorkspaceName(workspaceName);
             } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java Fri Feb 15 11:23:17 2013
@@ -24,6 +24,7 @@ import javax.security.auth.callback.Call
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginException;
 
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.JaasLoginContext;
@@ -43,15 +44,17 @@ public class LoginContextProviderImpl im
     private final String appName;
     private final Configuration configuration;
     private final NodeStore nodeStore;
+    private final CommitHook commitHook;
     private final QueryIndexProvider indexProvider;
     private final SecurityProvider securityProvider;
 
     public LoginContextProviderImpl(String appName, Configuration configuration,
-                                    NodeStore nodeStore, QueryIndexProvider indexProvider,
+                                    NodeStore nodeStore, CommitHook commitHook, QueryIndexProvider indexProvider,
                                     SecurityProvider securityProvider) {
         this.appName = appName;
         this.configuration = configuration;
         this.nodeStore = nodeStore;
+        this.commitHook = commitHook;
         this.indexProvider = indexProvider;
         this.securityProvider = securityProvider;
     }
@@ -80,6 +83,6 @@ public class LoginContextProviderImpl im
     }
 
     private CallbackHandler getCallbackHandler(Credentials credentials, String workspaceName) {
-        return new CallbackHandlerImpl(credentials, workspaceName, nodeStore, indexProvider, securityProvider);
+        return new CallbackHandlerImpl(credentials, workspaceName, nodeStore, commitHook, indexProvider, securityProvider);
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java Fri Feb 15 11:23:17 2013
@@ -25,6 +25,7 @@ import org.apache.jackrabbit.oak.api.Typ
 import org.apache.jackrabbit.oak.core.RootImpl;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -57,7 +58,7 @@ class PrivilegeInitializer implements Re
             NodeStoreBranch branch = store.branch();
             try {
                 branch.setRoot(root.getNodeState());
-                branch.merge();
+                branch.merge(EmptyHook.INSTANCE);
             } catch (CommitFailedException e) {
                 log.error("Failed to initialize privilege content ", e);
                 throw new RuntimeException(e);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java Fri Feb 15 11:23:17 2013
@@ -81,11 +81,10 @@ public class UserInitializer implements 
     @Override
     public NodeState initialize(NodeState state) {
         MemoryNodeStore store = new MemoryNodeStore();
-        store.setHook(IndexHookManager.of(new Property2IndexHookProvider()));
         NodeStoreBranch branch = store.branch();
         branch.setRoot(state);
         try {
-            branch.merge();
+            branch.merge(IndexHookManager.of(new Property2IndexHookProvider()));
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/lifecycle/OakInitializer.java Fri Feb 15 11:23:17 2013
@@ -29,14 +29,11 @@ public class OakInitializer {
 
     public static void initialize(NodeStore store,
             RepositoryInitializer initializer, IndexHookProvider indexHook) {
-
         NodeStoreBranch branch = store.branch();
         NodeState before = branch.getRoot();
-        NodeState after = initializer.initialize(before);
+        branch.setRoot(initializer.initialize(before));
         try {
-            branch.setRoot(IndexHookManager.of(indexHook).processCommit(before,
-                    after));
-            branch.merge();
+            branch.merge(IndexHookManager.of(indexHook));
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AuthenticationConfiguration.java Fri Feb 15 11:23:17 2013
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.spi.se
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
@@ -31,7 +32,7 @@ public interface AuthenticationConfigura
 
     // TODO review again
     @Nonnull
-    LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider indexProvider);
+    LoginContextProvider getLoginContextProvider(NodeStore nodeStore, CommitHook commitHook, QueryIndexProvider indexProvider);
 
     @Nonnull
     TokenProvider getTokenProvider(Root root);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/OpenAuthenticationConfiguration.java Fri Feb 15 11:23:17 2013
@@ -21,6 +21,7 @@ import javax.jcr.Credentials;
 import javax.security.auth.Subject;
 
 import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
@@ -35,7 +36,7 @@ public class OpenAuthenticationConfigura
 
     @Nonnull
     @Override
-    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider indexProvider) {
+    public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, CommitHook commitHook, QueryIndexProvider indexProvider) {
         return new LoginContextProvider() {
             @Nonnull
             @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java Fri Feb 15 11:23:17 2013
@@ -23,6 +23,7 @@ import javax.security.auth.callback.Call
 
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.core.RootImpl;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.OpenAccessControlConfiguration;
@@ -38,6 +39,7 @@ import org.apache.jackrabbit.oak.spi.sta
 public class RepositoryCallback implements Callback {
 
     private NodeStore nodeStore;
+    private CommitHook commitHook;
     private QueryIndexProvider indexProvider;
     private String workspaceName;
 
@@ -50,7 +52,7 @@ public class RepositoryCallback implemen
         if (nodeStore != null) {
             Subject subject = new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE), Collections.<Object>emptySet(), Collections.<Object>emptySet());
             AccessControlConfiguration acConfiguration = new OpenAccessControlConfiguration();
-            return new RootImpl(nodeStore, workspaceName, subject, acConfiguration, indexProvider);
+            return new RootImpl(nodeStore, commitHook, workspaceName, subject, acConfiguration, indexProvider);
         }
         return null;
     }
@@ -59,6 +61,10 @@ public class RepositoryCallback implemen
         this.nodeStore = nodeStore;
     }
 
+    public void setCommitHook(CommitHook commitHook) {
+        this.commitHook = commitHook;
+    }
+
     public void setIndexProvider(QueryIndexProvider indexProvider) {
         this.indexProvider = indexProvider;
     }
@@ -66,4 +72,5 @@ public class RepositoryCallback implemen
     public void setWorkspaceName(String workspaceName) {
         this.workspaceName = workspaceName;
     }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java Fri Feb 15 11:23:17 2013
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.spi.st
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 
 /**
  * An instance of this class represents a private branch of the tree in a
@@ -75,12 +76,13 @@ public interface NodeStoreBranch {
     /**
      * Merges the changes in this branch to the main content tree.
      *
+     * @param hook the commit hook to apply while merging changes
      * @return the node state resulting from the merge.
      * @throws CommitFailedException if the merge failed
      * @throws IllegalStateException if the branch is already merged
      */
     @Nonnull
-    NodeState merge() throws CommitFailedException;
+    NodeState merge(@Nonnull CommitHook hook) throws CommitFailedException;
 
     /**
      * Rebase the changes from this branch on top of the current

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java Fri Feb 15 11:23:17 2013
@@ -22,6 +22,7 @@ package org.apache.jackrabbit.oak.kernel
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
@@ -51,7 +52,7 @@ public class KernelNodeBuilderTest {
         NodeBuilder builder = branch.getRoot().builder();
         builder.child("x").child("y").child("z");
         branch.setRoot(builder.getNodeState());
-        branch.merge();
+        branch.merge(EmptyHook.INSTANCE);
     }
 
     private static void run(NodeStore store) throws CommitFailedException {
@@ -74,7 +75,7 @@ public class KernelNodeBuilderTest {
         assertFalse("child node x/y/z not should not be present", builder
                 .child("x").child("y").hasChildNode("z"));
 
-        branch.merge();
+        branch.merge(EmptyHook.INSTANCE);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java Fri Feb 15 11:23:17 2013
@@ -26,6 +26,7 @@ import java.util.List;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -58,7 +59,7 @@ public class KernelNodeStateTest {
         builder.child("z");
         branch.setRoot(builder.getNodeState());
 
-        state = branch.merge();
+        state = branch.merge(EmptyHook.INSTANCE);
     }
 
     @After

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=1446515&r1=1446514&r2=1446515&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 Feb 15 11:23:17 2013
@@ -22,6 +22,7 @@ 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.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -101,7 +102,7 @@ public class KernelNodeStoreTest {
         assertNull(testState.getChildNode("newNode"));
         assertNotNull(testState.getChildNode("x"));
 
-        branch.merge();
+        branch.merge(EmptyHook.INSTANCE);
 
         // Assert changes are present in the trunk
         testState = store.getRoot().getChildNode("test");
@@ -134,7 +135,7 @@ public class KernelNodeStoreTest {
 
         NodeStoreBranch branch = store.branch();
         branch.setRoot(newRoot);
-        branch.merge();
+        branch.merge(EmptyHook.INSTANCE);
         store.getRoot(); // triggers the observer
 
         NodeState before = states[0];
@@ -151,16 +152,6 @@ public class KernelNodeStoreTest {
 
     @Test
     public void beforeCommitHook() throws CommitFailedException {
-        store.setHook(new CommitHook() {
-            @Override
-            public NodeState processCommit(NodeState before, NodeState after) {
-                NodeBuilder rootBuilder = after.builder();
-                NodeBuilder testBuilder = rootBuilder.child("test");
-                testBuilder.child("fromHook");
-                return rootBuilder.getNodeState();
-            }
-        });
-
         NodeState root = store.getRoot();
         NodeBuilder rootBuilder = root.builder();
         NodeBuilder testBuilder = rootBuilder.child("test");
@@ -174,7 +165,15 @@ public class KernelNodeStoreTest {
 
         NodeStoreBranch branch = store.branch();
         branch.setRoot(newRoot);
-        branch.merge();
+        branch.merge(new CommitHook() {
+            @Override
+            public NodeState processCommit(NodeState before, NodeState after) {
+                NodeBuilder rootBuilder = after.builder();
+                NodeBuilder testBuilder = rootBuilder.child("test");
+                testBuilder.child("fromHook");
+                return rootBuilder.getNodeState();
+            }
+        });
 
         NodeState test = store.getRoot().getChildNode("test");
         assertNotNull(test.getChildNode("newNode"));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java Fri Feb 15 11:23:17 2013
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.oak.kernel
 
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -51,7 +52,7 @@ public class LargeKernelNodeStateTest {
         }
         branch.setRoot(builder.getNodeState());
 
-        state = branch.merge();
+        state = branch.merge(EmptyHook.INSTANCE);
     }
 
     @After

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java?rev=1446515&r1=1446514&r2=1446515&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java Fri Feb 15 11:23:17 2013
@@ -58,7 +58,6 @@ public class NodeTypeIndexTest {
     public void setup() {
         MicroKernel mk = new MicroKernelImpl();
         store = new KernelNodeStore(mk);
-        store.setHook(IndexHookManager.of(new Property2IndexHookProvider()));
         // initialize node types & index definitions
         OakInitializer.initialize(store, new InitialContent(),
                 CompositeIndexHookProvider
@@ -76,7 +75,7 @@ public class NodeTypeIndexTest {
         addFile(root, "file-1");
 
         branch.setRoot(root.getNodeState());
-        branch.merge();
+        branch.merge(IndexHookManager.of(new Property2IndexHookProvider()));
 
         NodeState rootState = store.getRoot();
         NodeTypeIndex index = new NodeTypeIndex();



Mime
View raw message