jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1478403 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/api/ main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/security/authorization/ main/java/org/apache/jackrabbit/oak/security/au...
Date Thu, 02 May 2013 15:06:19 GMT
Author: mduerig
Date: Thu May  2 15:06:19 2013
New Revision: 1478403

URL: http://svn.apache.org/r1478403
Log:
OAK-798: Review / refactor TreeImpl and related classes
- Remove TreeLocation from API and replace usages with utility class

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java
  (contents, props changed)
      - copied, changed from r1478402, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocations.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TreeLocation.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocations.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.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/core/ReadOnlyTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlContext.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContext.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/Context.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Thu
May  2 15:06:19 2013
@@ -89,16 +89,6 @@ public interface Root {
     Tree getTree(@Nonnull String path);
 
     /**
-     * Get a tree location for a given absolute {@code path}
-     * @param path absolute path to the location
-     * @return the tree location for {@code path}
-     * @deprecated use {@link #getTree(String)}
-     */
-    @Nonnull
-    @Deprecated
-    TreeLocation getLocation(String path);
-
-    /**
      * Rebase this root instance to the latest revision. After a call to this method,
      * trees obtained through {@link #getTree(String)} may become non existing.
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java Thu
May  2 15:06:19 2013
@@ -140,13 +140,6 @@ public interface Tree {
     boolean exists();
 
     /**
-     * @return the current location
-     */
-    @Nonnull
-    @Deprecated
-    TreeLocation getLocation();
-
-    /**
      * @return the possibly non existent parent of this {@code Tree}.
      * @throws IllegalStateException if called on the root tree.
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableRoot.java
Thu May  2 15:06:19 2013
@@ -27,7 +27,6 @@ import org.apache.jackrabbit.oak.api.Blo
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
@@ -67,18 +66,6 @@ public final class ImmutableRoot impleme
         return child;
     }
 
-    @Nonnull
-    @Override
-    @Deprecated
-    public TreeLocation getLocation(String path) {
-        checkArgument(PathUtils.isAbsolute(path));
-        TreeLocation child = rootTree.getLocation();
-        for (String name : elements(path)) {
-            child = child.getChild(name);
-        }
-        return child;
-    }
-
     @Override
     public boolean move(String sourcePath, String destPath) {
         throw new UnsupportedOperationException();

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=1478403&r1=1478402&r2=1478403&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 May  2 15:06:19 2013
@@ -46,10 +46,9 @@ import org.apache.jackrabbit.oak.spi.sta
  * {@link #ImmutableTree(ImmutableTree, String, org.apache.jackrabbit.oak.spi.state.NodeState)}
  * for every subsequent child state. Note, that this implementation will not
  * perform any kind of validation of the passed state and methods like {@link #isRoot()},
- * {@link #getName()}, {@link #getPath()} or {@link #getLocation()} will just
- * make use of the hierarchy that has been create by that sequence.
- * In order to create a disconnected individual tree in cases where the hierarchy
- * information is not (yet) need or known it is suggested to use
+ * {@link #getName()} or {@link #getPath()} will just make use of the hierarchy that has
been
+ * create by that sequence. In order to create a disconnected individual tree in cases where
+ * the hierarchy information is not (yet) need or known it is suggested to use
  * {@link #ImmutableTree(org.apache.jackrabbit.oak.core.ImmutableTree.ParentProvider, String,
org.apache.jackrabbit.oak.spi.state.NodeState)}
  * an specify an appropriate {@code ParentProvider} implementation.
  *

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ReadOnlyTree.java
Thu May  2 15:06:19 2013
@@ -31,7 +31,6 @@ import javax.annotation.Nullable;
 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.TreeLocation;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
@@ -147,12 +146,6 @@ public class ReadOnlyTree implements Tre
     }
 
     @Override
-    @Deprecated
-    public TreeLocation getLocation() {
-        return TreeLocations.create(this);
-    }
-
-    @Override
     public boolean hasChild(@Nonnull String name) {
         return state.hasChildNode(name);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Thu May  2 15:06:19 2013
@@ -18,9 +18,7 @@
  */
 package org.apache.jackrabbit.oak.core;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
 import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
 import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
 
@@ -42,7 +40,6 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.index.diffindex.UUIDDiffIndexProviderWrapper;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
@@ -211,18 +208,6 @@ public class RootImpl implements Root {
     }
 
     @Override
-    @Deprecated
-    public TreeLocation getLocation(String path) {
-        checkArgument(PathUtils.isAbsolute(path));
-        checkLive();
-        TreeLocation child = rootTree.getLocation();
-        for (String name : elements(path)) {
-            child = child.getChild(name);
-        }
-        return child;
-    }
-
-    @Override
     public void rebase() {
         checkLive();
         if (!store.getRoot().equals(getBaseState())) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Thu May  2 15:06:19 2013
@@ -47,7 +47,6 @@ import com.google.common.collect.Iterabl
 import com.google.common.collect.Sets;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.RootImpl.Move;
@@ -134,13 +133,6 @@ public class TreeImpl implements Tree {
     }
 
     @Override
-    @Deprecated
-    public TreeLocation getLocation() {
-        enter();
-        return TreeLocations.create(this);
-    }
-
-    @Override
     public boolean exists() {
         return enter();
     }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java
(from r1478402, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocations.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocations.java&r1=1478402&r2=1478403&rev=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocations.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java
Thu May  2 15:06:19 2013
@@ -23,16 +23,26 @@ import static com.google.common.base.Pre
 import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
 import static org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
 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.TreeLocation;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 
-@Deprecated
-public abstract class TreeLocations implements TreeLocation {
+/**
+ * A {@code TreeLocation} denotes a location inside a tree.
+ * <p>
+ * It can either refer to a inner node (that is a {@link Tree}), to a leaf (that is a
+ * {@link PropertyState}) or to an invalid location which refers to neither of the former.
+ * {@code TreeLocation} instances provide methods for navigating trees such that navigation
+ * always results in new {@code TreeLocation} instances. Navigation never fails. Errors are
+ * deferred until the underlying item itself is accessed. That is, if a {@code TreeLocation}
+ * points to an item which does not exist or is unavailable otherwise (i.e. due to access
+ * control restrictions) accessing the tree will return {@code null} at this point.
+ */
+public abstract class TreeLocation {
 
     /**
      * Create a new {@code TreeLocation} instance for a {@code tree}
@@ -61,23 +71,60 @@ public abstract class TreeLocations impl
         return create(root, "/");
     }
 
-    @Override
+    /**
+     * Navigate to the parent or an invalid location for the root of the hierarchy.
+     * @return a {@code TreeLocation} for the parent of this location.
+     */
+    @Nonnull
+    public abstract TreeLocation getParent();
+
+    /**
+     * Determine whether the underlying {@link org.apache.jackrabbit.oak.api.Tree} or
+     * {@link org.apache.jackrabbit.oak.api.PropertyState} for this {@code TreeLocation}
+     * is available.
+     * @return  {@code true} if the underlying item is available and has not been disconnected.
+     * @see org.apache.jackrabbit.oak.api.Tree#exists()
+     */
+    public abstract boolean exists();
+
+    /**
+     * The path of this location
+     * @return  path
+     */
+    @Nonnull
+    public abstract String getPath();
+
+    /**
+     * Remove the underlying item.
+     *
+     * @return {@code true} if the item was removed, {@code false} otherwise.
+     */
+    public abstract boolean remove();
+
+    /**
+     * Navigate to a child of the given {@code name}.
+     * @param name  name of the child
+     * @return  this default implementation return a non existing location
+     */
+    @Nonnull
     public TreeLocation getChild(String name) {
         return new NullLocation(this, name);
     }
 
     /**
-     * @return {@code null}
+     * Get the underlying {@link org.apache.jackrabbit.oak.api.Tree} for this {@code TreeLocation}.
+     * @return  this default implementation return {@code null}.
      */
-    @Override
+    @CheckForNull
     public Tree getTree() {
         return null;
     }
 
     /**
-     * @return {@code null}
+     * Get the underlying {@link org.apache.jackrabbit.oak.api.PropertyState} for this {@code
TreeLocation}.
+     * @return  this default implementation return {@code null}.
      */
-    @Override
+    @CheckForNull
     public PropertyState getProperty() {
         return null;
     }
@@ -91,7 +138,7 @@ public abstract class TreeLocations impl
      * This {@code TreeLocation} refers to child tree in a
      * {@code Tree}.
      */
-    private static class NodeLocation extends TreeLocations {
+    private static class NodeLocation extends TreeLocation {
         private final Tree tree;
 
         public NodeLocation(Tree tree) {
@@ -142,7 +189,7 @@ public abstract class TreeLocations impl
      * This {@code TreeLocation} refers to property in a
      * {@code Tree}.
      */
-    private static class PropertyLocation extends TreeLocations {
+    private static class PropertyLocation extends TreeLocation {
         private final Tree parent;
         private final String name;
 
@@ -184,7 +231,7 @@ public abstract class TreeLocations impl
      * This {@code TreeLocation} refers to an invalid location in a tree. That is
      * to a location where no item resides.
      */
-    private static final class NullLocation extends TreeLocations {
+    private static final class NullLocation extends TreeLocation {
         public static final NullLocation NULL = new NullLocation();
 
         private final TreeLocation parent;

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

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeLocation.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlContext.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlContext.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlContext.java
Thu May  2 15:06:19 2013
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.securi
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.security.authorization.permission.PermissionConstants;
 import org.apache.jackrabbit.oak.spi.security.Context;
 import org.apache.jackrabbit.oak.util.TreeUtil;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
Thu May  2 15:06:19 2013
@@ -29,7 +29,7 @@ import org.apache.jackrabbit.JcrConstant
 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.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.ImmutableRoot;
@@ -156,7 +156,7 @@ public class PermissionProviderImpl impl
 
     @Override
     public boolean isGranted(@Nonnull String oakPath, @Nonnull String jcrActions) {
-        TreeLocation location = getImmutableRoot().getLocation(oakPath);
+        TreeLocation location = TreeLocation.create(getImmutableRoot(), oakPath);
         boolean isAcContent = acConfig.getContext().definesLocation(location);
         long permissions = Permissions.getPermissions(jcrActions, location, isAcContent);
 
@@ -260,7 +260,7 @@ public class PermissionProviderImpl impl
             log.debug("Unable to determine versionable path of the version store node.");
             return null;
         } else {
-            return getImmutableRoot().getLocation(versionablePath);
+            return TreeLocation.create(getImmutableRoot(), versionablePath);
         }
     }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContext.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContext.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeContext.java
Thu May  2 15:06:19 2013
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.securi
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.spi.security.Context;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.util.TreeUtil;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
Thu May  2 15:06:19 2013
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.RepositoryException;
@@ -30,7 +31,7 @@ import javax.jcr.nodetype.PropertyDefini
 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.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
@@ -291,9 +292,8 @@ class AuthorizablePropertiesImpl impleme
     }
 
     @Nonnull
-    @Deprecated
     private static TreeLocation getLocation(Tree tree, String relativePath) {
-        TreeLocation loc = tree.getLocation();
+        TreeLocation loc = TreeLocation.create(tree);
         for (String element : Text.explode(relativePath, '/', false)) {
             if (PathUtils.denotesParent(element)) {
                 loc = loc.getParent();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserContext.java
Thu May  2 15:06:19 2013
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.securi
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.spi.security.Context;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.oak.util.TreeUtil;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/Context.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/Context.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/Context.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/Context.java
Thu May  2 15:06:19 2013
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.spi.se
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 
 /**
  * Context... TODO

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java
Thu May  2 15:06:19 2013
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
 import javax.jcr.Session;
 
 import com.google.common.collect.ImmutableSet;
-import org.apache.jackrabbit.oak.api.TreeLocation;
+import org.apache.jackrabbit.oak.core.TreeLocation;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceConstants;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.oak.plugins.version.VersionConstants;

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java?rev=1478403&r1=1478402&r2=1478403&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java
Thu May  2 15:06:19 2013
@@ -27,7 +27,6 @@ import org.apache.jackrabbit.oak.api.Com
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.api.TreeLocation;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -53,7 +52,7 @@ public class TreeLocationTest extends Oa
         tree.addChild("z").addChild("1").addChild("2").setProperty("p", "v");
         root.commit();
 
-        nullLocation = root.getLocation("/").getParent();
+        nullLocation = TreeLocation.create(root).getParent();
     }
 
     @After
@@ -72,13 +71,13 @@ public class TreeLocationTest extends Oa
 
     @Test
     public void testParentOfRoot() {
-        TreeLocation rootLocation = root.getLocation("/");
+        TreeLocation rootLocation = TreeLocation.create(root);
         assertEquals(nullLocation, rootLocation.getParent());
     }
 
     @Test
     public void testNodeLocation() {
-        TreeLocation x = root.getLocation("/x");
+        TreeLocation x = TreeLocation.create(root, "/x");
         assertNotNull(x.getTree());
 
         TreeLocation xyz = x.getChild("y").getChild("z");
@@ -94,7 +93,7 @@ public class TreeLocationTest extends Oa
 
     @Test
     public void testPropertyLocation() {
-        TreeLocation a = root.getLocation("/a");
+        TreeLocation a = TreeLocation.create(root, "/a");
         assertNotNull(a.getProperty());
 
         TreeLocation abc = a.getChild("b").getChild("c");
@@ -110,11 +109,11 @@ public class TreeLocationTest extends Oa
 
     @Test
     public void getDeepLocation() {
-        TreeLocation p = root.getLocation("/z/1/2/p");
+        TreeLocation p = TreeLocation.create(root, "/z/1/2/p");
         assertNotNull(p.getProperty());
         assertEquals("/z/1/2/p", p.getPath());
 
-        TreeLocation n = root.getLocation("/z/1/2/3/4");
+        TreeLocation n = TreeLocation.create(root, "/z/1/2/3/4");
         assertNull(n.getTree());
         assertNull(n.getProperty());
         assertEquals("/z/1/2/3/4", n.getPath());



Mime
View raw message