Package org.apache.jackrabbit.oak.spi.state

Examples of org.apache.jackrabbit.oak.spi.state.NodeState


        // ignore hidden tree
        if (childName.startsWith(":")) {
            return IGNORE;
        }
        ImmutableTree parentTree = new ImmutableTree(parent.getNodeState());
        NodeState childState;
        if (NT_FROZENNODE.equals(child.getName(JCR_PRIMARYTYPE))) {
            // need to translate into a regular node to get proper OPV value
            NodeBuilder builder = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE);
            builder.setProperty(JCR_PRIMARYTYPE, child.getName(JCR_FROZENPRIMARYTYPE), Type.NAME);
            builder.setProperty(JCR_MIXINTYPES, child.getNames(JCR_MIXINTYPES), Type.NAMES);
View Full Code Here


            definition.child(INDEX_CONTENT_NODE_NAME);

            // check uniqueness constraints when leaving the root
            if (keysToCheckForUniqueness != null
                    && !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,
View Full Code Here

        return getRevision(id).root;
    }

    private NodeState getNode(String revision, String path)
            throws MicroKernelException {
        NodeState node = getRoot(revision);
        if (path != null) {
            for (String element : PathUtils.elements(path)) {
                node = node.getChildNode(element);
            }
        }
        return node;
    }
View Full Code Here

        tokenizer.read('}');
    }

    @Override
    public synchronized String getHeadRevision() {
        NodeState root = store.getRoot();
        if (!root.equals(head.root)) {
            head = new Revision(head, root, "external");
            revisions.put(head.id, head);
            notifyAll();
        }
        return head.id;
View Full Code Here

    @Override
    public String diff(
            String fromRevisionId, String toRevisionId, String path, int depth)
            throws MicroKernelException {
        NodeState before = getNode(fromRevisionId, path);
        NodeState after = getNode(toRevisionId, path);

        JsopDiff diff = new JsopDiff(path, depth);
        after.compareAgainstBaseState(before, diff);
        return diff.toString();
    }
View Full Code Here

    }

    @Override
    public long getChildNodeCount(String path, String revisionId)
            throws MicroKernelException {
        NodeState node = getNode(revisionId, path);
        if (node.exists()) {
            return node.getChildNodeCount(Long.MAX_VALUE);
        } else {
            throw new MicroKernelException(
                    "Node not found: " + revisionId + path);
        }
    }
View Full Code Here

    @Override
    public String getNodes(
            String path, String revisionId, int depth,
            long offset, int maxChildNodes, String filter)
            throws MicroKernelException {
        NodeState node = getNode(revisionId, path);
        if (node.exists()) {
            if (maxChildNodes < 0) {
                maxChildNodes = Integer.MAX_VALUE;
            }
            if (filter == null) {
                filter = "{}";
View Full Code Here

        if (revision.branch != null) {
            revision = new Revision(revision, builder.getNodeState(), message);
        } else {
            try {
                NodeState newRoot = store.merge(builder, CONFLICT_HOOK, null);
                if (!newRoot.equals(head.root)) {
                    revision = new Revision(head, newRoot, message);
                    head = revision;
                    notifyAll();
                } else {
                    return head.id;
View Full Code Here

            throw new MicroKernelException(
                    "Branch not found: " + branchRevisionId);
        }

        try {
            NodeState newRoot =
                    store.merge(revision.branch, CONFLICT_HOOK, null);
            if (!newRoot.equals(head.root)) {
                head = new Revision(head, newRoot, message);
                revisions.put(head.id, head);
                notifyAll();
            }
        } catch (CommitFailedException e) {
View Full Code Here

    public synchronized void merge() {
        if (parent != null) {
            SegmentWriter writer = store.getWriter();

            Segment segment = writer.getDummySegment();
            NodeState before = new SegmentNodeState(segment, base);
            NodeState after = new SegmentNodeState(segment, head);

            while (!parent.setHead(base, head)) {
                RecordId newBase = parent.getHead();
                NodeBuilder builder =
                        new SegmentNodeState(segment, newBase).builder();
                after.compareAgainstBaseState(before, new MergeDiff(builder));
                NodeState state = builder.getNodeState();

                RecordId newHead = writer.writeNode(state).getRecordId();

                base = newBase;
                head = newHead;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.state.NodeState

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.