Interface LockStateManager
-
- All Known Implementing Classes:
LockManagerImpl
public interface LockStateManager
Defines the functionality needed for locking and unlocking nodes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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)
Returnstrue
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 returnsfalse
.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 onlyisSessionScoped
- whether the lock is session scoped- Returns:
- lock object
- Throws:
LockException
- if this node already is locked, or some descendant node is locked andisDeep
istrue
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 onlyisSessionScoped
- whether the lock is session scopedtimeoutHint
- 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 andisDeep
istrue
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 tokenRepositoryException
- 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 lockedRepositoryException
- See Also:
Node.getLock()
-
isLocked
boolean isLocked(NodeState nodeState) throws RepositoryException
Returnstrue
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 returnsfalse
.- 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 returnsfalse
- 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 allowedRepositoryException
- 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
-
-