CheckArg.isNotEmpty(srcAbsPath, "srcAbsPath");
CheckArg.isNotEmpty(destAbsPath, "destAbsPath");
// Create the paths ...
PathFactory factory = context.getValueFactories().getPathFactory();
Path srcPath = null;
Path destPath = null;
try {
srcPath = factory.create(srcAbsPath);
} catch (ValueFormatException e) {
throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(srcAbsPath, "srcAbsPath"), e);
}
try {
destPath = factory.create(destAbsPath);
} catch (ValueFormatException e) {
throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(destAbsPath, "destAbsPath"), e);
}
// Doing a literal test here because the path factory will canonicalize "/node[1]" to "/node"
if (destAbsPath.endsWith("]")) {
throw new RepositoryException(JcrI18n.pathCannotHaveSameNameSiblingIndex.text(destAbsPath));
}
try {
// Use the session to verify that the node location has a definition and is valid with the new cloned child.
// This also performs the check permission for reading the parent ...
Name newNodeName = destPath.getLastSegment().getName();
SessionCache cache = this.session.cache();
Node<JcrNodePayload, JcrPropertyPayload> newParent = cache.findNode(null, destPath.getParent());
cache.findBestNodeDefinition(newParent, newNodeName, newParent.getPayload().getPrimaryTypeName());
// Now perform the clone, using the direct (non-session) method ...
cache.graphSession().immediateMove(srcPath, destPath);
} catch (AccessControlException ace) {