jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r627328 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query: QueryManagerImpl.java qom/QueryObjectModelFactoryImpl.java
Date Wed, 13 Feb 2008 09:40:20 GMT
Author: mreutegg
Date: Wed Feb 13 01:40:18 2008
New Revision: 627328

URL: http://svn.apache.org/viewvc?rev=627328&view=rev
Log:
JCR-1378: Remove SessionImpl dependency from QueryObjectModelFactoryImpl

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/qom/QueryObjectModelFactoryImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java?rev=627328&r1=627327&r2=627328&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
Wed Feb 13 01:40:18 2008
@@ -21,7 +21,9 @@
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.query.jsr283.PreparedQuery;
 import org.apache.jackrabbit.core.query.jsr283.qom.QueryObjectModelFactory;
+import org.apache.jackrabbit.core.query.jsr283.qom.QueryObjectModel;
 import org.apache.jackrabbit.core.query.qom.QueryObjectModelFactoryImpl;
+import org.apache.jackrabbit.core.query.qom.QueryObjectModelTree;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -76,13 +78,19 @@
      * @param itemMgr
      * @param searchMgr
      */
-    public QueryManagerImpl(SessionImpl session,
-                            ItemManager itemMgr,
-                            SearchManager searchMgr) {
+    public QueryManagerImpl(final SessionImpl session,
+                            final ItemManager itemMgr,
+                            final SearchManager searchMgr) {
         this.session = session;
         this.itemMgr = itemMgr;
         this.searchMgr = searchMgr;
-        this.qomFactory = new QueryObjectModelFactoryImpl(session, searchMgr);
+        this.qomFactory = new QueryObjectModelFactoryImpl(session) {
+            protected QueryObjectModel createQuery(QueryObjectModelTree qomTree)
+                    throws InvalidQueryException, RepositoryException {
+                return searchMgr.createQueryObjectModel(
+                        session, qomTree, QueryImpl.JCR_SQL2);
+            }
+        };
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/qom/QueryObjectModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/qom/QueryObjectModelFactoryImpl.java?rev=627328&r1=627327&r2=627328&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/qom/QueryObjectModelFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/qom/QueryObjectModelFactoryImpl.java
Wed Feb 13 01:40:18 2008
@@ -55,9 +55,6 @@
 import org.apache.jackrabbit.core.query.jsr283.qom.BindVariableValue;
 import org.apache.jackrabbit.core.query.jsr283.qom.QueryObjectModelConstants;
 import org.apache.jackrabbit.core.query.jsr283.qom.Literal;
-import org.apache.jackrabbit.core.query.QueryImpl;
-import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.SearchManager;
 
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.RepositoryException;
@@ -68,7 +65,7 @@
  * <code>QueryObjectModelFactoryImpl</code> implements the query object model
  * factory from JSR 283.
  */
-public class QueryObjectModelFactoryImpl implements QueryObjectModelFactory {
+public abstract class QueryObjectModelFactoryImpl implements QueryObjectModelFactory {
 
     private static final BitSet VALID_OPERATORS = new BitSet();
 
@@ -98,22 +95,22 @@
      */
     private final NamePathResolver resolver;
 
-    /**
-     * The session of the user.
-     */
-    private final SessionImpl session;
+    public QueryObjectModelFactoryImpl(NamePathResolver resolver) {
+        this.resolver = resolver;
+    }
 
     /**
-     * The search manager of the workspace.
+     * Creates a query object model from the internal tree representation.
+     *
+     * @param qomTree the qom tree.
+     * @return a query object model that can be executed.
+     * @throws InvalidQueryException the the query object model tree is
+     *                               considered invalid by the query handler
+     *                               implementation.
+     * @throws RepositoryException   if any other error occurs.
      */
-    private final SearchManager searchMgr;
-
-    public QueryObjectModelFactoryImpl(SessionImpl session,
-                                       SearchManager searchMgr) {
-        this.resolver = session;
-        this.session = session;
-        this.searchMgr = searchMgr;
-    }
+    protected abstract QueryObjectModel createQuery(QueryObjectModelTree qomTree)
+            throws InvalidQueryException, RepositoryException;
 
     /**
      * Creates a query with one selector.
@@ -197,7 +194,7 @@
         QueryObjectModelTree qomTree = new QueryObjectModelTree(
                 resolver, (SourceImpl) source,
                 (ConstraintImpl) constraint, ords, cols);
-        return searchMgr.createQueryObjectModel(session, qomTree, QueryImpl.JCR_SQL2);
+        return createQuery(qomTree);
     }
 
     /**



Mime
View raw message