Package org.apache.jackrabbit.oak.plugins.index.old.mk.simple

Examples of org.apache.jackrabbit.oak.plugins.index.old.mk.simple.NodeMap


*/
public class MemoryNodeTest {

    @Test
    public void addChildNodes() {
        NodeMap map = new NodeMap();

        map.setMaxMemoryChildren(2);
        map.setDescendantInlineCount(-1);

        NodeImpl n = new NodeImpl(map, 0);
        Assert.assertEquals("{}", n.asString());
        n.setId(NodeId.get(255));
        Assert.assertEquals("nff={};", n.asString());
        n.setPath("/test");
        Assert.assertEquals("nff={};/* /test */", n.toString());
        n = n.createClone(10);
        Assert.assertEquals("{}", n.asString());
        NodeImpl a = new NodeImpl(map, 0);
        map.addNode(a);
        NodeImpl b = new NodeImpl(map, 0);
        map.addNode(b);
        NodeImpl c = new NodeImpl(map, 0);
        map.addNode(c);
        NodeImpl d = new NodeImpl(map, 0);
        map.addNode(d);
        n = n.cloneAndAddChildNode("a", false, null, a, 11);
        n = n.cloneAndSetProperty("x", "1", 12);
        n.setId(NodeId.get(3));
        Assert.assertEquals("n3={\"x\":1,\"a\":n1};", n.asString());
        NodeImpl n2 = NodeImpl.fromString(map, n.asString());
View Full Code Here


    }

    @Test
    public void inlineChildNodes() {
        NodeMap map = new NodeMap();
        map.setDescendantCount(true);
        map.setDescendantInlineCount(3);

        NodeImpl n = new NodeImpl(map, 0);
        Assert.assertEquals("{}", n.asString());
        NodeImpl a = new NodeImpl(map, 0);
        a.setProperty("name", "\"a\"");
        map.addNode(a);
        NodeImpl b = new NodeImpl(map, 0);
        b.setProperty("name", "\"b\"");
        map.addNode(b);
        NodeImpl c = new NodeImpl(map, 0);
        c.setProperty("name", "\"c\"");
        map.addNode(c);
        NodeImpl d = new NodeImpl(map, 0);
        d.setProperty("name", "\"d\"");
        map.addNode(d);
        n = n.cloneAndAddChildNode("a", false, null, a, 11);
        n = n.cloneAndSetProperty("x", "1", 12);
        n.setId(NodeId.get(3));
        Assert.assertEquals("n3={\"x\":1,\"a\":{\"name\":\"a\"}};", n.asString());
        NodeImpl n2 = NodeImpl.fromString(map, n.asString());
View Full Code Here

            do {
                String key = t.readString();
                t.read(':');
                if (t.matches('{')) {
                    names.add(key);
                    NodeImpl.parse(new NodeMap(), t, 0);
                } else {
                    if (!key.equals(":childNodeCount")) {
                        properties.add(key);
                    } else if (!key.equals(":hash")) {
                        properties.add(key);
View Full Code Here

        this.mk = MicroKernelWrapperBase.wrap(mk);

        String head = mk.getHeadRevision();
        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);
View Full Code Here

    public SecurityWrapper(MicroKernel mk, String user, String pass) {
        this.mk = MicroKernelWrapperBase.wrap(mk);
        // TODO security for the index mechanism

        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)) {
View Full Code Here

        boolean exists = mk.nodeExists(indexRootNode, revision);
        createNodes(INDEX_CONTENT);
        if (exists) {
            String node = mk.getNodes(indexRootNode, revision, 1, 0, Integer.MAX_VALUE, null);
            JsopTokenizer t = new JsopTokenizer(node);
            NodeMap map = new NodeMap();
            t.read('{');
            NodeImpl n = NodeImpl.parse(map, t, 0);
            String rev = n.getNode(INDEX_CONTENT).getProperty("rev");
            if (rev != null) {
                readRevision = JsopTokenizer.decodeQuoted(rev);
View Full Code Here

            String path = PathUtils.concat(rootPath, t.readString());
            String target;
            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();
View Full Code Here

            return;
        }
        // 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 (PIndex index : indexes.values()) {
View Full Code Here

            return;
        }
        // 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);
            map = new NodeMap();
            t.read('{');
            n = NodeImpl.parse(map, t, 0, targetPath);
            addOrRemoveRecursive(n, false, true);
        }
    }
View Full Code Here

            return;
        }
        // TODO add: support large child node lists
        String node = mk.getNodes(path, revision, 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()), revision);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.index.old.mk.simple.NodeMap

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.