Package org.apache.jackrabbit.mongomk.Node

Examples of org.apache.jackrabbit.mongomk.Node.Children


        assertEquals("{\"name\":\"Hello\",\":childNodeCount\":0}", test);
       
        String r0 = mk.commit("/test", "+\"a\":{\"name\": \"World\"}", null, null);
        String r1 = mk.commit("/test", "+\"b\":{\"name\": \"!\"}", null, null);
        test = mk.getNodes("/test", r0, 0, 0, Integer.MAX_VALUE, null);
        Children c;
        c = mk.getChildren("/", Revision.fromString(r0), Integer.MAX_VALUE);
        assertEquals("/: [/test]", c.toString());
        c = mk.getChildren("/test", Revision.fromString(r1), Integer.MAX_VALUE);
        assertEquals("/test: [/test/a, /test/b]", c.toString());

        rev = mk.commit("", "^\"/test\":1", null, null);
        test = mk.getNodes("/", rev, 0, 0, Integer.MAX_VALUE, null);
        assertEquals("{\"test\":1,\"test\":{},\":childNodeCount\":1}", test);
View Full Code Here


        mk.commit("/", "+\"testDel\":{\"name\": \"Hello\"}", null, null);
        mk.commit("/testDel", "+\"a\":{\"name\": \"World\"}", null, null);
        mk.commit("/testDel", "+\"b\":{\"name\": \"!\"}", null, null);
        String r1 = mk.commit("/testDel", "+\"c\":{\"name\": \"!\"}", null, null);

        Children c = mk.getChildren("/testDel", Revision.fromString(r1),
                Integer.MAX_VALUE);
        assertEquals(3, c.children.size());

        String r2 = mk.commit("/testDel", "-\"c\"", null, null);
        c = mk.getChildren("/testDel", Revision.fromString(r2),
View Full Code Here

    }

    public Children getChildren(String path, Revision rev, int limit) {
        checkRevisionAge(rev, path);
        String key = path + "@" + rev;
        Children children = nodeChildrenCache.getIfPresent(key);
        if (children == null) {
            children = readChildren(path, rev, limit);
            if (children != null) {
                nodeChildrenCache.put(key, children);
            }
View Full Code Here

        from = from.substring(0, from.length() - 1);
        String to = PathUtils.concat(path, "z");
        to = Utils.getIdFromPath(to);
        to = to.substring(0, to.length() - 2) + "0";
        List<Map<String, Object>> list = store.query(DocumentStore.Collection.NODES, from, to, limit);
        Children c = new Children(path, rev);
        Set<Revision> validRevisions = new HashSet<Revision>();
        for (Map<String, Object> e : list) {
            // filter out deleted children
            if (getLiveRevision(e, rev, validRevisions) == null) {
                continue;
View Full Code Here

        }
        Revision fromRev = Revision.fromString(fromRevisionId);
        Revision toRev = Revision.fromString(toRevisionId);
        // TODO this does not work well for large child node lists
        // use a MongoDB index instead
        Children fromChildren = getChildren(path, fromRev, Integer.MAX_VALUE);
        Children toChildren = getChildren(path, toRev, Integer.MAX_VALUE);
        Set<String> childrenSet = new HashSet<String>(toChildren.children);
        for (String n : fromChildren.children) {
            if (!childrenSet.contains(n)) {
                w.tag('-').value(n).newline();
            } else {
View Full Code Here

        n.append(json, includeId);
        if (maxChildNodes == -1) {
            maxChildNodes = Integer.MAX_VALUE;
        }
        // FIXME: must not read all children!
        Children c = getChildren(path, rev, Integer.MAX_VALUE);
        for (long i = offset; i < c.children.size(); i++) {
            if (maxChildNodes-- <= 0) {
                break;
            }
            String name = PathUtils.getName(c.children.get((int) i));
View Full Code Here

        } else {
            // the document was updated:
            // we no longer need to update it in a background process
            unsavedLastRevisions.remove(path);
        }
        Children c = nodeChildrenCache.getIfPresent(path + "@" + rev);
        if (isNew || (!isDelete && c != null)) {
            String key = path + "@" + rev;
            Children c2 = new Children(path, rev);
            TreeSet<String> set = new TreeSet<String>();
            if (c != null) {
                set.addAll(c.children);
            }
            set.removeAll(removed);
View Full Code Here

        assertEquals("{\"name\":\"Hello\",\":childNodeCount\":0}", test);
       
        String r0 = mk.commit("/test", "+\"a\":{\"name\": \"World\"}", null, null);
        String r1 = mk.commit("/test", "+\"b\":{\"name\": \"!\"}", null, null);
        test = mk.getNodes("/test", r0, 0, 0, Integer.MAX_VALUE, null);
        Children c;
        c = mk.getChildren("/", Revision.fromString(r0), Integer.MAX_VALUE);
        assertEquals("/: [/test]", c.toString());
        c = mk.getChildren("/test", Revision.fromString(r1), Integer.MAX_VALUE);
        assertEquals("/test: [/test/a, /test/b]", c.toString());

        rev = mk.commit("", "^\"/test\":1", null, null);
        test = mk.getNodes("/", rev, 0, 0, Integer.MAX_VALUE, null);
        assertEquals("{\"test\":1,\"test\":{},\":childNodeCount\":1}", test);
View Full Code Here

        mk.commit("/", "+\"testDel\":{\"name\": \"Hello\"}", null, null);
        mk.commit("/testDel", "+\"a\":{\"name\": \"World\"}", null, null);
        mk.commit("/testDel", "+\"b\":{\"name\": \"!\"}", null, null);
        String r1 = mk.commit("/testDel", "+\"c\":{\"name\": \"!\"}", null, null);

        Children c = mk.getChildren("/testDel", Revision.fromString(r1),
                Integer.MAX_VALUE);
        assertEquals(3, c.children.size());

        String r2 = mk.commit("/testDel", "-\"c\"", null, null);
        c = mk.getChildren("/testDel", Revision.fromString(r2),
View Full Code Here

    }

    public Children getChildren(String path, Revision rev, int limit) {
        checkRevisionAge(rev, path);
        String key = path + "@" + rev;
        Children children = nodeChildrenCache.getIfPresent(key);
        if (children == null) {
            children = readChildren(path, rev, limit);
            if (children != null) {
                nodeChildrenCache.put(key, children);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mongomk.Node.Children

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.