Search in sources :

Example 6 with RemoteCommitException

use of org.apache.jackrabbit.oak.remote.RemoteCommitException in project jackrabbit-oak by apache.

the class RemoveContentRemoteOperation method apply.

@Override
public void apply(Root root) throws RemoteCommitException {
    logger.debug("performing 'remove' operation on path={}", path);
    Tree tree = root.getTree(path);
    if (!tree.exists()) {
        throw new RemoteCommitException("tree does not exists");
    }
    if (!tree.remove()) {
        throw new RemoteCommitException("unable to remove the tree");
    }
}
Also used : RemoteCommitException(org.apache.jackrabbit.oak.remote.RemoteCommitException) Tree(org.apache.jackrabbit.oak.api.Tree)

Example 7 with RemoteCommitException

use of org.apache.jackrabbit.oak.remote.RemoteCommitException in project jackrabbit-oak by apache.

the class UnsetContentRemoteOperation method apply.

@Override
public void apply(Root root) throws RemoteCommitException {
    logger.debug("performing 'unset' operation on path={}, name={}", path, name);
    Tree tree = root.getTree(path);
    if (!tree.exists()) {
        throw new RemoteCommitException("tree does not exists");
    }
    if (!tree.hasProperty(name)) {
        throw new RemoteCommitException("property does not exist");
    }
    tree.removeProperty(name);
}
Also used : RemoteCommitException(org.apache.jackrabbit.oak.remote.RemoteCommitException) Tree(org.apache.jackrabbit.oak.api.Tree)

Aggregations

RemoteCommitException (org.apache.jackrabbit.oak.remote.RemoteCommitException)7 Tree (org.apache.jackrabbit.oak.api.Tree)5 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)1 Root (org.apache.jackrabbit.oak.api.Root)1 PathUtils.denotesRoot (org.apache.jackrabbit.oak.commons.PathUtils.denotesRoot)1 RemoteOperation (org.apache.jackrabbit.oak.remote.RemoteOperation)1 RemoteRevision (org.apache.jackrabbit.oak.remote.RemoteRevision)1 RemoteSession (org.apache.jackrabbit.oak.remote.RemoteSession)1