Package javax.jcr.lock

Examples of javax.jcr.lock.LockManager


     * {@inheritDoc}
     */
    public boolean holdsLock() throws RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.holdsLock(getPath());
    }
View Full Code Here


     * {@inheritDoc}
     */
    public boolean isLocked() throws RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.isLocked(getPath());
    }
View Full Code Here

    public Lock getLock()
            throws UnsupportedRepositoryOperationException, LockException,
            AccessDeniedException, RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.getLock(getPath());
    }
View Full Code Here

            throws UnsupportedRepositoryOperationException, LockException,
            AccessDeniedException, InvalidItemStateException,
            RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        lockMgr.unlock(getPath());
    }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean holdsLock() throws RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.holdsLock(getPath());
    }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean isLocked() throws RepositoryException {
        // check state of this instance
        sanityCheck();
        LockManager lockMgr = getSession().getWorkspace().getLockManager();
        return lockMgr.isLocked(getPath());
    }
View Full Code Here

        Lock l = lockMgr.lock(testPath, true, sessionScoped, Long.MAX_VALUE, null);
        String ltoken = l.getLockToken();

        Session other = helper.getReadWriteSession();
        try {
            LockManager otherLockMgr = getLockManager(other);
            assertFalse(containsLockToken(otherLockMgr, ltoken));

            try {
                otherLockMgr.addLockToken(ltoken);
                fail("Adding token to another session must fail.");
            } catch (LockException e) {
                // success
            }
        } finally {
View Full Code Here

        boolean sessionScoped = false;
        Lock l = lockMgr.lock(testPath, true, sessionScoped, Long.MAX_VALUE, null);
        String ltoken = l.getLockToken();

        Session other = helper.getReadWriteSession();
        LockManager otherLockMgr = getLockManager(other);
        try {
            lockMgr.removeLockToken(ltoken);
            otherLockMgr.addLockToken(ltoken);

            assertTrue("The new holding manager must contain the token.", containsLockToken(otherLockMgr, ltoken));

            Lock otherL = otherLockMgr.getLock(testPath);
            assertNotNull("Token must be exposed to new lock holder.", otherL.getLockToken());
            assertEquals("Token must be the same again.", ltoken, otherL.getLockToken());

        } finally {
            otherLockMgr.removeLockToken(ltoken);
            lockMgr.addLockToken(ltoken);
            other.logout();
        }
    }
View Full Code Here

        boolean sessionScoped = false;
        Lock l = lockMgr.lock(testPath, true, sessionScoped, Long.MAX_VALUE, null);
        String ltoken = l.getLockToken();

        Session other = helper.getReadWriteSession();
        LockManager otherLockMgr = getLockManager(other);
        try {
            lockMgr.removeLockToken(ltoken);
            otherLockMgr.addLockToken(ltoken);

            lockMgr.addLockToken(ltoken);
            fail("Adding the token to another session must fail.");
        } catch (LockException e) {
            // success
        } finally {
            otherLockMgr.removeLockToken(ltoken);
            lockMgr.addLockToken(ltoken);
            other.logout();
        }
    }
View Full Code Here

        boolean sessionScoped = false;
        Lock l = lockMgr.lock(testPath, true, sessionScoped, Long.MAX_VALUE, null);
        String ltoken = l.getLockToken();

        Session other = helper.getReadWriteSession();
        LockManager otherLockMgr = getLockManager(other);
        try {
            lockMgr.removeLockToken(ltoken);
            otherLockMgr.addLockToken(ltoken);

            lockMgr.removeLockToken(ltoken);
            fail("Removing a token that has been transfered to another manager must fail.");
        } catch (LockException e) {
            // success
        } finally {
            otherLockMgr.removeLockToken(ltoken);
            lockMgr.addLockToken(ltoken);
            other.logout();
        }
    }
View Full Code Here

TOP

Related Classes of javax.jcr.lock.LockManager

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.