Package org.apache.jackrabbit.mk.simple

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


            c.setTotalCount(i);
            c.setData(null);
            c.create();
            head = mk.getHeadRevision();
            String json = JsopBuilder.prettyPrint(mk.getNodes("/test" + i, head, Integer.MAX_VALUE, 0, -1, null));
            NodeImpl n = NodeImpl.parse(json);
            long count = count(n);
            JsopObject o = (JsopObject) Jsop.parse(json);
            Object d = o.get(NodeImpl.DESCENDANT_COUNT);
            if (d != null) {
                long descendants = Long.parseLong(d.toString());
View Full Code Here


        for (long pos = 0;; pos++) {
            String childName = n.getChildNodeName(pos);
            if (childName == null) {
                break;
            }
            NodeImpl c = n.getNode(childName);
            count += count(c);
        }
        return count;
    }
View Full Code Here

        }
        int i = 0;
        String last = first;
        for (String rev : revs) {
            String n = mk.getNodes("/test", rev);
            NodeImpl node = NodeImpl.parse(n);
            assertEquals(i, Integer.parseInt(node.getProperty("id")));
            String journal = mk.getJournal(last, rev, null);
            JsopArray array = (JsopArray) Jsop.parse(journal);
            assertEquals(last + ".." + rev + ": " + journal,
                    2, array.size());
            JsopObject obj = (JsopObject) array.get(0);
View Full Code Here

        head = mk.commit("/:root/head/config", "^ \"nodeVersion\": true", head, "");

        head = mk.commit("/", "+ \"test1\": { \"id\": 1 }", head, "");
        head = mk.commit("/", "+ \"test2\": { \"id\": 1 }", head, "");

        NodeImpl n = NodeImpl.parse(mk.getNodes("/", head));
        String vra = n.getNodeVersion();
        String v1a = n.getNode("test1").getNodeVersion();
        String v2a = n.getNode("test2").getNodeVersion();

        // changes the node version
        head = mk.commit("/", "^ \"test2/id\": 2", head, "");

        n = NodeImpl.parse(mk.getNodes("/", head));
        String vrb = n.getNodeVersion();
        String v1b = n.getNode("test1").getNodeVersion();
        String v2b = n.getNode("test2").getNodeVersion();

        assertFalse(vra.equals(vrb));
        assertEquals(v1a, v1b);
        assertFalse(v2a.equals(v2b));
    }
View Full Code Here

    public CoreValue currentProperty(String propertyName) {
        if (propertyName.equals(PATH)) {
            String p = currentPath();
            return p == null ? null : query.getValueFactory().createValue(p);
        }
        NodeImpl n = currentNode();
        if (n == null) {
            return null;
        }
        String value = n.getProperty(propertyName);
        if (value == null) {
            return null;
        }
        // TODO data type mapping
        value = JsopTokenizer.decodeQuoted(value);
View Full Code Here

        try {
            String role = mk.getNodes("/:user/" + user, mk.getHeadRevision());
            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"));
            return new SecurityWrapper(mk, rights.split(","));
        } catch (MicroKernelException e) {
            mk.dispose();
            throw e;
        }
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) {
            return t;
        }
        t.read('{');
        NodeImpl n = NodeImpl.parse(map, t, 0);
        n = filterAccess(path, n);
        JsopStream buff = new JsopStream();
        if (n == null) {
            throw ExceptionFactory.get("Node not found: " + path);
        } 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

        for (long pos = 0;; pos++) {
            String childName = n.getChildNodeName(pos);
            if (childName == null) {
                break;
            }
            NodeImpl c = n.getNode(childName);
            NodeImpl c2 = filterAccess(PathUtils.concat(path, childName), c);
            if (c2 != c) {
                if (c2 == null) {
                    n = n.cloneAndRemoveChildNode(childName, 0);
                } else {
                    n = n.setChild(childName, c2, 0);
View Full Code Here

            return true;
        }
        boolean access = false;
        while (true) {
            String key = path + "@" + rightsRevision;
            NodeImpl n = cache.get(key);
            if (n == null) {
                if (mk.nodeExists(path, rightsRevision)) {
                    String json = mk.getNodes(path, rightsRevision, 0, 0, 0, null);
                    JsopReader t = new JsopTokenizer(json);
                    t.read('{');
                    n = NodeImpl.parse(map, t, 0);
                } else {
                    n = new NodeImpl(map, 0);
                }
                cache.put(key, n);
            }
            Boolean b = hasRights(n);
            if (b != null) {
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.