Package javax.jcr.lock

Examples of javax.jcr.lock.LockManager.lock()


            lockManager.lock(path, true, false, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(true,false) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, false, true, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(false,true) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, false, false, 60, "");
View Full Code Here


     */
    private static Lock tryLock(Node lockable, boolean isDeep, long timeout, boolean isSessionScoped)
            throws UnsupportedRepositoryOperationException, RepositoryException {
        try {
            LockManager lm = lockable.getSession().getWorkspace().getLockManager();
            return lm.lock(lockable.getPath(), isDeep, isSessionScoped, timeout, null);
        } catch (LockException e) {
            // locked by some other session
        }
        return null;
    }
View Full Code Here

            lockManager.lock(path, false, true, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(false,true) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, false, false, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(false,false) did not throw a UnsupportedRepositoryOperationException");
        } catch (LockException success) {
        }
    }
View Full Code Here

            AccessDeniedException, InvalidItemStateException,
            RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.lock(getPath(), isDeep, isSessionScoped,
                sessionContext.getWorkspace().getConfig().getDefaultLockTimeout(), null);
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

     */
    private static Lock tryLock(Node lockable, boolean isDeep, long timeout, boolean isSessionScoped)
            throws UnsupportedRepositoryOperationException, RepositoryException {
        try {
            LockManager lm = lockable.getSession().getWorkspace().getLockManager();
            return lm.lock(lockable.getPath(), isDeep, isSessionScoped, timeout, null);
        } catch (LockException e) {
            // locked by some other session
        }
        return null;
    }
View Full Code Here

            trn.addMixin("mix:lockable");
            lockingSession.save();

            // let the "other" user lock the node
            LockManager oulm = lockingSession.getWorkspace().getLockManager();
            Lock l = oulm.lock(trn.getPath(), true, false, Long.MAX_VALUE, null);
            lockedpath = trn.getPath();
            locktoken = l.getLockToken();
            lockingSession.logout();

            // transfer the lock token to the super user and try the unlock
View Full Code Here

            AccessDeniedException, InvalidItemStateException,
            RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.lock(getPath(), isDeep, isSessionScoped,
                sessionContext.getWorkspace().getConfig().getDefaultLockTimeout(), null);
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

            AccessDeniedException, InvalidItemStateException,
            RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = session.getWorkspace().getLockManager();
        return lockMgr.lock(getPath(), isDeep, isSessionScoped, Long.MAX_VALUE, null);
    }

    /**
     * {@inheritDoc}
     */
 
View Full Code Here

     */
    public void testLockJcr2() throws Exception {
        LockManager lockManager = vHistory.getSession().getWorkspace().getLockManager();
        String path = vHistory.getPath();
        try {
            lockManager.lock(path, true, true, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(true,true) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, true, false, 60, "");
View Full Code Here

            lockManager.lock(path, true, true, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(true,true) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, true, false, 60, "");
            fail("VersionHistory should not be lockable: VersionHistory.lock(true,false) did not throw a LockException");
        } catch (LockException success) {
        }
        try {
            lockManager.lock(path, false, true, 60, "");
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.