org.apache.jackrabbit.jcr2spi.lock
Class DefaultLockManager

java.lang.Object
  extended by org.apache.jackrabbit.jcr2spi.lock.DefaultLockManager
All Implemented Interfaces:
LockManager

public class DefaultLockManager
extends Object
implements LockManager

DefaultLockManager...


Constructor Summary
DefaultLockManager()
           
 
Method Summary
 void addLockToken(String lt)
          Invoked by a session to inform that a lock token has been added.
 void checkLock(NodeState nodeState)
          Check whether the given node state is locked by somebody else than the current session.
 Lock getLock(NodeState nodeState)
          Returns the Lock object that applies to a node.
 String[] getLockTokens()
           
 boolean isLocked(NodeState nodeState)
          Returns true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false.
 Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped)
          Lock a node.
 Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerHint)
          Lock a node.
 void removeLockToken(String lt)
          Invoked by a session to inform that a lock token has been removed.
 void unlock(NodeState nodeState)
          Removes the lock on a node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLockManager

public DefaultLockManager()
Method Detail

lock

public Lock lock(NodeState nodeState,
                 boolean isDeep,
                 boolean isSessionScoped)
          throws LockException,
                 RepositoryException
Description copied from interface: LockManager
Lock a node. Checks whether the node is not locked and then returns a lock object for this node.

Specified by:
lock in interface LockManager
isDeep - whether the lock applies to this node only
isSessionScoped - whether the lock is session scoped
Returns:
lock object
Throws:
LockException - if this node already is locked, or some descendant node is locked and isDeep is true
RepositoryException
See Also:
Node.lock(boolean, boolean)

lock

public Lock lock(NodeState nodeState,
                 boolean isDeep,
                 boolean isSessionScoped,
                 long timeoutHint,
                 String ownerHint)
          throws LockException,
                 RepositoryException
Description copied from interface: LockManager
Lock a node. Checks whether the node is not locked and then returns a lock object for this node.

Specified by:
lock in interface LockManager
isDeep - whether the lock applies to this node only
isSessionScoped - whether the lock is session scoped
timeoutHint - optional timeout hint.
ownerHint - optional String defining the lock owner info to be displayed.
Returns:
lock object
Throws:
LockException - if this node already is locked, or some descendant node is locked and isDeep is true
RepositoryException
See Also:
Node.lock(boolean, boolean)

unlock

public void unlock(NodeState nodeState)
            throws LockException,
                   RepositoryException
Description copied from interface: LockManager
Removes the lock on a node.

Specified by:
unlock in interface LockManager
Throws:
LockException - if this node is not locked or the session does not have the correct lock token
RepositoryException
See Also:
Node.unlock()

getLock

public Lock getLock(NodeState nodeState)
             throws LockException,
                    RepositoryException
Description copied from interface: LockManager
Returns the Lock object that applies to a node. This may be either a lock on this node itself or a deep lock on a node above this node.

Specified by:
getLock in interface LockManager
Returns:
lock object
Throws:
LockException - if this node is not locked
RepositoryException
See Also:
Node.getLock()

isLocked

public boolean isLocked(NodeState nodeState)
                 throws RepositoryException
Description copied from interface: LockManager
Returns true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false.

Specified by:
isLocked in interface LockManager
Returns:
true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false
Throws:
RepositoryException - If an error occurs.
See Also:
Node.isLocked()

checkLock

public void checkLock(NodeState nodeState)
               throws LockException,
                      RepositoryException
Description copied from interface: LockManager
Check whether the given node state is locked by somebody else than the current session. Access is allowed if the node is not locked or if the session itself holds the lock to this node, i.e. the session contains the lock token for the lock. If the node is not locked at all this method returns silently.

Specified by:
checkLock in interface LockManager
Throws:
LockException - if write access to the specified node is not allowed
RepositoryException - if some other error occurs

getLockTokens

public String[] getLockTokens()
Specified by:
getLockTokens in interface LockManager
Returns:
The lock tokens associated with the Session this lock manager has been created for.

addLockToken

public void addLockToken(String lt)
Description copied from interface: LockManager
Invoked by a session to inform that a lock token has been added.

Specified by:
addLockToken in interface LockManager
Parameters:
lt - added lock token

removeLockToken

public void removeLockToken(String lt)
Description copied from interface: LockManager
Invoked by a session to inform that a lock token has been removed.

Specified by:
removeLockToken in interface LockManager
Parameters:
lt - removed lock token


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.