Package org.apache.jackrabbit.mk.simple

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


    public CoreValue currentValue() {
        if (propertyName.indexOf('/') < 0) {
            return selector.currentProperty(propertyName);
        }
        // TODO really support relative properties?
        NodeImpl n = selector.currentNode();
        String[] elements = PathUtils.split(propertyName);
        for (int i = 0; i < elements.length - 1; i++) {
            String p = elements[i];
            if (!n.exists(p)) {
                return null;
            }
            n = n.getNode(p);
        }
        String name = PathUtils.getName(propertyName);
        if (!n.hasProperty(name)) {
            return null;
        }
        // TODO data type mapping
        String value = n.getProperty(name);
        value = JsopTokenizer.decodeQuoted(value);
        return query.getValueFactory().createValue(value);

    }
View Full Code Here


        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")).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

        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

        if (mk.nodeExists(MOUNT, head)) {
            String mounts = mk.getNodes(MOUNT, head);
            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

    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

    public void setUp() throws Exception {
        mk = MicroKernelFactory.getInstance(url + ";clean");
        cleanRepository(mk);

        String root = mk.getNodes("/", mk.getHeadRevision(), 1, 0, -1, null);
        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

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.