jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1411623 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
Date Tue, 20 Nov 2012 11:39:11 GMT
Author: jukka
Date: Tue Nov 20 11:39:10 2012
New Revision: 1411623

URL: http://svn.apache.org/viewvc?rev=1411623&view=rev
Log:
OAK-410: RepositoryInitializer runs before the CommitHooks are in place

Run the required index hooks as a part of the initializer

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java?rev=1411623&r1=1411622&r2=1411623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/InitialContent.java
Tue Nov 20 11:39:10 2012
@@ -22,10 +22,14 @@ import org.apache.jackrabbit.JcrConstant
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.core.RootImpl;
+import org.apache.jackrabbit.oak.plugins.index.IndexHookManager;
+import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexHookProvider;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 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;
 
@@ -43,7 +47,8 @@ public class InitialContent implements R
     public void initialize(NodeStore store) {
         NodeStoreBranch branch = store.branch();
 
-        NodeBuilder root = branch.getRoot().builder();
+        NodeState before = branch.getRoot();
+        NodeBuilder root = before.builder();
         root.setProperty("jcr:primaryType", "rep:root", Type.NAME);
 
         if (!root.hasChildNode("jcr:system")) {
@@ -95,7 +100,9 @@ public class InitialContent implements R
                 .setProperty("reindex", true);
         }
         try {
-            branch.setRoot(root.getNodeState());
+            CommitHook hook =
+                    new IndexHookManager(new PropertyIndexHookProvider());
+            branch.setRoot(hook.processCommit(before, root.getNodeState()));
             branch.merge();
         } catch (CommitFailedException e) {
             throw new RuntimeException(e); // TODO: shouldn't need the wrapper



Mime
View raw message