Package org.apache.jackrabbit.mk.simple

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


        FileUtils.deleteRecursive("target/temp", false);
        mk = MicroKernelFactory.getInstance(url + ";clean");
        cleanRepository(mk);

        String root = mk.getNodes("/", mk.getHeadRevision());
        NodeImpl rootNode = NodeImpl.parse(root);
        if (rootNode.getPropertyCount() > 0) {
            System.out.println("Last mk not disposed: " + root);
        }
        if (rootNode.getChildNodeNames(Integer.MAX_VALUE).hasNext()) {
            System.out.println("Last mk not disposed: " + root);
        }
        if (PROFILE) {
            prof = new Profiler();
            prof.interval = 1;
View Full Code Here


            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

            return;
        }

        head = mk.commit("/", "+ \"test1\": { \"id\": 1 }", mk.getHeadRevision(), "");
        head = mk.commit("/", "+ \"test2\": { \"id\": 1 }", mk.getHeadRevision(), "");
        NodeImpl r = NodeImpl.parse(mk.getNodes("/", head));
        assertTrue(r.getHash() != null);
        NodeImpl t1 = NodeImpl.parse(mk.getNodes("/test1", head));
        NodeImpl t2 = NodeImpl.parse(mk.getNodes("/test2", head));
        assertTrue(Arrays.equals(t1.getHash(), t2.getHash()));
        assertFalse(Arrays.equals(t1.getHash(), r.getHash()));
    }
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

TOP

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

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.