Package org.apache.jackrabbit.mk.simple

Examples of org.apache.jackrabbit.mk.simple.NodeImpl$ChildVisitor


        if (mk.nodeExists(MOUNT, head)) {
            String mounts = mk.getNodes(MOUNT, head, 1, 0, -1, null);
            NodeMap map = new NodeMap();
            JsopReader t = new JsopTokenizer(mounts);
            t.read('{');
            NodeImpl n = NodeImpl.parse(map, t, 0);
            for (long pos = 0;; pos++) {
                String childName = n.getChildNodeName(pos);
                if (childName == null) {
                    break;
                }
                NodeImpl mount = n.getNode(childName);
                String mountUrl = JsopTokenizer.decodeQuoted(mount.getProperty("url"));
                String[] paths = JsopTokenizer.decodeQuoted(mount.getProperty("paths")).split(",");
                addMount(childName, mountUrl, paths);
                getHeadRevision();
            }
        }
    }
View Full Code Here


            String path = PathUtils.relativize("/", PathUtils.concat(rootPath, t.readString()));
            switch (r) {
            case '+':
                t.read(':');
                if (t.matches('{')) {
                    NodeImpl n = NodeImpl.parse(map, t, 0);
                    JsopWriter diff = new JsopBuilder();
                    diff.tag('+').key(path);
                    n.append(diff, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, false);
                    buffer(path, diff);
                } else {
                    String value = t.readRawValue().trim();
                    JsopWriter diff = new JsopBuilder();
                    diff.tag('+').key(path);
View Full Code Here

        String json = mk.getNodes(p, revision, 0, 0, 0, null);
        if (json == null) {
            page = new BTreeLeaf(tree, parent, name,
                    new String[0], new String[0]);
        } else {
            NodeImpl n = NodeImpl.parse(json);
            String keys = n.getProperty("keys");
            String values = n.getProperty("values");
            String children = n.getProperty("children");
            if (children != null) {
                BTreeNode node = new BTreeNode(tree, parent, name,
                        readArray(keys), readArray(values), readArray(children));
                page = node;
            } else {
View Full Code Here

            switch (r) {
            case '+': {
                t.read(':');
                NodeMap map = new NodeMap();
                if (t.matches('{')) {
                    NodeImpl n = NodeImpl.parse(map, t, 0, path);
                    addOrRemoveRecursive(n, false, true);
                } else {
                    String value = t.readRawValue().trim();
                    String nodePath = PathUtils.getParentPath(path);
                    NodeImpl node = new NodeImpl(map, 0);
                    node.setPath(nodePath);
                    String propertyName = PathUtils.getName(path);
                    node.cloneAndSetProperty(propertyName, value, 0);
                    addOrRemoveRecursive(node, true, true);
                }
                break;
            }
            case '*':
 
View Full Code Here

        // TODO remove: support large trees
        String node = mk.getNodes(nodePath, lastRevision, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, null);
        JsopTokenizer t = new JsopTokenizer(node);
        NodeMap map = new NodeMap();
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0, path);
        if (n.hasProperty(property)) {
            n.setPath(nodePath);
            for (Index index : indexes.values()) {
                index.addOrRemoveProperty(nodePath, property, n.getProperty(property), false);
            }
        }
    }
View Full Code Here

        // TODO move: support large trees
        String node = mk.getNodes(sourcePath, lastRevision, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, null);
        JsopTokenizer t = new JsopTokenizer(node);
        NodeMap map = new NodeMap();
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0, sourcePath);
        if (remove) {
            addOrRemoveRecursive(n, true, false);
        }
        if (targetPath != null) {
            t = new JsopTokenizer(node);
View Full Code Here

        // TODO add: support large child node lists
        String node = mk.getNodes(path, readRevision, 0, 0, Integer.MAX_VALUE, null);
        JsopTokenizer t = new JsopTokenizer(node);
        NodeMap map = new NodeMap();
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0, path);
        index.addOrRemoveNode(n, true);
        for (Iterator<String> it = n.getChildNodeNames(Integer.MAX_VALUE); it.hasNext();) {
            addRecursive(index, PathUtils.concat(path, it.next()));
        }
    }
View Full Code Here

        String role = mk.getNodes("/:user/" + user, mk.getHeadRevision(), 1, 0, -1, null);
        NodeMap map = new NodeMap();
        JsopReader t = new JsopTokenizer(role);
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0);
        String password = JsopTokenizer.decodeQuoted(n.getProperty("password"));
        if (!pass.equals(password)) {
            throw ExceptionFactory.get("Wrong password");
        }
        String[] rights =
                JsopTokenizer.decodeQuoted(n.getProperty("rights")).split(",");
        this.userRights = rights;
        boolean isAdmin = false;
        boolean canWrite = false;
        for (String r : rights) {
            if (r.equals("admin")) {
View Full Code Here

            }
            switch (r) {
            case '+':
                t.read(':');
                if (t.matches('{')) {
                    NodeImpl n = NodeImpl.parse(map, t, 0);
                    if (checkDiff(path, diff)) {
                        diff.tag('+').key(path);
                        n = filterAccess(path, n);
                        n.append(diff, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, false);
                        diff.newline();
                    }
                } else {
                    String value = t.readRawValue().trim();
                    String nodeName = PathUtils.getParentPath(path);
View Full Code Here

        JsopReader t = mk.getNodesStream(path, revisionId, depth, offset, count, filter);
        if (admin || t == null) {
            return t;
        }
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0);
        n = filterAccess(path, n);
        JsopStream buff = new JsopStream();
        if (n == null) {
            return null;
        } else {
            // TODO childNodeCount properties might be wrong
            // when count and offset are used
            n.append(buff, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, true);
        }
        return buff;
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mk.simple.NodeImpl$ChildVisitor

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.