Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Path


     * @see javax.jcr.Session#itemExists(String)
     */
    @Override
    public boolean itemExists(String absPath) throws RepositoryException {
        checkIsAlive();
        Path qPath = getQPath(absPath).getNormalizedPath();
        ItemManager itemMgr = getItemManager();
        return itemMgr.nodeExists(qPath) || itemMgr.propertyExists(qPath);
    }
View Full Code Here


    public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
        checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
        checkIsAlive();

        // build paths from the given JCR paths.
        Path srcPath = getQPath(srcAbsPath);
        Path destPath = getQPath(destAbsPath);

        // all validation is performed by Move Operation and state-manager
        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getPathResolver(), true);
        itemStateManager.execute(op);
    }
View Full Code Here

     */
    public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException {
        checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
        checkIsAlive();

        Path parentPath = getQPath(parentAbsPath);
        // NOTE: check if path corresponds to Node and is writable is performed
        // within the SessionImporter.
        Importer importer = new SessionImporter(parentPath, this, itemStateManager, uuidBehavior);
        return new ImportHandler(importer, getNamespaceResolver(), workspace.getNamespaceRegistry(), getNameFactory(), getPathFactory());
    }
View Full Code Here

     */
    @Override
    public Node getNode(String absPath) throws RepositoryException {
        checkIsAlive();
        try {
            Path qPath = getQPath(absPath).getNormalizedPath();
            ItemManager itemMgr = getItemManager();
            return itemMgr.getNode(qPath);
        } catch (AccessDeniedException ade) {
            throw new PathNotFoundException(absPath);
        }
View Full Code Here

     */
    @Override
    public Property getProperty(String absPath) throws RepositoryException {
        checkIsAlive();
        try {
            Path qPath = getQPath(absPath).getNormalizedPath();
            ItemManager itemMgr = getItemManager();
            return itemMgr.getProperty(qPath);
        } catch (AccessDeniedException ade) {
            throw new PathNotFoundException(absPath);
        }
View Full Code Here

    public boolean hasPermission(String absPath, String actions) throws RepositoryException {
        checkIsAlive();
        // build the array of actions to be checked
        String[] actionsArr = actions.split(",");

        Path targetPath = getQPath(absPath);

        boolean isGranted;
        // The given abs-path may point to a non-existing item
        if (itemManager.nodeExists(targetPath)) {
            NodeState nState = getHierarchyManager().getNodeState(targetPath);
            isGranted = getAccessManager().isGranted(nState, actionsArr);
        } else if (itemManager.propertyExists(targetPath)) {
            PropertyState pState = getHierarchyManager().getPropertyState(targetPath);
            isGranted = getAccessManager().isGranted(pState, actionsArr);
        } else {
            NodeState parentState = null;
            Path parentPath = targetPath;
            while (parentState == null) {
                parentPath = parentPath.getAncestor(1);
                if (itemManager.nodeExists(parentPath)) {
                    parentState = getHierarchyManager().getNodeState(parentPath);
                }
            }
            // parentState is the nearest existing nodeState or the root state.
            Path relPath = parentPath.computeRelativePath(targetPath);
            isGranted = getAccessManager().isGranted(parentState, relPath, actionsArr);
        }
        return isGranted;
    }
View Full Code Here

     * @see Session#nodeExists(String)
     */
    @Override
    public boolean nodeExists(String absPath) throws RepositoryException {
        checkIsAlive();
        Path qPath = getQPath(absPath).getNormalizedPath();
        ItemManager itemMgr = getItemManager();
        return itemMgr.nodeExists(qPath);
    }
View Full Code Here

     * @see Session#propertyExists(String)
     */
    @Override
    public boolean propertyExists(String absPath) throws RepositoryException {
        checkIsAlive();
        Path qPath = getQPath(absPath).getNormalizedPath();
        ItemManager itemMgr = getItemManager();
        return itemMgr.propertyExists(qPath);
    }
View Full Code Here

     * @throws RepositoryException if the resulting path isn't absolute
     * or if the given JCR path cannot be resolved to a path object.
     */
    Path getQPath(String absPath) throws RepositoryException {
        try {
            Path p = getPathResolver().getQPath(absPath);
            if (!p.isAbsolute()) {
                throw new RepositoryException("Not an absolute path: " + absPath);
            }
            return p;
        } catch (NameException mpe) {
            String msg = "Invalid path: " + absPath;
View Full Code Here

    NodeState getVersionState(Version version) throws RepositoryException {
        NodeState nodeState;
        if (version.getSession() == this) {
            nodeState = (NodeState) ((NodeImpl) version).getItemState();
        } else {
            Path p = getQPath(version.getPath());
            Path parentPath = p.getAncestor(1);
            HierarchyEntry parentEntry = getHierarchyManager().lookup(parentPath);
            if (parentEntry != null) {
                // make sure the parent entry is up to date
                parentEntry.invalidate(false);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.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.