jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r783435 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ ja...
Date Wed, 10 Jun 2009 17:43:14 GMT
Author: angela
Date: Wed Jun 10 17:43:13 2009
New Revision: 783435

URL: http://svn.apache.org/viewvc?rev=783435&view=rev
Log:
JCR-2107: JSR 283 Query (work in progress)

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
    jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Wed Jun 10 17:43:13 2009
@@ -312,12 +312,13 @@
      *                   the query statement.
      * @param limit
      * @param offset
+     * @param boundValues
      * @return
      * @throws RepositoryException
      */
     public QueryInfo executeQuery(String statement, String language, Map namespaces,
-                                  long limit, long offset) throws RepositoryException {
-        return service.executeQuery(sessionInfo, statement, language, namespaces, limit,
offset);
+                                  long limit, long offset, Map<String, QValue> boundValues)
throws RepositoryException {
+        return service.executeQuery(sessionInfo, statement, language, namespaces, limit,
offset, boundValues);
     }
 
     /**

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=783435&r1=783434&r2=783435&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
Wed Jun 10 17:43:13 2009
@@ -39,9 +39,11 @@
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 
 /**
  * Provides the default implementation for a JCR query.
@@ -97,6 +99,11 @@
     private long offset = 0;
 
     /**
+     * The name/value pairs collected upon calls to {@link #bindValue(String, Value)}.
+     */
+    private final Map<String, QValue> boundValues = new HashMap();
+
+    /**
      * Creates a new query.
      *
      * @param session          the session that created this query.
@@ -163,7 +170,7 @@
      */
     public QueryResult execute() throws RepositoryException {
         QueryInfo qI = wspManager.executeQuery(
-                statement, language, getNamespaceMappings(), limit, offset);
+                statement, language, getNamespaceMappings(), limit, offset, boundValues);
         return new QueryResultImpl(itemManager, mgrProvider, qI);
     }
 
@@ -241,8 +248,11 @@
      * @see Query#bindValue(String, Value)
      */
     public void bindValue(String varName, Value value) throws RepositoryException {
-        //TODO implementation missing
-        throw new UnsupportedOperationException("JCR-2107: Implementation missing");
+        if (value == null) {
+            boundValues.remove(varName);
+        } else {
+            boundValues.put(varName, ValueFormat.getQValue(value, mgrProvider.getNamePathResolver(),
mgrProvider.getQValueFactory()));
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
Wed Jun 10 17:43:13 2009
@@ -31,6 +31,7 @@
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.QNodeTypeDefinitionsBuilderImpl;
@@ -786,7 +787,7 @@
 
     public QueryInfo executeQuery(SessionInfo sessionInfo, String statement,
                                   String language, Map namespaces, long limit,
-                                  long offset) throws RepositoryException {
+                                  long offset, Map<String, QValue> values) throws RepositoryException
{
         throw new UnsupportedRepositoryOperationException();
     }
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
Wed Jun 10 17:43:13 2009
@@ -49,6 +49,7 @@
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.Subscription;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.QValue;
 
 /**
  * Log wrapper for a {@link RepositoryService}.
@@ -565,14 +566,14 @@
     }
 
     public QueryInfo executeQuery(final SessionInfo sessionInfo, final String statement,
-            final String language, final Map namespaces, final long limit, final long offset)
throws RepositoryException {
+                                  final String language, final Map namespaces, final long
limit, final long offset, final Map<String, QValue> values) throws RepositoryException
{
 
         return (QueryInfo) execute(new Callable() {
             public Object call() throws RepositoryException {
-                return service.executeQuery(unwrap(sessionInfo), statement, language, namespaces,
limit, offset);
+                return service.executeQuery(unwrap(sessionInfo), statement, language, namespaces,
limit, offset, values);
             }
-        }, "executeQuery(SessionInfo, String, String, Map, long, long)",
-                new Object[]{unwrap(sessionInfo), statement, language, namespaces, limit,
offset});
+        }, "executeQuery(SessionInfo, String, String, Map, long, long, Map)",
+                new Object[]{unwrap(sessionInfo), statement, language, namespaces, limit,
offset, values});
     }
 
     public EventFilter createEventFilter(final SessionInfo sessionInfo, final int eventTypes,

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
Wed Jun 10 17:43:13 2009
@@ -913,11 +913,13 @@
      * the query <code>statement</code>.
      * @param limit The maximum result size.
      * @param offset The offset in the total result set.
+     * @param values A Map of name/value pairs collected upon calls to
+     * {@link javax.jcr.query.Query#bindValue(String, javax.jcr.Value)}.
      * @return The query info.
      * @throws javax.jcr.RepositoryException
      * @see javax.jcr.query.Query#execute()
      */
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset) throws RepositoryException;
+    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset, Map<String, QValue> values) throws RepositoryException;
 
     //--------------------------------------------------------< Observation >---
     /**

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Wed Jun 10 17:43:13 2009
@@ -1703,9 +1703,9 @@
     }
 
     /**
-     * @see RepositoryService#executeQuery(SessionInfo, String, String, Map, long, long)
+     * @see RepositoryService#executeQuery(SessionInfo, String, String,java.util.Map,long,long,java.util.Map
      */
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset) throws RepositoryException {
+    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset, Map<String, QValue> values) throws RepositoryException
{
         SearchMethod method = null;
         try {
             String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
@@ -1715,6 +1715,10 @@
             sInfo.setNumberResults(limit);
             sInfo.setOffset(offset);
 
+            if (!(values == null || values.isEmpty())) {
+                throw new UnsupportedOperationException("Implementation missing:  JCR-2107");
+            }
+
             method = new SearchMethod(uri, sInfo);
             getClient(sessionInfo).executeMethod(method);
             method.checkSuccess();

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java?rev=783435&r1=783434&r2=783435&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
Wed Jun 10 17:43:13 2009
@@ -1040,12 +1040,22 @@
                 sInfo.getNamePathResolver(), getQValueFactory());
     }
 
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset) throws RepositoryException {
+    /**
+     * {@inheritDoc}
+     */
+    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map namespaces, long limit, long offset, Map<String, QValue> values) throws RepositoryException
{
         SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
         Query query = createQuery(sInfo.getSession(), statement,
                 language, namespaces);
         query.setLimit(limit);
         query.setOffset(offset);
+        if (values != null && !values.isEmpty()) {
+            for (Iterator<String> it = values.keySet().iterator(); it.hasNext();) {
+                String varName = it.next();
+                Value value = ValueFormat.getJCRValue(values.get(varName), sInfo.getNamePathResolver(),
sInfo.getSession().getValueFactory());
+                query.bindValue(varName, value);
+            }
+        }
         return new QueryInfoImpl(query.execute(), idFactory,
                 sInfo.getNamePathResolver(), getQValueFactory());
     }



Mime
View raw message