Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.CommitFailedException


     */
    private NodeBuilder getVersionLabelsFor(String historyRelPath)
            throws CommitFailedException {
        NodeBuilder history = resolve(versionStorageNode, historyRelPath);
        if (!history.exists()) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.UNEXPECTED_REPOSITORY_EXCEPTION.ordinal(),
                    "Version history does not exist: " + PathUtils.concat(
                            VERSION_STORE_PATH, historyRelPath));
        }
        return history.child(JCR_VERSIONLABELS);
View Full Code Here


                long timeout = optimisticMerge(hook, committed);
                if (timeout >= 0) {
                    pessimisticMerge(hook, committed, timeout);
                }
            } catch (InterruptedException e) {
                throw new CommitFailedException(
                        "Segment", 1, "Commit interrupted", e);
            }
        }
        return getHead();
    }
View Full Code Here

            throws CommitFailedException {
        if (propertiesChanged || !before.exists()) {
            try {
                solrServer.add(docFromState(after));
            } catch (SolrServerException e) {
                throw new CommitFailedException(
                        "Solr", 2, "Failed to add a document to Solr", e);
            } catch (IOException e) {
                throw new CommitFailedException(
                        "Solr", 6, "Failed to send data to Solr", e);
            }
        }

        if (parent == null) {
            try {
                OakSolrUtils.commitByPolicy(
                        solrServer,  configuration.getCommitPolicy());
            } catch (SolrServerException e) {
                throw new CommitFailedException(
                        "Solr", 3, "Failed to commit changes to Solr", e);
            } catch (IOException e) {
                throw new CommitFailedException(
                        "Solr", 6, "Failed to send data to Solr", e);
            }
        }
    }
View Full Code Here

        try {
            solrServer.deleteByQuery(String.format(
                    "%s:%s\\/*", configuration.getPathField(), path));
        } catch (SolrServerException e) {
            throw new CommitFailedException(
                    "Solr", 5, "Failed to remove documents from Solr", e);
        } catch (IOException e) {
            throw new CommitFailedException(
                    "Solr", 6, "Failed to send data to Solr", e);
        }

        return null; // no need to recurse down the removed subtree
    }
View Full Code Here

            throws CommitFailedException {
        checkNotNull(before);
        checkNotNull(after);
        NodeBuilder builder = after.builder();
        Editor editor = provider.getRootEditor(before, after, builder);
        CommitFailedException exception =
                EditorDiff.process(editor, before, after);
        if (exception == null) {
            return builder.getNodeState();
        } else {
            throw exception;
View Full Code Here

            }
        }
    }

    private static CommitFailedException constraintViolation(int code, @Nonnull String message) {
        return new CommitFailedException("Constraint", code, message);
    }
View Full Code Here

    public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
        Tree child = checkNotNull(parentAfter.getChild(name));
        if (isVersionstorageTree(child)) {
            child = getVersionHistoryTree(child);
            if (child == null) {
                throw new CommitFailedException(
                        ACCESS, 21, "New version storage node without version history: cannot verify permissions.");
            }
        }
        return checkPermissions(child, false, Permissions.ADD_NODE);
    }
View Full Code Here

            path = Text.getRelativeParent(aclPath, 1);
        }
        try {
            restrictionProvider.validateRestrictions(path, aceTree);
        } catch (AccessControlException e) {
            throw new CommitFailedException(ACCESS_CONTROL, 1, "Access control violation", e);
        } catch (RepositoryException e) {
            throw new CommitFailedException(OAK, 13, "Internal error", e);
        }
    }
View Full Code Here

    @Override
    public Validator childNodeDeleted(String name, NodeState before) throws CommitFailedException {
        Tree child = checkNotNull(parentBefore.getChild(name));
        if (isVersionstorageTree(child)) {
            throw new CommitFailedException(
                    ACCESS, 22, "Attempt to remove versionstorage node: Fail to verify delete permission.");
        }
        return checkPermissions(child, true, Permissions.REMOVE_NODE);
    }
View Full Code Here

            throw accessViolation(12, "Only root can store repository level policies.");
        }
    }

    private static CommitFailedException accessViolation(int code, String message) {
        return new CommitFailedException(ACCESS_CONTROL, code, message);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.CommitFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.