org.apache.jackrabbit.jcr2spi.lock
Interface LockStateManager

All Known Implementing Classes:
LockManagerImpl

public interface LockStateManager

Defines the functionality needed for locking and unlocking nodes.


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.
 

Method Detail

lock

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

Parameters:
nodeState -
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

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

Parameters:
nodeState -
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

void unlock(NodeState nodeState)
            throws LockException,
                   RepositoryException
Removes the lock on a node.

Parameters:
nodeState -
Throws:
LockException - if this node is not locked or the session does not have the correct lock token
RepositoryException
See Also:
Node.unlock()

getLock

Lock getLock(NodeState nodeState)
             throws LockException,
                    RepositoryException
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.

Parameters:
nodeState -
Returns:
lock object
Throws:
LockException - if this node is not locked
RepositoryException
See Also:
Node.getLock()

isLocked

boolean isLocked(NodeState nodeState)
                 throws RepositoryException
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.

Parameters:
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
Throws:
RepositoryException - If an error occurs.
See Also:
Node.isLocked()

checkLock

void checkLock(NodeState nodeState)
               throws LockException,
                      RepositoryException
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.

Parameters:
nodeState -
Throws:
LockException - if write access to the specified node is not allowed
RepositoryException - if some other error occurs

getLockTokens

String[] getLockTokens()
                       throws RepositoryException
Returns:
The lock tokens associated with the Session this lock manager has been created for.
Throws:
RepositoryException

addLockToken

void addLockToken(String lt)
                  throws LockException,
                         RepositoryException
Invoked by a session to inform that a lock token has been added.

Parameters:
lt - added lock token
Throws:
LockException
RepositoryException

removeLockToken

void removeLockToken(String lt)
                     throws LockException,
                            RepositoryException
Invoked by a session to inform that a lock token has been removed.

Parameters:
lt - removed lock token
Throws:
LockException
RepositoryException


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