Package org.apache.jackrabbit.oak.api

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


            if (history.hasChildNode(versionName)) {
                version = history.getChildNode(versionName);
            }
        }
        if (version == null) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.NO_SUCH_VERSION.ordinal(),
                    "The VersionHistory with UUID: " + uuidFromNode(versionable) +
                            " does not have a Version with UUID: " + versionUUID);
        }
        VersionableState versionableState = VersionableState.forRestore(
View Full Code Here


        String historyRelPath = PathUtils.relativize(VERSION_STORE_PATH, historyPath);
        NodeBuilder history = resolve(versionStorageNode, historyRelPath);
        checkState(history.exists(), "Version history does not exist: " + historyPath);
        NodeBuilder version = selector.select(history);
        if (version == null) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.NO_VERSION_TO_RESTORE.ordinal(),
                    "VersionSelector did not select any version from " +
                            "history: " + historyPath);
        }
        // make sure versionable nodes has a jcr:uuid
View Full Code Here

                                @Nonnull String label,
                                @Nonnull String versionName)
           throws CommitFailedException {
        NodeBuilder labels = getVersionLabelsFor(checkNotNull(historyRelPath));
        if (labels.hasProperty(checkNotNull(label))) {
            throw new CommitFailedException(CommitFailedException.LABEL_EXISTS,
                    VersionExceptionCode.LABEL_EXISTS.ordinal(),
                    "Version label " + label + " already exists on this version history");
        }
        NodeBuilder history = resolve(versionStorageNode, historyRelPath);
        if (checkNotNull(versionName).equals(JCR_ROOTVERSION)
                || !history.hasChildNode(checkNotNull(versionName))) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.NO_SUCH_VERSION.ordinal(),
                    "Not a valid version on this history: " + versionName);
        }
        String uuid = uuidFromNode(history.getChildNode(versionName));
        labels.setProperty(label, uuid, Type.REFERENCE);
View Full Code Here

    public void removeVersionLabel(@Nonnull String historyRelPath,
                                   @Nonnull String label)
            throws CommitFailedException {
        NodeBuilder labels = getVersionLabelsFor(checkNotNull(historyRelPath));
        if (!labels.hasProperty(checkNotNull(label))) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.NO_SUCH_VERSION_LABEL.ordinal(),
                    "Version label " + label + " does not exist on this version history");
        }
        labels.removeProperty(label);
    }
View Full Code Here

     */
    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

                                    CommitInfo info)
            throws CommitFailedException {
        try {
            return store.merge(branchHead);
        } catch (MicroKernelException e) {
            throw new CommitFailedException(MERGE, 1,
                    "Failed to merge changes to the underlying MicroKernel", e);
        }
    }
View Full Code Here

            throws CommitFailedException {
        mergeLock.lock();
        try {
            return super.merge(hook, info);
        } catch (MicroKernelException e) {
            throw new CommitFailedException(MERGE, 1,
                    "Failed to merge changes to the underlying MicroKernel", e);
        } finally {
            mergeLock.unlock();
        }
    }
View Full Code Here

            return editor;
        } else {
            // Some node types were modified, so scan the entire repository
            // to make sure that the modified type definitions still apply.
            // TODO: Only check the content that uses the modified node types.
            CommitFailedException exception =
                    EditorDiff.process(editor, MISSING_NODE, after);
            if (exception != null) {
                throw exception;
            }
            return null;
View Full Code Here

    @Nonnull
    @Override
    public NodeState merge(@Nonnull CommitHook hook, @Nullable CommitInfo info)
            throws CommitFailedException {
        CommitFailedException ex = null;
        for (long backoff = 100; backoff < maximumBackoff; backoff *= 2) {
            if (ex != null) {
                try {
                    Thread.sleep(backoff, RANDOM.nextInt(1000000));
                } catch (InterruptedException ie) {
View Full Code Here

    private CommitFailedException constraintViolation(
            int code, String message) {
        if (effective != null) {
            return effective.constraintViolation(code, getPath(), message);
        } else {
            return new CommitFailedException(
                    CONSTRAINT, 0, getPath() + ": " + 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.