jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1330745 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/ oak-core/src/test/java/org/apache/ja...
Date Thu, 26 Apr 2012 10:12:25 GMT
Author: angela
Date: Thu Apr 26 10:12:24 2012
New Revision: 1330745

URL: http://svn.apache.org/viewvc?rev=1330745&view=rev
Log:
OAK-18 - Define Oak API (WIP)

- clean up package structure and classes contained therein


Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentSession.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java   (contents, props changed)
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl2.java
      - copied, changed from r1330741, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree2.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/AbstractOakTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java   (contents, props changed)
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
      - copied, changed from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootTest.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentSession.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/AbstractPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree2.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/AbstractOakTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootTest.java
Modified:
    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/KernelNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.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/plugins/name/NamespaceMappingsTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java

Modified: 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/core/BinaryValue.java?rev=1330745&r1=1330744&r2=1330745&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/core/BinaryValue.java Thu Apr 26 10:12:24 2012
@@ -26,7 +26,7 @@ import java.io.InputStream;
 /**
  * BinaryValue... TODO: review name (BlobValue? BlobCoreValue? BinaryCoreValue?)
  */
-public class BinaryValue {
+class BinaryValue {
 
     /**
      * logger instance

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java Thu Apr 26 10:12:24 2012
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.kernel.NodeState;
+import org.apache.jackrabbit.oak.kernel.NodeStore;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,11 +38,11 @@ import javax.security.auth.login.LoginEx
  * {@link MicroKernel}-based implementation of
  * the {@link ContentRepository} interface.
  */
-public class KernelContentRepository implements ContentRepository {
+public class ContentRepositoryImpl implements ContentRepository {
 
     /** Logger instance */
     private static final Logger log =
-            LoggerFactory.getLogger(KernelContentRepository.class);
+            LoggerFactory.getLogger(ContentRepositoryImpl.class);
 
     // TODO: retrieve default wsp-name from configuration
     private static final String DEFAULT_WORKSPACE_NAME = "default";
@@ -49,17 +50,17 @@ public class KernelContentRepository imp
     private final MicroKernel microKernel;
     private final CoreValueFactory valueFactory;
     private final QueryEngine queryEngine;
-    private final KernelNodeStore nodeStore;
+    private final NodeStore nodeStore;
 
     /**
      * Utility constructor that creates a new in-memory repository for use
      * mostly in test cases.
      */
-    public KernelContentRepository() {
+    public ContentRepositoryImpl() {
         this(new MicroKernelImpl());
     }
 
-    public KernelContentRepository(MicroKernel mk) {
+    public ContentRepositoryImpl(MicroKernel mk) {
         microKernel = mk;
         valueFactory = new CoreValueFactoryImpl(microKernel);
         nodeStore = new KernelNodeStore(microKernel, valueFactory);
@@ -104,7 +105,7 @@ public class KernelContentRepository imp
             throw new NoSuchWorkspaceException(workspaceName);
         }
 
-        return new KernelContentSession(sc, workspaceName, nodeStore, queryEngine, valueFactory);
+        return new ContentSessionImpl(sc, workspaceName, nodeStore, queryEngine, valueFactory);
     }
 
 }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentSession.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentSession.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentSession.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java Thu Apr 26 10:12:24 2012
@@ -22,8 +22,7 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.kernel.KernelRoot;
+import org.apache.jackrabbit.oak.kernel.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,20 +32,20 @@ import java.io.IOException;
 /**
  * {@link MicroKernel}-based implementation of the {@link ContentSession} interface.
  */
-class KernelContentSession implements ContentSession {
+class ContentSessionImpl implements ContentSession {
 
     /** Logger instance */
     private static final Logger log =
-            LoggerFactory.getLogger(KernelContentSession.class);
+            LoggerFactory.getLogger(ContentSessionImpl.class);
 
     private final SimpleCredentials credentials;
     private final String workspaceName;
-    private final KernelNodeStore store;
+    private final NodeStore store;
     private final QueryEngine queryEngine;
     private final CoreValueFactory valueFactory;
 
-    public KernelContentSession(SimpleCredentials credentials, String workspaceName,
-            KernelNodeStore store, QueryEngine queryEngine, CoreValueFactory valueFactory) {
+    public ContentSessionImpl(SimpleCredentials credentials, String workspaceName,
+                              NodeStore store, QueryEngine queryEngine, CoreValueFactory valueFactory) {
 
         this.credentials = credentials;
         this.workspaceName = workspaceName;
@@ -78,7 +77,7 @@ class KernelContentSession implements Co
     
     @Override
     public Root getCurrentRoot() {
-        return new KernelRoot(store, workspaceName);
+        return new RootImpl(store, workspaceName);
     }
 
     @Override

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelPropertyState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java Thu Apr 26 10:12:24 2012
@@ -16,25 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.api.PropertyState;
+
+public class PropertyStateImpl implements PropertyState {
 
-class KernelPropertyState extends AbstractPropertyState {
     private final String name;
     private final CoreValue value;
     private final List<CoreValue> values;
 
-    public KernelPropertyState(String name, CoreValue value) {
+    public PropertyStateImpl(String name, CoreValue value) {
         this.name = name;
         this.value = value;
         this.values = null;
     }
 
-    public KernelPropertyState(String name, List<CoreValue> values) {
+    public PropertyStateImpl(String name, List<CoreValue> values) {
         this.name = name;
         this.value = null;
         this.values = Collections.unmodifiableList(values);
@@ -60,4 +63,57 @@ class KernelPropertyState extends Abstra
         return values;
     }
 
+    //------------------------------------------------------------< Object >----
+    /**
+     * Checks whether the given object is equal to this one. Two property
+     * states are considered equal if both their names and encoded values
+     * match. Subclasses may override this method with a more efficient
+     * equality check if one is available.
+     *
+     * @param that target of the comparison
+     * @return {@code true} if the objects are equal, {@code false} otherwise
+     */
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        } else if (that instanceof PropertyState) {
+            PropertyState other = (PropertyState) that;
+            return getName().equals(other.getName()) && valueEquals(other);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns a hash code that's compatible with how the
+     * {@link #equals(Object)} method is implemented. The current
+     * implementation simply returns the hash code of the property name
+     * since {@link PropertyState} instances are not intended for use as
+     * hash keys.
+     *
+     * @return hash code
+     */
+    @Override
+    public int hashCode() {
+        return getName().hashCode();
+    }
+
+    //------------------------------------------------------------< private >---
+
+    private boolean valueEquals(PropertyState other) {
+        if (isArray() != other.isArray()) {
+            return false;
+        } else if (isArray()) {
+            Iterator<CoreValue> iterator = other.getValues().iterator();
+            for (CoreValue value : getValues()) {
+                if (!iterator.hasNext() || !value.equals(iterator.next())) {
+                    return false;
+                }
+            }
+            return !iterator.hasNext();
+        } else {
+            return getValue().equals(other.getValue());
+        }
+    }
 }

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/PropertyStateImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java Thu Apr 26 10:12:24 2012
@@ -16,15 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
-import org.apache.jackrabbit.mk.util.PathUtils;
 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.Root;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.kernel.KernelTree.Listener;
+import org.apache.jackrabbit.oak.core.TreeImpl2.Listener;
+import org.apache.jackrabbit.oak.kernel.NodeState;
+import org.apache.jackrabbit.oak.kernel.NodeStateBuilder;
+import org.apache.jackrabbit.oak.kernel.NodeStore;
 
 import java.util.List;
 
@@ -39,38 +40,38 @@ import static org.apache.jackrabbit.mk.u
  *
  * TODO: Refactor tree to be based on the individual NodeStateBuilders instead of NodeStates
  */
-public class KernelRoot implements Root {
+public class RootImpl implements Root {
 
-    private final KernelNodeStore store;
+    private final NodeStore store;
     private final String workspaceName;
 
     /** Base node state of this tree */
     private NodeState base;
 
     /** Root state of this tree */
-    private KernelTree root;
+    private TreeImpl2 root;
 
     /** Listener for changes on the content tree */
     private TreeListener treeListener = new TreeListener();
 
     private NodeStateBuilder nodeStateBuilder;
 
-    public KernelRoot(KernelNodeStore store, String workspaceName) {
+    public RootImpl(NodeStore store, String workspaceName) {
         this.store = store;
         this.workspaceName = workspaceName;
         this.base = store.getRoot().getChildNode(workspaceName);
-        this.root = new KernelTree(base, treeListener);
         nodeStateBuilder = store.getBuilder(base);
+        this.root = new TreeImpl2(store, nodeStateBuilder, treeListener);
     }
 
     @Override
     public boolean move(String sourcePath, String destPath) {
-        KernelTree source = getTransientState(sourcePath);
+        TreeImpl2 source = getTransientState(sourcePath);
         if (source == null) {
             return false;
         }
 
-        KernelTree destParent = getTransientState(getParentPath(destPath));
+        TreeImpl2 destParent = getTransientState(getParentPath(destPath));
         String destName = getName(destPath);
         return destParent != null && source.move(destParent, destName);
 
@@ -78,12 +79,12 @@ public class KernelRoot implements Root 
 
     @Override
     public boolean copy(String sourcePath, String destPath) {
-        KernelTree sourceNode = getTransientState(sourcePath);
+        TreeImpl2 sourceNode = getTransientState(sourcePath);
         if (sourceNode == null) {
             return false;
         }
 
-        KernelTree destParent = getTransientState(getParentPath(destPath));
+        TreeImpl2 destParent = getTransientState(getParentPath(destPath));
         String destName = getName(destPath);
         return destParent != null && sourceNode.copy(destParent, destName);
 
@@ -105,7 +106,7 @@ public class KernelRoot implements Root 
         base = store.getRoot().getChildNode(workspaceName);
         nodeStateBuilder = store.getBuilder(base);
         treeListener = new TreeListener();
-        root = new KernelTree(base, treeListener);
+        root = new TreeImpl2(store, nodeStateBuilder, treeListener);
     }
 
     @Override
@@ -119,11 +120,11 @@ public class KernelRoot implements Root 
      * Get a transient node state for the node identified by
      * {@code path}
      * @param path  the path to the node state
-     * @return  a {@link KernelTree} instance for the item
+     * @return  a {@link Tree} instance for the item
      *          at {@code path} or {@code null} if no such item exits.
      */
-    private KernelTree getTransientState(String path) {
-        KernelTree state = root;
+    private TreeImpl2 getTransientState(String path) {
+        TreeImpl2 state = root;
         for (String name : elements(path)) {
             state = state.getChild(name);
             if (state == null) {
@@ -133,59 +134,42 @@ public class KernelRoot implements Root 
         return state;
     }
 
+    // TODO accumulate change log for refresh/rebase
     private class TreeListener implements Listener {
         private boolean isDirty;
-        
+
         @Override
-        public void addChild(KernelTree tree, String name) {
-            NodeStateBuilder target = getBuilder(tree);
-            target.addNode(name);
+        public void addChild(TreeImpl2 tree, String name) {
             isDirty = true;
         }
 
         @Override
-        public void removeChild(KernelTree tree, String name) {
-            NodeStateBuilder target = getBuilder(tree);
-            target.removeNode(name);
+        public void removeChild(TreeImpl2 tree, String name) {
             isDirty = true;
         }
 
         @Override
-        public void setProperty(KernelTree tree, String name, CoreValue value) {
-            NodeStateBuilder target = getBuilder(tree);
-            PropertyState propertyState = new KernelPropertyState(name, value);
-            target.setProperty(propertyState);
+        public void setProperty(TreeImpl2 tree, String name, CoreValue value) {
             isDirty = true;
         }
 
         @Override
-        public void setProperty(KernelTree tree, String name, List<CoreValue> values) {
-            NodeStateBuilder target = getBuilder(tree);
-            PropertyState propertyState = new KernelPropertyState(name, values);
-            target.setProperty(propertyState);
+        public void setProperty(TreeImpl2 tree, String name, List<CoreValue> values) {
             isDirty = true;
         }
 
         @Override
-        public void removeProperty(KernelTree tree, String name) {
-            NodeStateBuilder target = getBuilder(tree);
-            target.removeProperty(name);
+        public void removeProperty(TreeImpl2 tree, String name) {
             isDirty = true;
         }
 
         @Override
-        public void move(KernelTree tree, String name, KernelTree moved) {
-            NodeStateBuilder source = getBuilder(tree).getChildBuilder(name);
-            NodeStateBuilder destParent = getBuilder(moved.getParent());
-            source.moveTo(destParent, moved.getName());
+        public void move(TreeImpl2 tree, String name, TreeImpl2 moved) {
             isDirty = true;
         }
 
         @Override
-        public void copy(KernelTree tree, String name, KernelTree copied) {
-            NodeStateBuilder source = getBuilder(tree).getChildBuilder(name);
-            NodeStateBuilder destParent = getBuilder(copied.getParent());
-            source.copyTo(destParent, copied.getName());
+        public void copy(TreeImpl2 tree, String name, TreeImpl2 copied) {
             isDirty = true;
         }
 
@@ -194,13 +178,4 @@ public class KernelRoot implements Root 
         }
     }
 
-    private NodeStateBuilder getBuilder(Tree tree) {
-        String path = tree.getPath();
-        NodeStateBuilder builder = nodeStateBuilder;
-        for (String name : PathUtils.elements(path)) {
-            builder = builder.getChildBuilder(name);
-        }
-        
-        return builder;
-    }
 }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java Thu Apr 26 10:12:24 2012
@@ -16,11 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.kernel.ChildNodeEntry;
+import org.apache.jackrabbit.oak.kernel.NodeState;
 import org.apache.jackrabbit.oak.util.Function1;
 import org.apache.jackrabbit.oak.util.Iterators;
 import org.apache.jackrabbit.oak.util.PagedIterator;
@@ -43,7 +45,7 @@ import static org.apache.jackrabbit.oak.
 /**
  * TODO: Refactor to be based on the individual NodeStateBuilders instead of NodeStates
  */
-public class KernelTree implements Tree {
+public class TreeImpl implements Tree {
 
     /**
      * Underlying persistent state or {@code null} if this instance represents an
@@ -52,7 +54,7 @@ public class KernelTree implements Tree 
     private final NodeState persistentState;
 
     /** Parent of this content tree */
-    private KernelTree parent;
+    private TreeImpl parent;
 
     /** Name of this content tree */
     private String name;
@@ -61,12 +63,12 @@ public class KernelTree implements Tree 
     private final Listener listener;
 
     /** Children with underlying persistent child states */
-    private final Map<String, KernelTree> existingChildren =
-            new HashMap<String, KernelTree>();
+    private final Map<String, TreeImpl> existingChildren =
+            new HashMap<String, TreeImpl>();
 
     /** Transiently added children */
-    private final Map<String, KernelTree> addedTrees =
-            new HashMap<String, KernelTree>();
+    private final Map<String, TreeImpl> addedTrees =
+            new HashMap<String, TreeImpl>();
 
     /** Transiently removed children */
     private final Set<String> removedTrees = new HashSet<String>();
@@ -88,14 +90,14 @@ public class KernelTree implements Tree 
          * @param tree  parent to which a child was added
          * @param name  name of the added child
          */
-        void addChild(KernelTree tree, String name);
+        void addChild(TreeImpl tree, String name);
 
         /**
          * The child of the given {@code name} has been removed from {@code tree}
          * @param tree  parent from which a child was removed
          * @param name  name of the removed child
          */
-        void removeChild(KernelTree tree, String name);
+        void removeChild(TreeImpl tree, String name);
 
         /**
          * The property of the given {@code name} and {@code value} has been set.
@@ -103,7 +105,7 @@ public class KernelTree implements Tree 
          * @param name  name of the property
          * @param value  value of the property
          */
-        void setProperty(KernelTree tree, String name, CoreValue value);
+        void setProperty(TreeImpl tree, String name, CoreValue value);
 
         /**
          * The property of the given {@code name} and {@code values} has been set.
@@ -111,14 +113,14 @@ public class KernelTree implements Tree 
          * @param name  name of the property
          * @param values  values of the property
          */
-        void setProperty(KernelTree tree, String name, List<CoreValue> values);
+        void setProperty(TreeImpl tree, String name, List<CoreValue> values);
 
         /**
          * The property of the given {@code name} has been removed.
          * @param tree  parent on which the property was removed.
          * @param name  name of the property
          */
-        void removeProperty(KernelTree tree, String name);
+        void removeProperty(TreeImpl tree, String name);
 
         /**
          * The child with the given {@code name} has been moved.
@@ -126,7 +128,7 @@ public class KernelTree implements Tree 
          * @param name  name of the moved child
          * @param moved  moved child
          */
-        void move(KernelTree tree, String name, KernelTree moved);
+        void move(TreeImpl tree, String name, TreeImpl moved);
 
         /**
          * The child with the given {@code name} been copied.
@@ -134,7 +136,7 @@ public class KernelTree implements Tree 
          * @param name  name of the copied child
          * @param copied  copied child
          */
-        void copy(KernelTree tree, String name, KernelTree copied);
+        void copy(TreeImpl tree, String name, TreeImpl copied);
     }
 
     /**
@@ -142,7 +144,7 @@ public class KernelTree implements Tree 
      * @param persistentState  underlying persistent state
      * @param listener  change listener
      */
-    KernelTree(NodeState persistentState, Listener listener) {
+    TreeImpl(NodeState persistentState, Listener listener) {
         this(persistentState, null, "", listener);
     }
 
@@ -152,7 +154,7 @@ public class KernelTree implements Tree 
      * @param name  name of the child
      * @param listener  change listener
      */
-    private KernelTree(KernelTree parent, String name, Listener listener) {
+    private TreeImpl(TreeImpl parent, String name, Listener listener) {
         this(null, parent, name, listener);
     }
 
@@ -163,8 +165,8 @@ public class KernelTree implements Tree 
      * @param name  name of this content tree
      * @param listener  change listener
      */
-    private KernelTree(NodeState persistedState, KernelTree parent,
-                       String name, Listener listener) {
+    private TreeImpl(NodeState persistedState, TreeImpl parent,
+                     String name, Listener listener) {
 
         this.persistentState = persistedState;
         this.parent = parent;
@@ -179,8 +181,8 @@ public class KernelTree implements Tree 
      * @param parent  parent of the copied tree
      * @param name  name of the copied tree
      */
-    private KernelTree(KernelTree tree, KernelTree parent,
-                       String name) {
+    private TreeImpl(TreeImpl tree, TreeImpl parent,
+                     String name) {
 
         listener = tree.listener;
         persistentState = tree.persistentState;
@@ -188,17 +190,17 @@ public class KernelTree implements Tree 
         this.name = name;
 
         // recursively copy all existing children
-        for (Entry<String, KernelTree> existing : tree.existingChildren.entrySet()) {
+        for (Entry<String, TreeImpl> existing : tree.existingChildren.entrySet()) {
             String existingName = existing.getKey();
             this.existingChildren.put(existingName,
-                    new KernelTree(existing.getValue(), this, existingName));
+                    new TreeImpl(existing.getValue(), this, existingName));
         }
         
         // recursively copy all added children
-        for (Entry<String, KernelTree> added : tree.addedTrees.entrySet()) {
+        for (Entry<String, TreeImpl> added : tree.addedTrees.entrySet()) {
             String addedName = added.getKey();
             this.addedTrees.put(addedName,
-                    new KernelTree(added.getValue(), this, addedName));
+                    new TreeImpl(added.getValue(), this, addedName));
         }
 
         this.removedTrees.addAll(tree.removedTrees);
@@ -279,8 +281,8 @@ public class KernelTree implements Tree 
     }
 
     @Override
-    public KernelTree getChild(String name) {
-        KernelTree state = addedTrees.get(name);
+    public TreeImpl getChild(String name) {
+        TreeImpl state = addedTrees.get(name);
         if (state != null) {
             // Added or removed and re-added child
             return state;
@@ -301,7 +303,7 @@ public class KernelTree implements Tree 
             return Status.REMOVED;
         }
         else {
-            KernelTree child = getChild(name);
+            TreeImpl child = getChild(name);
             if (child == null) {
                 return null;
             }
@@ -420,7 +422,7 @@ public class KernelTree implements Tree 
     @Override
     public Tree addChild(String name) {
         if (!hasChild(name)) {
-            addedTrees.put(name, new KernelTree(this, name, listener));
+            addedTrees.put(name, new TreeImpl(this, name, listener));
             if (listener != null) {
                 listener.addChild(this, name);
             }
@@ -445,7 +447,7 @@ public class KernelTree implements Tree 
 
     @Override
     public void setProperty(String name, CoreValue value) {
-        PropertyState propertyState = new KernelPropertyState(name, value);
+        PropertyState propertyState = new PropertyStateImpl(name, value);
         setProperty(propertyState);
         if (listener != null) {
             listener.setProperty(this, name, value);
@@ -454,7 +456,7 @@ public class KernelTree implements Tree 
 
     @Override
     public void setProperty(String name, List<CoreValue> values) {
-        PropertyState propertyState = new KernelPropertyState(name, values);
+        PropertyState propertyState = new PropertyStateImpl(name, values);
         setProperty(propertyState);
         if (listener != null) {
             listener.setProperty(this, name, values);
@@ -482,14 +484,14 @@ public class KernelTree implements Tree 
      * @return  {@code true} if successful, {@code false otherwise}. I.e.
      * when {@code destName} already exists at {@code destParent}
      */
-    public boolean move(KernelTree destParent, String destName) {
+    public boolean move(TreeImpl destParent, String destName) {
         if (destParent.hasChild(destName)) {
             return false;
         }
 
         parent.markTreeRemoved(name);
 
-        KernelTree oldParent = parent;
+        TreeImpl oldParent = parent;
         String oldName = name;
 
         name = destName;
@@ -510,12 +512,12 @@ public class KernelTree implements Tree 
      * @return  {@code true} if successful, {@code false otherwise}. I.e.
      * when {@code destName} already exists at {@code destParent}
      */
-    public boolean copy(KernelTree destParent, String destName) {
+    public boolean copy(TreeImpl destParent, String destName) {
         if (destParent.hasChild(destName)) {
             return false;
         }
 
-        KernelTree copy = new KernelTree(this, destParent, destName);
+        TreeImpl copy = new TreeImpl(this, destParent, destName);
         destParent.addedTrees.put(destName, copy);
         if (listener != null) {
             listener.copy(parent, name, copy);
@@ -549,18 +551,18 @@ public class KernelTree implements Tree 
      *          does not have an underlying persistent state or the underlying
      *          persistent state does not have a child with the given {@code name}.
      */
-    private KernelTree getExistingChild(String name) {
+    private TreeImpl getExistingChild(String name) {
         if (persistentState == null) {
             return null;
         }
 
-        KernelTree transientState = existingChildren.get(name);
+        TreeImpl transientState = existingChildren.get(name);
         if (transientState == null) {
             NodeState state = persistentState.getChildNode(name);
             if (state == null) {
                 return null;
             }
-            transientState = new KernelTree(state, this, name, listener);
+            transientState = new TreeImpl(state, this, name, listener);
             existingChildren.put(name, transientState);
         }
         return transientState;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl2.java (from r1330741, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree2.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl2.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl2.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree2.java&r1=1330741&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelTree2.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl2.java Thu Apr 26 10:12:24 2012
@@ -16,11 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
 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.kernel.ChildNodeEntry;
+import org.apache.jackrabbit.oak.kernel.NodeState;
+import org.apache.jackrabbit.oak.kernel.NodeStateBuilder;
+import org.apache.jackrabbit.oak.kernel.NodeStateDiff;
+import org.apache.jackrabbit.oak.kernel.NodeStore;
 import org.apache.jackrabbit.oak.util.Function1;
 import org.apache.jackrabbit.oak.util.Iterators;
 import org.apache.jackrabbit.oak.util.PagedIterator;
@@ -30,7 +35,7 @@ import java.util.List;
 
 import static org.apache.jackrabbit.oak.util.Iterators.flatten;
 
-public class KernelTree2 implements Tree {
+public class TreeImpl2 implements Tree {
 
     private final NodeStore store;
 
@@ -49,10 +54,10 @@ public class KernelTree2 implements Tree
     private String name;
 
     /** Parent of this content tree */
-    private KernelTree2 parent;
+    private TreeImpl2 parent;
 
-    private KernelTree2(NodeStore store, NodeState baseState, NodeStateBuilder builder,
-            KernelTree2 parent, String name, Listener listener) {
+    private TreeImpl2(NodeStore store, NodeState baseState, NodeStateBuilder builder,
+                      TreeImpl2 parent, String name, Listener listener) {
 
         this.store = store;
         this.builder = builder;
@@ -62,7 +67,7 @@ public class KernelTree2 implements Tree
         this.parent = parent;
     }
     
-    KernelTree2(NodeStore store, NodeStateBuilder nodeStateBuilder, Listener listener) {
+    TreeImpl2(NodeStore store, NodeStateBuilder nodeStateBuilder, Listener listener) {
         this(store, nodeStateBuilder.getNodeState(), nodeStateBuilder, null, "", listener);
     }
 
@@ -76,14 +81,14 @@ public class KernelTree2 implements Tree
          * @param tree  parent to which a child was added
          * @param name  name of the added child
          */
-        void addChild(KernelTree2 tree, String name);
+        void addChild(TreeImpl2 tree, String name);
 
         /**
          * The child of the given {@code name} has been removed from {@code tree}
          * @param tree  parent from which a child was removed
          * @param name  name of the removed child
          */
-        void removeChild(KernelTree2 tree, String name);
+        void removeChild(TreeImpl2 tree, String name);
 
         /**
          * The property of the given {@code name} and {@code value} has been set.
@@ -91,7 +96,7 @@ public class KernelTree2 implements Tree
          * @param name  name of the property
          * @param value  value of the property
          */
-        void setProperty(KernelTree2 tree, String name, CoreValue value);
+        void setProperty(TreeImpl2 tree, String name, CoreValue value);
 
         /**
          * The property of the given {@code name} and {@code values} has been set.
@@ -99,14 +104,14 @@ public class KernelTree2 implements Tree
          * @param name  name of the property
          * @param values  values of the property
          */
-        void setProperty(KernelTree2 tree, String name, List<CoreValue> values);
+        void setProperty(TreeImpl2 tree, String name, List<CoreValue> values);
 
         /**
          * The property of the given {@code name} has been removed.
          * @param tree  parent on which the property was removed.
          * @param name  name of the property
          */
-        void removeProperty(KernelTree2 tree, String name);
+        void removeProperty(TreeImpl2 tree, String name);
 
         /**
          * The child with the given {@code name} has been moved.
@@ -114,7 +119,7 @@ public class KernelTree2 implements Tree
          * @param name  name of the moved child
          * @param moved  moved child
          */
-        void move(KernelTree2 tree, String name, KernelTree2 moved);
+        void move(TreeImpl2 tree, String name, TreeImpl2 moved);
 
         /**
          * The child with the given {@code name} been copied.
@@ -122,7 +127,7 @@ public class KernelTree2 implements Tree
          * @param name  name of the copied child
          * @param copied  copied child
          */
-        void copy(KernelTree2 tree, String name, KernelTree2 copied);
+        void copy(TreeImpl2 tree, String name, TreeImpl2 copied);
     }
 
     @Override
@@ -206,7 +211,7 @@ public class KernelTree2 implements Tree
     }
 
     @Override
-    public KernelTree2 getChild(String name) {
+    public TreeImpl2 getChild(String name) {
         NodeStateBuilder childBuilder = builder.getChildBuilder(name);
         NodeState childBaseState = baseState == null
             ? null
@@ -214,7 +219,7 @@ public class KernelTree2 implements Tree
 
         return childBuilder == null
             ? null
-            : new KernelTree2(store, childBaseState, childBuilder, this, name, listener);
+            : new TreeImpl2(store, childBaseState, childBuilder, this, name, listener);
     }
 
     @Override
@@ -280,7 +285,7 @@ public class KernelTree2 implements Tree
                     @Override
                     public Tree apply(ChildNodeEntry entry) {
                         NodeStateBuilder childBuilder = builder.getChildBuilder(entry.getName());
-                        return new KernelTree2(store, childBuilder.getNodeState(), childBuilder, KernelTree2.this, entry.getName(), listener);
+                        return new TreeImpl2(store, childBuilder.getNodeState(), childBuilder, TreeImpl2.this, entry.getName(), listener);
                     }
                 });
             }
@@ -290,7 +295,7 @@ public class KernelTree2 implements Tree
     @Override
     public Tree addChild(String name) {
         NodeStateBuilder childBuilder = builder.addNode(name);
-        KernelTree2 added = new KernelTree2(store, null, childBuilder, this, name, listener);
+        TreeImpl2 added = new TreeImpl2(store, null, childBuilder, this, name, listener);
         if (added != null) {
             listener.addChild(this, name);
         }
@@ -308,7 +313,7 @@ public class KernelTree2 implements Tree
 
     @Override
     public void setProperty(String name, CoreValue value) {
-        PropertyState propertyState = new KernelPropertyState(name, value);
+        PropertyState propertyState = new PropertyStateImpl(name, value);
         builder.setProperty(propertyState);
         if (listener != null) {
             listener.setProperty(this, name, value);
@@ -317,7 +322,7 @@ public class KernelTree2 implements Tree
 
     @Override
     public void setProperty(String name, List<CoreValue> values) {
-        PropertyState propertyState = new KernelPropertyState(name, values);
+        PropertyState propertyState = new PropertyStateImpl(name, values);
         builder.setProperty(propertyState);
         if (listener != null) {
             listener.setProperty(this, name, values);
@@ -341,10 +346,10 @@ public class KernelTree2 implements Tree
      * @return  {@code true} if successful, {@code false otherwise}. I.e.
      * when {@code destName} already exists at {@code destParent}
      */
-    public boolean move(KernelTree2 destParent, String destName) {
+    public boolean move(TreeImpl2 destParent, String destName) {
         boolean result = builder.moveTo(destParent.builder, destName);
         if (result) {
-            KernelTree2 oldParent = parent;
+            TreeImpl2 oldParent = parent;
             String oldName = name;
 
             name = destName;
@@ -365,7 +370,7 @@ public class KernelTree2 implements Tree
      * @return  {@code true} if successful, {@code false otherwise}. I.e.
      * when {@code destName} already exists at {@code destParent}
      */
-    public boolean copy(KernelTree2 destParent, String destName) {
+    public boolean copy(TreeImpl2 destParent, String destName) {
         boolean result = builder.copyTo(destParent.builder, destName);
         if (result) {
             if (listener != null) {

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=1330745&r1=1330744&r2=1330745&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 Thu Apr 26 10:12:24 2012
@@ -24,6 +24,7 @@ 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.util.CoreValueUtil;
 
 import java.util.ArrayList;
@@ -96,10 +97,10 @@ class KernelNodeState extends AbstractNo
                     }
                     childNodes.put(name, new KernelNodeState(kernel, valueFactory, childPath, revision));
                 } else if (reader.matches('[')) {
-                    properties.put(name, new KernelPropertyState(name, CoreValueUtil.listFromJsopReader(reader, valueFactory)));
+                    properties.put(name, new PropertyStateImpl(name, CoreValueUtil.listFromJsopReader(reader, valueFactory)));
                 } else {
                     CoreValue cv = CoreValueUtil.fromJsopReader(reader, valueFactory);
-                    properties.put(name, new KernelPropertyState(name, cv));
+                    properties.put(name, new PropertyStateImpl(name, cv));
                 }
             } while (reader.matches(','));
             reader.read('}');

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java?rev=1330745&r1=1330744&r2=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java Thu Apr 26 10:12:24 2012
@@ -22,7 +22,7 @@ import java.util.Properties;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.core.KernelContentRepository;
+import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -39,7 +39,7 @@ public class Activator implements Bundle
     private final Map<ServiceReference, ServiceRegistration> services =
             new HashMap<ServiceReference, ServiceRegistration>();
 
-    //-----------------------------------------------------< BundleActivator >--
+    //----------------------------------------------------< BundleActivator >---
 
     @Override
     public void start(BundleContext bundleContext) throws Exception {
@@ -54,7 +54,7 @@ public class Activator implements Bundle
         tracker.open();
     }
 
-    //--------------------------------------------< ServiceTrackerCustomizer >--
+    //-------------------------------------------< ServiceTrackerCustomizer >---
 
     @Override
     public Object addingService(ServiceReference reference) {
@@ -63,7 +63,7 @@ public class Activator implements Bundle
             MicroKernel kernel = (MicroKernel) service;
             services.put(reference, context.registerService(
                     ContentRepository.class.getName(),
-                    new KernelContentRepository(kernel),
+                    new ContentRepositoryImpl(kernel),
                     new Properties()));
             return service;
         } else {

Copied: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/AbstractOakTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java?p2=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/AbstractOakTest.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/AbstractOakTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractOakTest.java Thu Apr 26 10:12:24 2012
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+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.core.CoreValueFactoryImpl;
+import org.apache.jackrabbit.oak.kernel.NodeState;
 import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@ public abstract class AbstractOakTest {
     protected MicroKernel microKernel;
     protected CoreValueFactory valueFactory;
 
-    protected KernelNodeState state;
+    protected NodeState state;
 
     @Before
     public void setUp() {
@@ -48,5 +48,5 @@ public abstract class AbstractOakTest {
         state = createInitialState();
     }
 
-    abstract KernelNodeState createInitialState();
+    protected abstract NodeState createInitialState();
 }
\ No newline at end of file

Copied: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootFuzzIT.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?p2=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootFuzzIT.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootFuzzIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java Thu Apr 26 10:12:24 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
@@ -25,7 +25,7 @@ import org.apache.jackrabbit.oak.api.Cor
 import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-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;
@@ -34,38 +34,38 @@ import org.slf4j.LoggerFactory;
 import java.util.Iterator;
 import java.util.Random;
 
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.AddNode;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.CopyNode;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.MoveNode;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.RemoveNode;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.RemoveProperty;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.Save;
-import static org.apache.jackrabbit.oak.kernel.KernelRootFuzzIT.Operation.SetProperty;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.AddNode;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.CopyNode;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.MoveNode;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.RemoveNode;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.RemoveProperty;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.Save;
+import static org.apache.jackrabbit.oak.core.RootImplFuzzIT.Operation.SetProperty;
 import static org.junit.Assert.assertEquals;
 
 /**
  * Fuzz test running random sequences of operations on {@link Tree}.
  * Run with -DKernelRootFuzzIT-seed=42 to set a specific seed (i.e. 42);
  */
-public class KernelRootFuzzIT {
-    static final Logger log = LoggerFactory.getLogger(KernelRootFuzzIT.class);
+public class RootImplFuzzIT {
+    static final Logger log = LoggerFactory.getLogger(RootImplFuzzIT.class);
 
     private static final int OP_COUNT = 5000;
 
     private final Random random;
 
     private KernelNodeStore store1;
-    private KernelRoot root1;
+    private RootImpl root1;
 
     private KernelNodeStore store2;
-    private KernelRoot root2;
+    private RootImpl root2;
 
     private int counter;
 
     private CoreValueFactory vf;
 
-    public KernelRootFuzzIT() {
-        int seed = Integer.getInteger(KernelRootFuzzIT.class.getSimpleName() + "-seed",
+    public RootImplFuzzIT() {
+        int seed = Integer.getInteger(RootImplFuzzIT.class.getSimpleName() + "-seed",
                 new Random().nextInt());
         log.info("Seed = {}", seed);
         random = new Random(seed);
@@ -79,12 +79,12 @@ public class KernelRootFuzzIT {
         vf = new CoreValueFactoryImpl(mk1);
         store1 = new KernelNodeStore(mk1, vf);
         mk1.commit("", "+\"/test\":{} +\"/test/root\":{}", mk1.getHeadRevision(), "");
-        root1 = new KernelRoot(store1, "test");
+        root1 = new RootImpl(store1, "test");
 
         MicroKernel mk2 = new MicroKernelImpl("./target/mk2");
         store2 = new KernelNodeStore(mk2, vf);
         mk2.commit("", "+\"/test\":{} +\"/test/root\":{}", mk2.getHeadRevision(), "");
-        root2 = new KernelRoot(store2, "test");
+        root2 = new RootImpl(store2, "test");
     }
 
     @Test
@@ -130,7 +130,7 @@ public class KernelRootFuzzIT {
     }
 
     abstract static class Operation {
-        abstract void apply(KernelRoot root);
+        abstract void apply(RootImpl root);
 
         static class AddNode extends Operation {
             private final String parentPath;
@@ -142,7 +142,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 root.getTree(parentPath).addChild(name);
             }
 
@@ -160,7 +160,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 String parentPath = PathUtils.getParentPath(path);
                 String name = PathUtils.getName(path);
                 root.getTree(parentPath).removeChild(name);
@@ -182,7 +182,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 root.move(source.substring(1), destination.substring(1));
             }
 
@@ -202,7 +202,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 root.copy(source.substring(1), destination.substring(1));
             }
 
@@ -224,7 +224,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 root.getTree(parentPath).setProperty(propertyName, propertyValue);
             }
 
@@ -245,7 +245,7 @@ public class KernelRootFuzzIT {
             }
 
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 root.getTree(parentPath).removeProperty(name);
             }
 
@@ -257,7 +257,7 @@ public class KernelRootFuzzIT {
 
         static class Save extends Operation {
             @Override
-            void apply(KernelRoot root) {
+            void apply(RootImpl root) {
                 // empty
             }
 

Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java (from r1330668, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java?p2=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootTest.java&r1=1330668&r2=1330745&rev=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelRootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java Thu Apr 26 10:12:24 2012
@@ -16,12 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.kernel;
+package org.apache.jackrabbit.oak.core;
 
 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.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.kernel.NodeState;
+import org.apache.jackrabbit.oak.kernel.NodeStore;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -39,29 +42,29 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-public class KernelRootTest extends AbstractOakTest {
+public class RootImplTest extends AbstractOakTest {
 
-    private KernelNodeStore store;
+    private NodeStore store;
 
     @Override
     @Before
     public void setUp() {
         super.setUp();
-        store = new KernelNodeStore(microKernel, valueFactory);
     }
 
     @Override
-    KernelNodeState createInitialState() {
+    protected NodeState createInitialState() {
         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);
+        store = new KernelNodeStore(microKernel, valueFactory);
+        return store.getRoot().getChildNode("test");
     }
 
     @Test
     public void getChild() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Tree child = tree.getChild("any");
@@ -73,7 +76,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void getProperty() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         PropertyState propertyState = tree.getProperty("any");
@@ -88,7 +91,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void getChildren() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Iterable<Tree> children = tree.getChildren();
@@ -106,7 +109,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void getProperties() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Map<String, CoreValue> expectedProperties = new HashMap<String, CoreValue>();
@@ -114,7 +117,7 @@ public class KernelRootTest extends Abst
         expectedProperties.put("b", valueFactory.createValue(2));
         expectedProperties.put("c", valueFactory.createValue(3));
 
-        Iterable<PropertyState> properties = tree.getProperties();
+        Iterable<? extends PropertyState> properties = tree.getProperties();
         for (PropertyState property : properties) {
             CoreValue value = expectedProperties.remove(property.getName());
             assertNotNull(value);
@@ -129,7 +132,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void addChild() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertFalse(tree.hasChild("new"));
@@ -146,7 +149,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void addExistingChild() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertFalse(tree.hasChild("new"));
@@ -163,7 +166,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void removeChild() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertTrue(tree.hasChild("x"));
@@ -178,7 +181,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void setProperty() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertFalse(tree.hasProperty("new"));
@@ -200,7 +203,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void removeProperty() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertTrue(tree.hasProperty("a"));
@@ -215,7 +218,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void move() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Tree y = tree.getChild("y");
@@ -235,7 +238,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void rename() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertTrue(tree.hasChild("x"));
@@ -252,7 +255,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void copy() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Tree y = tree.getChild("y");
@@ -272,7 +275,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void deepCopy() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Tree y = tree.getChild("y");
@@ -297,7 +300,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void getChildrenCount() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertEquals(3, tree.getChildrenCount());
@@ -314,7 +317,7 @@ public class KernelRootTest extends Abst
 
     @Test
     public void getPropertyCount() {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         assertEquals(3, tree.getPropertyCount());
@@ -336,7 +339,7 @@ public class KernelRootTest extends Abst
     @Test
     @Ignore("WIP") // FIXME: causes OOME since the branch/merge feature from OAK-45 is used
     public void largeChildList() throws CommitFailedException {
-        KernelRoot root = new KernelRoot(store, "test");
+        RootImpl root = new RootImpl(store, "test");
         Tree tree = root.getTree("/");
 
         Set<String> added = new HashSet<String>();

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=1330745&r1=1330744&r2=1330745&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 Thu Apr 26 10:12:24 2012
@@ -19,6 +19,7 @@
 package org.apache.jackrabbit.oak.kernel;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.core.AbstractOakTest;
 import org.junit.Test;
 
 import java.util.ArrayList;
@@ -34,7 +35,7 @@ import static junit.framework.Assert.ass
 public class KernelNodeStateTest extends AbstractOakTest {
 
     @Override
-    KernelNodeState createInitialState() {
+    protected NodeState createInitialState() {
         String jsop =
                 "+\"test\":{\"a\":1,\"b\":2,\"c\":3,"
                 + "\"x\":{},\"y\":{},\"z\":{}}";

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=1330745&r1=1330744&r2=1330745&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 Thu Apr 26 10:12:24 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import org.apache.jackrabbit.oak.core.AbstractOakTest;
 import org.junit.Test;
 
 import static junit.framework.Assert.assertEquals;
@@ -30,7 +31,7 @@ public class LargeKernelNodeStateTest ex
     private final int N = KernelNodeState.MAX_CHILD_NODE_NAMES;
 
     @Override
-    KernelNodeState createInitialState() {
+    protected NodeState createInitialState() {
         StringBuilder jsop = new StringBuilder("+\"test\":{\"a\":1");
         for (int i = 0; i <= N; i++) {
             jsop.append(",\"x" + i + "\":{}");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappingsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappingsTest.java?rev=1330745&r1=1330744&r2=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappingsTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappingsTest.java Thu Apr 26 10:12:24 2012
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.plugin
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.core.KernelContentRepository;
+import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -28,8 +28,7 @@ public class NamespaceMappingsTest {
 
     @Test
     public void testMappings() throws Exception {
-        ContentRepository repository =
-                new KernelContentRepository(new MicroKernelImpl());
+        ContentRepository repository = new ContentRepositoryImpl(new MicroKernelImpl());
         ContentSession session = repository.login(null, "default");
         NamespaceMappings r = new NamespaceMappings(session);
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1330745&r1=1330744&r2=1330745&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java Thu Apr 26 10:12:24 2012
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.jcr;
 import org.apache.jackrabbit.commons.SimpleValueFactory;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.core.KernelContentRepository;
+import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +52,7 @@ public class RepositoryImpl implements R
      * mostly in test cases.
      */
     public RepositoryImpl() throws RepositoryException {
-        this(new KernelContentRepository());
+        this(new ContentRepositoryImpl());
     }
 
     //---------------------------------------------------------< Repository >---



Mime
View raw message