jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1540064 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query: ExecutionContext.java QueryEngineImpl.java QueryImpl.java
Date Fri, 08 Nov 2013 14:59:56 GMT
Author: jukka
Date: Fri Nov  8 14:59:55 2013
New Revision: 1540064

URL: http://svn.apache.org/r1540064
Log:
OAK-1132: QueryEngine #executeQuery creates a new revision on each call

Rename getRootState() to getBaseState() to make the contract clearer

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ExecutionContext.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/QueryImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ExecutionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ExecutionContext.java?rev=1540064&r1=1540063&r2=1540064&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ExecutionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ExecutionContext.java
Fri Nov  8 14:59:55 2013
@@ -31,28 +31,33 @@ import org.apache.jackrabbit.oak.spi.sta
  * the execution context was created.
  */
 public class ExecutionContext {
-    private final NodeState rootState;
+
+    /**
+     * Base state used for index lookups.
+     */
+    private final NodeState baseState;
+
     private final Tree rootTree;
+
     private final QueryIndexProvider indexProvider;
 
-    public ExecutionContext(NodeState rootState, Tree rootTree,
+    public ExecutionContext(
+            NodeState baseState, Tree rootTree,
             QueryIndexProvider indexProvider) {
-
-        this.rootState = rootState;
+        this.baseState = baseState;
         this.rootTree = rootTree;
         this.indexProvider = indexProvider;
     }
 
     /**
-     * 
      * Used to evaluate the query (ie. read the existing node types, index
      * definitions), doesn't need to be a secured version of a node state
      * 
-     * @return Root node state of the content tree against which the query runs.
+     * @return base state of the content tree against which the query runs.
      */
     @Nonnull
-    public NodeState getRootState() {
-        return rootState;
+    public NodeState getBaseState() {
+        return baseState;
     }
 
     /**
@@ -69,7 +74,7 @@ public class ExecutionContext {
 
     /**
      * @return Index provider for indexes matching the state of the content tree as
-     * returned from {@link #getRootState()}.
+     * returned from {@link #getBaseState()}.
      */
     @Nonnull
     public QueryIndexProvider getIndexProvider() {

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=1540064&r1=1540063&r2=1540064&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
Fri Nov  8 14:59:55 2013
@@ -89,9 +89,9 @@ public abstract class QueryEngineImpl im
     private static Query parseQuery(String statement, String language, 
             ExecutionContext context, NamePathMapper namePathMapper) throws ParseException
{
         LOG.debug("Parsing {} statement: {}", language, statement);
-        NodeState root = context.getRootState();
-        NodeState system = root.getChildNode(JCR_SYSTEM);
-        NodeState types = system.getChildNode(JCR_NODE_TYPES);
+        NodeState types = context.getBaseState()
+                .getChildNode(JCR_SYSTEM)
+                .getChildNode(JCR_NODE_TYPES);
         SQL2Parser parser = new SQL2Parser(namePathMapper, types);
         if (language.endsWith(NO_LITERALS)) {
             language = language.substring(0, language.length() - NO_LITERALS.length());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java?rev=1540064&r1=1540063&r2=1540064&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
Fri Nov  8 14:59:55 2013
@@ -381,7 +381,7 @@ public class QueryImpl implements Query 
             LOG.debug("query execute {} ", statement);
             LOG.debug("query plan {}", getPlan());
         }
-        RowIterator rowIt = new RowIterator(context.getRootState());
+        RowIterator rowIt = new RowIterator(context.getBaseState());
         Comparator<ResultRowImpl> orderBy = ResultRowImpl.getComparator(orderings);
         Iterator<ResultRowImpl> it = 
                 FilterIterators.newCombinedFilter(rowIt, distinct, limit, offset, orderBy);
@@ -420,7 +420,7 @@ public class QueryImpl implements Query 
     
     @Override
     public String getPlan() {
-        return source.getPlan(context.getRootState());
+        return source.getPlan(context.getBaseState());
     }
 
     @Override
@@ -593,7 +593,7 @@ public class QueryImpl implements Query 
     }
 
     public QueryIndex getBestIndex(Filter filter) {
-        return getBestIndex(context.getRootState(), filter,
+        return getBestIndex(context.getBaseState(), filter,
                 context.getIndexProvider(), traversalFallback);
     }
 



Mime
View raw message