jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1392859 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/ oak-core/src/main/java/or...
Date Tue, 02 Oct 2012 11:48:39 GMT
Author: alexparvulescu
Date: Tue Oct  2 11:48:38 2012
New Revision: 1392859

URL: http://svn.apache.org/viewvc?rev=1392859&view=rev
Log:
OAK-355 Move QueryEngine reference from ContentSession to Root

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.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/plugins/identifier/IdentifierManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SessionQueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.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/plugins/lucene/AbstractLuceneQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentSession.java
Tue Oct  2 11:48:38 2012
@@ -84,14 +84,6 @@ public interface ContentSession extends 
     Root getLatestRoot();
 
     /**
-     * Get the query engine.
-     *
-     * @return the query engine
-     */
-    @Nonnull
-    SessionQueryEngine getQueryEngine();
-
-    /**
      * Returns the internal value factory.
      *
      * @return the internal value factory.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Tue
Oct  2 11:48:38 2012
@@ -126,4 +126,13 @@ public interface Root {
      */
     @Nonnull
     ChangeExtractor getChangeExtractor();
+
+    /**
+     * Get the query engine.
+     * 
+     * @return the query engine
+     */
+    @Nonnull
+    SessionQueryEngine getQueryEngine();
+
 }

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=1392859&r1=1392858&r2=1392859&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
Tue Oct  2 11:48:38 2012
@@ -28,7 +28,6 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandlerProvider;
-import org.apache.jackrabbit.oak.query.QueryEngineImpl;
 import org.apache.jackrabbit.oak.security.authentication.LoginContextProviderImpl;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
@@ -58,7 +57,7 @@ public class ContentRepositoryImpl imple
             new AnnotatingConflictHandlerProvider();
 
     private final LoginContextProvider loginContextProvider;
-    private final QueryEngineImpl queryEngine;
+    private final QueryIndexProvider indexProvider;
     private final KernelNodeStore nodeStore;
 
     /**
@@ -117,9 +116,8 @@ public class ContentRepositoryImpl imple
         nodeStore = new KernelNodeStore(microKernel);
         nodeStore.setHook(commitHook);
 
-        QueryIndexProvider qip = indexProvider != null ? indexProvider
+        this.indexProvider = indexProvider != null ? indexProvider
                 : new CompositeQueryIndexProvider();
-        queryEngine = new QueryEngineImpl(nodeStore, qip);
 
         this.loginContextProvider = loginContextProvider;
     }
@@ -141,6 +139,6 @@ public class ContentRepositoryImpl imple
         loginContext.login();
 
         return new ContentSessionImpl(loginContext, workspaceName, nodeStore, DEFAULT_CONFLICT_HANDLER_PROVIDER,
-                queryEngine);
+                indexProvider);
     }
 }

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=1392859&r1=1392858&r2=1392859&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
Tue Oct  2 11:48:38 2012
@@ -27,16 +27,12 @@ import org.apache.jackrabbit.oak.api.Aut
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.SessionQueryEngine;
-import org.apache.jackrabbit.oak.query.QueryEngineImpl;
-import org.apache.jackrabbit.oak.query.SessionQueryEngineImpl;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandlerProvider;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 /**
  * {@code MicroKernel}-based implementation of the {@link ContentSession} interface.
  */
@@ -48,16 +44,16 @@ class ContentSessionImpl implements Cont
     private final String workspaceName;
     private final NodeStore store;
     private final ConflictHandlerProvider conflictHandlerProvider;
-    private final SessionQueryEngine queryEngine;
+    private final QueryIndexProvider indexProvider;
 
     public ContentSessionImpl(LoginContext loginContext, String workspaceName,
             NodeStore store, ConflictHandlerProvider conflictHandlerProvider,
-            QueryEngineImpl queryEngine) {
+            QueryIndexProvider indexProvider) {
         this.loginContext = loginContext;
         this.workspaceName = workspaceName;
         this.store = store;
         this.conflictHandlerProvider = conflictHandlerProvider;
-        this.queryEngine = new SessionQueryEngineImpl(this, checkNotNull(queryEngine));
+        this.indexProvider = indexProvider;
     }
 
     @Nonnull
@@ -74,7 +70,7 @@ class ContentSessionImpl implements Cont
     @Nonnull
     @Override
     public Root getLatestRoot() {
-        RootImpl root = new RootImpl(store, workspaceName, loginContext.getSubject());
+        RootImpl root = new RootImpl(store, workspaceName, loginContext.getSubject(), indexProvider);
         if (conflictHandlerProvider != null) {
             root.setConflictHandler(conflictHandlerProvider.getConflictHandler(getCoreValueFactory()));
         }
@@ -97,12 +93,6 @@ class ContentSessionImpl implements Cont
 
     @Nonnull
     @Override
-    public SessionQueryEngine getQueryEngine() {
-        return queryEngine;
-    }
-
-    @Nonnull
-    @Override
     public CoreValueFactory getCoreValueFactory() {
         return store.getValueFactory();
     }

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=1392859&r1=1392858&r2=1392859&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
Tue Oct  2 11:48:38 2012
@@ -18,6 +18,10 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
+import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -28,13 +32,17 @@ import javax.security.auth.Subject;
 
 import org.apache.jackrabbit.oak.api.ChangeExtractor;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.plugins.commit.DefaultConflictHandler;
-import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.api.SessionQueryEngine;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.plugins.commit.DefaultConflictHandler;
+import org.apache.jackrabbit.oak.query.SessionQueryEngineImpl;
 import org.apache.jackrabbit.oak.security.authorization.AccessControlContextImpl;
+import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
+import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlContext;
 import org.apache.jackrabbit.oak.spi.security.authorization.CompiledPermissions;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -45,10 +53,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
-import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
-
 public class RootImpl implements Root {
     static final Logger log = LoggerFactory.getLogger(RootImpl.class);
 
@@ -93,6 +97,8 @@ public class RootImpl implements Root {
 
     private volatile ConflictHandler conflictHandler = DefaultConflictHandler.OURS;
 
+    private final QueryIndexProvider indexProvider;
+
     /**
      * Purge listener.
      * @see #purgePurgeListeners
@@ -108,20 +114,23 @@ public class RootImpl implements Root {
      * @param subject
      */
     @SuppressWarnings("UnusedParameters")
-    public RootImpl(NodeStore store, String workspaceName, Subject subject) {
+    public RootImpl(NodeStore store, String workspaceName, Subject subject, QueryIndexProvider
indexProvider) {
         this.store = store;
         this.subject = subject;
+        this.indexProvider = indexProvider;
         refresh();
     }
 
     /**
+     * TODO remove constructor
+     * 
      * New instance bases on a given {@link NodeStore} and a workspace
      * @param store  node store
      * @param workspaceName  name of the workspace
      */
     @SuppressWarnings("UnusedParameters")
     public RootImpl(NodeStore store, String workspaceName) {
-        this(store, workspaceName, DUMMY_SUBJECT);
+        this(store, workspaceName, DUMMY_SUBJECT, new CompositeQueryIndexProvider());
     }
 
     public void setConflictHandler(ConflictHandler conflictHandler) {
@@ -333,4 +342,9 @@ public class RootImpl implements Root {
         }
     }
 
+    @Override
+    public SessionQueryEngine getQueryEngine() {
+        return new SessionQueryEngineImpl(store, indexProvider);
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
Tue Oct  2 11:48:38 2012
@@ -39,7 +39,6 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.Result;
 import org.apache.jackrabbit.oak.api.ResultRow;
 import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.SessionQueryEngine;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
@@ -55,11 +54,9 @@ public class IdentifierManager {
     private static final Logger log = LoggerFactory.getLogger(IdentifierManager.class);
 
     private final Root root;
-    private final SessionQueryEngine queryEngine;
 
-    public IdentifierManager(SessionQueryEngine queryEngine, Root root) {
+    public IdentifierManager(Root root) {
         this.root = root;
-        this.queryEngine = queryEngine;
     }
 
     @Nonnull
@@ -190,7 +187,7 @@ public class IdentifierManager {
                 String pName = propertyName == null ? "*" : propertyName;   // TODO: sanitize
against injection attacks!?
                 Map<String, ? extends CoreValue> bindings = Collections.singletonMap("uuid",
new StringValue(uuid));
 
-                Result result = queryEngine.executeQuery(
+                Result result = root.getQueryEngine().executeQuery(
                         "SELECT * FROM [nt:base] WHERE PROPERTY([" + pName + "], '" + reference
+ "') = $uuid",
                         Query.JCR_SQL2, Long.MAX_VALUE, 0, bindings, root, new NamePathMapper.Default());
 
@@ -290,7 +287,7 @@ public class IdentifierManager {
     private String resolveUUID(CoreValue uuid) {
         try {
             Map<String, CoreValue> bindings = Collections.singletonMap("id", uuid);
-            Result result = queryEngine.executeQuery(
+            Result result = root.getQueryEngine().executeQuery(
                     "SELECT * FROM [nt:base] WHERE [jcr:uuid] = $id", Query.JCR_SQL2,
                     Long.MAX_VALUE, 0, bindings, root, new NamePathMapper.Default());
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
Tue Oct  2 11:48:38 2012
@@ -24,7 +24,6 @@ import java.util.List;
 
 import javax.jcr.PropertyType;
 
-import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
@@ -93,7 +92,6 @@ public class Query {
     private long size = -1;
     private boolean prepared;
     private final CoreValueFactory valueFactory;
-    private ContentSession session;
     private Root root;
     private NamePathMapper namePathMapper;
 
@@ -685,10 +683,6 @@ public class Query {
         return queryEngine.getBestIndex(filter);
     }
 
-    public void setSession(ContentSession session) {
-        this.session = session;
-    }
-    
     public void setRoot(Root root) {
         this.root = root;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
Tue Oct  2 11:48:38 2012
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
@@ -96,10 +95,9 @@ public class QueryEngineImpl {
 
     public ResultImpl executeQuery(String statement, String language, 
             long limit, long offset, Map<String, ? extends CoreValue> bindings,
-            ContentSession session, Root root,
+            Root root,
             NamePathMapper namePathMapper) throws ParseException {
         Query q = parseQuery(statement, language);
-        q.setSession(session);
         q.setRoot(root);
         q.setNamePathMapper(namePathMapper);
         q.setLimit(limit);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SessionQueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SessionQueryEngineImpl.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SessionQueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SessionQueryEngineImpl.java
Tue Oct  2 11:48:38 2012
@@ -20,12 +20,13 @@ import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.Result;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.SessionQueryEngine;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * The query engine implementation bound to a session.
@@ -33,11 +34,10 @@ import org.apache.jackrabbit.oak.namepat
 public class SessionQueryEngineImpl implements SessionQueryEngine {
 
     private final QueryEngineImpl queryEngine;
-    private final ContentSession session;
 
-    public SessionQueryEngineImpl(ContentSession session, QueryEngineImpl queryEngine) {
-        this.session = session;
-        this.queryEngine = queryEngine;
+    public SessionQueryEngineImpl(NodeStore store,
+            QueryIndexProvider indexProvider) {
+        this.queryEngine = new QueryEngineImpl(store, indexProvider);
     }
 
     @Override
@@ -53,10 +53,10 @@ public class SessionQueryEngineImpl impl
 
     @Override
     public Result executeQuery(String statement, String language, long limit,
-            long offset, Map<String, ? extends CoreValue> bindings,
-            Root root, NamePathMapper namePathMapper) throws ParseException {
-        return queryEngine.executeQuery(statement, language, limit,
-                offset, bindings, session, root, namePathMapper);
+            long offset, Map<String, ? extends CoreValue> bindings, Root root,
+            NamePathMapper namePathMapper) throws ParseException {
+        return queryEngine.executeQuery(statement, language, limit, offset,
+                bindings, root, namePathMapper);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
Tue Oct  2 11:48:38 2012
@@ -20,7 +20,6 @@ import org.apache.jackrabbit.JcrConstant
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.SessionQueryEngine;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
 import org.apache.jackrabbit.oak.spi.security.user.Type;
@@ -40,15 +39,13 @@ abstract class AuthorizableBaseProvider 
     private static final Logger log = LoggerFactory.getLogger(AuthorizableBaseProvider.class);
 
     final CoreValueFactory valueFactory;
-    final SessionQueryEngine queryEngine;
     final Root root;
     final IdentifierManager identifierManager;
 
     AuthorizableBaseProvider(ContentSession contentSession, Root root, UserConfig config)
{
         this.valueFactory = contentSession.getCoreValueFactory();
-        this.queryEngine = contentSession.getQueryEngine();
         this.root = root;
-        this.identifierManager = new IdentifierManager(queryEngine, root);
+        this.identifierManager = new IdentifierManager(root);
     }
 
     Tree getByID(String authorizableId, Type authorizableType) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
Tue Oct  2 11:48:38 2012
@@ -205,7 +205,7 @@ class UserProviderImpl extends Authoriza
             stmt.append("SELECT * FROM [").append(UserConstants.NT_REP_AUTHORIZABLE).append(']');
             stmt.append("WHERE [").append(UserConstants.REP_PRINCIPAL_NAME).append("] = $principalName");
 
-            Result result = queryEngine.executeQuery(stmt.toString(),
+            Result result = root.getQueryEngine().executeQuery(stmt.toString(),
                     Query.JCR_SQL2, 1, 0,
                     Collections.singletonMap("principalName", bindValue),
                     root, new NamePathMapper.Default());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
Tue Oct  2 11:48:38 2012
@@ -22,6 +22,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.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Before;
 import org.slf4j.Logger;
@@ -54,6 +55,6 @@ public abstract class AbstractCoreTest {
     protected abstract NodeState createInitialState(MicroKernel microKernel);
 
     protected RootImpl createRootImpl(String workspaceName) {
-        return new RootImpl(store, workspaceName, new Subject());
+        return new RootImpl(store, workspaceName, new Subject(), new CompositeQueryIndexProvider());
     }
 }
\ 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=1392859&r1=1392858&r2=1392859&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
Tue Oct  2 11:48:38 2012
@@ -32,6 +32,7 @@ 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.query.CompositeQueryIndexProvider;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -80,12 +81,12 @@ public class RootImplFuzzIT {
         store1 = new KernelNodeStore(mk1);
         vf = store1.getValueFactory();
         mk1.commit("", "+\"/root\":{}", mk1.getHeadRevision(), "");
-        root1 = new RootImpl(store1, null, new Subject());
+        root1 = new RootImpl(store1, null, new Subject(), new CompositeQueryIndexProvider());
 
         MicroKernel mk2 = new MicroKernelImpl("./target/mk2/" + random.nextInt());
         store2 = new KernelNodeStore(mk2);
         mk2.commit("", "+\"/root\":{}", mk2.getHeadRevision(), "");
-        root2 = new RootImpl(store2, null, new Subject());
+        root2 = new RootImpl(store2, null, new Subject(), new CompositeQueryIndexProvider());
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
Tue Oct  2 11:48:38 2012
@@ -58,7 +58,7 @@ public abstract class AbstractLuceneQuer
         session = createAdminSession();
         root = session.getLatestRoot();
         vf = session.getCoreValueFactory();
-        qe = session.getQueryEngine();
+        qe = root.getQueryEngine();
         createIndexNode();
     }
 

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=1392859&r1=1392858&r2=1392859&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
Tue Oct  2 11:48:38 2012
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.oak.kernel.
 import org.apache.jackrabbit.oak.plugins.memory.MemoryValueFactory;
 import org.apache.jackrabbit.oak.query.ast.Operator;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
+import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.Cursor;
 import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.query.IndexDefinition;
@@ -47,7 +48,7 @@ public class LuceneEditorTest implements
 
         KernelNodeStore store = new KernelNodeStore(new MicroKernelImpl());
         store.setHook(new LuceneEditor(testID));
-        Root root = new RootImpl(store, null, new Subject());
+        Root root = new RootImpl(store, null, new Subject(), new CompositeQueryIndexProvider());
         Tree tree = root.getTree("/");
 
         tree.setProperty("foo", MemoryValueFactory.INSTANCE.createValue("bar"));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
Tue Oct  2 11:48:38 2012
@@ -65,8 +65,8 @@ public abstract class AbstractQueryTest 
         super.before();
         session = createAdminSession();
         vf = session.getCoreValueFactory();
-        qe = session.getQueryEngine();
         root = session.getLatestRoot();
+        qe = root.getQueryEngine();
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1392859&r1=1392858&r2=1392859&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Tue Oct  2 11:48:38 2012
@@ -88,11 +88,11 @@ public class SessionDelegate {
         this.repository = checkNotNull(repository);
         this.executor = executor;
         this.contentSession = checkNotNull(contentSession);
+        this.root = contentSession.getLatestRoot();
         this.workspace = new WorkspaceImpl(this);
         this.session = new SessionImpl(this);
-        this.root = contentSession.getLatestRoot();
         this.autoRefresh = autoRefresh;
-        this.idManager = new IdentifierManager(contentSession.getQueryEngine(), root);
+        this.idManager = new IdentifierManager(root);
         this.namePathMapper = new NamePathMapperImpl(new SessionNameMapper(this), idManager);
         this.valueFactory = new ValueFactoryImpl(contentSession.getCoreValueFactory(), namePathMapper);
     }
@@ -423,7 +423,7 @@ public class SessionDelegate {
 
     @Nonnull
     public SessionQueryEngine getQueryEngine() {
-        return contentSession.getQueryEngine();
+        return root.getQueryEngine();
     }
 
     @Nonnull



Mime
View raw message