jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r653763 - in /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: WorkspaceImpl.java query/QueryImpl.java query/QueryManagerImpl.java
Date Tue, 06 May 2008 13:12:02 GMT
Author: jukka
Date: Tue May  6 06:12:02 2008
New Revision: 653763

URL: http://svn.apache.org/viewvc?rev=653763&view=rev
Log:
JCR-1564: JSR 283 namespace handling
    - Reverted revision 653751 that broke API tests.

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

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=653763&r1=653762&r2=653763&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
Tue May  6 06:12:02 2008
@@ -261,7 +261,7 @@
     public QueryManager getQueryManager() throws RepositoryException {
         session.checkIsAlive();
         if (qManager == null) {
-            qManager = new QueryManagerImpl(session,
+            qManager = new QueryManagerImpl(session, session.getLocalNamespaceMappings(),
                     session.getNamePathResolver(), session.getItemManager(),
                     session.getHierarchyManager(), wspManager);
         }

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=653763&r1=653762&r2=653763&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
Tue May  6 06:12:02 2008
@@ -16,12 +16,10 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.jcr2spi.name.LocalNamespaceMappings;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.QueryInfo;
@@ -52,6 +50,11 @@
     private final Session session;
 
     /**
+     * The namespace mappings of the session that executes this query.
+     */
+    private final LocalNamespaceMappings nsResolver;
+
+    /**
      * Name and Path resolver
      */
     private final NamePathResolver resolver;
@@ -101,29 +104,20 @@
      * @param language         the language of the query statement.
      * @throws InvalidQueryException if the query is invalid.
      */
-    public QueryImpl(Session session, NamePathResolver resolver,
+    public QueryImpl(Session session, LocalNamespaceMappings nsResolver, NamePathResolver
resolver,
                      ItemManager itemMgr, HierarchyManager hierarchyManager,
                      WorkspaceManager wspManager,
                      String statement, String language)
             throws InvalidQueryException, RepositoryException {
         this.session = session;
         this.resolver = resolver;
+        this.nsResolver = nsResolver;
         this.itemManager = itemMgr;
         this.hierarchyManager = hierarchyManager;
         this.statement = statement;
         this.language = language;
         this.wspManager = wspManager;
-        this.wspManager.checkQueryStatement(
-                statement, language, getNamespaceMappings());
-    }
-
-    private Map getNamespaceMappings() throws RepositoryException {
-        Map map = new HashMap();
-        String[] prefixes = session.getNamespacePrefixes();
-        for (int i = 0; i < prefixes.length; i++) {
-            map.put(prefixes[i], session.getNamespaceURI(prefixes[i]));
-        }
-        return map;
+        this.wspManager.checkQueryStatement(statement, language, nsResolver.getLocalNamespaceMappings());
     }
 
     /**
@@ -140,12 +134,14 @@
      * @throws RepositoryException   if another error occurs while reading from
      *                               the node.
      */
-    public QueryImpl(Session session, NamePathResolver resolver,
+    public QueryImpl(Session session, LocalNamespaceMappings nsResolver, NamePathResolver
resolver,
                      ItemManager itemMgr, HierarchyManager hierarchyManager,
                      WorkspaceManager wspManager, Node node)
-            throws InvalidQueryException, RepositoryException {
+        throws InvalidQueryException, RepositoryException {
+
         this.session = session;
         this.resolver = resolver;
+        this.nsResolver = nsResolver;
         this.itemManager = itemMgr;
         this.hierarchyManager = hierarchyManager;
         this.node = node;
@@ -159,16 +155,16 @@
         }
         statement = node.getProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT)).getString();
         language = node.getProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE)).getString();
-        this.wspManager.checkQueryStatement(
-                statement, language, getNamespaceMappings());
+        this.wspManager.checkQueryStatement(statement, language,
+                    nsResolver.getLocalNamespaceMappings());
     }
 
     /**
      * @see Query#execute()
      */
     public QueryResult execute() throws RepositoryException {
-        QueryInfo qI = wspManager.executeQuery(
-                statement, language, getNamespaceMappings());
+        QueryInfo qI = wspManager.executeQuery(statement, language,
+                nsResolver.getLocalNamespaceMappings());
         return new QueryResultImpl(itemManager, hierarchyManager,
                 qI, resolver, session.getValueFactory());
     }

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=653763&r1=653762&r2=653763&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
Tue May  6 06:12:02 2008
@@ -19,6 +19,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.name.LocalNamespaceMappings;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 
 import javax.jcr.Node;
@@ -39,6 +40,11 @@
     private final Session session;
 
     /**
+     * The local namespace mappings for this query manager.
+     */
+    private final LocalNamespaceMappings nsResolver;
+
+    /**
      * Name and Path resolver
      */
     private final NamePathResolver resolver;
@@ -69,11 +75,13 @@
      * @param wspManager
      */
     public QueryManagerImpl(Session session,
+                            LocalNamespaceMappings nsResolver,
                             NamePathResolver resolver,
                             ItemManager itemMgr,
                             HierarchyManager hierarchyManager,
                             WorkspaceManager wspManager) {
         this.session = session;
+        this.nsResolver = nsResolver;
         this.resolver = resolver;
         this.itemMgr = itemMgr;
         this.hierarchyManager = hierarchyManager;
@@ -86,7 +94,7 @@
     public Query createQuery(String statement, String language)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, resolver, itemMgr, hierarchyManager, wspManager,
statement, language);
+        QueryImpl query = new QueryImpl(session, nsResolver, resolver, itemMgr, hierarchyManager,
wspManager, statement, language);
         return query;
     }
 
@@ -96,7 +104,7 @@
     public Query getQuery(Node node)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, resolver, itemMgr, hierarchyManager, wspManager,
node);
+        QueryImpl query = new QueryImpl(session, nsResolver, resolver, itemMgr, hierarchyManager,
wspManager, node);
         return query;
     }
 



Mime
View raw message