jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1309844 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query: QueryManagerImpl.java QueryResultImpl.java
Date Thu, 05 Apr 2012 13:27:43 GMT
Author: thomasm
Date: Thu Apr  5 13:27:43 2012
New Revision: 1309844

URL: http://svn.apache.org/viewvc?rev=1309844&view=rev
Log:
OAK-28 Query implementation (API changes)

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java?rev=1309844&r1=1309843&r2=1309844&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
Thu Apr  5 13:27:43 2012
@@ -82,7 +82,7 @@ public class QueryManagerImpl implements
 
     public List<String> parse(String statement, String language) throws InvalidQueryException
{
         try {
-            return queryEngine.getBindVariableNames(statement, convertLanguage(language));
+            return queryEngine.getBindVariableNames(statement, language);
         } catch (ParseException e) {
             throw new InvalidQueryException(e);
         }
@@ -92,24 +92,13 @@ public class QueryManagerImpl implements
             HashMap<String, Value> bindVariableMap, long limit, long offset) throws
RepositoryException {
         try {
             HashMap<String, CoreValue> bindMap = convertMap(bindVariableMap);
-            Result r = queryEngine.executeQuery(statement, convertLanguage(language), bindMap);
+            Result r = queryEngine.executeQuery(statement, language, bindMap);
             return new QueryResultImpl(r);
         } catch (ParseException e) {
             throw new InvalidQueryException(e);
         }
     }
 
-    @SuppressWarnings("deprecation")
-    private static String convertLanguage(String jcrLanguage) throws InvalidQueryException
{
-        if (jcrLanguage.equals(Query.JCR_SQL2)) {
-            return QueryEngine.SQL2;
-        } else if (jcrLanguage.equals(Query.XPATH)) {
-            return QueryEngine.XPATH;
-        } else {
-            throw new InvalidQueryException("Unsupported language: " + jcrLanguage);
-        }
-    }
-
     private HashMap<String, CoreValue> convertMap(HashMap<String, Value> bindVariableMap)
throws RepositoryException {
         HashMap<String, CoreValue> map = new HashMap<String, CoreValue>();
         for (Entry<String, Value> e : bindVariableMap.entrySet()) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java?rev=1309844&r1=1309843&r2=1309844&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
Thu Apr  5 13:27:43 2012
@@ -52,7 +52,7 @@ public class QueryResultImpl implements 
     public RowIterator getRows() throws RepositoryException {
         Iterator<RowImpl> it = new Iterator<RowImpl>() {
 
-            private Iterator<? extends ResultRow> it = result.getRows();
+            private Iterator<? extends ResultRow> it = result.getRows().iterator();
 
             @Override
             public boolean hasNext() {



Mime
View raw message