Package org.apache.jackrabbit.name

Examples of org.apache.jackrabbit.name.Path


                return m2;
            }

            String relPath;
            try {
                Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                // use prefix mappings of srcSession
                relPath = PathFormat.format(p, srcSession.getNamespaceResolver());
            } catch (NameException be) {
                // should never get here...
                String msg = "internal error: failed to determine relative path";
View Full Code Here


                Path.PathBuilder builder = new Path.PathBuilder();
                Path.PathElement[] elements = path.getElements();
                for (int i = 0; i < next; i++) {
                    builder.addLast(elements[i]);
                }
                Path parentPath = builder.getPath();
                cache((NodeState) state, parentPath);
            } catch (MalformedPathException mpe) {
                log.warn("Failed to build path of " + state.getId(), mpe);
            }
        }
View Full Code Here

    public void nodeAdded(NodeState state, QName name, int index, NodeId id) {
        // Optimization: ignore notifications for nodes that are not in the cache
        synchronized (cacheMonitor) {
            if (idCache.containsKey(state.getNodeId())) {
                try {
                    Path path = Path.create(getPath(state.getNodeId()), name, index, true);
                    insert(path, id);
                } catch (PathNotFoundException e) {
                    log.warn("Unable to get path of node " + state.getNodeId()
                            + ", event ignored.");
                } catch (MalformedPathException e) {
View Full Code Here

    public void nodeRemoved(NodeState state, QName name, int index, NodeId id) {
        // Optimization: ignore notifications for nodes that are not in the cache
        synchronized (cacheMonitor) {
            if (idCache.containsKey(state.getNodeId())) {
                try {
                    Path path = Path.create(getPath(state.getNodeId()), name, index, true);
                    remove(path, id);
                } catch (PathNotFoundException e) {
                    log.warn("Unable to get path of node " + state.getNodeId()
                            + ", event ignored.");
                } catch (MalformedPathException e) {
View Full Code Here

    */
   
    //TODO Faire plus rapide...
    public static String xmlEncodePath(Node node) throws RepositoryException, NoPrefixDeclaredException {
        NodeImpl nodeImpl = (NodeImpl) node;
        Path path = nodeImpl.getPrimaryPath();
        PathElement[] pathElements = path.getElements();
        StringBuffer buffer = new StringBuffer();
       
        //Skip the first
        for (int i = 1; i < pathElements.length; i++) {
            PathElement currentPathElement = pathElements[i];
View Full Code Here

                }
            }
            /**
             * build and resolve absolute path
             */
            Path p =
                Path.create(getPrimaryPath(), session.getQPath(relPath), false)
                .getCanonicalPath();
            ItemId id = session.getHierarchyManager().resolvePath(p);
            if (id == null) {
                // path not found
View Full Code Here

        try {
            /**
             * first check if relPath is just a name (in which case we don't
             * have to build & resolve absolute path)
             */
            Path p = session.getQPath(relPath);
            if (p.getLength() == 1) {
                Path.PathElement pe = p.getNameElement();
                if (pe.denotesName()) {
                    // check if node entry exists
                    NodeState thisState = (NodeState) state;
                    int index = pe.getIndex();
                    if (index == 0) {
View Full Code Here

    protected NodeImpl internalAddNode(String relPath, NodeTypeImpl nodeType,
                                       NodeId id)
            throws ItemExistsException, PathNotFoundException, VersionException,
            ConstraintViolationException, LockException, RepositoryException {
        Path nodePath;
        QName nodeName;
        Path parentPath;
        try {
            nodePath =
                Path.create(getPrimaryPath(), session.getQPath(relPath), false)
                .getCanonicalPath();
            if (nodePath.getNameElement().getIndex() != 0) {
View Full Code Here

    protected NodeImpl internalAddChildNode(QName nodeName,
                                            NodeTypeImpl nodeType, NodeId id)
            throws ItemExistsException, ConstraintViolationException,
            RepositoryException {
        Path nodePath;
        try {
            nodePath = Path.create(getPrimaryPath(), nodeName, true);
        } catch (MalformedPathException e) {
            // should never happen
            String msg = "internal error: invalid path " + safeGetJCRPath();
View Full Code Here

            ConstraintViolationException, ItemNotFoundException, LockException,
            RepositoryException {

        Path.PathElement insertName;
        try {
            Path p = session.getQPath(srcName);
            // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
            if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                throw new RepositoryException("invalid name: " + srcName);
            }
            insertName = p.getNameElement();
        } catch (NameException e) {
            String msg = "invalid name: " + srcName;
            log.debug(msg);
            throw new RepositoryException(msg, e);
        }

        Path.PathElement beforeName;
        if (destName != null) {
            try {
                Path p = session.getQPath(destName);
                // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
                if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                    throw new RepositoryException("invalid name: " + destName);
                }
                beforeName = p.getNameElement();
            } catch (NameException e) {
                String msg = "invalid name: " + destName;
                log.debug(msg);
                throw new RepositoryException(msg, e);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.name.Path

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.