Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java (revision ) @@ -29,7 +29,7 @@ import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.api.Type; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.spi.commit.Editor; import org.apache.jackrabbit.oak.spi.state.NodeBuilder; import org.apache.jackrabbit.oak.spi.state.NodeState; @@ -170,7 +170,7 @@ // this is not 100% correct, because t.getPath() will // not return the correct path for node after, but is // sufficient to check if it is versionable - Tree t = new ReadOnlyTree(after); + Tree t = new ImmutableTree(after); isVersionable = vMgr.isVersionable(t); } return isVersionable; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java (revision ) @@ -21,7 +21,7 @@ import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Service; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.spi.commit.EditorProvider; import org.apache.jackrabbit.oak.spi.commit.SubtreeValidator; import org.apache.jackrabbit.oak.spi.commit.Validator; @@ -40,7 +40,7 @@ @Override public Validator getRootValidator(NodeState before, NodeState after) { Validator validator = new NamespaceValidator( - Namespaces.getNamespaceMap(new ReadOnlyTree(before))); + Namespaces.getNamespaceMap(new ImmutableTree(before))); return new SubtreeValidator(validator, JCR_SYSTEM, REP_NAMESPACES); } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java (revision ) @@ -52,7 +52,7 @@ import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.commons.PathUtils; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.namepath.NameMapper; import org.apache.jackrabbit.oak.namepath.NamePathMapper; import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl; @@ -150,7 +150,7 @@ typesNode = typesNode.getChildNode(name); } - final Tree typesTree = new ReadOnlyTree(typesNode); + final Tree typesTree = new ImmutableTree(typesNode); return new ReadOnlyNodeTypeManager() { @Override protected Tree getTypes() { Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java (revision ) @@ -18,7 +18,7 @@ import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Service; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.spi.commit.EditorProvider; import org.apache.jackrabbit.oak.spi.commit.Validator; import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider; @@ -36,7 +36,7 @@ @Override public Validator getRootValidator(NodeState before, NodeState after) { return new NameValidator( - Namespaces.getNamespaceMap(new ReadOnlyTree(after)).keySet()); + Namespaces.getNamespaceMap(new ImmutableTree(after)).keySet()); } } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java (revision ) @@ -61,7 +61,7 @@ import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.core.IdentifierManager; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.plugins.memory.PropertyStates; import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager; import org.apache.jackrabbit.oak.spi.state.NodeBuilder; @@ -406,7 +406,7 @@ private void resetToDefaultValue(NodeBuilder dest, PropertyState p) throws RepositoryException { - ReadOnlyTree tree = new ReadOnlyTree(dest.getNodeState()); + ImmutableTree tree = new ImmutableTree(dest.getNodeState()); PropertyDefinition def = ntMgr.getDefinition(tree, p, true); Value[] values = def.getDefaultValues(); if (values != null) { @@ -444,7 +444,7 @@ "Checkin aborted due to OPV abort in " + name); } if (opv == OnParentVersionAction.VERSION) { - if (ntMgr.isNodeType(new ReadOnlyTree(child.getNodeState()), MIX_VERSIONABLE)) { + if (ntMgr.isNodeType(new ImmutableTree(child.getNodeState()), MIX_VERSIONABLE)) { // create frozen versionable child versionedChild(child, dest.child(name)); } else { @@ -509,14 +509,14 @@ // quick check without looking at type hierarchy return false; } - ReadOnlyTree tree = new ReadOnlyTree(node.getNodeState()); + ImmutableTree tree = new ImmutableTree(node.getNodeState()); return ntMgr.isNodeType(tree, MIX_REFERENCEABLE); } private int getOPV(NodeBuilder parent, NodeBuilder child, String childName) throws RepositoryException { - ReadOnlyTree parentTree = new ReadOnlyTree(parent.getNodeState()); - ReadOnlyTree childTree = new ReadOnlyTree( + ImmutableTree parentTree = new ImmutableTree(parent.getNodeState()); + ImmutableTree childTree = new ImmutableTree( parentTree, childName, child.getNodeState()); return ntMgr.getDefinition(parentTree, childTree).getOnParentVersion(); } @@ -527,7 +527,7 @@ // FIXME: handle child order properly return OnParentVersionAction.COPY; } else { - return ntMgr.getDefinition(new ReadOnlyTree(node.getNodeState()), + return ntMgr.getDefinition(new ImmutableTree(node.getNodeState()), property, false).getOnParentVersion(); } } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java (revision ) @@ -96,8 +96,8 @@ public String getIdentifier(Tree tree) { if (tree instanceof TreeImpl) { return ((TreeImpl) tree).getIdentifier(); - } else if (tree instanceof ReadOnlyTree) { - return ((ReadOnlyTree) tree).getIdentifier(); + } else if (tree instanceof ImmutableTree) { + return ((ImmutableTree) tree).getIdentifier(); } else { return tree.getPath(); } \ No newline at end of file Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java (revision ) @@ -29,7 +29,7 @@ import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.commons.PathUtils; -import org.apache.jackrabbit.oak.core.ReadOnlyTree; +import org.apache.jackrabbit.oak.core.ImmutableTree; import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager; import org.apache.jackrabbit.oak.spi.state.NodeState; @@ -81,7 +81,7 @@ public boolean include(int eventType, String path, @Nullable NodeState associatedParentNode) { return include(eventType) && include(path) - && (associatedParentNode == null || includeByType(new ReadOnlyTree(associatedParentNode))) + && (associatedParentNode == null || includeByType(new ImmutableTree(associatedParentNode))) && (associatedParentNode == null || includeByUuid(associatedParentNode)); } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java (revision 5cef3b531cd59dac28faae52e1458c1ad4eaa5f1) @@ -1,302 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.jackrabbit.oak.core; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.transform; -import static org.apache.jackrabbit.oak.api.Type.STRING; -import static org.apache.jackrabbit.oak.spi.state.NodeStateUtils.isHidden; - -import java.util.Iterator; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import org.apache.jackrabbit.JcrConstants; -import org.apache.jackrabbit.oak.api.PropertyState; -import org.apache.jackrabbit.oak.api.Tree; -import org.apache.jackrabbit.oak.api.Type; -import org.apache.jackrabbit.oak.commons.PathUtils; -import org.apache.jackrabbit.oak.spi.state.NodeState; - -public class ReadOnlyTree implements Tree { - - /** - * Internal and hidden property that contains the child order - */ - public static final String OAK_CHILD_ORDER = ":childOrder"; - - /** - * Parent of this tree, {@code null} for the root - */ - private final ReadOnlyTree parent; - - /** - * Name of this tree - */ - private final String name; - - /** - * Underlying node state - */ - final NodeState state; - - public ReadOnlyTree(@Nonnull NodeState rootState) { - this(null, "", rootState); - } - - public ReadOnlyTree(@Nullable ReadOnlyTree parent, @Nonnull String name, @Nonnull NodeState state) { - this.parent = parent; - this.name = checkNotNull(name); - this.state = checkNotNull(state); - checkArgument(!name.isEmpty() || parent == null); - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean isRoot() { - return parent == null; - } - - @Override - public String getPath() { - if (isRoot()) { - // shortcut - return "/"; - } - - StringBuilder sb = new StringBuilder(); - buildPath(sb); - return sb.toString(); - } - - private void buildPath(StringBuilder sb) { - if (parent != null) { - parent.buildPath(sb); - sb.append('/').append(name); - } - } - - @Nonnull - @Override - public Tree getParent() { - checkState(parent != null, "root tree does not have a parent"); - return parent; - } - - @Override - public PropertyState getProperty(String name) { - return state.getProperty(name); - } - - @Override - public Status getPropertyStatus(String name) { - if (hasProperty(name)) { - return Status.EXISTING; - } else { - return null; - } - } - - @Override - public boolean hasProperty(String name) { - return state.hasProperty(name); - } - - @Override - public long getPropertyCount() { - return state.getPropertyCount(); - } - - @Override - public Iterable extends PropertyState> getProperties() { - return state.getProperties(); - } - - @Nonnull - @Override - public ReadOnlyTree getChild(@Nonnull String name) { - return new ReadOnlyTree(this, name, state.getChildNode(name)); - } - - @Override - public Status getStatus() { - return Status.EXISTING; - } - - @Override - public boolean exists() { - return state.exists(); - } - - @Override - public boolean hasChild(@Nonnull String name) { - return state.hasChildNode(name); - } - - @Override - public long getChildrenCount() { - return state.getChildNodeCount(); - } - - /** - * This implementation does not respect ordered child nodes, but always - * returns them in some implementation specific order. - *
- * - * @return the children. - */ - @Override - public Iterable