Examples of PathBuilder


Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

    }

    private static NodeId buildNodeId(NodeEntryImpl entry, PathFactory pathFactory, IdFactory idFactory,
            boolean wspId) throws RepositoryException {

        PathBuilder pathBuilder = new PathBuilder(pathFactory);
        while (entry.getParent() != null && entry.getUniqueID() == null) {
            pathBuilder.addFirst(entry.getName(wspId), entry.getIndex(wspId));
            entry = (wspId && entry.revertInfo != null)
                ? entry.revertInfo.oldParent
                : entry.parent;
        }

        // We either walked up to an entry below root or up to an uniqueID. In the former
        // case we construct an NodeId with an absolute path. In the latter case we construct
        // a NodeId from an uuid and a relative path.
        if (entry.getParent() == null) {
            pathBuilder.addRoot();
            return idFactory.createNodeId((String) null, pathBuilder.getPath());
        }
        else {
            return idFactory.createNodeId(entry.getUniqueID(), pathBuilder.getPath());
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

                * Since 'path' might be ambiguous (Node or Property):
                * 1) first try Node
                * 2) if the NameElement does not have SNS-index => try Property
                * 3) else throw
                */
                PathBuilder pb = new PathBuilder(getPathFactory());
                for (int j = i; j < elems.length; j++) {
                    pb.addLast(elems[j]);
                }
                Path remainingPath = pb.getPath();

                NodeId parentId = entry.getWorkspaceId();
                IdFactory idFactory = factory.getIdFactory();

                NodeId nodeId = idFactory.createNodeId(parentId, remainingPath);
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

            * entry that has been invalidated:
            * Skip all intermediate entries and directly try to load the
            * PropertyState (including building the intermediate entries. If that
            * fails ItemNotFoundException is thrown.
            */
            PathBuilder pb = new PathBuilder(getPathFactory());
            for (int j = i; j < elems.length; j++) {
                pb.addLast(elems[j]);
            }
            Path remainingPath = pb.getPath();

            IdFactory idFactory = getIdFactory();
            NodeId parentId = entry.getWorkspaceId();
            parentId = (remainingPath.getLength() == 1) ? parentId : idFactory.createNodeId(parentId, remainingPath.getAncestor(1));
            PropertyId propId = idFactory.createPropertyId(parentId, remainingPath.getNameElement().getName());
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

        // shortcut for root state
        if (parent == null) {
            return pf.getRootPath();
        }
        // build path otherwise
        PathBuilder builder = new PathBuilder(pf);
        buildPath(builder, this, wspPath);
        return builder.getPath();
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

            removed.put(removedNodePath, removedNodePath);
            Name name = removedNodePath.getNameElement().getName();
            int index = removedNodePath.getNameElement().getNormalizedIndex();
            if (index > Path.INDEX_DEFAULT) {
                Path.Element[] elems = removedNodePath.getElements();
                PathBuilder pb = new PathBuilder();
                for (int i = 0; i <= elems.length - 2; i++) {
                    pb.addLast(elems[i]);
                }
                Path parent = pb.getPath();
                while (index > Path.INDEX_UNDEFINED) {
                    Path siblingP = getPathFactory().create(parent, name, --index, true);
                    if (removed.containsKey(siblingP)) {
                        // as the previous sibling has been remove -> the same index
                        // must be used to remove the node at removedNodePath.
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

                Name ntName = null;
                Node ntAttr = n.getAttributes().getNamedItem("primaryType");
                if (ntAttr != null) {
                    ntName = resolver.getQName(ntAttr.getNodeValue());
                }
                PathBuilder builder = new PathBuilder();
                for (String element : Text.explode(getTextContent(n), '/')) {
                    if (element.equals("*")) {
                        builder.addLast(NameConstants.ANY_NAME);
                    } else {
                        builder.addLast(resolver.getQName(element));
                    }
                }
                includes.add(new NodeInclude(builder.getPath(), ntName));
            }
        }
        return includes.toArray(new NodeInclude[includes.size()]);
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

        List<PropertyInclude> includes = new ArrayList<PropertyInclude>();
        NodeList childNodes = config.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node n = childNodes.item(i);
            if (n.getNodeName().equals("include-property")) {
                PathBuilder builder = new PathBuilder();
                for (String element : Text.explode(getTextContent(n), '/')) {
                    if (element.equals("*")) {
                        throw new IllegalNameException("* not supported in include-property");
                    }
                    builder.addLast(resolver.getQName(element));
                }
                includes.add(new PropertyInclude(builder.getPath()));
            }
        }
        return includes.toArray(new PropertyInclude[includes.size()]);
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

        // check existence
        if (!hasNode(srcName.getName(), srcName.getIndex())) {
            String name;
            try {
                Path.Element[] path = new Path.Element[] { srcName };
                name = session.getJCRPath(new PathBuilder(path).getPath());
            } catch (NameException e) {
                name = srcName.toString();
            } catch (NamespaceException e) {
                name = srcName.toString();
            }
            throw new ItemNotFoundException(
                    this + " has no child node with name " + name);
        }
        if (dstName != null && !hasNode(dstName.getName(), dstName.getIndex())) {
            String name;
            try {
                Path.Element[] path = new Path.Element[] { dstName };
                name = session.getJCRPath(new PathBuilder(path).getPath());
            } catch (NameException e) {
                name = dstName.toString();
            } catch (NamespaceException e) {
                name = dstName.toString();
            }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

        }

        NodeId parentId = getParentId();
        NodeImpl parentNode = (NodeImpl) getParent();
        Path parentPath = parentNode.getPrimaryPath();
        PathBuilder builder = new PathBuilder(parentPath);

        ChildNodeEntry entry = ((NodeState) parentNode.getItemState()).
                getChildNodeEntry(getNodeId());
        if (entry == null) {
            String msg = "failed to build path of " + id + ": "
                    + parentId + " has no child entry for "
                    + id;
            log.debug(msg);
            throw new ItemNotFoundException(msg);
        }
        // add to path
        if (entry.getIndex() == 1) {
            builder.addLast(entry.getName());
        } else {
            builder.addLast(entry.getName(), entry.getIndex());
        }
        return builder.getPath();
    }
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.name.PathBuilder

                Node ntAttr = n.getAttributes().getNamedItem("primaryType");
                if (ntAttr != null) {
                    ntName = resolver.getQName(ntAttr.getNodeValue());
                }
                String[] elements = Text.explode(getTextContent(n), '/');
                PathBuilder builder = new PathBuilder();
                for (int j = 0; j < elements.length; j++) {
                    if (elements[j].equals("*")) {
                        builder.addLast(NameConstants.ANY_NAME);
                    } else {
                        builder.addLast(resolver.getQName(elements[j]));
                    }
                }
                includes.add(new NodeInclude(builder.getPath(), ntName));
            }
        }
        return (NodeInclude[]) includes.toArray(new NodeInclude[includes.size()]);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.