jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1485747 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/j...
Date Thu, 23 May 2013 14:52:28 GMT
Author: mduerig
Date: Thu May 23 14:52:27 2013
New Revision: 1485747

URL: http://svn.apache.org/r1485747
Log:
OAK-813: Removing a Node if the parent is not accessible
replace usages of NodeBuilder.removeChildNode with NodeBuilder.remove and remove deprecated
removeChildNode method

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecuredNodeRebaseDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/MergingNodeStateDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MergeDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractRebaseDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompareAgainstBaseStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
    jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecuredNodeRebaseDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecuredNodeRebaseDiff.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecuredNodeRebaseDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecuredNodeRebaseDiff.java
Thu May 23 14:52:27 2013
@@ -128,7 +128,7 @@ class SecuredNodeRebaseDiff extends Abst
      */
     @Override
     protected void deleteChangedNode(NodeBuilder builder, String name, NodeState before)
{
-        builder.removeChildNode(name);
+        builder.getChildNode(name).remove();
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/MergingNodeStateDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/MergingNodeStateDiff.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/MergingNodeStateDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/commit/MergingNodeStateDiff.java
Thu May 23 14:52:27 2013
@@ -81,7 +81,7 @@ public final class MergingNodeStateDiff 
                 resolveConflict(conflict.getName(), conflict.getNodeState());
             }
 
-            target.removeChildNode(CONFLICT);
+            target.getChildNode(CONFLICT).remove();
         }
         return true;
     }
@@ -150,7 +150,7 @@ public final class MergingNodeStateDiff 
                 addChild(target, name, ours);
             }
         }
-        conflictMarker.removeChildNode(name);
+        conflictMarker.getChildNode(name).remove();
     }
 
     private NodeBuilder getConflictMarker(String conflictName) {
@@ -243,7 +243,7 @@ public final class MergingNodeStateDiff 
     }
 
     private static void removeChild(NodeBuilder target, String name) {
-        target.removeChildNode(name);
+        target.getChildNode(name).remove();
         PropertyState childOrder = target.getProperty(TreeImpl.OAK_CHILD_ORDER);
         if (childOrder != null) {
             PropertyBuilder<String> builder = MemoryPropertyBuilder.copy(Type.STRING,
childOrder);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
Thu May 23 14:52:27 2013
@@ -99,7 +99,7 @@ class IndexUpdate implements Editor {
                         // as we don't know the index content node name
                         // beforehand, we'll remove all child nodes
                         for (String rm : definition.getChildNodeNames()) {
-                            definition.removeChildNode(rm);
+                            definition.getChildNode(rm).remove();
                         }
                         reindex.add(editor);
                     } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java
Thu May 23 14:52:27 2013
@@ -96,7 +96,7 @@ public class ContentMirrorStoreStrategy 
                     NodeBuilder childEntry = indexEntry.child(name);
                     childEntry.removeProperty("match");
                     if (childEntry.getChildNodeCount() == 0) {
-                        indexEntry.removeChildNode(name);
+                        indexEntry.getChildNode(name).remove();
                     }
                 }
             }
@@ -114,7 +114,7 @@ public class ContentMirrorStoreStrategy 
         pruneNode(child);
         if (child.getChildNodeCount() == 0
                 && !child.hasProperty("match")) {
-            index.removeChildNode(key);
+            index.getChildNode(key).remove();
         }
     }
 
@@ -126,7 +126,7 @@ public class ContentMirrorStoreStrategy 
             NodeBuilder segment = parent.child(name);
             if (segment.getChildNodeCount() == 0
                     && !segment.hasProperty("match")) {
-                parent.removeChildNode(name);
+                parent.getChildNode(name).remove();
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Thu May 23 14:52:27 2013
@@ -290,18 +290,13 @@ public class MemoryNodeBuilder implement
     }
 
     @Override
-    public NodeBuilder removeChildNode(String name) {
-        if (write().removeChildNode(checkNotNull(name))) {
-            updated();
-        }
-        return this;
-    }
-
-    @Override
-    public void remove() {
-        write();
-        if (parent.head.removeChildNode(name)) {
-            updated();
+    public boolean remove() {
+        if (!exists()) {
+            return false;
+        } else {
+            write();
+            parent.head.removeChildNode(name);
+            return true;
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationEditor.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/RegistrationEditor.java
Thu May 23 14:52:27 2013
@@ -242,10 +242,10 @@ class RegistrationEditor extends Default
         type.setProperty(OAK_HAS_PROTECTED_RESIDUAL_PROPERTIES, false, BOOLEAN);
         type.setProperty(OAK_HAS_PROTECTED_RESIDUAL_CHILD_NODES, false, BOOLEAN);
         type.setProperty(OAK_NAMED_SINGLE_VALUED_PROPERTIES, empty, NAMES);
-        type.removeChildNode(OAK_NAMED_PROPERTY_DEFINITIONS);
-        type.removeChildNode(OAK_RESIDUAL_PROPERTY_DEFINITIONS);
-        type.removeChildNode(OAK_NAMED_CHILD_NODE_DEFINITIONS);
-        type.removeChildNode(OAK_RESIDUAL_CHILD_NODE_DEFINITIONS);
+        type.getChildNode(OAK_NAMED_PROPERTY_DEFINITIONS).remove();
+        type.getChildNode(OAK_RESIDUAL_PROPERTY_DEFINITIONS).remove();
+        type.getChildNode(OAK_NAMED_CHILD_NODE_DEFINITIONS).remove();
+        type.getChildNode(OAK_RESIDUAL_CHILD_NODE_DEFINITIONS).remove();
 
         // + jcr:propertyDefinition (nt:propertyDefinition)
         //   = nt:propertyDefinition protected sns

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MergeDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MergeDiff.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MergeDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MergeDiff.java
Thu May 23 14:52:27 2013
@@ -77,7 +77,7 @@ public class MergeDiff implements NodeSt
     public boolean childNodeDeleted(String name, NodeState before) {
         if (builder.hasChildNode(name)
                 && before.equals(builder.child(name).getNodeState())) {
-            builder.removeChildNode(name);
+            builder.getChildNode(name).remove();
         }
         return true;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
Thu May 23 14:52:27 2013
@@ -160,7 +160,7 @@ class SegmentNodeStoreBranch extends Abs
 
         NodeState sourceState = sourceBuilder.child(sourceName).getNodeState();
         targetBuilder.setChildNode(targetName, sourceState);
-        sourceBuilder.removeChildNode(sourceName);
+        sourceBuilder.getChildNode(sourceName).remove();
 
         setRoot(builder.getNodeState());
         return true;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
Thu May 23 14:52:27 2013
@@ -18,18 +18,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.version;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-import javax.jcr.nodetype.PropertyDefinition;
-import javax.jcr.version.OnParentVersionAction;
-
 import static com.google.common.base.Preconditions.checkNotNull;
 import static javax.jcr.version.OnParentVersionAction.ABORT;
 import static javax.jcr.version.OnParentVersionAction.COMPUTE;
@@ -56,6 +44,19 @@ import static org.apache.jackrabbit.JcrC
 import static org.apache.jackrabbit.oak.plugins.version.Utils.primaryTypeOf;
 import static org.apache.jackrabbit.oak.plugins.version.Utils.uuidFromNode;
 
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.version.OnParentVersionAction;
+
+import com.google.common.collect.Lists;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
@@ -66,8 +67,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.util.TODO;
 
-import com.google.common.collect.Lists;
-
 /**
  * <code>VersionableState</code> provides methods to create a versionable state
  * for a version based on a versionable node.
@@ -246,7 +245,7 @@ class VersionableState {
         String primaryType = primaryTypeOf(src);
         if (primaryType.equals(NT_FROZENNODE)) {
             // replace with frozen state
-            destParent.removeChildNode(name);
+            destParent.getChildNode(name).remove();
             restoreFrozen(src, destParent.child(name), selector);
         } else if (primaryType.equals(NT_VERSIONEDCHILD)) {
             // only perform chained restore if the node didn't exist
@@ -256,7 +255,7 @@ class VersionableState {
             }
         } else {
             // replace
-            destParent.removeChildNode(name);
+            destParent.getChildNode(name).remove();
             restoreNode(src, destParent.child(name), selector);
         }
     }
@@ -366,7 +365,7 @@ class VersionableState {
             int action = getOPV(dest, srcChild, name);
             if (action == COPY) {
                 // replace on destination
-                dest.removeChildNode(name);
+                dest.getChildNode(name).remove();
                 restoreNode(srcChild, dest.child(name), selector);
             } else if (action == VERSION) {
                 restoreState(srcChild, dest, name, selector);
@@ -379,7 +378,7 @@ class VersionableState {
             NodeBuilder destChild = dest.getChildNode(name);
             int action = getOPV(dest, destChild, name);
             if (action == COPY || action == VERSION || action == ABORT) {
-                dest.removeChildNode(name);
+                dest.getChildNode(name).remove();
             } else if (action == IGNORE) {
                 // no action
             } else if (action == INITIALIZE) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHook.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHook.java
Thu May 23 14:52:27 2013
@@ -16,9 +16,15 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.permission;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
+import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
@@ -35,10 +41,10 @@ import org.apache.jackrabbit.oak.core.Im
 import org.apache.jackrabbit.oak.core.TreeImpl;
 import org.apache.jackrabbit.oak.core.TreeTypeProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
-import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConstants;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBits;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBitsProvider;
 import org.apache.jackrabbit.oak.spi.commit.PostValidationHook;
+import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConstants;
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction;
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider;
 import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
@@ -50,11 +56,6 @@ import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
-import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
-
 /**
  * {@code CommitHook} implementation that processes any modification made to
  * access control content and updates persisted permission caches associated
@@ -213,7 +214,7 @@ public class PermissionHook implements P
             PermissionEntry entry = createPermissionEntry(name, ace, parentBefore);
             NodeBuilder principalRoot = getPrincipalRoot(entry.principalName);
             if (principalRoot != null) {
-                principalRoot.removeChildNode(entry.nodeName);
+                principalRoot.getChildNode(entry.nodeName).remove();
             }
         }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractRebaseDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractRebaseDiff.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractRebaseDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractRebaseDiff.java
Thu May 23 14:52:27 2013
@@ -228,7 +228,7 @@ public abstract class AbstractRebaseDiff
         if (!builder.hasChildNode(name)) {
             deleteDeletedNode(builder, name, before);
         } else if (before.equals(builder.child(name).getNodeState())) {
-            builder.removeChildNode(name);
+            builder.getChildNode(name).remove();
         } else {
             deleteChangedNode(builder, name, before);
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeBuilder.java
Thu May 23 14:52:27 2013
@@ -162,7 +162,7 @@ public interface NodeBuilder {
      * had been made after each update. Repeated calls to this method with
      * the same name will return the same child builder instance until an
      * explicit {@link #setChildNode(String, NodeState)} or
-     * {@link #removeChildNode(String)} call is made, at which point the link
+     * {@link #remove())} call is made, at which point the link
      * between this builder and a previously returned child builder for
      * that child node name will get broken.
      *
@@ -208,21 +208,10 @@ public interface NodeBuilder {
     NodeBuilder setChildNode(String name, @Nonnull NodeState nodeState);
 
     /**
-     * Remove a child node. This method has no effect if a
-     * name of the given {@code name} does not exist.
-     *
-     * @param name  name of the child node
-     * @return this builder
-     * @deprecated Use {@link #remove()}
-     */
-    @Nonnull
-    @Deprecated
-    NodeBuilder removeChildNode(String name);
-
-    /**
      * Remove this child node from its parent.
+     * @return {@code true} for existing nodes, {@code false} otherwise
      */
-    void remove();
+    boolean remove();
 
     /**
      * Returns the current number of properties.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/ReadOnlyBuilder.java
Thu May 23 14:52:27 2013
@@ -88,13 +88,8 @@ public class ReadOnlyBuilder implements 
         throw unsupported();
     }
 
-    @Override @Nonnull
-    public NodeBuilder removeChildNode(String name) {
-        throw unsupported();
-    }
-
     @Override
-    public void remove() {
+    public boolean remove() {
         throw unsupported();
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeBuilderTest.java
Thu May 23 14:52:27 2013
@@ -19,6 +19,9 @@
 
 package org.apache.jackrabbit.oak.kernel;
 
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
@@ -28,9 +31,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
 public class KernelNodeBuilderTest {
 
     @Test
@@ -65,7 +65,7 @@ public class KernelNodeBuilderTest {
         assertTrue("child node x/y/z should be present", builder.child("x")
                 .child("y").hasChildNode("z"));
 
-        builder.removeChildNode("x");
+        builder.getChildNode("x").remove();
         assertFalse("child node x not should be present",
                 builder.hasChildNode("x"));
         assertFalse("child node x/y not should be present", builder.child("x")

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
Thu May 23 14:52:27 2013
@@ -18,6 +18,12 @@
  */
 package org.apache.jackrabbit.oak.kernel;
 
+import static junit.framework.Assert.assertFalse;
+import static org.apache.jackrabbit.oak.api.Type.LONG;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -37,12 +43,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.Before;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertFalse;
-import static org.apache.jackrabbit.oak.api.Type.LONG;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class KernelNodeStoreTest {
 
     private KernelNodeStore store;
@@ -82,7 +82,7 @@ public class KernelNodeStoreTest {
         NodeBuilder testBuilder = rootBuilder.child("test");
         NodeBuilder newNodeBuilder = testBuilder.child("newNode");
 
-        testBuilder.removeChildNode("x");
+        testBuilder.getChildNode("x").remove();
 
         newNodeBuilder.setProperty("n", 42);
 
@@ -137,7 +137,7 @@ public class KernelNodeStoreTest {
 
         newNodeBuilder.setProperty("n", 42);
 
-        testBuilder.removeChildNode("a");
+        testBuilder.getChildNode("a").remove();
 
         NodeState newRoot = rootBuilder.getNodeState();
 
@@ -167,7 +167,7 @@ public class KernelNodeStoreTest {
 
         newNodeBuilder.setProperty("n", 42);
 
-        testBuilder.removeChildNode("a");
+        testBuilder.getChildNode("a").remove();
 
         NodeState newRoot = rootBuilder.getNodeState();
 
@@ -272,7 +272,7 @@ public class KernelNodeStoreTest {
         branch = store.branch();
         root = branch.getHead().builder();
         parent = root.child("parent");
-        parent.removeChildNode("child-moved");
+        parent.getChildNode("child-moved").remove();
         branch.setRoot(root.getNodeState());
         branch.merge(EmptyHook.INSTANCE);
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java
Thu May 23 14:52:27 2013
@@ -16,12 +16,17 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.nodetype;
 
+import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
+import static org.junit.Assert.assertEquals;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Set;
 
+import com.google.common.collect.Sets;
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
@@ -29,8 +34,8 @@ import org.apache.jackrabbit.oak.api.Blo
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
-import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
 import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
 import org.apache.jackrabbit.oak.query.ast.SelectorImpl;
@@ -45,12 +50,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.Before;
 import org.junit.Test;
 
-import com.google.common.collect.Sets;
-
-import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
-import static org.junit.Assert.assertEquals;
-
 /**
  * {@code NodeTypeIndexTest} performs tests on {@link NodeTypeIndex}.
  */
@@ -73,7 +72,7 @@ public class NodeTypeIndexTest {
         NodeStoreBranch branch = store.branch();
         NodeBuilder root = branch.getHead().builder();
 
-        root.removeChildNode("rep:security"); // interferes with tests
+        root.getChildNode("rep:security").remove(); // interferes with tests
         addFolder(root, "folder-1");
         addFolder(root, "folder-2");
         addFile(root, "file-1");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
Thu May 23 14:52:27 2013
@@ -331,7 +331,7 @@ public class PropertyIndexTest {
                 .setProperty("foo", "abc");
         NodeState before = builder.getNodeState();
         builder = before.builder();
-        builder.removeChildNode("b");
+        builder.getChildNode("b").remove();
         NodeState after = builder.getNodeState();
 
         CommitFailedException unexpected = EditorDiff.process(

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Thu May 23 14:52:27 2013
@@ -111,7 +111,7 @@ public class MemoryNodeBuilderTest {
             NodeBuilder root = base.builder();
             NodeBuilder child = root.child(name);
 
-            root.removeChildNode(name);
+            root.getChildNode(name).remove();
             try {
                 child.setProperty("q", "w");
                 fail();
@@ -128,7 +128,7 @@ public class MemoryNodeBuilderTest {
     public void testAddRemovedNodeAgain() {
         NodeBuilder root = base.builder();
 
-        root.removeChildNode("x");
+        root.getChildNode("x").remove();
         NodeBuilder x = root.child("x");
 
         x.child("q");
@@ -176,7 +176,7 @@ public class MemoryNodeBuilderTest {
         assertTrue(x.exists());
         assertTrue(q.exists());
 
-        root.removeChildNode("x");
+        root.getChildNode("x").remove();
         assertFalse(q.exists());
         assertFalse(x.exists());
     }
@@ -204,7 +204,7 @@ public class MemoryNodeBuilderTest {
     public void testRemovedStatus() {
         NodeBuilder root = base.builder();
         NodeBuilder x = root.child("x");
-        root.removeChildNode("x");
+        root.getChildNode("x").remove();
         assertFalse(x.exists());
         assertFalse(x.isNew());
         assertFalse(x.isModified());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java
Thu May 23 14:52:27 2013
@@ -52,7 +52,7 @@ public class TypeEditorTest {
         hook.processCommit(before, after);
 
         before = after;
-        builder.removeChildNode(":hidden");
+        builder.getChildNode(":hidden").remove();
         after = builder.getNodeState();
         hook.processCommit(before, after);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompareAgainstBaseStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompareAgainstBaseStateTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompareAgainstBaseStateTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/CompareAgainstBaseStateTest.java
Thu May 23 14:52:27 2013
@@ -141,7 +141,7 @@ public class CompareAgainstBaseStateTest
     @Test
     public void testChildNodeDeleted() {
         NodeState before = persist(builder);
-        builder.removeChildNode("baz");
+        builder.getChildNode("baz").remove();
         NodeState after = persist(builder);
 
         expect(diff.childNodeDeleted("baz", before.getChildNode("baz"))).andReturn(true);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Thu May 23 14:52:27 2013
@@ -307,7 +307,7 @@ public class RecordTest {
 
         builder = before.builder();
         for (int i = 0; i < 900; i++) {
-            builder.removeChildNode("test" + i);
+            builder.getChildNode("test" + i).remove();
         }
         NodeState after = writer.writeNode(builder.getNodeState());
         writer.flush();

Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadOnlyOakDirectory.java
Thu May 23 14:52:27 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
+import static org.apache.jackrabbit.oak.api.Type.BINARY;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Collection;
@@ -31,8 +33,6 @@ import org.apache.lucene.store.IndexInpu
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.NoLockFactory;
 
-import static org.apache.jackrabbit.oak.api.Type.BINARY;
-
 /**
  * A read-only implementation of the Lucene {@link Directory} (a flat list of
  * files) that only allows reading of the Lucene index content stored in an Oak
@@ -60,7 +60,7 @@ class ReadOnlyOakDirectory extends Direc
 
     @Override
     public void deleteFile(String name) throws IOException {
-        directoryBuilder.removeChildNode(name);
+        directoryBuilder.getChildNode(name).remove();
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookTest.java?rev=1485747&r1=1485746&r2=1485747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/index/SolrCommitHookTest.java
Thu May 23 14:52:27 2013
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.index.solr.SolrBaseTest;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Before;
 import org.junit.Test;
@@ -63,7 +64,9 @@ public class SolrCommitHookTest extends 
     public void testRemoveNode() throws Exception {
         SolrCommitHook solrCommitHook = new SolrCommitHook(server);
         NodeState before = store.getRoot().builder().child("somechild").getNodeState();
-        NodeState after = before.builder().removeChildNode("somechild").getNodeState();
+        NodeBuilder builder = before.builder();
+        builder.getChildNode("somechild").remove();
+        NodeState after = builder.getNodeState();
         NodeState changedState = solrCommitHook.processCommit(before, after);
         assertEquals(after, changedState);
     }



Mime
View raw message