Package org.apache.jackrabbit.ocm.lock

Examples of org.apache.jackrabbit.ocm.lock.Lock


            checkIfNodeLocked(absPath);

            Node node = getNode(absPath);
            javax.jcr.lock.Lock lock = node.lock(isDeep, isSessionScoped);

            return new Lock(lock);
        } catch (LockException e) {
            // Only one case with LockException remains: if node is not
            // mix:lockable, propably error in custom node types definitions
            throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Node of type is not type mix:lockable", e);
        } catch (RepositoryException e) {
View Full Code Here


           
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------          
           
            Lock lock = ocm.lock("/test", true, false);
            assertTrue("the Lock owner is not correct", lock.getLockOwner().equals("superuser"));
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            a = (A) ocm.getObject("/test");
            a.setA1("new a1 Value");
            ocm.update(a);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------          
View Full Code Here

            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------                      
            Lock lock = ocm.lock("/test", true, false);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------          
View Full Code Here

           
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------          
           
            Lock lock = ocm.lock("/test", true, false);
            assertTrue("the Lock owner is not correct", lock.getLockOwner().equals("superuser"));
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            a = (A) ocm.getObject("/test");
            a.setA1("new a1 Value");
            ocm.update(a);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------          
View Full Code Here

            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------                      
            Lock lock = ocm.lock("/test", true, false);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------          
View Full Code Here

            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------

            Lock lock = ocm.lock("/test", true, false);
            assertTrue("the Lock owner is not correct", lock.getLockOwner().equals(ocm.getSession().getUserID()));

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            a = (A) ocm.getObject("/test");
            a.setA1("new a1 Value");
            ocm.update(a);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());


            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------
View Full Code Here

            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------
            Lock lock = ocm.lock("/test", true, false);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());


            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------
View Full Code Here

            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------

            Lock lock = ocm.lock("/test", true, false);
            assertTrue("the Lock owner is not correct", lock.getLockOwner().equals(ocm.getSession().getUserID()));

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            a = (A) ocm.getObject("/test");
            a.setA1("new a1 Value");
            ocm.update(a);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());


            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------
View Full Code Here

            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------
            Lock lock = ocm.lock("/test", true, false);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());


            // --------------------------------------------------------------------------------
            // Remove the object
            // --------------------------------------------------------------------------------
View Full Code Here

            // and this operation cant be done (exception translation)
            checkIfNodeLocked(absPath);

            javax.jcr.lock.Lock lock = getLockManager().lock(absPath, isDeep, isSessionScoped, 0L, session.getUserID());

            return new Lock(lock);
        } catch (LockException e) {
            // Only one case with LockException remains: if node is not
            // mix:lockable, propably error in custom node types definitions
            throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Node of type is not type mix:lockable", e);
        } catch (RepositoryException e) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.lock.Lock

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.