Package org.apache.jackrabbit.name

Examples of org.apache.jackrabbit.name.Path


                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


    /**
     * {@inheritDoc}
     */
    public void nodeAdded(NodeState state, QName name, int index, NodeId id) {
        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

    /**
     * {@inheritDoc}
     */
    public void nodeRemoved(NodeState state, QName name, int index, NodeId id) {
        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

        // 1. check paths & retrieve state

        NodeState srcState = getNodeState(srcStateMgr, srcHierMgr, srcPath);

        Path.PathElement destName = destPath.getNameElement();
        Path destParentPath = destPath.getAncestor(1);
        NodeState destParentState = getNodeState(destParentPath);
        int ind = destName.getIndex();
        if (ind > 0) {
            // subscript in name element
            String msg = "invalid destination path (subscript in name element is not allowed)";
View Full Code Here

            log.debug(msg);
            throw new RepositoryException(msg, mpe);
        }

        Path.PathElement srcName = srcPath.getNameElement();
        Path srcParentPath = srcPath.getAncestor(1);
        NodeState target = getNodeState(srcPath);
        NodeState srcParent = getNodeState(srcParentPath);

        Path.PathElement destName = destPath.getNameElement();
        Path destParentPath = destPath.getAncestor(1);
        NodeState destParent = getNodeState(destParentPath);

        int ind = destName.getIndex();
        if (ind > 0) {
            // subscript in name element
View Full Code Here

                             QName nodeTypeName, int options)
            throws ConstraintViolationException, AccessDeniedException,
            VersionException, LockException, ItemNotFoundException,
            ItemExistsException, RepositoryException {

        Path parentPath = hierMgr.getPath(parentState.getNodeId());

        // 1. locking status

        if ((options & CHECK_LOCK) == CHECK_LOCK) {
            // make sure there's no foreign lock on parent node
View Full Code Here

            // root or orphaned node
            throw new ConstraintViolationException("cannot remove root node");
        }
        NodeId targetId = targetState.getNodeId();
        NodeState parentState = getNodeState(parentId);
        Path parentPath = hierMgr.getPath(parentId);

        // 1. locking status

        if ((options & CHECK_LOCK) == CHECK_LOCK) {
            // make sure there's no foreign lock on parent node
View Full Code Here

        HashSet set = new HashSet();
        for (int i = 0; i < strings.length; i++) {
            set.add(strings[i]);
        }

        Path targetPath;
        try {
            targetPath = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
        } catch (MalformedPathException mpe) {
            String msg = "invalid path: " + absPath;
            log.debug(msg, mpe);
            throw new RepositoryException(msg);
        }
        if (!targetPath.isAbsolute()) {
            throw new RepositoryException("not an absolute path: " + absPath);
        }

        ItemId targetId = null;

        /**
         * "read" action:
         * requires READ permission on target item
         */
        if (set.contains(READ_ACTION)) {
            try {
                targetId = hierMgr.resolvePath(targetPath);
                if (targetId == null) {
                    // target does not exist, throw exception
                    throw new AccessControlException(READ_ACTION);
                }
                accessMgr.checkPermission(targetId, AccessManager.READ);
            } catch (AccessDeniedException re) {
                // otherwise the RepositoryException catch clause will
                // log a warn message, which is not appropriate in this case.
                throw new AccessControlException(READ_ACTION);
            }
        }

        Path parentPath = null;
        ItemId parentId = null;

        /**
         * "add_node" action:
         * requires WRITE permission on parent item
View Full Code Here

    public Item getItem(String absPath) throws PathNotFoundException, RepositoryException {
        // check sanity of this session
        sanityCheck();

        try {
            Path p = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
            if (!p.isAbsolute()) {
                throw new RepositoryException("not an absolute path: " + absPath);
            }
            return getItemManager().getItem(p);
        } catch (AccessDeniedException ade) {
            throw new PathNotFoundException(absPath);
View Full Code Here

    public boolean itemExists(String absPath) throws RepositoryException {
        // check sanity of this session
        sanityCheck();

        try {
            Path p = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
            if (!p.isAbsolute()) {
                throw new RepositoryException("not an absolute path: " + absPath);
            }
            return getItemManager().itemExists(p);
        } catch (MalformedPathException mpe) {
            String msg = "invalid path:" + absPath;
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.