jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1331855 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/kernel/ main/java/org/apache/jackrabbit/oak/query/ main/java/org/apache/jackrabbit/oak/spi/state/ test/java/org/...
Date Sat, 28 Apr 2012 23:50:56 GMT
Author: jukka
Date: Sat Apr 28 23:50:55 2012
New Revision: 1331855

URL: http://svn.apache.org/viewvc?rev=1331855&view=rev
Log:
OAK-30: Strongly typed wrapper for the MicroKernel

Move property and value implementation classes to .kernel as they're now accessed through
the .spi.state interfaces

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/BinaryValue.java
      - copied, changed from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueFactoryImpl.java
      - copied, changed from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueFactoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueImpl.java
      - copied, changed from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/PropertyStateImpl.java
      - copied, changed from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueFactoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java
Modified:
    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/core/ContentSessionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/CoreValueUtilTest.java

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=1331855&r1=1331854&r2=1331855&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
Sat Apr 28 23:50:55 2012
@@ -21,7 +21,6 @@ import org.apache.jackrabbit.mk.core.Mic
 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;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
@@ -50,7 +49,6 @@ public class ContentRepositoryImpl imple
     private static final String DEFAULT_WORKSPACE_NAME = "default";
 
     private final MicroKernel microKernel;
-    private final CoreValueFactory valueFactory;
     private final QueryEngine queryEngine;
     private final NodeStore nodeStore;
 
@@ -81,9 +79,8 @@ public class ContentRepositoryImpl imple
      */
     public ContentRepositoryImpl(MicroKernel mk, QueryIndexProvider indexProvider) {
         microKernel = mk;
-        valueFactory = new CoreValueFactoryImpl(microKernel);
-        nodeStore = new KernelNodeStore(microKernel, valueFactory);
-        queryEngine = new QueryEngineImpl(microKernel, valueFactory, indexProvider);
+        nodeStore = new KernelNodeStore(microKernel);
+        queryEngine = new QueryEngineImpl(nodeStore, microKernel, indexProvider);
 
         // FIXME: workspace setup must be done elsewhere...
         queryEngine.init();
@@ -124,7 +121,7 @@ public class ContentRepositoryImpl imple
             throw new NoSuchWorkspaceException(workspaceName);
         }
 
-        return new ContentSessionImpl(sc, workspaceName, nodeStore, queryEngine, valueFactory);
+        return new ContentSessionImpl(sc, workspaceName, nodeStore, queryEngine);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Sat Apr 28 23:50:55 2012
@@ -42,16 +42,14 @@ class ContentSessionImpl implements Cont
     private final String workspaceName;
     private final NodeStore store;
     private final QueryEngine queryEngine;
-    private final CoreValueFactory valueFactory;
 
     public ContentSessionImpl(SimpleCredentials credentials, String workspaceName,
-                              NodeStore store, QueryEngine queryEngine, CoreValueFactory
valueFactory) {
+                              NodeStore store, QueryEngine queryEngine) {
 
         this.credentials = credentials;
         this.workspaceName = workspaceName;
         this.store = store;
         this.queryEngine = queryEngine;
-        this.valueFactory = valueFactory;
     }
 
     @Override
@@ -97,7 +95,7 @@ class ContentSessionImpl implements Cont
 
     @Override
     public CoreValueFactory getCoreValueFactory() {
-        return valueFactory;
+        return store.getValueFactory();
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Sat Apr 28 23:50:55 2012
@@ -351,7 +351,7 @@ public class TreeImpl implements Tree {
 
     @Override
     public void setProperty(String name, CoreValue value) {
-        builder.setProperty(new PropertyStateImpl(name, value));
+        builder.setProperty(name, value);
         if (listener != null) {
             listener.setProperty(this, name, value);
         }
@@ -359,7 +359,7 @@ public class TreeImpl implements Tree {
 
     @Override
     public void setProperty(String name, List<CoreValue> values) {
-        builder.setProperty(new PropertyStateImpl(name, values));
+        builder.setProperty(name, values);
         if (listener != null) {
             listener.setProperty(this, name, values);
         }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/BinaryValue.java
(from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/BinaryValue.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/BinaryValue.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java&r1=1331854&r2=1331855&rev=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/BinaryValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/BinaryValue.java
Sat Apr 28 23:50:55 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.core;
+package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.util.MicroKernelInputStream;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueFactoryImpl.java
(from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueFactoryImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueFactoryImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueFactoryImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueFactoryImpl.java&r1=1331854&r2=1331855&rev=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueFactoryImpl.java
Sat Apr 28 23:50:55 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.core;
+package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CoreValue;
@@ -29,7 +29,7 @@ import java.math.BigDecimal;
 /**
  * CoreValueFactoryImpl... TODO javadoc
  */
-public class CoreValueFactoryImpl implements CoreValueFactory {
+class CoreValueFactoryImpl implements CoreValueFactory {
 
     /**
      * logger instance

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueImpl.java
(from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueImpl.java&r1=1331854&r2=1331855&rev=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/CoreValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/CoreValueImpl.java
Sat Apr 28 23:50:55 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.core;
+package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.slf4j.Logger;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Sat Apr 28 23:50:55 2012
@@ -24,7 +24,6 @@ import org.apache.jackrabbit.mk.json.Jso
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.core.PropertyStateImpl;
 import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
Sat Apr 28 23:50:55 2012
@@ -16,9 +16,12 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import java.util.List;
+
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -97,13 +100,19 @@ public class KernelNodeStateBuilder impl
     }
 
     @Override
-    public void setProperty(PropertyState property) {
-        String targetPath = PathUtils.concat(path, property.getName());
-        String value = property.isArray()
-            ? CoreValueUtil.toJsonArray(property.getValues())
-            : CoreValueUtil.toJsonValue(property.getValue());
+    public void setProperty(String name, CoreValue value) {
+        String targetPath = PathUtils.concat(path, name);
+        String json = CoreValueUtil.toJsonValue(value);
+
+        revision[0] = kernel.commit("", "^\"" + targetPath + "\":" + json, revision[0], null);
+    }
+
+    @Override
+    public void setProperty(String name, List<CoreValue> values) {
+        String targetPath = PathUtils.concat(path, name);
+        String json = CoreValueUtil.toJsonArray(values);
 
-        revision[0] = kernel.commit("", "^\"" + targetPath + "\":" + value, revision[0],
null);
+        revision[0] = kernel.commit("", "^\"" + targetPath + "\":" + json, revision[0], null);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Sat Apr 28 23:50:55 2012
@@ -39,9 +39,9 @@ public class KernelNodeStore extends Abs
     final MicroKernel kernel;
     final CoreValueFactory valueFactory;
 
-    public KernelNodeStore(MicroKernel kernel, CoreValueFactory valueFactory) {
+    public KernelNodeStore(MicroKernel kernel) {
         this.kernel = kernel;
-        this.valueFactory = valueFactory;
+        this.valueFactory = new CoreValueFactoryImpl(kernel);
     }
 
     @Override
@@ -72,73 +72,8 @@ public class KernelNodeStore extends Abs
     }
 
     @Override
-    public void compare(NodeState before, NodeState after, NodeStateDiff diff) {
-        compareProperties(before, after, diff);
-        compareChildNodes(before, after, diff);
-    }
-
-    /**
-     * Compares the properties of the given two node states.
-     *
-     * @param before node state before changes
-     * @param after node state after changes
-     * @param diff handler of node state differences
-     */
-    protected void compareProperties(
-            NodeState before, NodeState after, NodeStateDiff diff) {
-        Set<String> beforeProperties = new HashSet<String>();
-
-        for (PropertyState beforeProperty : before.getProperties()) {
-            String name = beforeProperty.getName();
-            PropertyState afterProperty = after.getProperty(name);
-            if (afterProperty == null) {
-                diff.propertyDeleted(beforeProperty);
-            } else {
-                beforeProperties.add(name);
-                if (!beforeProperty.equals(afterProperty)) {
-                    diff.propertyChanged(beforeProperty, afterProperty);
-                }
-            }
-        }
-
-        for (PropertyState afterProperty : after.getProperties()) {
-            if (!beforeProperties.contains(afterProperty.getName())) {
-                diff.propertyAdded(afterProperty);
-            }
-        }
-    }
-
-    /**
-     * Compares the child nodes of the given two node states.
-     *
-     * @param before node state before changes
-     * @param after node state after changes
-     * @param diff handler of node state differences
-     */
-    protected void compareChildNodes(
-            NodeState before, NodeState after, NodeStateDiff diff) {
-        Set<String> beforeChildNodes = new HashSet<String>();
-
-        for (ChildNodeEntry beforeCNE : before.getChildNodeEntries(0, -1)) {
-            String name = beforeCNE.getName();
-            NodeState beforeChild = beforeCNE.getNodeState();
-            NodeState afterChild = after.getChildNode(name);
-            if (afterChild == null) {
-                diff.childNodeDeleted(name, beforeChild);
-            } else {
-                beforeChildNodes.add(name);
-                if (!beforeChild.equals(afterChild)) {
-                    diff.childNodeChanged(name, beforeChild, afterChild);
-                }
-            }
-        }
-
-        for (ChildNodeEntry afterChild : after.getChildNodeEntries(0, -1)) {
-            String name = afterChild.getName();
-            if (!beforeChildNodes.contains(name)) {
-                diff.childNodeAdded(name, afterChild.getNodeState());
-            }
-        }
+    public CoreValueFactory getValueFactory() {
+        return valueFactory;
     }
 
 }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/PropertyStateImpl.java
(from r1331854, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/PropertyStateImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/PropertyStateImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java&r1=1331854&r2=1331855&rev=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/PropertyStateImpl.java
Sat Apr 28 23:50:55 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.core;
+package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
@@ -25,7 +25,7 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-public class PropertyStateImpl implements PropertyState {
+class PropertyStateImpl implements PropertyState {
 
     private final String name;
     private final CoreValue value;

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=1331855&r1=1331854&r2=1331855&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
Sat Apr 28 23:50:55 2012
@@ -28,6 +28,7 @@ import org.apache.jackrabbit.oak.query.i
 import org.apache.jackrabbit.oak.query.index.TraversingIndex;
 import org.apache.jackrabbit.oak.spi.QueryIndex;
 import org.apache.jackrabbit.oak.spi.QueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 public class QueryEngineImpl implements QueryEngine {
 
@@ -39,9 +40,9 @@ public class QueryEngineImpl implements 
     private final SQL2Parser parserSQL2;
     private final QueryIndexProvider indexProvider;
 
-    public QueryEngineImpl(MicroKernel mk, CoreValueFactory valueFactory, QueryIndexProvider
indexProvider) {
+    public QueryEngineImpl(NodeStore store, MicroKernel mk, QueryIndexProvider indexProvider)
{
         this.mk = mk;
-        this.vf = valueFactory;
+        this.vf = store.getValueFactory();
         this.indexProvider = indexProvider;
         parserSQL2 = new SQL2Parser(vf);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateBuilder.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStateBuilder.java
Sat Apr 28 23:50:55 2012
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.spi.state;
 
+import java.util.List;
+
+import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 
 /**
@@ -67,9 +70,11 @@ public interface NodeStateBuilder {
     /**
      * Set a property.
      *
-     * @param property  property to set
+     * @param name property name
      */
-    void setProperty(PropertyState property);
+    void setProperty(String name, CoreValue values);
+
+    void setProperty(String name, List<CoreValue> values);
 
     /**
      * Remove the named property

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStore.java
Sat Apr 28 23:50:55 2012
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.oak.spi.state;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.CoreValueFactory;
 
 /**
  * Storage abstraction for trees. At any given point in time the stored
@@ -46,6 +47,13 @@ public interface NodeStore {
     NodeStateBuilder getBuilder(NodeState base);
 
     /**
+     * Returns the factory for creating values used for building node states.
+     *
+     * @return value factory
+     */
+    CoreValueFactory getValueFactory();
+
+    /**
      * Updates the state of the tree.
      * @param builder  builder containing the new node state
      */

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
Sat Apr 28 23:50:55 2012
@@ -19,7 +19,9 @@ package org.apache.jackrabbit.oak.core;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,18 +37,20 @@ public abstract class AbstractOakTest {
     private static final Logger log = LoggerFactory.getLogger(AbstractOakTest.class);
 
     // TODO: use regular oak-repo setup
-    protected MicroKernel microKernel;
+    protected NodeStore store;
     protected CoreValueFactory valueFactory;
 
     protected NodeState state;
 
     @Before
     public void setUp() {
-        microKernel = new MicroKernelImpl();
-        valueFactory = new CoreValueFactoryImpl(microKernel);
+        MicroKernel microKernel = new MicroKernelImpl();
+        store = new KernelNodeStore(microKernel);
+        valueFactory = store.getValueFactory();
 
-        state = createInitialState();
+        state = createInitialState(microKernel);
     }
 
-    protected abstract NodeState createInitialState();
+    protected abstract NodeState createInitialState(MicroKernel microKernel);
+
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
Sat Apr 28 23:50:55 2012
@@ -77,13 +77,13 @@ public class RootImplFuzzIT {
         counter = 0;
 
         MicroKernel mk1 = new MicroKernelImpl("./target/mk1/" + random.nextInt());
-        vf = new CoreValueFactoryImpl(mk1);
-        store1 = new KernelNodeStore(mk1, vf);
+        store1 = new KernelNodeStore(mk1);
+        vf = store1.getValueFactory();
         mk1.commit("", "+\"/test\":{} +\"/test/root\":{}", mk1.getHeadRevision(), "");
         root1 = new RootImpl(store1, "test");
 
         MicroKernel mk2 = new MicroKernelImpl("./target/mk2/" + random.nextInt());
-        store2 = new KernelNodeStore(mk2, vf);
+        store2 = new KernelNodeStore(mk2);
         mk2.commit("", "+\"/test\":{} +\"/test/root\":{}", mk2.getHeadRevision(), "");
         root2 = new RootImpl(store2, "test");
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
Sat Apr 28 23:50:55 2012
@@ -18,15 +18,14 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Tree.Status;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -45,21 +44,12 @@ import static org.junit.Assert.assertTru
 
 public class RootImplTest extends AbstractOakTest {
 
-    private NodeStore store;
-
-    @Override
-    @Before
-    public void setUp() {
-        super.setUp();
-    }
-
     @Override
-    protected NodeState createInitialState() {
+    protected NodeState createInitialState(MicroKernel microKernel) {
         String jsop =
                 "+\"test\":{\"a\":1,\"b\":2,\"c\":3,"
                         + "\"x\":{},\"y\":{},\"z\":{}}";
-        String revision = microKernel.commit("/", jsop, microKernel.getHeadRevision(), "test
data");
-        store = new KernelNodeStore(microKernel, valueFactory);
+        microKernel.commit("/", jsop, microKernel.getHeadRevision(), "test data");
         return store.getRoot().getChildNode("test");
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
Sat Apr 28 23:50:55 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.core.AbstractOakTest;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -37,13 +38,12 @@ import static junit.framework.Assert.ass
 public class KernelNodeStateTest extends AbstractOakTest {
 
     @Override
-    protected NodeState createInitialState() {
+    protected NodeState createInitialState(MicroKernel microKernel) {
         String jsop =
                 "+\"test\":{\"a\":1,\"b\":2,\"c\":3,"
                 + "\"x\":{},\"y\":{},\"z\":{}}";
-        String revision = microKernel.commit(
-                "/", jsop, microKernel.getHeadRevision(), "test data");
-        return new KernelNodeState(microKernel, valueFactory, "/test", revision);
+        microKernel.commit("/", jsop, null, "test data");
+        return store.getRoot().getChildNode("test");
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/LargeKernelNodeStateTest.java
Sat Apr 28 23:50:55 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.core.AbstractOakTest;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -33,15 +34,14 @@ public class LargeKernelNodeStateTest ex
     private final int N = KernelNodeState.MAX_CHILD_NODE_NAMES;
 
     @Override
-    protected NodeState createInitialState() {
+    protected NodeState createInitialState(MicroKernel microKernel) {
         StringBuilder jsop = new StringBuilder("+\"test\":{\"a\":1");
         for (int i = 0; i <= N; i++) {
             jsop.append(",\"x" + i + "\":{}");
         }
         jsop.append('}');
-        String revision = microKernel.commit(
-                "/", jsop.toString(), microKernel.getHeadRevision(), "test data");
-        return new KernelNodeState(microKernel, valueFactory, "/test", revision);
+        microKernel.commit("/", jsop.toString(), null, "test data");
+        return store.getRoot().getChildNode("test");
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
Sat Apr 28 23:50:55 2012
@@ -19,7 +19,8 @@ package org.apache.jackrabbit.oak.query;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
-import org.apache.jackrabbit.oak.core.CoreValueFactoryImpl;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
  * AbstractQueryTest...
@@ -28,5 +29,9 @@ public abstract class AbstractQueryTest 
 
     // TODO improve: use ContentRepository here instead of creating mk instance.
     protected final MicroKernel mk = new MicroKernelImpl();
-    protected final CoreValueFactory vf = new CoreValueFactoryImpl(mk);
+
+    protected final NodeStore store = new KernelNodeStore(mk);
+
+    protected final CoreValueFactory vf = store.getValueFactory();
+
 }
\ No newline at end of file

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=1331855&r1=1331854&r2=1331855&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
Sat Apr 28 23:50:55 2012
@@ -41,7 +41,7 @@ import org.junit.Test;
 public class QueryTest extends AbstractQueryTest {
 
     private QueryIndexProvider ip = new Indexer(mk);
-    private QueryEngineImpl qe = new QueryEngineImpl(mk, vf, ip);
+    private QueryEngineImpl qe = new QueryEngineImpl(store, mk, ip);
 
     @Before
     public void setup() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/CoreValueUtilTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/CoreValueUtilTest.java?rev=1331855&r1=1331854&r2=1331855&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/CoreValueUtilTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/CoreValueUtilTest.java
Sat Apr 28 23:50:55 2012
@@ -22,7 +22,7 @@ import org.apache.jackrabbit.mk.json.Jso
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
-import org.apache.jackrabbit.oak.core.CoreValueFactoryImpl;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -61,7 +61,7 @@ public class CoreValueUtilTest {
     @Before
     public void setUp() throws IOException {
         microKernel = new SimpleKernelImpl("mem:" + getClass().getName());
-        valueFactory = new CoreValueFactoryImpl(microKernel);
+        valueFactory = new KernelNodeStore(microKernel).getValueFactory();
 
         singleValueMap = new HashMap<CoreValue, String>();
         singleValueMap.put(valueFactory.createValue("abc"), "\"abc\"");



Mime
View raw message