jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1502177 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ oak-core/src/main/...
Date Thu, 11 Jul 2013 10:16:05 GMT
Author: mduerig
Date: Thu Jul 11 10:16:05 2013
New Revision: 1502177

URL: http://svn.apache.org/r1502177
Log:
OAK-798: Review / refactor TreeImpl and related classes
Inline ReadOnlyTree into ImmutableTree

Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
Thu Jul 11 10:16:05 2013
@@ -96,8 +96,8 @@ public class IdentifierManager {
     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();
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
Thu Jul 11 10:16:05 2013
@@ -17,15 +17,24 @@
 package org.apache.jackrabbit.oak.core;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+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.CheckForNull;
 import javax.annotation.Nonnull;
+
 import com.google.common.base.Function;
 import com.google.common.base.Objects;
+import com.google.common.base.Predicate;
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
@@ -57,7 +66,7 @@ import org.apache.jackrabbit.oak.spi.sta
  * <ul>
  *     <li>{@link DefaultParentProvider}: used with the default usage where the
  *     parent tree is passed to the constructor</li>
- *     <li>{@link ParentProvider#ROOTPROVIDER}: the default parent provider for
+ *     <li>{@link ParentProvider#ROOT_PROVIDER}: the default parent provider for
  *     the root tree. All children will get {@link DefaultParentProvider}</li>
  *     <li>{@link ParentProvider#UNSUPPORTED}: throws {@code UnsupportedOperationException}
  *     upon hierarchy related methods like {@link #getParent()}, {@link #getPath()} and
@@ -87,10 +96,23 @@ import org.apache.jackrabbit.oak.spi.sta
  * are consider equal if their name and the underlying {@code NodeState}s are equal. Note
  * however, that according to the contract defined in {@code NodeState} these
  * objects are not expected to be used as hash keys.
- *
- * FIXME: merge with ReadOnlyTree
  */
-public final class ImmutableTree extends ReadOnlyTree {
+public final class ImmutableTree implements Tree {
+
+    /**
+     * Internal and hidden property that contains the child order
+     */
+    public static final String OAK_CHILD_ORDER = ":childOrder";
+
+    /**
+     * Name of this tree
+     */
+    private final String name;
+
+    /**
+     * Underlying node state
+     */
+    final NodeState state;
 
     private final ParentProvider parentProvider;
     private final TreeTypeProvider typeProvider;
@@ -98,11 +120,11 @@ public final class ImmutableTree extends
     private String path;
 
     public ImmutableTree(@Nonnull NodeState rootState) {
-        this(ParentProvider.ROOTPROVIDER, "", rootState, TreeTypeProvider.EMPTY);
+        this(ParentProvider.ROOT_PROVIDER, "", rootState, TreeTypeProvider.EMPTY);
     }
 
     public ImmutableTree(@Nonnull NodeState rootState, @Nonnull TreeTypeProvider typeProvider)
{
-        this(ParentProvider.ROOTPROVIDER, "", rootState, typeProvider);
+        this(ParentProvider.ROOT_PROVIDER, "", rootState, typeProvider);
     }
 
     public ImmutableTree(@Nonnull ImmutableTree parent, @Nonnull String name, @Nonnull NodeState
state) {
@@ -115,7 +137,8 @@ public final class ImmutableTree extends
 
     public ImmutableTree(@Nonnull ParentProvider parentProvider, @Nonnull String name,
                          @Nonnull NodeState state, @Nonnull TreeTypeProvider typeProvider)
{
-        super(null, name, state);
+        this.name = checkNotNull(name);
+        this.state = checkNotNull(state);
         this.parentProvider = checkNotNull(parentProvider);
         this.typeProvider = typeProvider;
     }
@@ -126,11 +149,17 @@ public final class ImmutableTree extends
         } else if (root instanceof ImmutableRoot) {
             return ((ImmutableRoot) root).getTree("/");
         } else {
-            throw new IllegalArgumentException("Unsupported Root implementation.");
+            throw new IllegalArgumentException("Unsupported Root implementation: " + root.getClass());
         }
     }
 
     //---------------------------------------------------------------< Tree >---
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
     @Override
     public boolean isRoot() {
         return "".equals(getName());
@@ -140,27 +169,67 @@ public final class ImmutableTree extends
     public String getPath() {
         if (path == null) {
             if (isRoot()) {
-                // shortcut
                 path = "/";
             } else {
                 StringBuilder sb = new StringBuilder();
-                ImmutableTree parent = getParent();
-                sb.append(parent.getPath());
-                if (!parent.isRoot()) {
-                    sb.append('/');
-                }
-                sb.append(getName());
+                buildPath(sb);
                 path = sb.toString();
             }
         }
         return path;
     }
 
+    private void buildPath(StringBuilder sb) {
+        if (!isRoot()) {
+            getParent().buildPath(sb);
+            sb.append('/').append(name);
+        }
+    }
+
+    @Override
+    public Status getStatus() {
+        return Status.EXISTING;
+    }
+
+    @Override
+    public boolean exists() {
+        return state.exists();
+    }
+
     @Override
     public ImmutableTree getParent() {
         return parentProvider.getParent();
     }
 
+    @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 ImmutableTree getChild(@Nonnull String name) {
@@ -168,6 +237,16 @@ public final class ImmutableTree extends
         return new ImmutableTree(this, name, child);
     }
 
+    @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.
@@ -177,10 +256,63 @@ public final class ImmutableTree extends
      */
     @Override
     public Iterable<Tree> getChildren() {
-        return super.getChildren();
+        return transform(
+                filter(getChildNames(), new Predicate<String>() {
+                    @Override
+                    public boolean apply(String name) {
+                        return !isHidden(name);
+                    }
+                }),
+                new Function<String, Tree>() {
+                    @Override
+                    public Tree apply(String name) {
+                        return new ImmutableTree(ImmutableTree.this, name, state.getChildNode(name));
+                    }
+                });
+    }
+
+    @Override
+    public boolean remove() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Tree addChild(String name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setOrderableChildren(boolean enable) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean orderBefore(String name) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setProperty(PropertyState property) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> void setProperty(String name, T value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> void setProperty(String name, T value, Type<T> type) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeProperty(String name) {
+        throw new UnsupportedOperationException();
     }
 
     //-------------------------------------------------------------< Object >---
+
     @Override
     public int hashCode() {
         return Objects.hashCode(getName(), state);
@@ -200,11 +332,11 @@ public final class ImmutableTree extends
 
     @Override
     public String toString() {
-        return new StringBuilder().append("ImmutableTree '").append(getName()).append("':").append(state.toString()).toString();
+        return "ImmutableTree '" + getName() + "':" + state.toString();
     }
 
-
     //--------------------------------------------------------------------------
+
     public NodeState getNodeState() {
         return state;
     }
@@ -222,7 +354,6 @@ public final class ImmutableTree extends
         }
     }
 
-    @Override
     @Nonnull
     String getIdentifier() {
         PropertyState property = state.getProperty(JcrConstants.JCR_UUID);
@@ -234,18 +365,46 @@ public final class ImmutableTree extends
             return PathUtils.concat(getParent().getIdentifier(), getName());
         }
     }
-    
-    @Override
-    protected Function<String, Tree> createChild(){
-    	return new Function<String, Tree>() {
-            @Override
-            public Tree apply(String name) {
-                return new ImmutableTree(ImmutableTree.this, name, state.getChildNode(name));
-            }
-        };
+
+    /**
+     * Returns the list of child names considering the its ordering
+     * when the {@link #OAK_CHILD_ORDER} property is set.
+     *
+     * @return the list of child names.
+     */
+    private Iterable<String> getChildNames() {
+        if (state.hasProperty(OAK_CHILD_ORDER)) {
+            return new Iterable<String>() {
+                @Override
+                public Iterator<String> iterator() {
+                    return new Iterator<String>() {
+                        final PropertyState childOrder = state.getProperty(OAK_CHILD_ORDER);
+                        int index = 0;
+
+                        @Override
+                        public boolean hasNext() {
+                            return index < childOrder.count();
+                        }
+
+                        @Override
+                        public String next() {
+                            return childOrder.getValue(STRING, index++);
+                        }
+
+                        @Override
+                        public void remove() {
+                            throw new UnsupportedOperationException();
+                        }
+                    };
+                }
+            };
+        } else {
+            return state.getChildNodeNames();
+        }
     }
 
     //--------------------------------------------------------------------------
+
     public interface ParentProvider {
 
         ParentProvider UNSUPPORTED = new ParentProvider() {
@@ -255,7 +414,7 @@ public final class ImmutableTree extends
             }
         };
 
-        ParentProvider ROOTPROVIDER = new ParentProvider() {
+        ParentProvider ROOT_PROVIDER = new ParentProvider() {
             @Override
             public ImmutableTree getParent() {
                 throw new IllegalStateException("root tree does not have a parent");
@@ -267,7 +426,7 @@ public final class ImmutableTree extends
     }
 
     public static final class DefaultParentProvider implements ParentProvider {
-        private ImmutableTree parent;
+        private final ImmutableTree parent;
 
         DefaultParentProvider(ImmutableTree parent) {
             this.parent = checkNotNull(parent);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidatorProvider.java
Thu Jul 11 10:16:05 2013
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.plugin
 
 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 @@ public class NameValidatorProvider exten
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {
         return new NameValidator(
-                Namespaces.getNamespaceMap(new ReadOnlyTree(after)).keySet());
+                Namespaces.getNamespaceMap(new ImmutableTree(after)).keySet());
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceValidatorProvider.java
Thu Jul 11 10:16:05 2013
@@ -21,7 +21,7 @@ import static org.apache.jackrabbit.oak.
 
 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 @@ public class NamespaceValidatorProvider 
     @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);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Thu Jul 11 10:16:05 2013
@@ -52,7 +52,7 @@ import org.apache.jackrabbit.oak.api.Roo
 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 @@ public abstract class ReadOnlyNodeTypeMa
             typesNode = typesNode.getChildNode(name);
         }
 
-        final Tree typesTree = new ReadOnlyTree(typesNode);
+        final Tree typesTree = new ImmutableTree(typesNode);
         return new ReadOnlyNodeTypeManager() {
             @Override
             protected Tree getTypes() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java
Thu Jul 11 10:16:05 2013
@@ -29,7 +29,7 @@ import org.apache.jackrabbit.oak.api.Com
 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 @@ class VersionEditor implements Editor {
             // 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;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
Thu Jul 11 10:16:05 2013
@@ -61,7 +61,7 @@ import org.apache.jackrabbit.oak.api.Com
 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 @@ class VersionableState {
 
     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 @@ class VersionableState {
                         "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 @@ class VersionableState {
             // 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 @@ class VersionableState {
             // 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();
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java?rev=1502177&r1=1502176&r2=1502177&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/EventFilter.java
Thu Jul 11 10:16:05 2013
@@ -29,7 +29,7 @@ import org.apache.jackrabbit.oak.api.Pro
 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 @@ class EventFilter {
     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));
     }
 



Mime
View raw message