jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1445578 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/core/RootImpl.java main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
Date Wed, 13 Feb 2013 13:09:25 GMT
Author: alexparvulescu
Date: Wed Feb 13 13:09:25 2013
New Revision: 1445578

URL: http://svn.apache.org/r1445578
Log:
OAK-443 UserInitializer causes repository traversal

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/security/user/UserInitializer.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.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=1445578&r1=1445577&r2=1445578&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 Feb 13 13:09:25 2013
@@ -114,10 +114,15 @@ public class RootImpl implements Root {
 
     // TODO: review if this constructor really makes sense and cannot be replaced.
     public RootImpl(NodeStore store) {
+        this(store, new CompositeQueryIndexProvider());
+    }
+
+    // TODO: review if this constructor really makes sense and cannot be replaced.
+    public RootImpl(NodeStore store, QueryIndexProvider indexProvider) {
         this.store = checkNotNull(store);
         this.subject = new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE),
Collections.<Object>emptySet(), Collections.<Object>emptySet());
         this.accConfiguration = new OpenAccessControlConfiguration();
-        this.indexProvider = new CompositeQueryIndexProvider();
+        this.indexProvider = indexProvider;
         refresh();
     }
 

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=1445578&r1=1445577&r2=1445578&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
Wed Feb 13 13:09:25 2013
@@ -25,15 +25,16 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.core.RootImpl;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
+import org.apache.jackrabbit.oak.plugins.index.IndexHookManager;
 import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
+import org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexHookProvider;
+import org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexProvider;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 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;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.slf4j.Logger;
@@ -79,16 +80,16 @@ public class UserInitializer implements 
     //----------------------------------------------< RepositoryInitializer >---
     @Override
     public NodeState initialize(NodeState state) {
-        NodeBuilder builder = state.builder();
-        NodeStore store = new MemoryNodeStore();
+        MemoryNodeStore store = new MemoryNodeStore();
+        store.setHook(IndexHookManager.of(new Property2IndexHookProvider()));
         NodeStoreBranch branch = store.branch();
-        branch.setRoot(builder.getNodeState());
+        branch.setRoot(state);
         try {
             branch.merge();
         } catch (CommitFailedException e) {
             throw new RuntimeException(e);
         }
-        Root root = new RootImpl(store);
+        Root root = new RootImpl(store, new Property2IndexProvider());
 
         UserConfiguration userConfiguration = securityProvider.getUserConfiguration();
         UserManager userManager = userConfiguration.getUserManager(root, NamePathMapper.DEFAULT);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java?rev=1445578&r1=1445577&r2=1445578&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
Wed Feb 13 13:09:25 2013
@@ -28,6 +28,8 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexHookProvider;
+import org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.authentication.ConfigurationUtil;
@@ -55,6 +57,8 @@ public abstract class AbstractSecurityTe
     public void before() throws Exception {
         contentRepository = new Oak()
                 .with(new InitialContent())
+                .with(new Property2IndexHookProvider())
+                .with(new Property2IndexProvider())
                 .with(getSecurityProvider())
                 .createContentRepository();
 



Mime
View raw message