jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1330354 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: KernelNodeStore.java KernelRoot.java KernelTree.java NodeStateBuilder.java NodeStore.java
Date Wed, 25 Apr 2012 15:38:07 GMT
Author: mduerig
Date: Wed Apr 25 15:38:07 2012
New Revision: 1330354

URL: http://svn.apache.org/viewvc?rev=1330354&view=rev
Log:
OAK-9: Internal tree builder
- update javadoc

Modified:
    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/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/NodeStateBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStore.java

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=1330354&r1=1330353&r2=1330354&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
Wed Apr 25 15:38:07 2012
@@ -44,12 +44,12 @@ public class KernelNodeStore implements 
     }
 
     @Override
-    public NodeStateBuilder getBuilder(NodeState nodeState) {
-        if (!(nodeState instanceof KernelNodeState)) {
+    public NodeStateBuilder getBuilder(NodeState base) {
+        if (!(base instanceof KernelNodeState)) {
             throw new IllegalArgumentException("Alien node state");
         }
 
-        KernelNodeState kernelNodeState = (KernelNodeState) nodeState;
+        KernelNodeState kernelNodeState = (KernelNodeState) base;
         String branchRevision = kernel.branch(kernelNodeState.getRevision());
         String path = kernelNodeState.getPath();
         return KernelNodeStateBuilder.create(kernel, valueFactory, path, branchRevision);

Modified: 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/kernel/KernelRoot.java?rev=1330354&r1=1330353&r2=1330354&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/kernel/KernelRoot.java
Wed Apr 25 15:38:07 2012
@@ -33,17 +33,11 @@ import static org.apache.jackrabbit.mk.u
 import static org.apache.jackrabbit.mk.util.PathUtils.getParentPath;
 
 /**
- * FIXME: update javadoc
- * This {@code Root} implementation accumulates all changes into a json diff
- * and applies them to the microkernel on {@link #commit()}
+ * This {@code Root} implementation listens on the root of the underlying
+ * {@link Tree} using a {@link Listener}. All changes are directly applied
+ * to the {@link NodeStateBuilder} for the relevant sub-tree.
  *
- * TODO: review/rewrite when OAK-45 is resolved
- * When the MicroKernel has support for branching and merging private working copies,
- * this implementation could:
- * - directly write every operation through to the private working copy
- * - batch write operations through to the private working copy when the
- *   transient space gets too big.
- * - spool write operations through to the private working copy on a background thread
+ * TODO: Refactor tree to be based on the individual NodeStateBuilders instead of NodeStates
  */
 public class KernelRoot implements Root {
 

Modified: 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/kernel/KernelTree.java?rev=1330354&r1=1330353&r2=1330354&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/kernel/KernelTree.java
Wed Apr 25 15:38:07 2012
@@ -40,6 +40,9 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.util.Iterators.flatten;
 import static org.apache.jackrabbit.oak.util.Iterators.map;
 
+/**
+ * TODO: Refactor to be based on the individual NodeStateBuilders instead of NodeStates
+ */
 public class KernelTree implements Tree {
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStateBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStateBuilder.java?rev=1330354&r1=1330353&r2=1330354&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStateBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStateBuilder.java
Wed Apr 25 15:38:07 2012
@@ -19,16 +19,75 @@ package org.apache.jackrabbit.oak.kernel
 import org.apache.jackrabbit.oak.api.PropertyState;
 
 /**
- * FIXME document
+ * Builder interface for constructing new {@link NodeState node states}.
  */
 public interface NodeStateBuilder {
+
+    /**
+     * Returns an immutable node state that matches the current state of
+     * the builder.
+     *
+     * @return immutable node state
+     */
     NodeState getNodeState();
+
+    /**
+     * Get a builder for a child node
+     *
+     * @param name  name of the child node
+     * @return  builder for the {@code name}d child node
+     */
     NodeStateBuilder getChildBuilder(String name);
+
+    /**
+     * Add a sub-tree
+     *
+     * @param name  name child node containing the sub-tree
+     * @param nodeState  sub-tree
+     * @return  builder for the added sub-tree
+     */
     NodeStateBuilder addNode(String name, NodeState nodeState);
+
+    /**
+     * Set or removes the named child node.
+     *
+     * @param name  name of the child node
+     */
     NodeStateBuilder addNode(String name);
+
+    /**
+     * Remove a child node
+     * @param name  name of the child node
+     * @return  {@code true} iff the child node existed
+     */
     boolean removeNode(String name);
+
+    /**
+     * Set a property.
+     *
+     * @param property  property to set
+     */
     void setProperty(PropertyState property);
+
+    /**
+     * Remove the named property
+     * @param name  name of the property
+     */
     void removeProperty(String name);
+
+    /**
+     * Move this node
+     * @param destParent  builder for the parent node of the destination
+     * @param destName  name of the moved node
+     * @return  {@code true} iff the move succeeded
+     */
     boolean moveTo(NodeStateBuilder destParent, String destName);
+
+    /**
+     * Copy this node
+     * @param destParent  builder for the parent node of the destination
+     * @param destName  name of the copied node
+     * @return  {@code true} iff the copy succeeded
+     */
     boolean copyTo(NodeStateBuilder destParent, String destName);
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStore.java?rev=1330354&r1=1330353&r2=1330354&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeStore.java
Wed Apr 25 15:38:07 2012
@@ -19,15 +19,12 @@ package org.apache.jackrabbit.oak.kernel
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 
 /**
- * TODO update javadoc
  * Storage abstraction for content trees. At any given point in time
  * the stored content tree is rooted at a single immutable node state.
  * <p>
  * This is a low-level interface that doesn't cover functionality like
  * merging concurrent changes or rejecting new tree states based on some
  * higher-level consistency constraints.
- *
- * TODO: check if can be replaced by mk.model.NodeStore
  */
 public interface NodeStore {
 
@@ -39,16 +36,18 @@ public interface NodeStore {
     NodeState getRoot();
 
     /**
-     * FIXME document
-     * @param nodeState
-     * @return
+     * Returns a builder for constructing a new or modified node state.
+     * The builder is initialized with all the properties and child nodes
+     * from the given base node state.
+     *
+     * @param base  base node state
+     * @return  builder instance
      */
-    NodeStateBuilder getBuilder(NodeState nodeState);
+    NodeStateBuilder getBuilder(NodeState base);
 
     /**
-     * FIXME document
-     * @param builder
-     * @return
+     * Updates the state of the content tree.
+     * @param builder  builder containing the new node state
      */
     void apply(NodeStateBuilder builder) throws CommitFailedException;
 



Mime
View raw message