Package org.apache.jackrabbit.oak.api

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


            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


        AsyncUpdateCallback callback = new AsyncUpdateCallback();
        IndexUpdate indexUpdate = new IndexUpdate(provider, name, after,
                builder, callback);

        CommitFailedException exception = EditorDiff.process(indexUpdate,
                before, after);
        if (exception == null && callback.dirty) {
            async.setProperty(name, checkpoint);
            try {
                store.merge(builder, new CommitHook() {
View Full Code Here

    NodeBuilder create() throws CommitFailedException {
        try {
            createFrozen(versionable, uuidFromNode(versionable), frozenNode);
            return frozenNode;
        } catch (RepositoryException e) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.UNEXPECTED_REPOSITORY_EXCEPTION.ordinal(),
                    "Unexpected RepositoryException", e);
        }
    }
View Full Code Here

            }
            restoreFrozen(frozenNode, versionable, selector);
            restoreVersionable(versionable, version);
            return versionable;
        } catch (RepositoryException e) {
            throw new CommitFailedException(CommitFailedException.VERSION,
                    VersionExceptionCode.UNEXPECTED_REPOSITORY_EXCEPTION.ordinal(),
                    "Unexpected RepositoryException", e);
        }
    }
View Full Code Here

            NodeBuilder child = src.getChildNode(name);
            String childId = getChildId(srcId, child, name);
            int opv = getOPV(src, child, name);

            if (opv == OnParentVersionAction.ABORT) {
                throw new CommitFailedException(CommitFailedException.VERSION,
                        VersionExceptionCode.OPV_ABORT_ITEM_PRESENT.ordinal(),
                        "Checkin aborted due to OPV abort in " + name);
            }
            if (opv == OnParentVersionAction.VERSION) {
                if (ntMgr.isNodeType(new ImmutableTree(child.getNodeState()), MIX_VERSIONABLE)) {
View Full Code Here

        for (PropertyState prop : src.getProperties()) {
            int opv = opvProvider.getAction(src, dest, prop);

            String propName = prop.getName();
            if (opv == OnParentVersionAction.ABORT) {
                throw new CommitFailedException(CommitFailedException.VERSION,
                        VersionExceptionCode.OPV_ABORT_ITEM_PRESENT.ordinal(),
                        "Checkin aborted due to OPV abort in " + propName);
            }
            if (ignoreTypeAndUUID && BASIC_PROPERTIES.contains(propName)) {
                continue;
View Full Code Here

                    && !keysToCheckForUniqueness.isEmpty()) {
                NodeState indexMeta = definition.getNodeState();
                IndexStoreStrategy s = getStrategy(true);
                for (String key : keysToCheckForUniqueness) {
                    if (s.count(indexMeta, singleton(key), 2) > 1) {
                        throw new CommitFailedException(
                                CONSTRAINT, 30,
                                "Uniqueness constraint violated for key " + key);
                    }
                }
            }
View Full Code Here

    //----------------------------------------------------------< Iterable >--

    @Override
    public Iterator<T> iterator() {
        CommitFailedException e = EditorDiff.process(
                new VisibleEditor(new MoveDetector(this)),
                before, after);
        if (e != null) {
            LOG.error("Error while extracting observation events", e);
        }
View Full Code Here

        if (JCR_PRIMARYTYPE.equals(prefix)) {
            return;
        }

        if (namespaces.hasProperty(prefix)) {
            throw new CommitFailedException(CommitFailedException.NAMESPACE, 1,
                    "Namespace mapping already registered: " + prefix);
        } else if (isValidPrefix(prefix)) {
            if (after.isArray() || !STRING.equals(after.getType())) {
                throw new CommitFailedException(
                        CommitFailedException.NAMESPACE, 2,
                        "Invalid namespace mapping: " + prefix);
            } else if (prefix.toLowerCase(Locale.ENGLISH).startsWith("xml")) {
                throw new CommitFailedException(
                        CommitFailedException.NAMESPACE, 3,
                        "XML prefixes are reserved: " + prefix);
            } else if (containsValue(namespaces, after.getValue(STRING))) {
                throw modificationNotAllowed(prefix);
            }
        } else {
            throw new CommitFailedException(CommitFailedException.NAMESPACE, 4,
                    "Not a valid namespace prefix: " + prefix);
        }
        modified = true;
    }
View Full Code Here

    private static Set<String> jcrSystemNS = ImmutableSet.of(PREFIX_JCR,
            PREFIX_NT, PREFIX_MIX, NamespaceConstants.PREFIX_SV);

    private static CommitFailedException modificationNotAllowed(String prefix) {
        return new CommitFailedException(CommitFailedException.NAMESPACE, 5,
                "Namespace modification not allowed: " + prefix);
    }
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.