Package org.apache.jackrabbit.oak.jcr

Examples of org.apache.jackrabbit.oak.jcr.SessionDelegate


    }

    @Override
    public Node storeAsNode(String absPath) throws RepositoryException {
        manager.ensureIsAlive();
        SessionDelegate sessionDelegate = manager.getSessionDelegate();
        String oakPath = sessionDelegate.getOakPathOrThrow(absPath);
        // TODO query nodes should be of type nt:query
        String parent = PathUtils.getParentPath(oakPath);
        String nodeName = PathUtils.getName(oakPath);
        NodeDelegate parentNode = sessionDelegate.getNode(parent);
        ValueFactoryImpl vf = sessionDelegate.getValueFactory();
        if (parentNode == null) {
            throw new PathNotFoundException("The specified path does not exist: " + parent);
        }
        NodeDelegate node = parentNode.addChild(nodeName);
        if (node == null) {
View Full Code Here


        return TODO.unimplemented().returnValue(NodeIteratorAdapter.EMPTY);
    }

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

    }

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

        });
    }

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

    @Override
    public void checkout(final String absPath) throws RepositoryException {
        if (true) {
            TODO.unimplemented().doNothing();
        }
        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
        sessionDelegate.perform(new SessionOperation<Void>() {
            @Override
            public Void perform() throws RepositoryException {
                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
                NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                if (nodeDelegate == null) {
                    throw new PathNotFoundException(absPath);
                }
                if (sessionDelegate.getLockManager().isLocked(absPath)) {
                    throw new LockException("Node at " + absPath + " is locked");
                }
                versionManagerDelegate.checkout(nodeDelegate);
                return null;
            }
View Full Code Here

    @Override
    public Version checkin(final String absPath) throws RepositoryException {
        if (true) {
            return TODO.dummyImplementation().returnValue(getBaseVersion(absPath));
        }
        final SessionDelegate sessionDelegate = versionManagerDelegate.getSessionDelegate();
        return sessionDelegate.perform(new SessionOperation<Version>() {
            @Override
            public Version perform() throws RepositoryException {
                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
                NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                if (nodeDelegate == null) {
                    throw new PathNotFoundException(absPath);
                }
                if (sessionDelegate.getLockManager().isLocked(absPath)) {
                    throw new LockException("Node at " + absPath + " is locked");
                }
                return new VersionImpl(versionManagerDelegate.checkin(nodeDelegate));
            }
        });
View Full Code Here

    }

    @Override
    public Node storeAsNode(String absPath) throws RepositoryException {
        manager.ensureIsAlive();
        SessionDelegate sessionDelegate = manager.getSessionDelegate();
        String oakPath = sessionDelegate.getOakPath(absPath);
        String parent = PathUtils.getParentPath(oakPath);
        NodeDelegate parentDelegate = sessionDelegate.getNode(parent);
        if (parentDelegate == null) {
            throw new PathNotFoundException("The specified path does not exist: " + parent);
        }
        Node parentNode = new NodeImpl<NodeDelegate>(parentDelegate);
        if (!parentNode.isCheckedOut()) {
            throw new VersionException("Cannot store query. Node at " +
                    absPath + " is checked in.");
        }
        String nodeName = PathUtils.getName(oakPath);
        ValueFactory vf = sessionDelegate.getValueFactory();
        Node n = parentNode.addNode(nodeName, JcrConstants.NT_QUERY);
        n.setProperty(JcrConstants.JCR_STATEMENT, vf.createValue(statement));
        n.setProperty(JcrConstants.JCR_LANGUAGE, vf.createValue(language));
        setStoredQueryPath(oakPath);
        return n;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.jcr.SessionDelegate

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.