Package org.apache.jackrabbit.mk.model

Examples of org.apache.jackrabbit.mk.model.NodeState


            throw new IllegalStateException("not initialized");
        } else if (!PathUtils.isAbsolute(path)) {
            throw new IllegalArgumentException("illegal path");
        }

        NodeState node = rs.getNodeState(rs.getRootNode(revId));
        for (String name : PathUtils.split(path)) {
            node = node.getChildNode(name);
            if (node == null) {
                break;
            }
        }
        return node;
View Full Code Here


            throw new IllegalStateException("not initialized");
        } else if (!PathUtils.isAbsolute(path)) {
            throw new IllegalArgumentException("illegal path");
        }

        NodeState node = rs.getNodeState(rs.getRootNode(revId));
        for (String name : PathUtils.split(path)) {
            node = node.getChildNode(name);
            if (node == null) {
                return false;
            }
        }
        return true;
View Full Code Here

            NodeState before, NodeState after, NodeStateDiff diff) {
        Set<String> beforeChildNodes = new HashSet<String>();

        for (ChildNodeEntry beforeCNE : before.getChildNodeEntries(0, -1)) {
            String name = beforeCNE.getName();
            NodeState beforeChild = beforeCNE.getNode();
            NodeState afterChild = after.getChildNode(name);
            if (afterChild == null) {
                diff.childNodeDeleted(name, beforeChild);
            } else {
                beforeChildNodes.add(name);
                if (!beforeChild.equals(afterChild)) {
                    diff.childNodeChanged(name, beforeChild, afterChild);
                }
            }
        }

        for (ChildNodeEntry afterChild : after.getChildNodeEntries(0, -1)) {
            String name = afterChild.getName();
            if (!beforeChildNodes.contains(name)) {
                diff.childNodeAdded(name, afterChild.getNode());
            }
        }
    }
View Full Code Here

        if (fromRevisionId.equals(toRevisionId)) {
            return "";
        }

        try {
            NodeState before = rep.getNodeState(fromRevisionId, path);
            NodeState after = rep.getNodeState(toRevisionId, path);

            return new DiffBuilder(before, after, path, rep.getRevisionStore(), filter).build();
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
View Full Code Here

            throw new IllegalStateException("this instance has already been disposed");
        }

        Id revId = revisionId == null ? getHeadRevisionId() : Id.fromString(revisionId);

        NodeState nodeState;
        try {
            nodeState = rep.getNodeState(revId, path);
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
        if (nodeState != null) {
            return nodeState.getChildNodeCount();
        } else {
            throw new MicroKernelException("Path " + path + " not found in revision " + revisionId);
        }
    }
View Full Code Here

        Id revId = revisionId == null ? getHeadRevisionId() : Id.fromString(revisionId);

        // TODO extract and evaluate filter criteria (such as e.g. ':hash') specified in 'filter' parameter

        try {
            NodeState nodeState = rep.getNodeState(revId, path);
            if (nodeState == null) {
                return null;
            }
            JsopBuilder buf = new JsopBuilder().object();
            toJson(buf, nodeState, depth, (int) offset, count, true);
View Full Code Here

                    // specified range spans a single commit:
                    // use diff stored in commit instead of building it dynamically
                    return toCommit.getChanges();
                }
            }
            NodeState before = rep.getNodeState(fromRevisionId, path);
            NodeState after = rep.getNodeState(toRevisionId, path);

            return new DiffBuilder(before, after, path, rep.getRevisionStore(), path).build();
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
View Full Code Here

            throw new IllegalStateException("this instance has already been disposed");
        }

        Id revId = revisionId == null ? getHeadRevisionId() : Id.fromString(revisionId);

        NodeState nodeState;
        try {
            nodeState = rep.getNodeState(revId, path);
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
        if (nodeState != null) {
            return nodeState.getChildNodeCount();
        } else {
            throw new MicroKernelException("Path " + path + " not found in revision " + revisionId);
        }
    }
View Full Code Here

            // both an offset > 0 and a filter on node names have been specified...
            throw new IllegalArgumentException("offset > 0 with child node filter");
        }

        try {
            NodeState nodeState = rep.getNodeState(revId, path);
            if (nodeState == null) {
                return null;
            }

            JsopBuilder buf = new JsopBuilder().object();
View Full Code Here

                    // optimization for large child node lists:
                    // no need to iterate over the entire child node list if the filter
                    // does not include wildcards
                    int count = maxChildNodes == -1 ? Integer.MAX_VALUE : maxChildNodes;
                    for (String name : childFilter.getInclusionPatterns()) {
                        NodeState child = node.getChildNode(name);
                        if (child != null) {
                            boolean incl = true;
                            for (String exclName : childFilter.getExclusionPatterns()) {
                                if (name.equals(exclName)) {
                                    incl = false;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mk.model.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.