Package org.apache.jackrabbit.oak.jcr.delegate

Examples of org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate


        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
        sessionDelegate.perform(new SessionOperation<Void>() {
            @Override
            public Void perform() throws RepositoryException {
                String oakPath = getOakPathOrThrowNotFound(absPath);
                NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                if (nodeDelegate == null) {
                    throw new PathNotFoundException(absPath);
                }
                checkNotLocked(absPath);
                versionManagerDelegate.checkout(nodeDelegate);
View Full Code Here


        final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
        return sessionDelegate.perform(new SessionOperation<Version>() {
            @Override
            public Version perform() throws RepositoryException {
                String oakPath = getOakPathOrThrowNotFound(absPath);
                NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                if (nodeDelegate == null) {
                    throw new PathNotFoundException(absPath);
                }
                checkNotLocked(absPath);
                return new VersionImpl(versionManagerDelegate.checkin(nodeDelegate), sessionContext);
View Full Code Here

    private NodeDelegate ensureParentExists(@Nonnull SessionDelegate sessionDelegate,
                                            @Nonnull String absPath)
            throws PathNotFoundException {
        String oakParentPath = getOakPathOrThrowNotFound(
                PathUtils.getParentPath(checkNotNull(absPath)));
        NodeDelegate parent = checkNotNull(sessionDelegate).getNode(oakParentPath);
        if (parent == null) {
            throw new PathNotFoundException(PathUtils.getParentPath(absPath));
        }
        return parent;
    }
View Full Code Here

        if (uuids.isEmpty()) {
            return Collections.emptyList();
        }
        List<NodeDelegate> existing = new ArrayList<NodeDelegate>();
        for (String uuid : uuids) {
            NodeDelegate node = delegate.getNodeByIdentifier(uuid);
            if (node != null) {
                boolean inSubGraph = false;
                for (String versionablePath : versionablePaths) {
                    if (node.getPath().startsWith(versionablePath)) {
                        inSubGraph = true;
                        break;
                    }
                }
                if (!inSubGraph) {
View Full Code Here

    private VersionHistoryDelegate internalGetVersionHistory(
            @Nonnull String absPathVersionable)
            throws RepositoryException, UnsupportedRepositoryOperationException {
        SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
        String oakPath = getOakPathOrThrowNotFound(checkNotNull(absPathVersionable));
        NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
        if (nodeDelegate == null) {
            throw new PathNotFoundException(absPathVersionable);
        }
        return versionManagerDelegate.getVersionHistory(nodeDelegate);
View Full Code Here

    @Nonnull
    public Node getParent() throws RepositoryException {
        return perform(new ItemReadOperation<Node>() {
            @Override
            public Node perform() throws RepositoryException {
                NodeDelegate parent = dlg.getParent();
                if (parent == null) {
                    throw new AccessDeniedException();
                } else {
                    return sessionContext.createNodeOrNull(dlg.getParent());
                }
View Full Code Here

            @Override
            protected Item perform() throws RepositoryException {
                if (depth < 0) {
                    throw new ItemNotFoundException(this + ": Invalid ancestor depth (" + depth + ')');
                } else if (depth == 0) {
                    NodeDelegate nd = sessionDelegate.getRootNode();
                    if (nd == null) {
                        throw new AccessDeniedException("Root node is not accessible.");
                    }
                    return sessionContext.createNodeOrNull(nd);
                }

                String path = dlg.getPath();
                int slash = 0;
                for (int i = 0; i < depth - 1; i++) {
                    slash = PathUtils.getNextSlash(path, slash + 1);
                    if (slash == -1) {
                        throw new ItemNotFoundException(this + ": Invalid ancestor depth (" + depth + ')');
                    }
                }
                slash = PathUtils.getNextSlash(path, slash + 1);
                if (slash == -1) {
                    return ItemImpl.this;
                }

                NodeDelegate nd = sessionDelegate.getNode(path.substring(0, slash));
                if (nd == null) {
                    throw new AccessDeniedException(this + ": Ancestor access denied (" + depth + ')');
                }
                return sessionContext.createNodeOrNull(nd);
            }
View Full Code Here

        });
    }

    @Override @Nonnull
    public Lock getLock(String absPath) throws RepositoryException {
        NodeDelegate lock = perform(
                new LockOperation<NodeDelegate>(sessionContext, absPath, "getLock") {
                    @Override
                    protected NodeDelegate perform(NodeDelegate node) {
                        return node.getLock();
                    }
View Full Code Here

        delegate.perform(new SessionOperation<Void>() {
            @Override
            public Void perform() throws RepositoryException {
                Iterator<String> iterator = sessionScopedLocks.iterator();
                while (iterator.hasNext()) {
                    NodeDelegate node = delegate.getNode(iterator.next());
                    if (node != null) {
                        try {
                            node.unlock(); // TODO: use a single commit
                        } catch (RepositoryException e) {
                            log.warn("Failed to unlock a session scoped lock", e);
                        }
                    }
                    iterator.remove();
View Full Code Here

            @Override
            public Node perform() throws RepositoryException {
                if (node.isRoot()) {
                    throw new ItemNotFoundException("Root has no parent");
                } else {
                    NodeDelegate parent = node.getParent();
                    if (parent == null) {
                        throw new AccessDeniedException();
                    }
                    return NodeImpl.createNode(parent, sessionContext);
                }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate

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.