Package javax.jcr

Examples of javax.jcr.Node.lock()


            throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return (LockInfo) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Node n = getNode(nodeId, sInfo);
                Lock lock = n.lock(deep, sessionScoped);
                return LockInfoImpl.createLockInfo(lock, idFactory, sInfo.getNamePathResolver());
            }
        }, sInfo);
    }
View Full Code Here


                // TODO: remove check once jsr283 is released
                if (sInfo.getSession() instanceof javax.jcr.Session) {
                    javax.jcr.lock.LockManager lMgr = (((javax.jcr.Workspace) sInfo.getSession().getWorkspace()).getLockManager());
                    lock = lMgr.lock(n.getPath(), deep, sessionScoped, timeoutHint, ownerHint);
                } else {
                    lock = n.lock(deep, sessionScoped);
                }
                return LockInfoImpl.createLockInfo(lock, idFactory, sInfo.getNamePathResolver());
            }
        }, sInfo);
    }
View Full Code Here

        // access node through another session to lock it
        Session session2 = getHelper().getSuperuserSession();
        try {
            Node node2 = session2.getRootNode().getNode(pathRelToRoot);
            node2.lock(true, true);

            try {
                String destPath = testRoot + "/" + nodeName2;
                session.move(srcNode.getPath(), destPath);
                testRootNode.save();
View Full Code Here

            throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException {
        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return (LockInfo) executeWithLocalEvents(new Callable() {
            public Object run() throws RepositoryException {
                Node n = getNode(nodeId, sInfo);
                Lock lock = n.lock(deep, sessionScoped);
                return LockInfoImpl.createLockInfo(lock, idFactory);
            }
        }, sInfo);
    }
View Full Code Here

        rootNode.save();

        String uuid = n.getUUID();
       
        // lock this new node
        Lock lock = n.lock(true, false);
        String lockToken = lock.getLockToken();
       
        // assert: session must get a non-null lock token
        assertNotNull("session must get a non-null lock token", lockToken);
View Full Code Here

        rootNode.save();

        String uuid = n.getUUID();
       
        // lock this new node
        Lock lock = n.lock(true, false);
        String lockToken = lock.getLockToken();
       
        // commit
        utx.commit();
       
View Full Code Here

            UserTransaction utx = new UserTransactionImpl(superuser);
            utx.begin();
            n.lock(false, true);

            // lock node in non-transactional session, too
            nOther.lock(false, true);

            // verify node is locked in both sessions
            assertTrue("Node locked in session 1", n.isLocked());
            assertTrue("Node locked in session 2", nOther.isLocked());
            assertTrue("Node locked in session 2", nOther.hasProperty(jcrLockOwner));
View Full Code Here

        n.addMixin(mixLockable);
        n.addMixin(mixReferenceable);
        testRootNode.save();

        // lock this new node
        n.lock(false, true);
        assertTrue("Node locked in transaction", n.isLocked());

        // commit
        utx.commit();
View Full Code Here

        rootNode.save();

        String uuid = n.getUUID();

        // lock this new node
        Lock lock = n.lock(true, false);
        String lockToken = lock.getLockToken();

        // assert: session must get a non-null lock token
        assertNotNull("session must get a non-null lock token", lockToken);
View Full Code Here

        assertFalse("Node not locked", n.isLocked());

        // get user transaction object, start and lock node
        UserTransaction utx = new UserTransactionImpl(superuser);
        utx.begin();
        n.lock(false, true);

        // verify node is locked
        assertTrue("Node locked", n.isLocked());

        // unlock node
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.