You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2015/08/13 14:11:57 UTC
svn commit: r1695693 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
DocumentNodeStoreBranch.java DocumentRootBuilder.java
Author: mreutegg
Date: Thu Aug 13 12:11:57 2015
New Revision: 1695693
URL: http://svn.apache.org/r1695693
Log:
OAK-3226: Remove unused code in DocumentNodeStore
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentRootBuilder.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java?rev=1695693&r1=1695692&r2=1695693&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java Thu Aug 13 12:11:57 2015
@@ -21,9 +21,6 @@ import static java.util.concurrent.TimeU
import static org.apache.jackrabbit.oak.api.CommitFailedException.MERGE;
import static org.apache.jackrabbit.oak.api.CommitFailedException.OAK;
import static org.apache.jackrabbit.oak.api.CommitFailedException.STATE;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
-import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
-import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.COLLISIONS;
import java.util.Random;
@@ -40,7 +37,6 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.apache.jackrabbit.oak.spi.commit.CommitHook;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
@@ -94,64 +90,6 @@ class DocumentNodeStoreBranch implements
this.mergeLock = mergeLock;
}
- /**
- * Moves a node in this private branch.
- *
- * @param source source path
- * @param target target path
- * @return {@code true} iff the move succeeded
- * @throws IllegalStateException if the branch is already merged
- */
- public boolean move(String source, String target) {
- if (PathUtils.isAncestor(checkNotNull(source), checkNotNull(target))) {
- return false;
- } else if (source.equals(target)) {
- return true;
- }
-
- if (!getNode(source).exists()) {
- // source does not exist
- return false;
- }
- NodeState destParent = getNode(getParentPath(target));
- if (!destParent.exists()) {
- // parent of destination does not exist
- return false;
- }
- if (destParent.getChildNode(getName(target)).exists()) {
- // destination exists already
- return false;
- }
- branchState.persist().move(source, target);
- return true;
- }
-
- /**
- * Copies a node in this private branch.
- *
- * @param source source path
- * @param target target path
- * @return {@code true} iff the copy succeeded
- * @throws IllegalStateException if the branch is already merged
- */
- public boolean copy(String source, String target) {
- if (!getNode(checkNotNull(source)).exists()) {
- // source does not exist
- return false;
- }
- NodeState destParent = getNode(getParentPath(checkNotNull(target)));
- if (!destParent.exists()) {
- // parent of destination does not exist
- return false;
- }
- if (destParent.getChildNode(getName(target)).exists()) {
- // destination exists already
- return false;
- }
- branchState.persist().copy(source, target);
- return true;
- }
-
@Nonnull
@Override
public NodeState getBase() {
@@ -344,14 +282,6 @@ class DocumentNodeStoreBranch implements
return store.getRoot(rev);
}
- private NodeState getNode(String path) {
- NodeState node = getHead();
- for (String name : elements(path)) {
- node = node.getChildNode(name);
- }
- return node;
- }
-
private <T> T withCurrentBranch(Callable<T> callable) throws Exception {
Thread t = Thread.currentThread();
Object previous = BRANCHES.putIfAbsent(t, this);
@@ -600,28 +530,6 @@ class DocumentNodeStoreBranch implements
return store.getRoot(state.getRevision().asBranchRevision());
}
- void move(String source, final String target) {
- final DocumentNodeState src = store.getNode(source, head.getRevision());
- checkNotNull(src, "Source node %s@%s does not exist", source, head.getRevision());
- head = DocumentNodeStoreBranch.this.persist(new Changes() {
- @Override
- public void with(Commit c) {
- store.moveNode(src, target, c);
- }
- }, head, null);
- }
-
- void copy(String source, final String target) {
- final DocumentNodeState src = store.getNode(source, head.getRevision());
- checkNotNull(src, "Source node %s@%s does not exist", source, head.getRevision());
- head = DocumentNodeStoreBranch.this.persist(new Changes() {
- @Override
- public void with(Commit c) {
- store.copyNode(src, target, c);
- }
- }, head, null);
- }
-
@Override
@Nonnull
NodeState getHead() {
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentRootBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentRootBuilder.java?rev=1695693&r1=1695692&r2=1695693&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentRootBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentRootBuilder.java Thu Aug 13 12:11:57 2015
@@ -169,32 +169,6 @@ class DocumentRootBuilder extends Abstra
return reset();
}
- /**
- * Applied all pending changes to the underlying branch and then
- * move the node as a separate operation on the underlying store.
- * This allows stores to optimise move operations instead of
- * seeing them as an added node followed by a deleted node.
- */
- boolean move(String source, String target) {
- purge();
- boolean success = branch.move(source, target);
- super.reset(branch.getHead());
- return success;
- }
-
- /**
- * Applied all pending changes to the underlying branch and then
- * copy the node as a separate operation on the underlying store.
- * This allows stores to optimise copy operations instead of
- * seeing them as an added node.
- */
- boolean copy(String source, String target) {
- purge();
- boolean success = branch.copy(source, target);
- super.reset(branch.getHead());
- return success;
- }
-
private void purge() {
branch.setRoot(super.getNodeState());
super.reset(branch.getHead());