You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2012/04/23 00:00:55 UTC
svn commit: r1328984 - in /jackrabbit/oak/trunk:
oak-core/src/main/java/org/apache/jackrabbit/oak/api/
oak-core/src/main/java/org/apache/jackrabbit/oak/core/
oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/
oak-core/src/test/java/org/apache/jac...
Author: mduerig
Date: Sun Apr 22 22:00:54 2012
New Revision: 1328984
URL: http://svn.apache.org/viewvc?rev=1328984&view=rev
Log:
OAK-18: Define Oak API
rename TransientNodeState to ContentTree and rename related identifiers accordingly
update Javadoc
Added:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentTree.java
- copied, changed from r1328944, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelContentTree.java
- copied, changed from r1328944, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
Removed:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
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/kernel/KernelBranch.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchFuzzIT.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchTest.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java Sun Apr 22 22:00:54 2012
@@ -24,39 +24,39 @@ package org.apache.jackrabbit.oak.api;
public interface Branch {
/**
- * Move the node state located at {@code sourcePath} to a node
- * state at {@code destPath}. Do nothing if either the source
+ * Move the child located at {@code sourcePath} to a child
+ * at {@code destPath}. Do nothing if either the source
* does not exist, the parent of the destination does not exist
* or the destination exists already. Both paths must resolve
- * to node states located in this branch.
+ * to a child located in this branch.
*
- * @param sourcePath source path relative to this node state
- * @param destPath destination path relative to this node state
+ * @param sourcePath source path relative to this branch
+ * @param destPath destination path relative to this branch
* @return {@code true} on success, {@code false} otherwise.
*/
boolean move(String sourcePath, String destPath);
/**
- * Copy the node state located at {@code sourcePath} to a node
- * state at {@code destPath}. Do nothing if either the source
+ * Copy the child located at {@code sourcePath} to a child
+ * at {@code destPath}. Do nothing if either the source
* does not exist, the parent of the destination does not exist
* or the destination exists already. Both paths must resolve
- * to node states located in this branch.
+ * to a child located in this branch.
*
- * @param sourcePath source path relative to this node state
- * @param destPath destination path relative to this node state
+ * @param sourcePath source path relative to this branch
+ * @param destPath destination path relative to this branch
* @return {@code true} on success, {@code false} otherwise.
*/
boolean copy(String sourcePath, String destPath);
/**
- * Retrieve the child node state at the given {@code path}.
- * The path must resolve to a node state located in this branch.
+ * Retrieve the {@code ContentTree} at the given {@code path}.
+ * The path must resolve to a content tree in this branch.
*
- * @param path path of the child node state to getNode.
- * @return transient node state at the given path or {@code null} if no
- * such node state exists.
+ * @param path path to the content tree
+ * @return content tree at the given path or {@code null} if no
+ * such tree exists
*/
- TransientNodeState getNode(String path);
+ ContentTree getContentTree(String path);
}
Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentTree.java (from r1328944, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentTree.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentTree.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java&r1=1328944&r2=1328984&rev=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/ContentTree.java Sun Apr 22 22:00:54 2012
@@ -21,31 +21,41 @@ package org.apache.jackrabbit.oak.api;
import java.util.List;
/**
- * A transient node state represents a mutable node.
+ * A content tree represents a snapshot of the content in a
+ * {@code ContentRepository} at the time the instance was acquired.
+ * {@code ContentTree} instances may become invalid over time due to
+ * garbage collection of old content, at which point an outdated
+ * snapshot will start throwing {@code IllegalStateException}s to
+ * indicate that the snapshot is no longer available.
* <p>
- * A transient node state contains the current state of a node and is
- * in contrast to {@link org.apache.jackrabbit.mk.model.NodeState} instances
- * mutable and not thread safe.
+ * {@code ContentTree} instance belongs to the client and its state
+ * is only modified in response to method calls made by the client.
+ * The various accessors on this class mirror these of {@code NodeState}.
+ * However, since instances of this class are mutable return values may
+ * change between invocations.
* <p>
- * The various accessors on this class mirror these of {@code NodeState}. However,
- * since instances of this class are mutable return values may change between
- * invocations.
+ * {@code ContentTree} instances are not thread-safe for write access, so
+ * writing clients need to ensure that they are not accessed concurrently
+ * from multiple threads. {@code ContentTree} instances are however
+ * thread-safe for read access, so implementations need to ensure that all
+ * reading clients see a coherent state.
+ *
*/
-public interface TransientNodeState {
+public interface ContentTree {
/**
- * @return the name of this transient node state
+ * @return the name of this {@code ContentTree} instance.
*/
String getName();
/**
- * @return relative path of this transient node state
+ * @return path of this {@code ContentTree} instance.
*/
String getPath();
/**
- * @return the parent of this transient node state
+ * @return the parent of this {@code ContentTree} instance.
*/
- TransientNodeState getParent();
+ ContentTree getParent();
/**
* Get a property state
@@ -71,7 +81,7 @@ public interface TransientNodeState {
/**
* All property states. The returned {@code Iterable} has snapshot semantics. That
- * is, it reflect the state of this transient node state instance at the time of the
+ * is, it reflect the state of this {@code ContentTree} instance at the time of the
* call. Later changes to this instance are no visible to iterators obtained from
* the returned iterable.
* @return An {@code Iterable} for all property states
@@ -79,55 +89,54 @@ public interface TransientNodeState {
Iterable<PropertyState> getProperties();
/**
- * Get a child node state
- * @param name name of the child node state
- * @return the child node state with the given {@code name} or {@code null}
- * if no such child node state exists.
+ * Get a child of this {@code ContentTree} instance
+ * @param name name of the child
+ * @return the child with the given {@code name} or {@code null} if no such child
+ * exists.
*/
- TransientNodeState getChildNode(String name);
+ ContentTree getChild(String name);
/**
- * Determine if a child node state exists
- * @param name name of the child node state
- * @return {@code true} if and only if a child node with the given {@code name}
+ * Determine if a child of this {@code ContentTree} instance exists.
+ * @param name name of the child
+ * @return {@code true} if and only if a child with the given {@code name}
* exists.
*/
- boolean hasNode(String name);
+ boolean hasChild(String name);
/**
- * Determine the number of child nodes.
- * @return number of child nodes.
+ * Determine the number of children of this {@code ContentTree} instance.
+ * @return number of children
*/
- long getChildNodeCount();
+ long getChildrenCount();
/**
- * All child node states. The returned {@code Iterable} has snapshot semantics. That
- * is, it reflect the state of this transient node state instance at the time of the
- * call. Later changes to this instance are no visible to iterators obtained from
- * the returned iterable.
- * @return An {@code Iterable} for all child node states
+ * All children of this {@code ContentTree} instance. The returned {@code Iterable}
+ * has snapshot semantics. That is, it reflect the state of this {@code ContentTree}
+ * instance. instance at the time of the call. Later changes to this instance are no
+ * visible to iterators obtained from the returned iterable.
+ * @return An {@code Iterable} for all children
*/
- Iterable<TransientNodeState> getChildNodes();
+ Iterable<ContentTree> getChildren();
/**
- * Add the child node state with the given {@code name}. Does nothing
- * if such a child node already exists.
+ * Add a child with the given {@code name}. Does nothing if such a child
+ * already exists.
*
- * @param name name of the new node state
- * @return the transient state of the child node with that name.
+ * @param name name of the child
+ * @return the {@code ContentTree} instance of the child with the given {@code name}.
*/
- TransientNodeState addNode(String name);
+ ContentTree addChild(String name);
/**
- * Remove the child node state with the given {@code name}. Does nothing
- * if no such child node exists.
- * @param name name of the node state to remove
- * @return {@code false} iff no such child node exists.
+ * Remove a child with the given {@code name}. Does nothing if no such child exists.
+ * @param name name of the child to remove
+ * @return {@code false} iff no such child exists.
*/
- boolean removeNode(String name);
+ boolean removeChild(String name);
/**
- * Set a single valued property state on this node state.
+ * Set a single valued property state
*
* @param name The name of this property
* @param value The value of this property
@@ -135,7 +144,7 @@ public interface TransientNodeState {
void setProperty(String name, Scalar value);
/**
- * Set a multivalued valued property state on this node state.
+ * Set a multivalued valued property state
*
* @param name The name of this property
* @param values The value of this property
@@ -143,7 +152,7 @@ public interface TransientNodeState {
void setProperty(String name, List<Scalar> values);
/**
- * Remove a property from this node state
+ * Remove a property
* @param name name of the property
*/
void removeProperty(String name);
Modified: 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/KernelContentRepository.java?rev=1328984&r1=1328983&r2=1328984&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/KernelContentRepository.java Sun Apr 22 22:00:54 2012
@@ -57,7 +57,7 @@ public class KernelContentRepository imp
NodeState wspNode = root.getChildNode(DEFAULT_WORKSPACE_NAME);
if (wspNode == null) {
Branch branch = nodeStore.branch(root);
- branch.getNode("/").addNode(DEFAULT_WORKSPACE_NAME);
+ branch.getContentTree("/").addChild(DEFAULT_WORKSPACE_NAME);
nodeStore.merge(branch);
}
}
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java Sun Apr 22 22:00:54 2012
@@ -21,9 +21,9 @@ package org.apache.jackrabbit.oak.kernel
import org.apache.jackrabbit.mk.api.MicroKernel;
import org.apache.jackrabbit.mk.json.JsonBuilder;
import org.apache.jackrabbit.oak.api.Branch;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.Scalar;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
-import org.apache.jackrabbit.oak.kernel.TransientKernelNodeState.Listener;
+import org.apache.jackrabbit.oak.kernel.KernelContentTree.Listener;
import java.util.List;
@@ -53,7 +53,7 @@ public class KernelBranch implements Bra
private final NodeState base;
/** Root state of this branch */
- private final TransientKernelNodeState root;
+ private final KernelContentTree root;
/**
* Create a new branch for the given base node state
@@ -61,36 +61,36 @@ public class KernelBranch implements Bra
*/
KernelBranch(NodeState base) {
this.base = base;
- root = new TransientKernelNodeState(base, changeLog);
+ root = new KernelContentTree(base, changeLog);
}
@Override
public boolean move(String sourcePath, String destPath) {
- TransientKernelNodeState sourceNode = getTransientState(sourcePath);
- if (sourceNode == null) {
+ KernelContentTree source = getTransientState(sourcePath);
+ if (source == null) {
return false;
}
- TransientKernelNodeState destParent = getTransientState(getParentPath(destPath));
+ KernelContentTree destParent = getTransientState(getParentPath(destPath));
String destName = getName(destPath);
- if (destParent == null || destParent.hasNode(destName)) {
+ if (destParent == null || destParent.hasChild(destName)) {
return false;
}
- sourceNode.move(destParent, destName);
+ source.move(destParent, destName);
return true;
}
@Override
public boolean copy(String sourcePath, String destPath) {
- TransientKernelNodeState sourceNode = getTransientState(sourcePath);
+ KernelContentTree sourceNode = getTransientState(sourcePath);
if (sourceNode == null) {
return false;
}
- TransientKernelNodeState destParent = getTransientState(getParentPath(destPath));
+ KernelContentTree destParent = getTransientState(getParentPath(destPath));
String destName = getName(destPath);
- if (destParent == null || destParent.hasNode(destName)) {
+ if (destParent == null || destParent.hasChild(destName)) {
return false;
}
@@ -99,7 +99,7 @@ public class KernelBranch implements Bra
}
@Override
- public TransientNodeState getNode(String path) {
+ public ContentTree getContentTree(String path) {
return getTransientState(path);
}
@@ -132,13 +132,13 @@ public class KernelBranch implements Bra
* Get a transient node state for the node identified by
* {@code path}
* @param path the path to the node state
- * @return a {@link TransientKernelNodeState} instance for the item
+ * @return a {@link KernelContentTree} instance for the item
* at {@code path} or {@code null} if no such item exits.
*/
- private TransientKernelNodeState getTransientState(String path) {
- TransientKernelNodeState state = root;
+ private KernelContentTree getTransientState(String path) {
+ KernelContentTree state = root;
for (String name : elements(path)) {
- state = state.getChildNode(name);
+ state = state.getChild(name);
if (state == null) {
return null;
}
@@ -153,7 +153,7 @@ public class KernelBranch implements Bra
* @param name The item name.
* @return relative path of the item {@code name}
*/
- private static String path(TransientNodeState state, String name) {
+ private static String path(ContentTree state, String name) {
String path = state.getPath();
return path.isEmpty() ? name : path + '/' + name;
}
@@ -192,38 +192,38 @@ public class KernelBranch implements Bra
private final StringBuilder jsop = new StringBuilder();
@Override
- public void addNode(TransientKernelNodeState state, String name) {
- jsop.append("+\"").append(path(state, name)).append("\":{}");
+ public void addChild(KernelContentTree tree, String name) {
+ jsop.append("+\"").append(path(tree, name)).append("\":{}");
}
@Override
- public void removeNode(TransientKernelNodeState state, String name) {
- jsop.append("-\"").append(path(state, name)).append('"');
+ public void removeChild(KernelContentTree tree, String name) {
+ jsop.append("-\"").append(path(tree, name)).append('"');
}
@Override
- public void setProperty(TransientKernelNodeState state, String name, Scalar value) {
- jsop.append("^\"").append(path(state, name)).append("\":").append(encode(value));
+ public void setProperty(KernelContentTree tree, String name, Scalar value) {
+ jsop.append("^\"").append(path(tree, name)).append("\":").append(encode(value));
}
@Override
- public void setProperty(TransientKernelNodeState state, String name, List<Scalar> values) {
- jsop.append("^\"").append(path(state, name)).append("\":").append(encode(values));
+ public void setProperty(KernelContentTree tree, String name, List<Scalar> values) {
+ jsop.append("^\"").append(path(tree, name)).append("\":").append(encode(values));
}
@Override
- public void removeProperty(TransientKernelNodeState state, String name) {
- jsop.append("^\"").append(path(state, name)).append("\":null");
+ public void removeProperty(KernelContentTree tree, String name) {
+ jsop.append("^\"").append(path(tree, name)).append("\":null");
}
@Override
- public void move(TransientKernelNodeState state, String name, TransientKernelNodeState moved) {
- jsop.append(">\"").append(path(state, name)).append("\":\"")
+ public void move(KernelContentTree tree, String name, KernelContentTree moved) {
+ jsop.append(">\"").append(path(tree, name)).append("\":\"")
.append(moved.getPath()).append('"');
}
@Override
- public void copy(TransientKernelNodeState state, String name, TransientKernelNodeState copied) {
+ public void copy(KernelContentTree state, String name, KernelContentTree copied) {
jsop.append("*\"").append(path(state, name)).append("\":\"")
.append(copied.getPath()).append('"');
}
Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelContentTree.java (from r1328944, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelContentTree.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelContentTree.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java&r1=1328944&r2=1328984&rev=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelContentTree.java Sun Apr 22 22:00:54 2012
@@ -18,9 +18,9 @@
*/
package org.apache.jackrabbit.oak.kernel;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Scalar;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
import org.apache.jackrabbit.oak.util.Function1;
import org.apache.jackrabbit.oak.util.Iterators;
import org.apache.jackrabbit.oak.util.PagedIterator;
@@ -40,33 +40,33 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.util.Iterators.flatten;
import static org.apache.jackrabbit.oak.util.Iterators.map;
-public class TransientKernelNodeState implements TransientNodeState {
+public class KernelContentTree implements ContentTree {
/**
* Underlying persistent state or {@code null} if this instance represents an
- * added node state
+ * added content tree
*/
private final NodeState persistentState;
- /** Parent of this state */
- private TransientKernelNodeState parent;
+ /** Parent of this content tree */
+ private KernelContentTree parent;
- /** Name of this state */
+ /** Name of this content tree */
private String name;
- /** Listener for changes on this node state */
+ /** Listener for changes on this content tree */
private final Listener listener;
- /** Resolved persistent child states */
- private final Map<String, TransientKernelNodeState> existingChildNodes =
- new HashMap<String, TransientKernelNodeState>();
-
- /** Transiently added node states */
- private final Map<String, TransientKernelNodeState> addedNodes =
- new HashMap<String, TransientKernelNodeState>();
+ /** Children with underlying persistent child states */
+ private final Map<String, KernelContentTree> existingChildren =
+ new HashMap<String, KernelContentTree>();
+
+ /** Transiently added children */
+ private final Map<String, KernelContentTree> addedTrees =
+ new HashMap<String, KernelContentTree>();
- /** Transiently removed node stated */
- private final Set<String> removedNodes = new HashSet<String>();
+ /** Transiently removed children */
+ private final Set<String> removedTrees = new HashSet<String>();
/** Transiently added property states */
private final Map<String, PropertyState> addedProperties =
@@ -76,62 +76,62 @@ public class TransientKernelNodeState im
private final Set<String> removedProperties = new HashSet<String>();
/**
- * Listener for changes on {@code TransientKernelNodeState}s
+ * Listener for changes on {@code ContentTree}s
*/
interface Listener {
/**
- * The node of the given {@code name} has been added to {@code state}.
- * @param state parent state to which a node was added
- * @param name name of the added node
+ * The child of the given {@code name} has been added to {@code tree}.
+ * @param tree parent to which a child was added
+ * @param name name of the added child
*/
- void addNode(TransientKernelNodeState state, String name);
+ void addChild(KernelContentTree tree, String name);
/**
- * The node of the given {@code name} has been removed from {@code state}
- * @param state parent state from which a node was removed
- * @param name name of the removed node
+ * 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 removeNode(TransientKernelNodeState state, String name);
+ void removeChild(KernelContentTree tree, String name);
/**
* The property of the given {@code name} and {@code value} has been set.
- * @param state state on which the property was set.
+ * @param tree parent on which the property was set.
* @param name name of the property
* @param value value of the property
*/
- void setProperty(TransientKernelNodeState state, String name, Scalar value);
+ void setProperty(KernelContentTree tree, String name, Scalar value);
/**
* The property of the given {@code name} and {@code values} has been set.
- * @param state state on which the property was set.
+ * @param tree parent on which the property was set.
* @param name name of the property
* @param values values of the property
*/
- void setProperty(TransientKernelNodeState state, String name, List<Scalar> values);
+ void setProperty(KernelContentTree tree, String name, List<Scalar> values);
/**
* The property of the given {@code name} has been removed.
- * @param state state on which the property was removed.
+ * @param tree parent on which the property was removed.
* @param name name of the property
*/
- void removeProperty(TransientKernelNodeState state, String name);
+ void removeProperty(KernelContentTree tree, String name);
/**
- * The node of the given {@code name} has been moved.
- * @param state parent state from which the property was moved
- * @param name name of the moved property
- * @param moved moved property
+ * The child with the given {@code name} has been moved.
+ * @param tree parent from which the child was moved
+ * @param name name of the moved child
+ * @param moved moved child
*/
- void move(TransientKernelNodeState state, String name, TransientKernelNodeState moved);
+ void move(KernelContentTree tree, String name, KernelContentTree moved);
/**
- * The node of the given {@code name} been copies.
- * @param state parent state from which the property way copies
- * @param name name of the copied property
- * @param copied copied property
+ * The child with the given {@code name} been copied.
+ * @param state parent from which the child way copied
+ * @param name name of the copied child
+ * @param copied copied child
*/
- void copy(TransientKernelNodeState state, String name, TransientKernelNodeState copied);
+ void copy(KernelContentTree state, String name, KernelContentTree copied);
}
/**
@@ -139,28 +139,28 @@ public class TransientKernelNodeState im
* @param persistentState underlying persistent state
* @param listener change listener
*/
- TransientKernelNodeState(NodeState persistentState, Listener listener) {
+ KernelContentTree(NodeState persistentState, Listener listener) {
this(persistentState, null, "", listener);
}
/**
- * Create a new instance representing a added node state
- * @param parent the parent state of the state
- * @param name name of the state
+ * Create a new instance representing an added child
+ * @param parent the parent of the child
+ * @param name name of the child
* @param listener change listener
*/
- private TransientKernelNodeState(TransientKernelNodeState parent, String name, Listener listener) {
+ private KernelContentTree(KernelContentTree parent, String name, Listener listener) {
this(null, parent, name, listener);
}
/**
* Create a new instance with an underlying persistent state
* @param persistedState underlying persistent state
- * @param parent the parent state of the state
- * @param name name of the state
+ * @param parent the parent of this content tree
+ * @param name name of this content tree
* @param listener change listener
*/
- private TransientKernelNodeState(NodeState persistedState, TransientKernelNodeState parent,
+ private KernelContentTree(NodeState persistedState, KernelContentTree parent,
String name, Listener listener) {
this.persistentState = persistedState;
@@ -170,37 +170,37 @@ public class TransientKernelNodeState im
}
/**
- * Copy constructor: create a deep copy of the passed {@code state} with
+ * Copy constructor: create a deep copy of the passed {@code ContentTree} with
* the given {@code name} and {@code parent}.
- * @param state state to copy
- * @param parent parent of the copied state
- * @param name name of the copied state
+ * @param tree content tree to copy
+ * @param parent parent of the copied tree
+ * @param name name of the copied tree
*/
- private TransientKernelNodeState(TransientKernelNodeState state, TransientKernelNodeState parent,
+ private KernelContentTree(KernelContentTree tree, KernelContentTree parent,
String name) {
- listener = state.listener;
- persistentState = state.persistentState;
+ listener = tree.listener;
+ persistentState = tree.persistentState;
this.parent = parent;
this.name = name;
- // recursively copy all existing node states
- for (Entry<String, TransientKernelNodeState> existing : state.existingChildNodes.entrySet()) {
+ // recursively copy all existing children
+ for (Entry<String, KernelContentTree> existing : tree.existingChildren.entrySet()) {
String existingName = existing.getKey();
- this.existingChildNodes.put(existingName,
- new TransientKernelNodeState(existing.getValue(), this, existingName));
+ this.existingChildren.put(existingName,
+ new KernelContentTree(existing.getValue(), this, existingName));
}
- // recursively copy all added node states
- for (Entry<String, TransientKernelNodeState> added : state.addedNodes.entrySet()) {
+ // recursively copy all added children
+ for (Entry<String, KernelContentTree> added : tree.addedTrees.entrySet()) {
String addedName = added.getKey();
- this.addedNodes.put(addedName,
- new TransientKernelNodeState(added.getValue(), this, addedName));
+ this.addedTrees.put(addedName,
+ new KernelContentTree(added.getValue(), this, addedName));
}
- this.removedNodes.addAll(state.removedNodes);
- this.addedProperties.putAll(state.addedProperties);
- this.removedProperties.addAll(state.removedProperties);
+ this.removedTrees.addAll(tree.removedTrees);
+ this.addedProperties.putAll(tree.addedProperties);
+ this.removedProperties.addAll(tree.removedProperties);
}
@Override
@@ -222,7 +222,7 @@ public class TransientKernelNodeState im
}
@Override
- public TransientNodeState getParent() {
+ public ContentTree getParent() {
return parent;
}
@@ -255,31 +255,31 @@ public class TransientKernelNodeState im
}
@Override
- public TransientKernelNodeState getChildNode(String name) {
- TransientKernelNodeState state = addedNodes.get(name);
+ public KernelContentTree getChild(String name) {
+ KernelContentTree state = addedTrees.get(name);
if (state != null) {
- // Added or removed and re-added child node
+ // Added or removed and re-added child
return state;
}
- // Existing child node unless removed
- return removedNodes.contains(name)
+ // Existing child unless removed
+ return removedTrees.contains(name)
? null
- : getExistingChildNode(name);
+ : getExistingChild(name);
}
@Override
- public boolean hasNode(String name) {
- return getChildNode(name) != null;
+ public boolean hasChild(String name) {
+ return getChild(name) != null;
}
@Override
- public long getChildNodeCount() {
+ public long getChildrenCount() {
long persistentCount = persistentState == null
? 0
: persistentState.getChildNodeCount();
- return persistentCount + addedNodes.size() - removedNodes.size();
+ return persistentCount + addedTrees.size() - removedTrees.size();
}
@Override
@@ -324,24 +324,23 @@ public class TransientKernelNodeState im
}
@Override
- public Iterable<TransientNodeState> getChildNodes() {
- // Copy od removed child node states
+ public Iterable<ContentTree> getChildren() {
+ // Copy of removed children
final Set<String> removed = new HashSet<String>();
- removed.addAll(removedNodes);
+ removed.addAll(removedTrees);
- // Copy od added and re-added child node states
- final Set<TransientNodeState> added = new HashSet<TransientNodeState>();
- added.addAll(addedNodes.values());
+ // Copy od added and re-added children
+ final Set<ContentTree> added = new HashSet<ContentTree>();
+ added.addAll(addedTrees.values());
// Filter removed child node entries from persisted child node entries,
- // map remaining child node entries to child node states and add added
- // child node states
- return new Iterable<TransientNodeState>() {
+ // map remaining child node entries to content trees and add added children.
+ return new Iterable<ContentTree>() {
@Override
- public Iterator<TransientNodeState> iterator() {
+ public Iterator<ContentTree> iterator() {
// persisted entries
final Iterator<? extends ChildNodeEntry> persisted =
- getPersistedChildNodeEntries(persistentState);
+ getPersistedChildren(persistentState);
// persisted entries - removed entries
Iterator<ChildNodeEntry> persistedMinusRemovedEntries =
@@ -352,40 +351,40 @@ public class TransientKernelNodeState im
}
});
- // persisted states - removed states
- Iterator<TransientNodeState> persistedMinusRemoved =
+ // persisted trees - removed trees
+ Iterator<ContentTree> persistedMinusRemoved =
map(persistedMinusRemovedEntries,
- new Function1<ChildNodeEntry, TransientNodeState>() {
+ new Function1<ChildNodeEntry, ContentTree>() {
@Override
- public TransientNodeState apply(ChildNodeEntry entry) {
- return getExistingChildNode(entry.getName());
+ public ContentTree apply(ChildNodeEntry entry) {
+ return getExistingChild(entry.getName());
}
});
- // persisted states - removed states + added states
+ // persisted trees - removed trees + added trees
return chain(persistedMinusRemoved, added.iterator());
}
};
}
@Override
- public TransientNodeState addNode(String name) {
- if (!hasNode(name)) {
- addedNodes.put(name, new TransientKernelNodeState(this, name, listener));
+ public ContentTree addChild(String name) {
+ if (!hasChild(name)) {
+ addedTrees.put(name, new KernelContentTree(this, name, listener));
if (listener != null) {
- listener.addNode(this, name);
+ listener.addChild(this, name);
}
}
- return getChildNode(name);
+ return getChild(name);
}
@Override
- public boolean removeNode(String name) {
- if (hasNode(name)) {
- markNodeRemoved(name);
+ public boolean removeChild(String name) {
+ if (hasChild(name)) {
+ markTreeRemoved(name);
if (listener != null) {
- listener.removeNode(this, name);
+ listener.removeChild(this, name);
}
return true;
}
@@ -425,36 +424,35 @@ public class TransientKernelNodeState im
}
/**
- * Move this node state to the parent node state at {@code destParent}
- * with the new name {@code destName}.
+ * Move this tree to the parent at {@code destParent} with the new name
+ * {@code destName}.
*
- * @param destParent new parent for this node state
- * @param destName new name for this node state
+ * @param destParent new parent for this tree
+ * @param destName new name for this tree
*/
- public void move(TransientKernelNodeState destParent, String destName) {
- parent.markNodeRemoved(name);
+ public void move(KernelContentTree destParent, String destName) {
+ parent.markTreeRemoved(name);
- TransientKernelNodeState oldParent = parent;
+ KernelContentTree oldParent = parent;
String oldName = name;
name = destName;
parent = destParent;
- destParent.addedNodes.put(destName, this);
+ destParent.addedTrees.put(destName, this);
if (listener != null) {
listener.move(oldParent, oldName, this);
}
}
/**
- * Copy this node state to the parent node state at {@code destParent}
- * with the name {@code destName}.
+ * Copy this tree to the parent at {@code destParent} with the name {@code destName}.
*
- * @param destParent parent for the copied node state
- * @param destName name for the copied node state
+ * @param destParent parent for the copied tree
+ * @param destName name for the copied tree
*/
- public void copy(TransientKernelNodeState destParent, String destName) {
- TransientKernelNodeState copy = new TransientKernelNodeState(this, destParent, destName);
- destParent.addedNodes.put(destName, copy);
+ public void copy(KernelContentTree destParent, String destName) {
+ KernelContentTree copy = new KernelContentTree(this, destParent, destName);
+ destParent.addedTrees.put(destName, copy);
if (listener != null) {
listener.copy(parent, name, copy);
}
@@ -462,11 +460,11 @@ public class TransientKernelNodeState im
//------------------------------------------------------------< internal >---
- private void markNodeRemoved(String name) {
- addedNodes.remove(name);
- if (hasExistingNode(name)) {
+ private void markTreeRemoved(String name) {
+ addedTrees.remove(name);
+ if (hasExistingChild(name)) {
// Mark as removed if removing existing
- removedNodes.add(name);
+ removedTrees.add(name);
}
}
@@ -478,41 +476,39 @@ public class TransientKernelNodeState im
}
/**
- * Get a transient node state for a child node state which has
- * an existing underlying persistent node date.
+ * Get a content tree for a child which has an existing underlying persistent
+ * node date.
*
- * @param name name of the child node state
- * @return transient node state or {@code null} if this transient
- * node state does not have an underlying persistent state
- * or the underlying persistent state does not have a child
- * node state with the given {@code name}.
+ * @param name name of the child
+ * @return content tree or {@code null} if this instance node state
+ * does not have an underlying persistent state or the underlying
+ * persistent state does not have a child with the given {@code name}.
*/
- private TransientKernelNodeState getExistingChildNode(String name) {
+ private KernelContentTree getExistingChild(String name) {
if (persistentState == null) {
return null;
}
- TransientKernelNodeState transientState = existingChildNodes.get(name);
+ KernelContentTree transientState = existingChildren.get(name);
if (transientState == null) {
NodeState state = persistentState.getChildNode(name);
if (state == null) {
return null;
}
- transientState = new TransientKernelNodeState(state, this, name, listener);
- existingChildNodes.put(name, transientState);
+ transientState = new KernelContentTree(state, this, name, listener);
+ existingChildren.put(name, transientState);
}
return transientState;
}
/**
* Determine whether there is an underling persistent state which has
- * a child node state with the given {@code name}.
- * @param name name of the child node state.
- * @return {@code true} if and only if this transient node state has an
- * underlying persistent state which has a child node state with
- * the given {@code name}.
+ * a child with the given {@code name}.
+ * @param name name of the child.
+ * @return {@code true} if and only if this instance has an underlying persistent
+ * state which has a child with the given {@code name}.
*/
- private boolean hasExistingNode(String name) {
+ private boolean hasExistingChild(String name) {
return persistentState != null && persistentState.getChildNode(name) != null;
}
@@ -520,9 +516,8 @@ public class TransientKernelNodeState im
* Determine whether there is an underling persistent state which has
* a property state with the given {@code name}.
* @param name name of the property state.
- * @return {@code true} if and only if this transient node state has an
- * underlying persistent state which has a property state with
- * the given {@code name}.
+ * @return {@code true} if and only if this instance has an underlying persistent
+ * state which has a property state with the given {@code name}.
*/
private boolean hasExistingProperty(String name) {
return persistentState != null && persistentState.getProperty(name) != null;
@@ -535,7 +530,7 @@ public class TransientKernelNodeState im
* @param persistentState persistent state for retrieving the child node entries from
* @return iterator of child node entries
*/
- private static Iterator<? extends ChildNodeEntry> getPersistedChildNodeEntries(
+ private static Iterator<? extends ChildNodeEntry> getPersistedChildren(
final NodeState persistentState) {
if (persistentState == null) {
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchFuzzIT.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchFuzzIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchFuzzIT.java Sun Apr 22 22:00:54 2012
@@ -21,9 +21,9 @@ package org.apache.jackrabbit.oak.kernel
import org.apache.jackrabbit.mk.api.MicroKernel;
import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Scalar;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -90,7 +90,7 @@ public class KernelBranchFuzzIT {
log.info("{}", op);
op.apply(branch1);
op.apply(branch2);
- checkEqual(branch1.getNode("/"), branch2.getNode("/"));
+ checkEqual(branch1.getContentTree("/"), branch2.getContentTree("/"));
state1 = branch1.mergeInto(mk1, state1);
branch1 = new KernelBranch(state1);
@@ -142,7 +142,7 @@ public class KernelBranchFuzzIT {
@Override
void apply(KernelBranch branch) {
- branch.getNode(parentPath).addNode(name);
+ branch.getContentTree(parentPath).addChild(name);
}
@Override
@@ -162,7 +162,7 @@ public class KernelBranchFuzzIT {
void apply(KernelBranch branch) {
String parentPath = PathUtils.getParentPath(path);
String name = PathUtils.getName(path);
- branch.getNode(parentPath).removeNode(name);
+ branch.getContentTree(parentPath).removeChild(name);
}
@Override
@@ -224,7 +224,7 @@ public class KernelBranchFuzzIT {
@Override
void apply(KernelBranch branch) {
- branch.getNode(parentPath).setProperty(propertyName, propertyValue);
+ branch.getContentTree(parentPath).setProperty(propertyName, propertyValue);
}
@Override
@@ -245,7 +245,7 @@ public class KernelBranchFuzzIT {
@Override
void apply(KernelBranch branch) {
- branch.getNode(parentPath).removeProperty(name);
+ branch.getContentTree(parentPath).removeProperty(name);
}
@Override
@@ -411,17 +411,17 @@ public class KernelBranchFuzzIT {
return ScalarImpl.stringScalar("V" + counter++);
}
- private static void checkEqual(TransientNodeState state1, TransientNodeState state2) {
- assertEquals(state1.getPath(), state2.getPath());
- assertEquals(state1.getChildNodeCount(), state2.getChildNodeCount());
- assertEquals(state1.getPropertyCount(), state2.getPropertyCount());
+ private static void checkEqual(ContentTree child2, ContentTree tree2) {
+ assertEquals(child2.getPath(), tree2.getPath());
+ assertEquals(child2.getChildrenCount(), tree2.getChildrenCount());
+ assertEquals(child2.getPropertyCount(), tree2.getPropertyCount());
- for (PropertyState property1 : state1.getProperties()) {
- assertEquals(property1, state2.getProperty(property1.getName()));
+ for (PropertyState property1 : child2.getProperties()) {
+ assertEquals(property1, tree2.getProperty(property1.getName()));
}
- for (TransientNodeState node1 : state1.getChildNodes()) {
- checkEqual(node1, state2.getChildNode(node1.getName()));
+ for (ContentTree child1 : child2.getChildren()) {
+ checkEqual(child1, tree2.getChild(child1.getName()));
}
}
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchTest.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelBranchTest.java Sun Apr 22 22:00:54 2012
@@ -20,9 +20,9 @@ package org.apache.jackrabbit.oak.kernel
import org.apache.jackrabbit.mk.api.MicroKernel;
import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Scalar;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
import org.junit.Before;
import org.junit.Test;
@@ -55,24 +55,24 @@ public class KernelBranchTest {
}
@Test
- public void getNode() {
+ public void getChild() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- TransientNodeState childState = transientState.getChildNode("any");
- assertNull(childState);
+ ContentTree tree = branch.getContentTree("/");
+ ContentTree child = tree.getChild("any");
+ assertNull(child);
- childState = transientState.getChildNode("x");
- assertNotNull(childState);
+ child = tree.getChild("x");
+ assertNotNull(child);
}
@Test
public void getProperty() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- PropertyState propertyState = transientState.getProperty("any");
+ ContentTree tree = branch.getContentTree("/");
+ PropertyState propertyState = tree.getProperty("any");
assertNull(propertyState);
- propertyState = transientState.getProperty("a");
+ propertyState = tree.getProperty("a");
assertNotNull(propertyState);
assertFalse(propertyState.isArray());
assertEquals(Scalar.Type.LONG, propertyState.getScalar().getType());
@@ -80,33 +80,33 @@ public class KernelBranchTest {
}
@Test
- public void getNodes() {
+ public void getChildren() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- Iterable<TransientNodeState> nodes = transientState.getChildNodes();
+ ContentTree tree = branch.getContentTree("/");
+ Iterable<ContentTree> children = tree.getChildren();
Set<String> expectedPaths = new HashSet<String>();
Collections.addAll(expectedPaths, "x", "y", "z");
- for (TransientNodeState node : nodes) {
- assertTrue(expectedPaths.remove(node.getPath()));
+ for (ContentTree child : children) {
+ assertTrue(expectedPaths.remove(child.getPath()));
}
assertTrue(expectedPaths.isEmpty());
- assertEquals(3, transientState.getChildNodeCount());
+ assertEquals(3, tree.getChildrenCount());
}
@Test
public void getProperties() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
Map<String, Scalar> expectedProperties = new HashMap<String, Scalar>();
expectedProperties.put("a", ScalarImpl.longScalar(1));
expectedProperties.put("b", ScalarImpl.longScalar(2));
expectedProperties.put("c", ScalarImpl.longScalar(3));
- Iterable<PropertyState> properties = transientState.getProperties();
+ Iterable<PropertyState> properties = tree.getProperties();
for (PropertyState property : properties) {
Scalar value = expectedProperties.remove(property.getName());
assertNotNull(value);
@@ -116,49 +116,49 @@ public class KernelBranchTest {
assertTrue(expectedProperties.isEmpty());
- assertEquals(3, transientState.getPropertyCount());
+ assertEquals(3, tree.getPropertyCount());
}
@Test
- public void addNode() {
+ public void addChild() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertFalse(transientState.hasNode("new"));
- TransientNodeState newNode = transientState.addNode("new");
- assertNotNull(newNode);
- assertEquals("new", newNode.getName());
- assertTrue(transientState.hasNode("new"));
+ assertFalse(tree.hasChild("new"));
+ ContentTree added = tree.addChild("new");
+ assertNotNull(added);
+ assertEquals("new", added.getName());
+ assertTrue(tree.hasChild("new"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNotNull(newState.getChildNode("new"));
}
@Test
- public void addExistingNode() {
+ public void addExistingChild() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertFalse(transientState.hasNode("new"));
- transientState.addNode("new");
+ assertFalse(tree.hasChild("new"));
+ tree.addChild("new");
NodeState newState = branch.mergeInto(microkernel, state);
branch = new KernelBranch(newState);
- transientState = branch.getNode("/");
- assertTrue(transientState.hasNode("new"));
- TransientNodeState newNode = transientState.addNode("new");
- assertNotNull(newNode);
- assertEquals("new", newNode.getName());
+ tree = branch.getContentTree("/");
+ assertTrue(tree.hasChild("new"));
+ ContentTree added = tree.addChild("new");
+ assertNotNull(added);
+ assertEquals("new", added.getName());
}
@Test
- public void removeNode() {
+ public void removeChild() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertTrue(transientState.hasNode("x"));
- transientState.removeNode("x");
- assertFalse(transientState.hasNode("x"));
+ assertTrue(tree.hasChild("x"));
+ tree.removeChild("x");
+ assertFalse(tree.hasChild("x"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNull(newState.getChildNode("x"));
@@ -167,12 +167,12 @@ public class KernelBranchTest {
@Test
public void setProperty() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertFalse(transientState.hasProperty("new"));
+ assertFalse(tree.hasProperty("new"));
Scalar value = ScalarImpl.stringScalar("value");
- transientState.setProperty("new", value);
- PropertyState property = transientState.getProperty("new");
+ tree.setProperty("new", value);
+ PropertyState property = tree.getProperty("new");
assertNotNull(property);
assertEquals("new", property.getName());
assertEquals(value, property.getScalar());
@@ -187,11 +187,11 @@ public class KernelBranchTest {
@Test
public void removeProperty() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertTrue(transientState.hasProperty("a"));
- transientState.removeProperty("a");
- assertFalse(transientState.hasProperty("a"));
+ assertTrue(tree.hasProperty("a"));
+ tree.removeProperty("a");
+ assertFalse(tree.hasProperty("a"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNull(newState.getProperty("a"));
@@ -200,13 +200,13 @@ public class KernelBranchTest {
@Test
public void move() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- TransientNodeState y = transientState.getChildNode("y");
+ ContentTree tree = branch.getContentTree("/");
+ ContentTree y = tree.getChild("y");
- assertTrue(transientState.hasNode("x"));
+ assertTrue(tree.hasChild("x"));
branch.move("x", "y/xx");
- assertFalse(transientState.hasNode("x"));
- assertTrue(y.hasNode("xx"));
+ assertFalse(tree.hasChild("x"));
+ assertTrue(y.hasChild("xx"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNull(newState.getChildNode("x"));
@@ -217,12 +217,12 @@ public class KernelBranchTest {
@Test
public void rename() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- assertTrue(transientState.hasNode("x"));
+ assertTrue(tree.hasChild("x"));
branch.move("x", "xx");
- assertFalse(transientState.hasNode("x"));
- assertTrue(transientState.hasNode("xx"));
+ assertFalse(tree.hasChild("x"));
+ assertTrue(tree.hasChild("xx"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNull(newState.getChildNode("x"));
@@ -232,13 +232,13 @@ public class KernelBranchTest {
@Test
public void copy() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- TransientNodeState y = transientState.getChildNode("y");
+ ContentTree tree = branch.getContentTree("/");
+ ContentTree y = tree.getChild("y");
- assertTrue(transientState.hasNode("x"));
+ assertTrue(tree.hasChild("x"));
branch.copy("x", "y/xx");
- assertTrue(transientState.hasNode("x"));
- assertTrue(y.hasNode("xx"));
+ assertTrue(tree.hasChild("x"));
+ assertTrue(y.hasChild("xx"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNotNull(newState.getChildNode("x"));
@@ -249,13 +249,13 @@ public class KernelBranchTest {
@Test
public void deepCopy() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- TransientNodeState y = transientState.getChildNode("y");
+ ContentTree tree = branch.getContentTree("/");
+ ContentTree y = tree.getChild("y");
- branch.getNode("x").addNode("x1");
+ branch.getContentTree("x").addChild("x1");
branch.copy("x", "y/xx");
- assertTrue(y.hasNode("xx"));
- assertTrue(y.getChildNode("xx").hasNode("x1"));
+ assertTrue(y.hasChild("xx"));
+ assertTrue(y.getChild("xx").hasChild("x1"));
NodeState newState = branch.mergeInto(microkernel, state);
assertNotNull(newState.getChildNode("x"));
@@ -269,59 +269,59 @@ public class KernelBranchTest {
}
@Test
- public void getChildNodeCount() {
+ public void getChildrenCount() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- assertEquals(3, transientState.getChildNodeCount());
+ ContentTree tree = branch.getContentTree("/");
+ assertEquals(3, tree.getChildrenCount());
- transientState.removeNode("x");
- assertEquals(2, transientState.getChildNodeCount());
+ tree.removeChild("x");
+ assertEquals(2, tree.getChildrenCount());
- transientState.addNode("a");
- assertEquals(3, transientState.getChildNodeCount());
+ tree.addChild("a");
+ assertEquals(3, tree.getChildrenCount());
- transientState.addNode("x");
- assertEquals(4, transientState.getChildNodeCount());
+ tree.addChild("x");
+ assertEquals(4, tree.getChildrenCount());
}
@Test
public void getPropertyCount() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
- assertEquals(3, transientState.getPropertyCount());
+ ContentTree tree = branch.getContentTree("/");
+ assertEquals(3, tree.getPropertyCount());
Scalar value = ScalarImpl.stringScalar("foo");
- transientState.setProperty("a", value);
- assertEquals(3, transientState.getPropertyCount());
+ tree.setProperty("a", value);
+ assertEquals(3, tree.getPropertyCount());
- transientState.removeProperty("a");
- assertEquals(2, transientState.getPropertyCount());
+ tree.removeProperty("a");
+ assertEquals(2, tree.getPropertyCount());
- transientState.setProperty("x", value);
- assertEquals(3, transientState.getPropertyCount());
+ tree.setProperty("x", value);
+ assertEquals(3, tree.getPropertyCount());
- transientState.setProperty("a", value);
- assertEquals(4, transientState.getPropertyCount());
+ tree.setProperty("a", value);
+ assertEquals(4, tree.getPropertyCount());
}
@Test
- public void largeChildNodeList() {
+ public void largeChildList() {
KernelBranch branch = new KernelBranch(state);
- TransientNodeState transientState = branch.getNode("/");
+ ContentTree tree = branch.getContentTree("/");
- transientState.addNode("large");
- transientState = transientState.getChildNode("large");
+ tree.addChild("large");
+ tree = tree.getChild("large");
for (int c = 0; c < 10000; c++) {
- transientState.addNode("n" + c);
+ tree.addChild("n" + c);
}
KernelNodeState newState = branch.mergeInto(microkernel, state);
branch = new KernelBranch(newState);
- transientState = branch.getNode("/");
- transientState = transientState.getChildNode("large");
+ tree = branch.getContentTree("/");
+ tree = tree.getChild("large");
int c = 0;
- for (TransientNodeState q : transientState.getChildNodes()) {
+ for (ContentTree q : tree.getChildren()) {
assertEquals("n" + c++, q.getName());
}
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java Sun Apr 22 22:00:54 2012
@@ -20,8 +20,8 @@ import org.apache.jackrabbit.JcrConstant
import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
import org.apache.jackrabbit.oak.api.Branch;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
import org.apache.jackrabbit.oak.jcr.util.ItemNameMatcher;
import org.apache.jackrabbit.oak.jcr.util.LogUtil;
import org.apache.jackrabbit.oak.jcr.util.ValueConverter;
@@ -70,11 +70,11 @@ public class NodeImpl extends ItemImpl i
*/
private static final Logger log = LoggerFactory.getLogger(NodeImpl.class);
- private TransientNodeState transientNodeState;
+ private ContentTree contentTree;
- NodeImpl(SessionContext<SessionImpl> sessionContext, TransientNodeState transientNodeState) {
+ NodeImpl(SessionContext<SessionImpl> sessionContext, ContentTree contentTree) {
super(sessionContext);
- this.transientNodeState = transientNodeState;
+ this.contentTree = contentTree;
}
//---------------------------------------------------------------< Item >---
@@ -91,7 +91,7 @@ public class NodeImpl extends ItemImpl i
*/
@Override
public String getName() throws RepositoryException {
- return getTransientNodeState().getName();
+ return getContentTree().getName();
}
/**
@@ -107,11 +107,11 @@ public class NodeImpl extends ItemImpl i
*/
@Override
public Node getParent() throws RepositoryException {
- if (getTransientNodeState().getParent() == null) {
+ if (getContentTree().getParent() == null) {
throw new ItemNotFoundException("Root has no parent");
}
- return new NodeImpl(sessionContext, getTransientNodeState().getParent());
+ return new NodeImpl(sessionContext, getContentTree().getParent());
}
/**
@@ -123,7 +123,7 @@ public class NodeImpl extends ItemImpl i
if (depth < 0 || depth > current) {
throw new ItemNotFoundException("ancestor at depth " + depth + " does not exist");
}
- TransientNodeState ancestor = getTransientNodeState();
+ ContentTree ancestor = getContentTree();
while (depth < current) {
ancestor = ancestor.getParent();
current -= 1;
@@ -162,7 +162,7 @@ public class NodeImpl extends ItemImpl i
*/
@Override
public void remove() throws RepositoryException {
- getTransientNodeState().getParent().removeNode(getName());
+ getContentTree().getParent().removeChild(getName());
}
/**
@@ -183,14 +183,14 @@ public class NodeImpl extends ItemImpl i
checkStatus();
String parentPath = Paths.concat(path(), Paths.getParentPath(relPath));
- TransientNodeState parentState = getBranch().getNode(parentPath);
+ ContentTree parentState = getBranch().getContentTree(parentPath);
if (parentState == null) {
throw new PathNotFoundException(relPath);
}
String name = Paths.getName(relPath);
- parentState.addNode(name);
- return new NodeImpl(sessionContext, parentState.getChildNode(name));
+ parentState.addChild(name);
+ return new NodeImpl(sessionContext, parentState.getChild(name));
}
@Override
@@ -381,38 +381,38 @@ public class NodeImpl extends ItemImpl i
public NodeIterator getNodes() throws RepositoryException {
checkStatus();
- Iterable<TransientNodeState> childNodeStates = getTransientNodeState().getChildNodes();
- return new NodeIteratorAdapter(nodeIterator(childNodeStates.iterator()));
+ Iterable<ContentTree> children = getContentTree().getChildren();
+ return new NodeIteratorAdapter(nodeIterator(children.iterator()));
}
@Override
public NodeIterator getNodes(final String namePattern) throws RepositoryException {
checkStatus();
- Iterator<TransientNodeState> childNodeStates = filter(getTransientNodeState().getChildNodes().iterator(),
- new Predicate<TransientNodeState>() {
+ Iterator<ContentTree> children = filter(getContentTree().getChildren().iterator(),
+ new Predicate<ContentTree>() {
@Override
- public boolean evaluate(TransientNodeState state) {
+ public boolean evaluate(ContentTree state) {
return ItemNameMatcher.matches(state.getName(), namePattern);
}
});
- return new NodeIteratorAdapter(nodeIterator(childNodeStates));
+ return new NodeIteratorAdapter(nodeIterator(children));
}
@Override
public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
checkStatus();
- Iterator<TransientNodeState> childNodeStates = filter(getTransientNodeState().getChildNodes().iterator(),
- new Predicate<TransientNodeState>() {
+ Iterator<ContentTree> children = filter(getContentTree().getChildren().iterator(),
+ new Predicate<ContentTree>() {
@Override
- public boolean evaluate(TransientNodeState state) {
+ public boolean evaluate(ContentTree state) {
return ItemNameMatcher.matches(state.getName(), nameGlobs);
}
});
- return new NodeIteratorAdapter(nodeIterator(childNodeStates));
+ return new NodeIteratorAdapter(nodeIterator(children));
}
@Override
@@ -431,7 +431,7 @@ public class NodeImpl extends ItemImpl i
public PropertyIterator getProperties() throws RepositoryException {
checkStatus();
- Iterable<PropertyState> properties = getTransientNodeState().getProperties();
+ Iterable<PropertyState> properties = getContentTree().getProperties();
return new PropertyIteratorAdapter(propertyIterator(properties.iterator()));
}
@@ -439,7 +439,7 @@ public class NodeImpl extends ItemImpl i
public PropertyIterator getProperties(final String namePattern) throws RepositoryException {
checkStatus();
- Iterator<PropertyState> properties = filter(getTransientNodeState().getProperties().iterator(),
+ Iterator<PropertyState> properties = filter(getContentTree().getProperties().iterator(),
new Predicate<PropertyState>() {
@Override
public boolean evaluate(PropertyState entry) {
@@ -452,7 +452,7 @@ public class NodeImpl extends ItemImpl i
@Override
public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException {
- Iterator<PropertyState> propertyNames = filter(getTransientNodeState().getProperties().iterator(),
+ Iterator<PropertyState> propertyNames = filter(getContentTree().getProperties().iterator(),
new Predicate<PropertyState>() {
@Override
public boolean evaluate(PropertyState entry) {
@@ -560,14 +560,14 @@ public class NodeImpl extends ItemImpl i
public boolean hasNodes() throws RepositoryException {
checkStatus();
- return getTransientNodeState().getChildNodeCount() != 0;
+ return getContentTree().getChildrenCount() != 0;
}
@Override
public boolean hasProperties() throws RepositoryException {
checkStatus();
- return getTransientNodeState().getPropertyCount() != 0;
+ return getContentTree().getPropertyCount() != 0;
}
/**
@@ -856,7 +856,7 @@ public class NodeImpl extends ItemImpl i
//------------------------------------------------------------< package >---
String path() {
- return '/' + getTransientNodeState().getPath();
+ return '/' + getContentTree().getPath();
}
//------------------------------------------------------------< private >---
@@ -864,22 +864,22 @@ public class NodeImpl extends ItemImpl i
/**
* @return The node state associated with this node
*/
- private TransientNodeState getState() {
- return getTransientNodeState();
+ private ContentTree getState() {
+ return getContentTree();
}
private Branch getBranch() {
return sessionContext.getBranch();
}
- private synchronized TransientNodeState getTransientNodeState() {
- return transientNodeState = getBranch().getNode(transientNodeState.getPath());
+ private synchronized ContentTree getContentTree() {
+ return contentTree = getBranch().getContentTree(contentTree.getPath());
}
- private Iterator<Node> nodeIterator(Iterator<TransientNodeState> childNodeStates) {
- return Iterators.map(childNodeStates, new Function1<TransientNodeState, Node>() {
+ private Iterator<Node> nodeIterator(Iterator<ContentTree> childNodeStates) {
+ return Iterators.map(childNodeStates, new Function1<ContentTree, Node>() {
@Override
- public Node apply(TransientNodeState state) {
+ public Node apply(ContentTree state) {
return new NodeImpl(sessionContext, state);
}
});
@@ -889,30 +889,30 @@ public class NodeImpl extends ItemImpl i
return Iterators.map(properties, new Function1<PropertyState, Property>() {
@Override
public Property apply(PropertyState propertyState) {
- return new PropertyImpl(sessionContext, getTransientNodeState(), propertyState);
+ return new PropertyImpl(sessionContext, getContentTree(), propertyState);
}
});
}
private NodeImpl getNodeOrNull(String relPath) {
String absPath = Paths.concat(path(), relPath);
- TransientNodeState nodeState = getBranch().getNode(absPath);
- return nodeState == null
+ ContentTree tree = getBranch().getContentTree(absPath);
+ return tree == null
? null
- : new NodeImpl(sessionContext, nodeState);
+ : new NodeImpl(sessionContext, tree);
}
private PropertyImpl getPropertyOrNull(String relPath) {
String absPath = Paths.concat(path(), Paths.getParentPath(relPath));
- TransientNodeState parentState = getBranch().getNode(absPath);
- if (parentState == null) {
+ ContentTree parent = getBranch().getContentTree(absPath);
+ if (parent == null) {
return null;
}
String name = Paths.getName(relPath);
- PropertyState propertyState = parentState.getProperty(name);
+ PropertyState propertyState = parent.getProperty(name);
return propertyState == null
? null
- : new PropertyImpl(sessionContext, parentState, propertyState);
+ : new PropertyImpl(sessionContext, parent, propertyState);
}
}
\ No newline at end of file
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java Sun Apr 22 22:00:54 2012
@@ -17,8 +17,8 @@
package org.apache.jackrabbit.oak.jcr;
import org.apache.jackrabbit.oak.api.Branch;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
import org.apache.jackrabbit.oak.jcr.util.LogUtil;
import org.apache.jackrabbit.oak.jcr.util.ValueConverter;
import org.apache.jackrabbit.oak.namepath.Paths;
@@ -52,14 +52,14 @@ public class PropertyImpl extends ItemIm
*/
private static final Logger log = LoggerFactory.getLogger(PropertyImpl.class);
- private TransientNodeState parentState;
+ private ContentTree parent;
private PropertyState propertyState;
- PropertyImpl(SessionContext<SessionImpl> sessionContext, TransientNodeState parentState,
+ PropertyImpl(SessionContext<SessionImpl> sessionContext, ContentTree parent,
PropertyState propertyState) {
super(sessionContext);
- this.parentState = parentState;
+ this.parent = parent;
this.propertyState = propertyState;
}
@@ -85,7 +85,7 @@ public class PropertyImpl extends ItemIm
*/
@Override
public String getPath() throws RepositoryException {
- return '/' + getParentState().getPath() + '/' + getStateName();
+ return '/' + getParentContentTree().getPath() + '/' + getStateName();
}
/**
@@ -93,7 +93,7 @@ public class PropertyImpl extends ItemIm
*/
@Override
public Node getParent() throws RepositoryException {
- return new NodeImpl(sessionContext, getParentState());
+ return new NodeImpl(sessionContext, getParentContentTree());
}
/**
@@ -139,7 +139,7 @@ public class PropertyImpl extends ItemIm
*/
@Override
public void remove() throws RepositoryException {
- getParentState().removeProperty(getStateName());
+ getParentContentTree().removeProperty(getStateName());
}
/**
@@ -567,7 +567,7 @@ public class PropertyImpl extends ItemIm
remove();
}
else {
- getParentState().setProperty(getStateName(), ValueConverter.toScalar(value));
+ getParentContentTree().setProperty(getStateName(), ValueConverter.toScalar(value));
}
}
@@ -587,7 +587,7 @@ public class PropertyImpl extends ItemIm
remove();
}
else {
- getParentState().setProperty(getStateName(), ValueConverter.toScalar(values));
+ getParentContentTree().setProperty(getStateName(), ValueConverter.toScalar(values));
}
}
@@ -611,9 +611,9 @@ public class PropertyImpl extends ItemIm
return sessionContext.getBranch();
}
- private TransientNodeState getParentState() {
+ private ContentTree getParentContentTree() {
resolve();
- return parentState;
+ return parent;
}
private PropertyState getPropertyState() {
@@ -626,14 +626,14 @@ public class PropertyImpl extends ItemIm
}
private synchronized void resolve() {
- parentState = getBranch().getNode(parentState.getPath());
- String path = Paths.concat(parentState.getPath(), propertyState.getName());
+ parent = getBranch().getContentTree(parent.getPath());
+ String path = Paths.concat(parent.getPath(), propertyState.getName());
- if (parentState == null) {
+ if (parent == null) {
propertyState = null;
}
else {
- propertyState = parentState.getProperty(Paths.getName(path));
+ propertyState = parent.getProperty(Paths.getName(path));
}
}
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java Sun Apr 22 22:00:54 2012
@@ -21,7 +21,7 @@ package org.apache.jackrabbit.oak.jcr;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.api.Branch;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
+import org.apache.jackrabbit.oak.api.ContentTree;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -40,5 +40,5 @@ public interface SessionContext<T extend
NodeTypeManager getNodeTypeManager() throws RepositoryException;
VersionManager getVersionManager() throws RepositoryException;
Branch getBranch();
- TransientNodeState getState(NodeImpl node);
+ ContentTree getContentTree(NodeImpl node);
}
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java Sun Apr 22 22:00:54 2012
@@ -20,7 +20,7 @@ import org.apache.jackrabbit.commons.Abs
import org.apache.jackrabbit.oak.api.Branch;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.TransientNodeState;
+import org.apache.jackrabbit.oak.api.ContentTree;
import org.apache.jackrabbit.oak.namepath.Paths;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -120,7 +120,7 @@ public class SessionImpl extends Abstrac
@Override
public Node getRootNode() throws RepositoryException {
ensureIsAlive();
- return new NodeImpl(sessionContext, branch.getNode("/"));
+ return new NodeImpl(sessionContext, branch.getContentTree("/"));
}
@Override
@@ -462,8 +462,8 @@ public class SessionImpl extends Abstrac
}
@Override
- public TransientNodeState getState(NodeImpl node) {
- return branch.getNode(node.path());
+ public ContentTree getContentTree(NodeImpl node) {
+ return branch.getContentTree(node.path());
}
}
}
\ No newline at end of file
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java?rev=1328984&r1=1328983&r2=1328984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java Sun Apr 22 22:00:54 2012
@@ -322,7 +322,7 @@ public class UserManagerImpl implements
void setInternalProperty(NodeImpl userNode, String name, String value, int type) throws RepositoryException {
// TODO: check again if this really makes a transient modification with marking the property modified/new
Scalar scalar = ValueConverter.toScalar(value, type);
- sessionContext.getState(userNode).setProperty(name, scalar);
+ sessionContext.getContentTree(userNode).setProperty(name, scalar);
}
void setInternalProperty(NodeImpl userNode, String name, String[] values, int type) throws RepositoryException {
@@ -331,12 +331,12 @@ public class UserManagerImpl implements
for (String value : values) {
scalarList.add(ValueConverter.toScalar(value, PropertyType.STRING));
}
- sessionContext.getState(userNode).setProperty(name, scalarList);
+ sessionContext.getContentTree(userNode).setProperty(name, scalarList);
}
void removeInternalProperty(NodeImpl userNode, String name) {
// TODO: check again if this really makes a transient modification with marking the property modified
- sessionContext.getState(userNode).removeProperty(name);
+ sessionContext.getContentTree(userNode).removeProperty(name);
}
private Authorizable getAuthorizable(NodeImpl node) throws RepositoryException {