jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1477009 [1/3] - 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/plugins/name/ oak-core/src/main/java/or...
Date Mon, 29 Apr 2013 12:42:01 GMT
Author: mduerig
Date: Mon Apr 29 12:41:59 2013
New Revision: 1477009

URL: http://svn.apache.org/r1477009
Log:
OAK-798: Review / refactor TreeImpl and related classes
OAK-709: Consider moving permission evaluation to the node state level
- Rename @NonNull variants of Root.getTree, Tree.getParent and Tree.getChild and deprecate @CheckForNull variants
- Deprecate TreeLocation

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/api/TreeLocation.java
    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/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/core/TreeTypeProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistry.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.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/nodetype/write/BuiltInNodeTypes.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventCollector.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventQueueReader.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.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/authorization/permission/PermissionValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBitsProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionWriter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeMigrator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/ContentSessionTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/RootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/TreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/api/UniquePropertyTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerOursTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTheirsTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableTreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/LargeMoveTestIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeLocationTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/RootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java
    jackrabbit/oak/trunk/oak-http/src/main/java/org/apache/jackrabbit/oak/http/OakServlet.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/SessionContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/VersionHistoryDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookIT.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryEngineIT.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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -34,7 +34,7 @@ import javax.annotation.Nonnull;
  * {@link Tree} instances may become disconnected after a call to {@link #refresh()},
  * {@link #rebase()} or {@link #commit()}. Any access to disconnected tree instances
  * - except for  {@link Tree#getName()}, {@link Tree#isRoot()}, {@link Tree#getPath()},
- * {@link Tree#getParent()} and {@link Tree#exists()} - will cause an
+ * {@link Tree#getParentOrNull()} and {@link Tree#exists()} - will cause an
  * {@code InvalidStateException}.
  * TODO document iterability / existence (OAK-798)
  */
@@ -89,7 +89,7 @@ public interface Root {
      * @return tree at the given path.
      */
     @Nonnull
-    Tree getTreeNonNull(@Nonnull String path);
+    Tree getTree(@Nonnull String path);
 
     /**
      * Retrieve the {@code Tree} at the given absolute {@code path}. The path
@@ -98,9 +98,11 @@ public interface Root {
      * @param path absolute path to the tree
      * @return tree at the given path or {@code null} if no such tree exists or
      *         if the tree at {@code path} is not accessible.
+     * @deprecated Use {@link #getTree(String)} and {@link Tree#exists()} instead.
      */
     @CheckForNull
-    Tree getTree(String path);
+    @Deprecated
+    Tree getTreeOrNull(String path);
 
     /**
      * Get a tree location for a given absolute {@code path}
@@ -113,13 +115,13 @@ public interface Root {
 
     /**
      * Rebase this root instance to the latest revision. After a call to this method,
-     * trees obtained through {@link #getTree(String)} may become disconnected.
+     * trees obtained through {@link #getTreeOrNull(String)} may become disconnected.
      */
     void rebase();
 
     /**
      * Reverts all changes made to this root and refreshed to the latest trunk.
-     * After a call to this method, trees obtained through {@link #getTree(String)}
+     * After a call to this method, trees obtained through {@link #getTreeOrNull(String)}
      * may become disconnected.
      */
     void refresh();
@@ -127,7 +129,7 @@ public interface Root {
     /**
      * Atomically apply all changes made to the tree beneath this root to the
      * underlying store and refreshes this root. After a call to this method,
-     * all trees obtained through {@link #getTree(String)} become invalid and fresh
+     * all trees obtained through {@link #getTreeOrNull(String)} become invalid and fresh
      * instances must be obtained.
      *
      * @throws CommitFailedException

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -60,7 +60,7 @@ import javax.annotation.Nullable;
  * {@link Tree} instances may become disconnected after a call to {@link Root#refresh()},
  * {@link Root#rebase()} or {@link Root#commit()}. Any access to disconnected tree instances
  * - except for {@link Tree#getName()}, {@link Tree#isRoot()}, {@link Tree#getPath()},
- * {@link Tree#getParent()} and {@link Tree#exists()} - will cause an
+ * {@link Tree#getParentOrNull()} and {@link Tree#exists()} - will cause an
  * {@code InvalidStateException}.
  * TODO document iterability / existence (OAK-798)
  */
@@ -131,15 +131,17 @@ public interface Tree {
      * @throws IllegalStateException if called on the root tree.
      */
     @Nonnull
-    Tree getParentNonNull();
+    Tree getParent();
 
     /**
      * @return the parent of this {@code Tree} instance. This method returns
      *         {@code null} if the parent is not accessible or if no parent exists (root
      *         node).
+     * @deprecated use {@link #getParent()} and {@link #exists()} instead.
      */
     @CheckForNull
-    Tree getParent();
+    @Deprecated
+    Tree getParentOrNull();
 
     /**
      * Get a property state
@@ -195,7 +197,7 @@ public interface Tree {
      * @return The child with the given {@code name}.
      */
     @Nonnull
-    Tree getChildNonNull(@Nonnull String name);
+    Tree getChild(@Nonnull String name);
 
     /**
      * Get a child of this {@code Tree} instance.
@@ -203,9 +205,11 @@ public interface Tree {
      * @param name The name of the child to retrieve.
      * @return The child with the given {@code name} or {@code null} if no such
      *         child exists or the child is not accessible.
+     * @deprecated use {@link #getChild(String)} and {@link #exists()} instead.
      */
     @CheckForNull
-    Tree getChild(@Nonnull String name);
+    @Deprecated
+    Tree getChildOrNull(@Nonnull String name);
 
     /**
      * Determine if a child of this {@code Tree} instance exists. If no child

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TreeLocation.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TreeLocation.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TreeLocation.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TreeLocation.java Mon Apr 29 12:41:59 2013
@@ -34,7 +34,9 @@ import org.apache.jackrabbit.oak.api.Tre
  * 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.
+ * @deprecated Use {@link Tree} and {@link Tree#exists()} instead.
  */
+@Deprecated
 public interface TreeLocation {
 
     /**

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -224,7 +224,7 @@ public class IdentifierManager {
                 paths = Iterables.filter(paths, new Predicate<String>() {
                     @Override
                     public boolean apply(String path) {
-                        Tree tree = root.getTree(PathUtils.getParentPath(path));
+                        Tree tree = root.getTreeOrNull(PathUtils.getParentPath(path));
                         if (tree != null) {
                             for (String ntName : nodeTypeNames) {
                                 if (nodeTypeManager.isNodeType(tree, ntName)) {

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -58,18 +58,19 @@ public final class ImmutableRoot impleme
 
     @Nonnull
     @Override
-    public ImmutableTree getTreeNonNull(@Nonnull String path) {
+    public ImmutableTree getTree(@Nonnull String path) {
         checkArgument(PathUtils.isAbsolute(path));
         ImmutableTree child = rootTree;
         for (String name : elements(path)) {
-            child = child.getChildNonNull(name);
+            child = child.getChild(name);
         }
         return child;
     }
 
     @Override
-    public ImmutableTree getTree(String path) {
-        ImmutableTree tree = getTreeNonNull(path);
+    @Deprecated
+    public ImmutableTree getTreeOrNull(String path) {
+        ImmutableTree tree = getTree(path);
         return tree.exists() ? tree : null;
     }
 

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -65,7 +65,7 @@ import org.apache.jackrabbit.oak.spi.sta
  *     <li>{@link ParentProvider#ROOTPROVIDER}: 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
+ *     upon hierarchy related methods like {@link #getParentOrNull()}, {@link #getPath()} and
  *     {@link #getIdentifier()}</li>
  * </ul>
  *
@@ -129,7 +129,7 @@ public final class ImmutableTree extends
         if (root instanceof RootImpl) {
             return new ImmutableTree(((RootImpl) root).getBaseState(), typeProvider);
         } else if (root instanceof ImmutableRoot) {
-            return ((ImmutableRoot) root).getTree("/");
+            return ((ImmutableRoot) root).getTreeOrNull("/");
         } else {
             throw new IllegalArgumentException("Unsupported Root implementation.");
         }
@@ -149,7 +149,7 @@ public final class ImmutableTree extends
                 path = "/";
             } else {
                 StringBuilder sb = new StringBuilder();
-                ImmutableTree parent = getParent();
+                ImmutableTree parent = getParentOrNull();
                 sb.append(parent.getPath());
                 if (!parent.isRoot()) {
                     sb.append('/');
@@ -162,20 +162,22 @@ public final class ImmutableTree extends
     }
 
     @Override
-    public ImmutableTree getParent() {
+    @Deprecated
+    public ImmutableTree getParentOrNull() {
         return parentProvider.getParent();
     }
 
     @Nonnull
     @Override
-    public ImmutableTree getChildNonNull(@Nonnull String name) {
+    public ImmutableTree getChild(@Nonnull String name) {
         NodeState child = state.getChildNode(name);
         return new ImmutableTree(this, name, child);
     }
 
     @Override
-    public ImmutableTree getChild(@Nonnull String name) {
-        ImmutableTree child = getChildNonNull(name);
+    @Deprecated
+    public ImmutableTree getChildOrNull(@Nonnull String name) {
+        ImmutableTree child = getChild(name);
         return child.exists() ? child : null;
     }
 
@@ -264,10 +266,10 @@ public final class ImmutableTree extends
         PropertyState property = state.getProperty(JcrConstants.JCR_UUID);
         if (property != null) {
             return property.getValue(STRING);
-        } else if (getParent().isRoot()) {
+        } else if (getParentOrNull().isRoot()) {
             return "/";
         } else {
-            return PathUtils.concat(getParent().getIdentifier(), getName());
+            return PathUtils.concat(getParentOrNull().getIdentifier(), getName());
         }
     }
 

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -96,13 +96,14 @@ public class ReadOnlyTree implements Tre
 
     @Nonnull
     @Override
-    public Tree getParentNonNull() {
+    public Tree getParent() {
         checkState(parent != null, "root tree does not have a parent");
         return parent;
     }
 
     @Override
-    public Tree getParent() {
+    @Deprecated
+    public Tree getParentOrNull() {
         return parent;
     }
 
@@ -137,13 +138,14 @@ public class ReadOnlyTree implements Tre
 
     @Nonnull
     @Override
-    public ReadOnlyTree getChildNonNull(@Nonnull String name) {
+    public ReadOnlyTree getChild(@Nonnull String name) {
         return new ReadOnlyTree(this, name, state.getChildNode(name));
     }
 
     @Override
-    public ReadOnlyTree getChild(@Nonnull String name) {
-        ReadOnlyTree child = getChildNonNull(name);
+    @Deprecated
+    public ReadOnlyTree getChildOrNull(@Nonnull String name) {
+        ReadOnlyTree child = getChild(name);
         return child.exists() ? child : null;
     }
 
@@ -294,7 +296,7 @@ public class ReadOnlyTree implements Tre
 
         @Override
         protected ReadOnlyTree getChildTree(String name) {
-            return tree.getChild(name);
+            return tree.getChildOrNull(name);
         }
 
         @Override

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -185,8 +185,8 @@ public class RootImpl implements Root {
         boolean success = branch.move(sourcePath, destPath);
         reset();
         if (success) {
-            getTree(getParentPath(sourcePath)).updateChildOrder();
-            getTree(getParentPath(destPath)).updateChildOrder();
+            getTreeOrNull(getParentPath(sourcePath)).updateChildOrder();
+            getTreeOrNull(getParentPath(destPath)).updateChildOrder();
             lastMove = lastMove.setMove(sourcePath, destParent, getName(destPath));
         }
         return success;
@@ -199,19 +199,20 @@ public class RootImpl implements Root {
         boolean success = branch.copy(sourcePath, destPath);
         reset();
         if (success) {
-            getTree(getParentPath(destPath)).updateChildOrder();
+            getTreeOrNull(getParentPath(destPath)).updateChildOrder();
         }
         return success;
     }
 
     @Override
-    public TreeImpl getTreeNonNull(@Nonnull String path) {
+    public TreeImpl getTree(@Nonnull String path) {
         checkLive();
         return rootTree.getTree(path);
     }
 
     @Override
-    public TreeImpl getTree(String path) {
+    @Deprecated
+    public TreeImpl getTreeOrNull(String path) {
         checkLive();
         return rootTree.getTreeOrNull(path);
     }

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -146,14 +146,15 @@ public class TreeImpl implements Tree {
     }
 
     @Override
-    public Tree getParentNonNull() {
+    public Tree getParent() {
         checkState(parent != null, "root tree does not have a parent");
         root.checkLive();
         return parent;
     }
 
     @Override
-    public Tree getParent() {
+    @Deprecated
+    public Tree getParentOrNull() {
         enterNoStateCheck();
         if (parent != null && parent.nodeBuilder.exists()) {
             return parent;
@@ -214,15 +215,16 @@ public class TreeImpl implements Tree {
     }
 
     @Override
-    public TreeImpl getChildNonNull(@Nonnull String name) {
+    public TreeImpl getChild(@Nonnull String name) {
         checkNotNull(name);
         enterNoStateCheck();
         return new TreeImpl(root, this, name, pendingMoves);
     }
 
     @Override
-    public TreeImpl getChild(@Nonnull String name) {
-        TreeImpl child = getChildNonNull(name);
+    @Deprecated
+    public TreeImpl getChildOrNull(@Nonnull String name) {
+        TreeImpl child = getChild(name);
         return child.nodeBuilder.exists() ? child : null;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProviderImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProviderImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProviderImpl.java Mon Apr 29 12:41:59 2013
@@ -36,7 +36,7 @@ public final class TreeTypeProviderImpl 
 
     @Override
     public int getType(ImmutableTree tree) {
-        ImmutableTree parent = tree.getParent();
+        ImmutableTree parent = tree.getParentOrNull();
         if (parent == null) {
             return TYPE_DEFAULT;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java Mon Apr 29 12:41:59 2013
@@ -52,9 +52,9 @@ public class Namespaces implements Names
     public static Map<String, String> getNamespaceMap(Tree root) {
         Map<String, String> map = new HashMap<String, String>(DEFAULTS);
 
-        Tree system = root.getChild(JcrConstants.JCR_SYSTEM);
+        Tree system = root.getChildOrNull(JcrConstants.JCR_SYSTEM);
         if (system != null) {
-            Tree namespaces = system.getChild(REP_NAMESPACES);
+            Tree namespaces = system.getChildOrNull(REP_NAMESPACES);
             if (namespaces != null) {
                 for (PropertyState property : namespaces.getProperties()) {
                     String prefix = property.getName();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistry.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistry.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistry.java Mon Apr 29 12:41:59 2013
@@ -59,10 +59,10 @@ public abstract class ReadWriteNamespace
     }
 
     private static Tree getOrCreate(Root root, String... path) {
-        Tree tree = root.getTree("/");
+        Tree tree = root.getTreeOrNull("/");
         assert tree != null;
         for (String name : path) {
-            Tree child = tree.getChild(name);
+            Tree child = tree.getChildOrNull(name);
             if (child == null) {
                 child = tree.addChild(name);
             }
@@ -115,7 +115,7 @@ public abstract class ReadWriteNamespace
     @Override
     public void unregisterNamespace(String prefix) throws RepositoryException {
         Root root = getWriteRoot();
-        Tree namespaces = root.getTree(NAMESPACES_PATH);
+        Tree namespaces = root.getTreeOrNull(NAMESPACES_PATH);
         if (namespaces == null || !namespaces.hasProperty(prefix)) {
             throw new NamespaceException(
                     "Namespace mapping from " + prefix + " to "

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeType.java Mon Apr 29 12:41:59 2013
@@ -312,7 +312,7 @@ public class EffectiveNodeType {
             }
             for (NodeDefinition nd : nodeType.getChildNodeDefinitions()) {
                 String name = nd.getName();
-                if (nd.isMandatory() && !nd.isProtected() && tree.getChild(name) == null) {
+                if (nd.isMandatory() && !nd.isProtected() && tree.getChildOrNull(name) == null) {
                     throw new ConstraintViolationException(
                             "Node '" + name + "' in '" + nodeType.getName() + "' is mandatory");
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java Mon Apr 29 12:41:59 2013
@@ -62,9 +62,9 @@ class NodeDefinitionImpl extends ItemDef
         }
 
         NodeType[] types = new NodeType[oakNames.length];
-        Tree root = definition.getParent().getParent();
+        Tree root = definition.getParentOrNull().getParentOrNull();
         for (int i = 0; i < oakNames.length; i++) {
-            Tree type = root.getChild(oakNames[i]);
+            Tree type = root.getChildOrNull(oakNames[i]);
             checkState(type != null);
             types[i] = new NodeTypeImpl(type, mapper);
         }
@@ -85,8 +85,8 @@ class NodeDefinitionImpl extends ItemDef
     public NodeType getDefaultPrimaryType() {
         String oakName = getName(JcrConstants.JCR_DEFAULTPRIMARYTYPE);
         if (oakName != null) {
-            Tree root = definition.getParent().getParent();
-            Tree type = root.getChild(oakName);
+            Tree root = definition.getParentOrNull().getParentOrNull();
+            Tree type = root.getChildOrNull(oakName);
             checkState(type != null);
             return new NodeTypeImpl(type, mapper);
         } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java Mon Apr 29 12:41:59 2013
@@ -197,10 +197,10 @@ class NodeTypeImpl extends AbstractTypeD
     private void addSupertypes(Tree type, Map<String, NodeType> supertypes) {
         PropertyState property = type.getProperty(JCR_SUPERTYPES);
         if (property != null) {
-            Tree root = definition.getParent();
+            Tree root = definition.getParentOrNull();
             for (String oakName : property.getValue(Type.NAMES)) {
                 if (!supertypes.containsKey(oakName)) {
-                    Tree supertype = root.getChild(oakName);
+                    Tree supertype = root.getChildOrNull(oakName);
                     checkState(supertype != null);
                     supertypes.put(
                             oakName, new NodeTypeImpl(supertype, mapper));
@@ -216,9 +216,9 @@ class NodeTypeImpl extends AbstractTypeD
         String[] oakNames = getNames(JCR_SUPERTYPES);
         if (oakNames != null && oakNames.length > 0) {
             supertypes = new NodeType[oakNames.length];
-            Tree root = definition.getParent();
+            Tree root = definition.getParentOrNull();
             for (int i = 0; i < oakNames.length; i++) {
-                Tree type = root.getChild(oakNames[i]);
+                Tree type = root.getChildOrNull(oakNames[i]);
                 checkState(type != null);
                 supertypes[i] = new NodeTypeImpl(type, mapper);
             }
@@ -230,7 +230,7 @@ class NodeTypeImpl extends AbstractTypeD
     public NodeTypeIterator getSubtypes() {
         Map<String, Set<String>> inheritance = Maps.newHashMap();
         
-        Tree root = definition.getParent();
+        Tree root = definition.getParentOrNull();
         for (Tree child : root.getChildren()) {
             String oakName = getOakName(child);
             PropertyState supertypes = child.getProperty(JCR_SUPERTYPES);
@@ -258,7 +258,7 @@ class NodeTypeImpl extends AbstractTypeD
         if (subnames != null) {
             for (String subname : subnames) {
                 if (!subtypes.containsKey(subname)) {
-                    Tree tree = root.getChild(subname);
+                    Tree tree = root.getChildOrNull(subname);
                     subtypes.put(subname, new NodeTypeImpl(tree, mapper));
                 }
             }
@@ -270,7 +270,7 @@ class NodeTypeImpl extends AbstractTypeD
         List<NodeType> subtypes = Lists.newArrayList();
 
         String oakName = getOakName();
-        Tree root = definition.getParent();
+        Tree root = definition.getParentOrNull();
         for (Tree child : root.getChildren()) {
             PropertyState supertypes = child.getProperty(JCR_SUPERTYPES);
             if (supertypes != null) {
@@ -429,7 +429,7 @@ class NodeTypeImpl extends AbstractTypeD
     }
 
     private ReadOnlyNodeTypeManager getManager() {
-        final Tree types = definition.getParent();
+        final Tree types = definition.getParentOrNull();
         return new ReadOnlyNodeTypeManager() {
             @Override @CheckForNull
             protected Tree getTypes() {
@@ -471,7 +471,7 @@ class NodeTypeImpl extends AbstractTypeD
     }
 
     Iterable<PropertyDefinition> getDeclaredNamedPropertyDefinitions(String oakName) {
-        Tree named = definition.getChild("oak:namedPropertyDefinitions");
+        Tree named = definition.getChildOrNull("oak:namedPropertyDefinitions");
         if (named != null) {
             String escapedName;
             if (JCR_PRIMARYTYPE.equals(oakName)) {
@@ -483,7 +483,7 @@ class NodeTypeImpl extends AbstractTypeD
             } else {
                 escapedName = oakName;
             }
-            Tree definitions = named.getChild(escapedName);
+            Tree definitions = named.getChildOrNull(escapedName);
             if (definitions != null) {
                 return Iterables.transform(
                         definitions.getChildren(),
@@ -500,7 +500,7 @@ class NodeTypeImpl extends AbstractTypeD
     }
 
     Iterable<PropertyDefinition> getDeclaredResidualPropertyDefinitions() {
-        Tree definitions = definition.getChild("oak:residualPropertyDefinitions");
+        Tree definitions = definition.getChildOrNull("oak:residualPropertyDefinitions");
         if (definitions != null) {
             return Iterables.transform(
                     definitions.getChildren(),
@@ -516,9 +516,9 @@ class NodeTypeImpl extends AbstractTypeD
     }
 
     Iterable<NodeDefinition> getDeclaredNamedNodeDefinitions(String oakName) {
-        Tree named = definition.getChild("oak:namedChildNodeDefinitions");
+        Tree named = definition.getChildOrNull("oak:namedChildNodeDefinitions");
         if (named != null) {
-            Tree definitions = named.getChild(oakName);
+            Tree definitions = named.getChildOrNull(oakName);
             if (definitions != null) {
                 return Iterables.transform(
                         definitions.getChildren(),
@@ -535,7 +535,7 @@ class NodeTypeImpl extends AbstractTypeD
     }
 
     Iterable<NodeDefinition> getDeclaredResidualNodeDefinitions() {
-        Tree definitions = definition.getChild("oak:residualChildNodeDefinitions");
+        Tree definitions = definition.getChildOrNull("oak:residualChildNodeDefinitions");
         if (definitions != null) {
             return Iterables.transform(
                     definitions.getChildren(),

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -124,7 +124,7 @@ public abstract class ReadOnlyNodeTypeMa
         return new ReadOnlyNodeTypeManager() {
             @Override
             protected Tree getTypes() {
-                return root.getTree(NODE_TYPES_PATH);
+                return root.getTreeOrNull(NODE_TYPES_PATH);
             }
 
             @Nonnull
@@ -308,7 +308,7 @@ public abstract class ReadOnlyNodeTypeMa
             return true;
         }
 
-        Tree type = types.getChild(typeName);
+        Tree type = types.getChildOrNull(typeName);
         if (type == null) {
             return false;
         }
@@ -411,7 +411,7 @@ public abstract class ReadOnlyNodeTypeMa
     NodeTypeImpl internalGetNodeType(String oakName) throws NoSuchNodeTypeException {
         Tree types = getTypes();
         if (types != null) {
-            Tree type = types.getChild(oakName);
+            Tree type = types.getChildOrNull(oakName);
             if (type != null) {
                 return new NodeTypeImpl(type, getNamePathMapper());
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/BuiltInNodeTypes.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/BuiltInNodeTypes.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/BuiltInNodeTypes.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/BuiltInNodeTypes.java Mon Apr 29 12:41:59 2013
@@ -55,7 +55,7 @@ class BuiltInNodeTypes {
         this.ntMgr =  new ReadWriteNodeTypeManager() {
             @Override
             protected Tree getTypes() {
-                return root.getTree(NODE_TYPES_PATH);
+                return root.getTreeOrNull(NODE_TYPES_PATH);
             }
 
             @Nonnull
@@ -68,7 +68,7 @@ class BuiltInNodeTypes {
         this.nsReg = new ReadWriteNamespaceRegistry() {
             @Override
             protected Tree getReadTree() {
-                return root.getTree("/");
+                return root.getTreeOrNull("/");
             }
             @Override
             protected Root getWriteRoot() {
@@ -80,7 +80,7 @@ class BuiltInNodeTypes {
                 new GlobalNameMapper() {
                     @Override
                     protected Map<String, String> getNamespaceMap() {
-                        return Namespaces.getNamespaceMap(root.getTree("/"));
+                        return Namespaces.getNamespaceMap(root.getTreeOrNull("/"));
                     }
                 }));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java Mon Apr 29 12:41:59 2013
@@ -127,7 +127,7 @@ class NodeTypeTemplateImpl extends Named
     Tree writeTo(Tree parent, boolean allowUpdate) throws RepositoryException {
         String oakName = getOakName();
 
-        Tree type = parent.getChild(oakName);
+        Tree type = parent.getChildOrNull(oakName);
         if (type != null) {
             if (allowUpdate) {
                 type.remove();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java Mon Apr 29 12:41:59 2013
@@ -164,11 +164,11 @@ public abstract class ReadWriteNodeTypeM
     }
 
     private static Tree getOrCreateNodeTypes(Root root) {
-        Tree types = root.getTree(NODE_TYPES_PATH);
+        Tree types = root.getTreeOrNull(NODE_TYPES_PATH);
         if (types == null) {
-            Tree system = root.getTree('/' + JCR_SYSTEM);
+            Tree system = root.getTreeOrNull('/' + JCR_SYSTEM);
             if (system == null) {
-                system = root.getTree("/").addChild(JCR_SYSTEM);
+                system = root.getTreeOrNull("/").addChild(JCR_SYSTEM);
             }
             types = system.addChild(JCR_NODE_TYPES);
         }
@@ -179,9 +179,9 @@ public abstract class ReadWriteNodeTypeM
     public void unregisterNodeType(String name) throws RepositoryException {
         Tree type = null;
         Root root = getWriteRoot();
-        Tree types = root.getTree(NODE_TYPES_PATH);
+        Tree types = root.getTreeOrNull(NODE_TYPES_PATH);
         if (types != null) {
-            type = types.getChild(getOakName(name));
+            type = types.getChildOrNull(getOakName(name));
         }
         if (type == null) {
             throw new NoSuchNodeTypeException("Node type " + name + " can not be unregistered.");
@@ -204,14 +204,14 @@ public abstract class ReadWriteNodeTypeM
     @Override
     public void unregisterNodeTypes(String[] names) throws RepositoryException {
         Root root = getWriteRoot();
-        Tree types = root.getTree(NODE_TYPES_PATH);
+        Tree types = root.getTreeOrNull(NODE_TYPES_PATH);
         if (types == null) {
             throw new NoSuchNodeTypeException("Node types can not be unregistered.");
         }
 
         try {
             for (String name : names) {
-                Tree type = types.getChild(getOakName(name));
+                Tree type = types.getChildOrNull(getOakName(name));
                 if (type == null) {
                     throw new NoSuchNodeTypeException("Node type " + name + " can not be unregistered.");
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventCollector.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventCollector.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventCollector.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventCollector.java Mon Apr 29 12:41:59 2013
@@ -146,7 +146,7 @@ class EventCollector implements Runnable
     }
 
     private static Tree getOrCreate(Tree parent, String name) {
-        Tree child = parent.getChild(name);
+        Tree child = parent.getChildOrNull(name);
         if (child == null) {
             child = parent.addChild(name);
         }
@@ -155,7 +155,7 @@ class EventCollector implements Runnable
 
     private Tree getOrCreateListenerSpec(Root root) {
         return getOrCreate(getOrCreate(getOrCreate(
-                root.getTree('/' + JCR_SYSTEM), REP_OBSERVATION), LISTENERS), getId());
+                root.getTreeOrNull('/' + JCR_SYSTEM), REP_OBSERVATION), LISTENERS), getId());
     }
 
     private Root getLatestRoot() {
@@ -180,7 +180,7 @@ class EventCollector implements Runnable
 
     private void clearFilterSpec() throws CommitFailedException {
         Root root = getLatestRoot();
-        Tree listenerSpec = root.getTree(LISTENER_PATH + '/' + getId());
+        Tree listenerSpec = root.getTreeOrNull(LISTENER_PATH + '/' + getId());
         if  (listenerSpec != null) {
             listenerSpec.remove();
             root.commit();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventQueueReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventQueueReader.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventQueueReader.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventQueueReader.java Mon Apr 29 12:41:59 2013
@@ -73,11 +73,11 @@ public class EventQueueReader {
 
     private Iterator<Tree> getEvents(long next, final String id) {
         if (bundles == null) {
-            bundles = root.getTree(EVENTS_PATH);
+            bundles = root.getTreeOrNull(EVENTS_PATH);
         }
 
         if (bundles != null) {
-            Tree bundle = bundles.getChild(String.valueOf(next));
+            Tree bundle = bundles.getChildOrNull(String.valueOf(next));
             if (bundle != null) {
                 nextBundleId++;
                 if (bundle.getChildrenCount() > 0) {
@@ -97,9 +97,9 @@ public class EventQueueReader {
     private Event createEvent(Tree event, String id) {
         int type = (int) getLong(event, TYPE, 0);
         String path = getJcrPath(event);
-        String userId = getString(event.getChild(id), USER_ID);
+        String userId = getString(event.getChildOrNull(id), USER_ID);
         long date = getLong(event, DATE, 0);
-        String userData = getString(event.getChild(id), USER_DATA);
+        String userData = getString(event.getChildOrNull(id), USER_DATA);
         return new EventImpl(type, path, userId, id, Collections.emptyMap(), date, userData);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java Mon Apr 29 12:41:59 2013
@@ -73,7 +73,7 @@ public class ObservationManagerImpl2 imp
         if (EventQueueWriterProvider.BUNDLE_ID.get() == 0) {
             try {
                 Root root = contentSession.getLatestRoot();
-                Tree events = root.getTree(ObservationConstants.EVENTS_PATH);
+                Tree events = root.getTreeOrNull(ObservationConstants.EVENTS_PATH);
                 if (events != null) {
                     events.remove();
                     root.commit();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java Mon Apr 29 12:41:59 2013
@@ -281,11 +281,11 @@ public class SelectorImpl extends Source
                     return null;
                 }
                 if (p.equals("..")) {
-                    t = t.getParent();
+                    t = t.getParentOrNull();
                 } else if (p.equals(".")) {
                     // same node
                 } else {
-                    t = t.getChild(p);
+                    t = t.getChildOrNull(p);
                 }
             }
             propertyName = PathUtils.getName(propertyName);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java Mon Apr 29 12:41:59 2013
@@ -163,7 +163,7 @@ public class TokenProviderImpl implement
         try {
             Authorizable user = userManager.getAuthorizable(userId);
             if (user != null && !user.isGroup()) {
-                NodeUtil userNode = new NodeUtil(root.getTree(user.getPath()));
+                NodeUtil userNode = new NodeUtil(root.getTreeOrNull(user.getPath()));
                 NodeUtil tokenParent = userNode.getChild(TOKENS_NODE_NAME);
                 if (tokenParent == null) {
                     tokenParent = userNode.addChild(TOKENS_NODE_NAME, TOKENS_NT_NAME);
@@ -308,7 +308,7 @@ public class TokenProviderImpl implement
     @CheckForNull
     private Tree getTokenTree(TokenInfo tokenInfo) {
         if (tokenInfo instanceof TokenInfoImpl) {
-            return root.getTree(((TokenInfoImpl) tokenInfo).tokenPath);
+            return root.getTreeOrNull(((TokenInfoImpl) tokenInfo).tokenPath);
         } else {
             return null;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java Mon Apr 29 12:41:59 2013
@@ -189,7 +189,7 @@ class AccessControlImporter implements P
     @CheckForNull
     private JackrabbitAccessControlList getACL(Tree tree) throws RepositoryException {
         String nodeName = tree.getName();
-        Tree parent = tree.getParent();
+        Tree parent = tree.getParentOrNull();
 
         if (parent != null) {
             if (AccessControlConstants.REP_POLICY.equals(nodeName)

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImpl.java Mon Apr 29 12:41:59 2013
@@ -170,7 +170,7 @@ public class AccessControlManagerImpl im
         if (oakPath != null) {
             String parentPath = Text.getRelativeParent(oakPath, 1);
             while (!parentPath.isEmpty()) {
-                Tree t = root.getTree(parentPath);
+                Tree t = root.getTreeOrNull(parentPath);
                 AccessControlPolicy plc = createACL(parentPath, t, true);
                 if (plc != null) {
                     effective.add(plc);
@@ -359,7 +359,7 @@ public class AccessControlManagerImpl im
         for (ResultRow row : aceResult.getRows()) {
             String acePath = row.getPath();
             String aclName = Text.getName(Text.getRelativeParent(acePath, 1));
-            Tree accessControlledTree = root.getTree(Text.getRelativeParent(acePath, 2));
+            Tree accessControlledTree = root.getTreeOrNull(Text.getRelativeParent(acePath, 2));
 
             if (aclName.isEmpty() || accessControlledTree == null) {
                 log.debug("Isolated access control entry -> ignore query result at " + acePath);
@@ -411,7 +411,7 @@ public class AccessControlManagerImpl im
 
     @Nonnull
     private Tree getTree(@Nullable String oakPath, long permissions) throws RepositoryException {
-        Tree tree = (oakPath == null) ? root.getTree("/") : root.getTree(oakPath);
+        Tree tree = (oakPath == null) ? root.getTreeOrNull("/") : root.getTreeOrNull(oakPath);
         if (tree == null) {
             throw new PathNotFoundException("No tree at " + oakPath);
         }
@@ -477,7 +477,7 @@ public class AccessControlManagerImpl im
     @CheckForNull
     private Tree getAclTree(@Nullable String oakPath, @Nonnull Tree accessControlledTree) {
         if (isAccessControlled(accessControlledTree, getMixinName(oakPath))) {
-            Tree policyTree = accessControlledTree.getChild(getAclName(oakPath));
+            Tree policyTree = accessControlledTree.getChildOrNull(getAclName(oakPath));
             if (policyTree != null) {
                 return policyTree;
             }
@@ -518,7 +518,7 @@ public class AccessControlManagerImpl im
         String mixinName = getMixinName(oakPath);
 
         if (accessControlledTree != null && isAccessControlled(accessControlledTree, mixinName)) {
-            Tree aclTree = accessControlledTree.getChild(aclName);
+            Tree aclTree = accessControlledTree.getChildOrNull(aclName);
             if (aclTree != null) {
                 List<JackrabbitAccessControlEntry> entries = new ArrayList<JackrabbitAccessControlEntry>();
                 for (Tree child : aclTree.getChildren()) {
@@ -543,7 +543,7 @@ public class AccessControlManagerImpl im
         RestrictionProvider restrProvider = new PrincipalRestrictionProvider(restrictionProvider, namePathMapper);
         List<JackrabbitAccessControlEntry> entries = new ArrayList<JackrabbitAccessControlEntry>();
         for (ResultRow row : aceResult.getRows()) {
-            Tree aceTree = root.getTree(row.getPath());
+            Tree aceTree = root.getTreeOrNull(row.getPath());
             if (isACE(aceTree)) {
                 String aclPath = Text.getRelativeParent(aceTree.getPath(), 1);
                 String path;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidator.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidator.java Mon Apr 29 12:41:59 2013
@@ -90,7 +90,7 @@ class AccessControlValidator extends Def
 
     @Override
     public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
-        Tree treeAfter = checkNotNull(parentAfter.getChild(name));
+        Tree treeAfter = checkNotNull(parentAfter.getChildOrNull(name));
 
         checkValidTree(parentAfter, treeAfter);
         return new AccessControlValidator(null, treeAfter, privileges, restrictionProvider, ntMgr);
@@ -98,8 +98,8 @@ class AccessControlValidator extends Def
 
     @Override
     public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException {
-        Tree treeBefore = checkNotNull(parentBefore.getChild(name));
-        Tree treeAfter = checkNotNull(parentAfter.getChild(name));
+        Tree treeBefore = checkNotNull(parentBefore.getChildOrNull(name));
+        Tree treeAfter = checkNotNull(parentAfter.getChildOrNull(name));
 
         checkValidTree(parentAfter, treeAfter);
         return new AccessControlValidator(treeBefore, treeAfter, privileges, restrictionProvider, ntMgr);
@@ -173,7 +173,7 @@ class AccessControlValidator extends Def
     }
 
     private void checkValidAccessControlEntry(Tree aceNode) throws CommitFailedException {
-        Tree parent = aceNode.getParent();
+        Tree parent = aceNode.getParentOrNull();
         if (parent == null || !NT_REP_ACL.equals(TreeUtil.getPrimaryTypeName(parent))) {
             throw accessViolation(7, "Isolated access control entry at " + aceNode.getPath());
         }
@@ -208,7 +208,7 @@ class AccessControlValidator extends Def
 
     private void checkValidRestrictions(Tree aceTree) throws CommitFailedException {
         String path;
-        Tree aclTree = checkNotNull(aceTree.getParent());
+        Tree aclTree = checkNotNull(aceTree.getParentOrNull());
         String aclPath = aclTree.getPath();
         if (REP_REPO_POLICY.equals(Text.getName(aclPath))) {
             path = null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java Mon Apr 29 12:41:59 2013
@@ -95,7 +95,7 @@ class CompiledPermissionImpl implements 
         if (!refresh) {
             for (Map.Entry<String, ImmutableTree> entry : trees.entrySet()) {
                 ImmutableTree t = entry.getValue();
-                ImmutableTree t2 = permissionsTree.getChild(t.getName());
+                ImmutableTree t2 = permissionsTree.getChildOrNull(t.getName());
                 if (t2 != null && !t.equals(t2)) {
                     refresh = true;
                     break;
@@ -152,7 +152,7 @@ class CompiledPermissionImpl implements 
     //------------------------------------------------------------< private >---
     @CheckForNull
     private static ImmutableTree getPrincipalRoot(ImmutableTree permissionsTree, Principal principal) {
-        return permissionsTree.getChild(Text.escapeIllegalJcrChars(principal.getName()));
+        return permissionsTree.getChildOrNull(Text.escapeIllegalJcrChars(principal.getName()));
     }
 
     private void buildEntries(@Nullable ImmutableTree permissionsTree) {
@@ -205,7 +205,7 @@ class CompiledPermissionImpl implements 
         if (respectParent) {
             parentAllowBits = PrivilegeBits.getInstance();
             parentDenyBits = PrivilegeBits.getInstance();
-            parent = (tree != null) ? tree.getParent() : null;
+            parent = (tree != null) ? tree.getParentOrNull() : null;
             parentPath = (path != null) ? Strings.emptyToNull(Text.getRelativeParent(path, 1)) : null;
         } else {
             parentAllowBits = PrivilegeBits.EMPTY;

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=1477009&r1=1477008&r2=1477009&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 Mon Apr 29 12:41:59 2013
@@ -251,7 +251,7 @@ public class PermissionProviderImpl impl
                 }
                 break;
             }
-            t = t.getParent();
+            t = t.getParentOrNull();
         }
 
         if (versionablePath == null || versionablePath.length() == 0) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidator.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionValidator.java Mon Apr 29 12:41:59 2013
@@ -87,7 +87,7 @@ class PermissionValidator extends Defaul
         if (TreeImpl.OAK_CHILD_ORDER.equals(after.getName())) {
             String childName = new ChildOrderDiff(before, after).firstReordered();
             if (childName != null) {
-                Tree child = parentAfter.getChild(childName);
+                Tree child = parentAfter.getChildOrNull(childName);
                 checkPermissions(child, false, Permissions.MODIFY_CHILD_NODE_COLLECTION);
             } // else: no re-order but only internal update
         } else {
@@ -102,7 +102,7 @@ class PermissionValidator extends Defaul
 
     @Override
     public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
-        Tree child = checkNotNull(parentAfter.getChild(name));
+        Tree child = checkNotNull(parentAfter.getChildOrNull(name));
         if (isVersionstorageTree(child)) {
             child = getVersionHistoryTree(child);
             if (child == null) {
@@ -117,8 +117,8 @@ class PermissionValidator extends Defaul
 
     @Override
     public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException {
-        Tree childBefore = parentBefore.getChild(name);
-        Tree childAfter = parentAfter.getChild(name);
+        Tree childBefore = parentBefore.getChildOrNull(name);
+        Tree childAfter = parentAfter.getChildOrNull(name);
 
         // TODO
 
@@ -127,7 +127,7 @@ class PermissionValidator extends Defaul
 
     @Override
     public Validator childNodeDeleted(String name, NodeState before) throws CommitFailedException {
-        Tree child = checkNotNull(parentBefore.getChild(name));
+        Tree child = checkNotNull(parentBefore.getChildOrNull(name));
         if (isVersionstorageTree(child)) {
             // TODO: check again
             throw new CommitFailedException(

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/restriction/RestrictionProviderImpl.java Mon Apr 29 12:41:59 2013
@@ -165,7 +165,7 @@ public class RestrictionProviderImpl imp
 
     @Nonnull
     private Tree getRestrictionsTree(Tree aceTree) {
-        Tree restrictions = aceTree.getChild(REP_RESTRICTIONS);
+        Tree restrictions = aceTree.getChildOrNull(REP_RESTRICTIONS);
         if (restrictions == null) {
             // no rep:restrictions tree -> read from aceTree for backwards compatibility
             restrictions = aceTree;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBitsProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBitsProvider.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBitsProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBitsProvider.java Mon Apr 29 12:41:59 2013
@@ -60,7 +60,7 @@ public final class PrivilegeBitsProvider
      */
     @CheckForNull
     Tree getPrivilegesTree() {
-        return root.getTree(PRIVILEGES_PATH);
+        return root.getTreeOrNull(PRIVILEGES_PATH);
     }
 
     @Nonnull
@@ -91,7 +91,7 @@ public final class PrivilegeBitsProvider
         }
         PrivilegeBits bits = PrivilegeBits.getInstance();
         for (String privilegeName : privilegeNames) {
-            Tree defTree = privilegesTree.getChild(checkNotNull(privilegeName));
+            Tree defTree = privilegesTree.getChildOrNull(checkNotNull(privilegeName));
             if (defTree != null) {
                 bits.add(PrivilegeBits.getInstance(defTree));
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java Mon Apr 29 12:41:59 2013
@@ -38,7 +38,7 @@ class PrivilegeDefinitionReader implemen
     private final Tree privilegesTree;
 
     PrivilegeDefinitionReader(@Nonnull Root root) {
-        this.privilegesTree = root.getTree(PRIVILEGES_PATH);
+        this.privilegesTree = root.getTreeOrNull(PRIVILEGES_PATH);
     }
 
     /**
@@ -74,7 +74,7 @@ class PrivilegeDefinitionReader implemen
         if (privilegesTree == null) {
             return null;
         } else {
-            Tree definitionTree = privilegesTree.getChild(privilegeName);
+            Tree definitionTree = privilegesTree.getChildOrNull(privilegeName);
             return (isPrivilegeDefinition(definitionTree)) ? readDefinition(definitionTree) : null;
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionWriter.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionWriter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionWriter.java Mon Apr 29 12:41:59 2013
@@ -96,7 +96,7 @@ class PrivilegeDefinitionWriter implemen
     private void writeDefinitions(Iterable<PrivilegeDefinition> definitions) throws RepositoryException {
         try {
             // make sure the privileges path is defined
-            Tree privilegesTree = root.getTree(PRIVILEGES_PATH);
+            Tree privilegesTree = root.getTreeOrNull(PRIVILEGES_PATH);
             if (privilegesTree == null) {
                 throw new RepositoryException("Privilege store does not exist.");
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeMigrator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeMigrator.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeMigrator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeMigrator.java Mon Apr 29 12:41:59 2013
@@ -72,7 +72,7 @@ public class PrivilegeMigrator {
 
                 @Override
                 protected Tree getReadTree() {
-                    return root.getTree("/");
+                    return root.getTreeOrNull("/");
                 }
             };
             for (PrivilegeDefinition def : readCustomDefinitions(privilegeStream, nsRegistry)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidator.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeValidator.java Mon Apr 29 12:41:59 2013
@@ -130,7 +130,7 @@ class PrivilegeValidator extends Default
 
     @Nonnull
     private Tree getPrivilegesTree(Root root) throws CommitFailedException {
-        Tree privilegesTree = root.getTree(PRIVILEGES_PATH);
+        Tree privilegesTree = root.getTreeOrNull(PRIVILEGES_PATH);
         if (privilegesTree == null) {
             throw new CommitFailedException(CONSTRAINT, 44, "Privilege store not initialized.");
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java Mon Apr 29 12:41:59 2013
@@ -56,7 +56,7 @@ abstract class AuthorizableBaseProvider 
 
     @CheckForNull
     Tree getByPath(@Nonnull String authorizableOakPath) {
-        Tree tree = root.getTree(authorizableOakPath);
+        Tree tree = root.getTreeOrNull(authorizableOakPath);
         if (UserUtility.isType(tree, AuthorizableType.AUTHORIZABLE)) {
             return tree;
         } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java Mon Apr 29 12:41:59 2013
@@ -121,7 +121,7 @@ class MembershipProvider extends Authori
     Iterator<String> getMembers(Tree groupTree, AuthorizableType authorizableType, boolean includeInherited) {
         Iterable memberPaths = Collections.emptySet();
         if (useMemberNode(groupTree)) {
-            Tree membersTree = groupTree.getChild(REP_MEMBERS);
+            Tree membersTree = groupTree.getChildOrNull(REP_MEMBERS);
             if (membersTree != null) {
                 throw new UnsupportedOperationException("not implemented: retrieve members from member-node hierarchy");
             }
@@ -157,7 +157,7 @@ class MembershipProvider extends Authori
             }
         } else {
             if (useMemberNode(groupTree)) {
-                Tree membersTree = groupTree.getChild(REP_MEMBERS);
+                Tree membersTree = groupTree.getChildOrNull(REP_MEMBERS);
                 if (membersTree != null) {
                     // FIXME: fix.. testing for property name in jr2 wasn't correct.
                     // TODO OAK-482: add implementation
@@ -204,7 +204,7 @@ class MembershipProvider extends Authori
 
     boolean removeMember(Tree groupTree, Tree memberTree) {
         if (useMemberNode(groupTree)) {
-            Tree membersTree = groupTree.getChild(REP_MEMBERS);
+            Tree membersTree = groupTree.getChildOrNull(REP_MEMBERS);
             if (membersTree != null) {
                 // TODO OAK-482: add implementation
                 throw new UnsupportedOperationException("not implemented: remove member from member-node hierarchy");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java Mon Apr 29 12:41:59 2013
@@ -345,7 +345,7 @@ class UserImporter implements ProtectedP
         if (isMemberNode(protectedParent)) {
             Tree groupTree = protectedParent;
             while (isMemberNode(groupTree)) {
-                groupTree = groupTree.getParent();
+                groupTree = groupTree.getParentOrNull();
             }
             Authorizable auth = (groupTree == null) ? null : userManager.getAuthorizable(groupTree);
             if (auth == null) {
@@ -528,7 +528,7 @@ class UserImporter implements ProtectedP
             // handling non-existing members in case of best-effort
             if (!nonExisting.isEmpty()) {
                 log.info("ImportBehavior.BESTEFFORT: Found " + nonExisting.size() + " entries of rep:members pointing to non-existing authorizables. Adding to rep:members.");
-                Tree groupTree = root.getTree(gr.getPath());
+                Tree groupTree = root.getTreeOrNull(gr.getPath());
 
                 MembershipProvider membershipProvider = userManager.getMembershipProvider();
                 for (Membership.Member member : nonExisting) {
@@ -611,7 +611,7 @@ class UserImporter implements ProtectedP
             }
 
             if (!nonExisting.isEmpty()) {
-                Tree userTree = checkNotNull(root.getTree(a.getPath()));
+                Tree userTree = checkNotNull(root.getTreeOrNull(a.getPath()));
                 // copy over all existing impersonators to the nonExisting list
                 PropertyState impersonators = userTree.getProperty(REP_IMPERSONATORS);
                 if (impersonators != null) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserInitializer.java Mon Apr 29 12:41:59 2013
@@ -105,7 +105,7 @@ class UserInitializer implements Workspa
 
         String errorMsg = "Failed to initialize user content.";
         try {
-            NodeUtil rootTree = checkNotNull(new NodeUtil(root.getTree("/")));
+            NodeUtil rootTree = checkNotNull(new NodeUtil(root.getTreeOrNull("/")));
             NodeUtil index = rootTree.getOrAddChild(IndexConstants.INDEX_DEFINITIONS_NAME, JcrConstants.NT_UNSTRUCTURED);
 
             if (!index.hasChild("authorizableId")) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java?rev=1477009&r1=1477008&r2=1477009&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java Mon Apr 29 12:41:59 2013
@@ -145,7 +145,7 @@ import static org.apache.jackrabbit.oak.
  *
  * <h3>By Path</h3>
  * Access by path consists of a simple lookup by path such as exposed by
- * {@link Root#getTree(String)}. The resulting tree is validated to really
+ * {@link Root#getTreeOrNull(String)}. The resulting tree is validated to really
  * represent a user/group tree.
  *
  * <h3>By Principal</h3>
@@ -198,7 +198,7 @@ class UserProvider extends AuthorizableB
     @CheckForNull
     Tree getAuthorizableByPrincipal(Principal principal) {
         if (principal instanceof TreeBasedPrincipal) {
-            return root.getTree(((TreeBasedPrincipal) principal).getOakPath());
+            return root.getTreeOrNull(((TreeBasedPrincipal) principal).getOakPath());
         }
 
         // NOTE: in contrast to JR2 the extra shortcut for ID==principalName
@@ -217,7 +217,7 @@ class UserProvider extends AuthorizableB
             Iterator<? extends ResultRow> rows = result.getRows().iterator();
             if (rows.hasNext()) {
                 String path = rows.next().getPath();
-                return root.getTree(path);
+                return root.getTreeOrNull(path);
             }
         } catch (ParseException ex) {
             log.error("Failed to retrieve authorizable by principal", ex);
@@ -273,9 +273,9 @@ class UserProvider extends AuthorizableB
                                        boolean isGroup, String intermediatePath) throws RepositoryException {
         String authRoot = (isGroup) ? groupPath : userPath;
         NodeUtil folder;
-        Tree authTree = root.getTree(authRoot);
+        Tree authTree = root.getTreeOrNull(authRoot);
         if (authTree == null) {
-            folder = new NodeUtil(root.getTree("/"));
+            folder = new NodeUtil(root.getTreeOrNull("/"));
             for (String name : Text.explode(authRoot, '/', false)) {
                 folder = folder.getOrAddChild(name, NT_REP_AUTHORIZABLE_FOLDER);
             }



Mime
View raw message