jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1330862 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/mk/index/ main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/query/ test/java/org/apache/jackrabbit/oak/query/
Date Thu, 26 Apr 2012 14:09:20 GMT
Author: thomasm
Date: Thu Apr 26 14:09:19 2012
New Revision: 1330862

URL: http://svn.apache.org/viewvc?rev=1330862&view=rev
Log:
OAK-28 Query implementation (make index provider pluggable)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java?rev=1330862&r1=1330861&r2=1330862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
Thu Apr 26 14:09:19 2012
@@ -23,7 +23,6 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopStream;
-import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.apache.jackrabbit.mk.simple.NodeImpl;
 import org.apache.jackrabbit.mk.simple.NodeMap;
 import org.apache.jackrabbit.mk.util.ExceptionFactory;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java?rev=1330862&r1=1330861&r2=1330862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
Thu Apr 26 14:09:19 2012
@@ -43,6 +43,9 @@ import java.util.Map.Entry;
  */
 public class Indexer implements QueryIndexProvider {
 
+    // TODO discuss where to store index config data
+    private static final String INDEX_CONFIG_ROOT = "/jcr:system/indexes";
+
     private static final boolean DISABLED = Boolean.getBoolean("mk.indexDisabled");
 
     private MicroKernel mk;
@@ -60,7 +63,7 @@ public class Indexer implements QueryInd
     }
 
     public Indexer(MicroKernel mk) {
-        this(mk, "/index");
+        this(mk, INDEX_CONFIG_ROOT);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1330862&r1=1330861&r2=1330862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Thu Apr 26 14:09:19 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.mk.index.Indexer;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
@@ -26,6 +27,7 @@ import org.apache.jackrabbit.oak.kernel.
 import org.apache.jackrabbit.oak.kernel.NodeState;
 import org.apache.jackrabbit.oak.kernel.NodeStore;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
+import org.apache.jackrabbit.oak.query.index.QueryIndexProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,9 +66,11 @@ public class ContentRepositoryImpl imple
         microKernel = mk;
         valueFactory = new CoreValueFactoryImpl(microKernel);
         nodeStore = new KernelNodeStore(microKernel, valueFactory);
-        queryEngine = new QueryEngineImpl(microKernel, valueFactory);
+        QueryIndexProvider indexProvider = new Indexer(mk);
+        queryEngine = new QueryEngineImpl(microKernel, valueFactory, indexProvider);
 
         // FIXME: workspace setup must be done elsewhere...
+        indexProvider.init();
         queryEngine.init();
         NodeState root = nodeStore.getRoot();
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java?rev=1330862&r1=1330861&r2=1330862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
Thu Apr 26 14:09:19 2012
@@ -21,12 +21,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.index.Indexer;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.query.index.Filter;
 import org.apache.jackrabbit.oak.query.index.QueryIndex;
+import org.apache.jackrabbit.oak.query.index.QueryIndexProvider;
 import org.apache.jackrabbit.oak.query.index.TraversingIndex;
 
 public class QueryEngineImpl implements QueryEngine {
@@ -34,25 +34,22 @@ public class QueryEngineImpl implements 
     static final String SQL2 = "JCR-SQL2";
     private static final String XPATH = "xpath";
 
-    // TODO discuss where to store index config data
-    private static final String INDEX_CONFIG_ROOT = "/jcr:system/indexes";
-
     private final MicroKernel mk;
     private final CoreValueFactory vf;
     private final SQL2Parser parserSQL2;
-    private final Indexer indexer;
+    private final QueryIndexProvider indexProvider;
 
-    public QueryEngineImpl(MicroKernel mk, CoreValueFactory valueFactory) {
+    public QueryEngineImpl(MicroKernel mk, CoreValueFactory valueFactory, QueryIndexProvider
indexProvider) {
         this.mk = mk;
         this.vf = valueFactory;
+        this.indexProvider = indexProvider;
         parserSQL2 = new SQL2Parser(vf);
-        indexer = new Indexer(mk, INDEX_CONFIG_ROOT);
     }
 
     @Override
     public void init() {
         // TODO the list of index providers should be configurable as well
-        indexer.init();
+        indexProvider.init();
     }
 
     /**
@@ -113,7 +110,7 @@ public class QueryEngineImpl implements 
     }
 
     private List<QueryIndex> getIndexes() {
-        return indexer.getQueryIndexes(mk);
+        return indexProvider.getQueryIndexes(mk);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1330862&r1=1330861&r2=1330862&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
Thu Apr 26 14:09:19 2012
@@ -27,9 +27,11 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import org.apache.jackrabbit.mk.index.Indexer;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.Result;
 import org.apache.jackrabbit.oak.api.ResultRow;
+import org.apache.jackrabbit.oak.query.index.QueryIndexProvider;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -38,7 +40,8 @@ import org.junit.Test;
  */
 public class QueryTest extends AbstractQueryTest {
 
-    private QueryEngineImpl qe = new QueryEngineImpl(mk, vf);
+    private QueryIndexProvider ip = new Indexer(mk);
+    private QueryEngineImpl qe = new QueryEngineImpl(mk, vf, ip);
 
     @Before
     public void setup() {



Mime
View raw message