jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r674491 - in /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: WorkspaceImpl.java query/QueryImpl.java query/QueryManagerImpl.java query/QueryResultImpl.java
Date Mon, 07 Jul 2008 13:56:36 GMT
Author: mreutegg
Date: Mon Jul  7 06:56:35 2008
New Revision: 674491

URL: http://svn.apache.org/viewvc?rev=674491&view=rev
Log:
JCR-1658: Executing query throws UnsupportedRepositoryOperationException(LEVEL_2_SUPPORTED)
for a level 1 only implementation

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=674491&r1=674490&r2=674491&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Mon Jul  7 06:56:35 2008
@@ -260,9 +260,8 @@
     public QueryManager getQueryManager() throws RepositoryException {
         session.checkIsAlive();
         if (qManager == null) {
-            qManager = new QueryManagerImpl(session,
-                    session.getNamePathResolver(), session.getItemManager(),
-                    session.getHierarchyManager(), wspManager);
+            qManager = new QueryManagerImpl(session, session,
+                    session.getItemManager(), wspManager);
         }
         return qManager;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java?rev=674491&r1=674490&r2=674491&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
Mon Jul  7 06:56:35 2008
@@ -21,7 +21,7 @@
 
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.QueryInfo;
@@ -52,9 +52,9 @@
     private final Session session;
 
     /**
-     * Name and Path resolver
+     * Provides various managers.
      */
-    private final NamePathResolver resolver;
+    private final ManagerProvider mgrProvider;
 
     /**
      * The item manager of the session that executes this query.
@@ -62,11 +62,6 @@
     private final ItemManager itemManager;
 
     /**
-     * The hierarchy manager of the session that executes this query.
-     */
-    private final HierarchyManager hierarchyManager;
-
-    /**
      * The query statement
      */
     private String statement;
@@ -91,24 +86,21 @@
      * Creates a new query.
      *
      * @param session          the session that created this query.
-     * @param resolver
+     * @param mgrProvider the manager provider.
      * @param itemMgr          the item manager of that session.
-     * @param hierarchyManager the HierarchyManager of that session.
      * @param wspManager       the workspace manager that belongs to the
      *                         session.
      * @param statement        the query statement.
      * @param language         the language of the query statement.
      * @throws InvalidQueryException if the query is invalid.
      */
-    public QueryImpl(Session session, NamePathResolver resolver,
-                     ItemManager itemMgr, HierarchyManager hierarchyManager,
-                     WorkspaceManager wspManager,
+    public QueryImpl(Session session, ManagerProvider mgrProvider,
+                     ItemManager itemMgr, WorkspaceManager wspManager,
                      String statement, String language)
             throws InvalidQueryException, RepositoryException {
         this.session = session;
-        this.resolver = resolver;
+        this.mgrProvider = mgrProvider;
         this.itemManager = itemMgr;
-        this.hierarchyManager = hierarchyManager;
         this.statement = statement;
         this.language = language;
         this.wspManager = wspManager;
@@ -120,27 +112,26 @@
      * Creates a query from a node.
      *
      * @param session    the session that created this query.
-     * @param resolver
+     * @param mgrProvider the manager provider.
      * @param itemMgr    the item manager of that session.
-     * @param hierarchyManager
      * @param wspManager the workspace manager that belongs to the session.
      * @param node       the node from where to read the query.
      * @throws InvalidQueryException if the query is invalid.
      * @throws RepositoryException   if another error occurs while reading from
      *                               the node.
      */
-    public QueryImpl(Session session, NamePathResolver resolver,
-                     ItemManager itemMgr, HierarchyManager hierarchyManager,
-                     WorkspaceManager wspManager, Node node)
+    public QueryImpl(Session session, ManagerProvider mgrProvider,
+                     ItemManager itemMgr, WorkspaceManager wspManager,
+                     Node node)
         throws InvalidQueryException, RepositoryException {
 
         this.session = session;
-        this.resolver = resolver;
+        this.mgrProvider = mgrProvider;
         this.itemManager = itemMgr;
-        this.hierarchyManager = hierarchyManager;
         this.node = node;
         this.wspManager = wspManager;
 
+        NamePathResolver resolver = mgrProvider.getNamePathResolver();
         if (!node.isNodeType(resolver.getJCRName(NameConstants.NT_QUERY))) {
             throw new InvalidQueryException("Node is not of type nt:query");
         }
@@ -159,8 +150,7 @@
     public QueryResult execute() throws RepositoryException {
         QueryInfo qI = wspManager.executeQuery(
                 statement, language, getNamespaceMappings());
-        return new QueryResultImpl(itemManager, hierarchyManager,
-                qI, resolver, session.getValueFactory());
+        return new QueryResultImpl(itemManager, mgrProvider, qI);
     }
 
     /***
@@ -210,6 +200,7 @@
         PathNotFoundException, VersionException, ConstraintViolationException,
         LockException, UnsupportedRepositoryOperationException, RepositoryException {
 
+        NamePathResolver resolver = mgrProvider.getNamePathResolver();
         try {
             Path p = resolver.getQPath(absPath).getNormalizedPath();
             if (!p.isAbsolute()) {

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java?rev=674491&r1=674490&r2=674491&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
Mon Jul  7 06:56:35 2008
@@ -18,8 +18,7 @@
 
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -39,9 +38,9 @@
     private final Session session;
 
     /**
-     * Name and Path resolver
+     * Provides various managers.
      */
-    private final NamePathResolver resolver;
+    private final ManagerProvider mgrProvider;
 
     /**
      * The <code>ItemManager</code> of for item retrieval in search results
@@ -49,11 +48,6 @@
     private final ItemManager itemMgr;
 
     /**
-     * The <code>HierarchyManager</code> of for item retrieval in search results
-     */
-    private final HierarchyManager hierarchyManager;
-
-    /**
      * The <code>WorkspaceManager</code> where queries are executed.
      */
     private final WorkspaceManager wspManager;
@@ -62,20 +56,18 @@
      * Creates a new <code>QueryManagerImpl</code> for the passed
      * <code>Session</code>.
      *
-     * @param session
-     * @param itemMgr
-     * @param hierarchyManager
-     * @param wspManager
+     * @param session the current session.
+     * @param mgrProvider the manager provider.
+     * @param itemMgr the item manager of the current session.
+     * @param wspManager the workspace manager.
      */
     public QueryManagerImpl(Session session,
-                            NamePathResolver resolver,
+                            ManagerProvider mgrProvider,
                             ItemManager itemMgr,
-                            HierarchyManager hierarchyManager,
                             WorkspaceManager wspManager) {
         this.session = session;
-        this.resolver = resolver;
+        this.mgrProvider = mgrProvider;
         this.itemMgr = itemMgr;
-        this.hierarchyManager = hierarchyManager;
         this.wspManager = wspManager;
     }
 
@@ -85,8 +77,7 @@
     public Query createQuery(String statement, String language)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, resolver, itemMgr, hierarchyManager, wspManager,
statement, language);
-        return query;
+        return new QueryImpl(session, mgrProvider, itemMgr, wspManager, statement, language);
     }
 
     /**
@@ -95,8 +86,7 @@
     public Query getQuery(Node node)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, resolver, itemMgr, hierarchyManager, wspManager,
node);
-        return query;
+        return new QueryImpl(session, mgrProvider, itemMgr, wspManager, node);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java?rev=674491&r1=674490&r2=674491&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
Mon Jul  7 06:56:35 2008
@@ -17,16 +17,13 @@
 package org.apache.jackrabbit.jcr2spi.query;
 
 import org.apache.jackrabbit.jcr2spi.ItemManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
 
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
-import javax.jcr.ValueFactory;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.RowIterator;
 
@@ -36,19 +33,14 @@
 class QueryResultImpl implements QueryResult {
 
     /**
-     * The logger instance for this class
-     */
-    private static final Logger log = LoggerFactory.getLogger(QueryResultImpl.class);
-
-    /**
      * The item manager of the session executing the query
      */
     private final ItemManager itemMgr;
 
     /**
-     * The HierarchyManager of the session executing the query
+     * Provides various managers.
      */
-    private final HierarchyManager hierarchyMgr;
+    private final ManagerProvider mgrProvider;
 
     /**
      * The spi query result.
@@ -56,33 +48,18 @@
     private final QueryInfo queryInfo;
 
     /**
-     * The namespace nameResolver of the session executing the query
-     */
-    private final NamePathResolver resolver;
-
-    /**
-     * The JCR value factory.
-     */
-    private final ValueFactory valueFactory;
-
-    /**
      * Creates a new query result.
      *
-     * @param itemMgr      the item manager of the session executing the query.
-     * @param hierarchyMgr the HierarchyManager of the session executing the
-     *                     query.
-     * @param queryInfo    the spi query result.
-     * @param resolver
-     * @param valueFactory the JCR value factory.
-     */
-    QueryResultImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr,
-                    QueryInfo queryInfo, NamePathResolver resolver,
-                    ValueFactory valueFactory) {
+     * @param itemMgr     the item manager of the session executing the query.
+     * @param mgrProvider the manager provider.
+     * @param queryInfo   the spi query result.
+     */
+    QueryResultImpl(ItemManager itemMgr,
+                    ManagerProvider mgrProvider,
+                    QueryInfo queryInfo) {
         this.itemMgr = itemMgr;
-        this.hierarchyMgr = hierarchyMgr;
+        this.mgrProvider = mgrProvider;
         this.queryInfo = queryInfo;
-        this.resolver = resolver;
-        this.valueFactory = valueFactory;
     }
 
     /**
@@ -91,6 +68,7 @@
     public String[] getColumnNames() throws RepositoryException {
         Name[] names = queryInfo.getColumnNames();
         String[] propNames = new String[names.length];
+        NamePathResolver resolver = mgrProvider.getNamePathResolver();
         for (int i = 0; i < names.length; i++) {
             propNames[i] = resolver.getJCRName(names[i]);
         }
@@ -108,7 +86,8 @@
      * {@inheritDoc}
      */
     public RowIterator getRows() throws RepositoryException {
-        return new RowIteratorImpl(queryInfo, resolver, valueFactory);
+        return new RowIteratorImpl(queryInfo, mgrProvider.getNamePathResolver(),
+                mgrProvider.getJcrValueFactory());
     }
 
     /**
@@ -116,6 +95,7 @@
      * @return a node iterator over the result nodes.
      */
     private ScoreNodeIterator getNodeIterator() {
-        return new NodeIteratorImpl(itemMgr, hierarchyMgr, queryInfo);
+        return new NodeIteratorImpl(itemMgr,
+                mgrProvider.getHierarchyManager(), queryInfo);
     }
 }



Mime
View raw message