jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r789312 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/com...
Date Mon, 29 Jun 2009 12:55:01 GMT
Author: mreutegg
Date: Mon Jun 29 12:55:00 2009
New Revision: 789312

URL: http://svn.apache.org/viewvc?rev=789312&view=rev
Log:
JCR-2174: Remove redundant RepositoryService.executeQuery() method

Modified:
    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/QueryInfo.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/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java?rev=789312&r1=789311&r2=789312&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 Jun 29 12:55:00 2009
@@ -88,15 +88,13 @@
 
     /**
      * The maximum result size
-     * TODO: review default value
      */
-    private long limit = Long.MAX_VALUE;
+    private long limit = -1;
 
     /**
      * The offset in the total result set
-     * TODO: review default value
      */
-    private long offset = 0;
+    private long offset = -1;
 
     /**
      * The name/value pairs collected upon calls to {@link #bindValue(String, Value)}.
@@ -151,11 +149,10 @@
      * @return namespace mappings (prefix -> uri)
      * @throws RepositoryException if a repository error occurs
      */
-    private Map getNamespaceMappings() throws RepositoryException {
-        Map mappings = new HashMap();
-        String[] prefixes = session.getNamespacePrefixes();
-        for (int i = 0; i < prefixes.length; i++) {
-            mappings.put(prefixes[i], session.getNamespaceURI(prefixes[i]));
+    private Map<String, String> getNamespaceMappings() throws RepositoryException {
+        Map<String, String> mappings = new HashMap<String, String>();
+        for (String prefix : session.getNamespacePrefixes()) {
+            mappings.put(prefix, session.getNamespaceURI(prefix));
         }
         return mappings;
     }

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=789312&r1=789311&r2=789312&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
Mon Jun 29 12:55:00 2009
@@ -781,12 +781,6 @@
     }
 
     public QueryInfo executeQuery(SessionInfo sessionInfo, String statement,
-                                  String language, Map namespaces) throws
-            RepositoryException {
-        throw new UnsupportedRepositoryOperationException();
-    }
-
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement,
                                   String language, Map<String, String> namespaces,
long limit,
                                   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=789312&r1=789311&r2=789312&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
Mon Jun 29 12:55:00 2009
@@ -555,17 +555,6 @@
     }
 
     public QueryInfo executeQuery(final SessionInfo sessionInfo, final String statement,
-            final String language, final Map<String, String> namespaces) throws RepositoryException
{
-
-        return (QueryInfo) execute(new Callable() {
-            public Object call() throws RepositoryException {
-                return service.executeQuery(unwrap(sessionInfo), statement, language, namespaces);
-            }
-        }, "executeQuery(SessionInfo, String, String, Map)",
-                new Object[]{unwrap(sessionInfo), statement, language, namespaces});
-    }
-
-    public QueryInfo executeQuery(final SessionInfo sessionInfo, final String statement,
                                   final String language, final Map<String, String>
namespaces, final long limit, final long offset, final Map<String, QValue> values) throws
RepositoryException {
 
         return (QueryInfo) execute(new Callable() {

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java?rev=789312&r1=789311&r2=789312&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
Mon Jun 29 12:55:00 2009
@@ -21,7 +21,7 @@
 
 /**
  * <code>QueryInfo</code> is the the return value of
- * {@link RepositoryService#executeQuery(SessionInfo, String, String, Map)}
+ * {@link RepositoryService#executeQuery(SessionInfo, String, String, Map, long, long, Map)}

  * which is used to run a query on the <code>RepositoryService</code>. It
  * provides access to the rows of the query result as well as to the column
  * names.

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=789312&r1=789311&r2=789312&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
Mon Jun 29 12:55:00 2009
@@ -889,37 +889,31 @@
      * to namespace uri in order to be able to properly resolve prefix:localname
      * patterns present within the query statement.
      *
-     * @param sessionInfo
-     * @param statement the query statement to be execute.
-     * @param language the query language used to parse the query <code>statement</code>.
-     * @param namespaces the locally re-mapped namespace which may be used in
-     * the query <code>statement</code>.
-     * @return
-     * @throws javax.jcr.RepositoryException
-     * @see javax.jcr.query.Query#execute()
-     */
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map<String, String> namespaces) throws RepositoryException;
-
-    /**
-     * Execute the given query statement with the specified query language. The
-     * additional <code>namespaces</code> parameter provides a mapping of prefix
-     * to namespace uri in order to be able to properly resolve prefix:localname
-     * patterns present within the query statement.
-     *
-     * @param sessionInfo
-     * @param statement the query statement to be execute.
-     * @param language the query language used to parse the query <code>statement</code>.
-     * @param namespaces the locally re-mapped namespace which may be used in
-     * 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)}.
+     * @param sessionInfo the session info that wants to execute the query.
+     * @param statement   the query statement to be execute.
+     * @param language    the query language used to parse the query
+     *                    <code>statement</code>.
+     * @param namespaces  the locally re-mapped namespace which may be used in
+     *                    the query <code>statement</code>.
+     * @param limit       The maximum result size or <code>-1</code> is no
+     *                    maximum is set.
+     * @param offset      The offset in the total result set or <code>-1</code>
+     *                    is no offset is 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
+     * @throws RepositoryException if an error occurs.
      * @see javax.jcr.query.Query#execute()
      */
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map<String, String> namespaces, long limit, long offset, Map<String, QValue> values)
throws RepositoryException;
+    public QueryInfo executeQuery(SessionInfo sessionInfo,
+                                  String statement,
+                                  String language,
+                                  Map<String, String> 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=789312&r1=789311&r2=789312&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
Mon Jun 29 12:55:00 2009
@@ -1676,33 +1676,6 @@
     }
 
     /**
-     * @see RepositoryService#executeQuery(SessionInfo, String, String, Map)
-     */
-    public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map<String, String> namespaces) throws RepositoryException {
-        SearchMethod method = null;
-        try {
-            String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
-            SearchInfo sInfo = new SearchInfo(language,
-                    Namespace.EMPTY_NAMESPACE, statement, namespaces);
-            method = new SearchMethod(uri, sInfo);
-            getClient(sessionInfo).executeMethod(method);
-            method.checkSuccess();
-
-            MultiStatus ms = method.getResponseBodyAsMultiStatus();
-            NamePathResolver resolver = getNamePathResolver(sessionInfo);
-            return new QueryInfoImpl(ms, idFactory, resolver, valueFactory, getQValueFactory());
-        } catch (IOException e) {
-            throw new RepositoryException(e);
-        } catch (DavException e) {
-            throw ExceptionConverter.generate(e);
-        }  finally {
-            if (method != null) {
-                method.releaseConnection();
-            }
-        }
-    }
-
-    /**
      * @see RepositoryService#executeQuery(SessionInfo, String, String,java.util.Map,long,long,java.util.Map
      */
     public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map<String, String> namespaces, long limit, long offset, Map<String, QValue> values)
throws RepositoryException {
@@ -1711,9 +1684,13 @@
             String uri = uriResolver.getWorkspaceUri(sessionInfo.getWorkspaceName());
             SearchInfo sInfo = new SearchInfo(language,
                     Namespace.EMPTY_NAMESPACE, statement, namespaces);
-            
-            sInfo.setNumberResults(limit);
-            sInfo.setOffset(offset);
+
+            if (limit != -1) {
+                sInfo.setNumberResults(limit);
+            }
+            if (offset != -1) {
+                sInfo.setOffset(offset);
+            }
 
             if (!(values == null || values.isEmpty())) {
                 throw new UnsupportedOperationException("Implementation missing:  JCR-2107");

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=789312&r1=789311&r2=789312&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
Mon Jun 29 12:55:00 2009
@@ -1029,26 +1029,16 @@
     /**
      * {@inheritDoc}
      */
-    public QueryInfo executeQuery(SessionInfo sessionInfo,
-                                  String statement,
-                                  String language,
-                                  Map<String, String> namespaces) throws RepositoryException
{
-        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
-        Query query = createQuery(sInfo.getSession(), statement,
-                language, namespaces);
-        return new QueryInfoImpl(query, query.execute(), idFactory,
-                sInfo.getNamePathResolver(), getQValueFactory());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public QueryInfo executeQuery(SessionInfo sessionInfo, String statement, String language,
Map<String, String> 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 (limit != -1) {
+            query.setLimit(limit);
+        }
+        if (offset != -1) {
+            query.setOffset(offset);
+        }
         if (values != null && !values.isEmpty()) {
             for (Map.Entry<String, QValue> entry : values.entrySet()) {
                 Value value = ValueFormat.getJCRValue(entry.getValue(), sInfo.getNamePathResolver(),
sInfo.getSession().getValueFactory());



Mime
View raw message