Class LockManagerImpl
- java.lang.Object
-
- org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl
-
- All Implemented Interfaces:
LockStateManager,SessionListener
public class LockManagerImpl extends Object implements LockStateManager, SessionListener
LockManagerImpl... TODO: TOBEFIXED. Lock objects obtained through this mgr are not informed if another session is or becomes lock-holder and removes the lock again.
-
-
Constructor Summary
Constructors Constructor Description LockManagerImpl(WorkspaceManager wspManager, ItemManager itemManager, CacheBehaviour cacheBehaviour)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLockToken(String lt)Delegates this call toWorkspaceManager.addLockToken(String).voidcheckLock(NodeState nodeState)Check whether the given node state is locked by somebody else than the current session.LockgetLock(NodeState nodeState)If the session created a lock on the node with the given state, we already know the lock.String[]getLockTokens()Returns the lock tokens present on theSessionInfothis manager has been created with.booleanisLocked(NodeState nodeState)Returnstrueif 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.Locklock(NodeState nodeState, boolean isDeep, boolean isSessionScoped)Lock a node.Locklock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerHint)Lock a node.voidloggedOut(Session session)Called when aSessionhas been 'closed' by calling.Session.logout()voidloggingOut(Session session)Called when aSessionis about to be 'closed' by calling.Session.logout()voidremoveLockToken(String lt)If the lock addressed by the token is session-scoped, this method will throw a LockException, such as defined by JSR170 v.1.0.1 forSession.removeLockToken(String).
Otherwise the call is delegated toWorkspaceManager.removeLockToken(String).voidunlock(NodeState nodeState)Removes the lock on a node.
-
-
-
Constructor Detail
-
LockManagerImpl
public LockManagerImpl(WorkspaceManager wspManager, ItemManager itemManager, CacheBehaviour cacheBehaviour)
-
-
Method Detail
-
lock
public Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped) throws LockException, RepositoryException
Description copied from interface:LockStateManagerLock a node. Checks whether the node is not locked and then returns a lock object for this node.- Specified by:
lockin interfaceLockStateManagerisDeep- 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 andisDeepistrueRepositoryException- See Also:
LockStateManager.lock(NodeState,boolean,boolean)
-
lock
public Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerHint) throws RepositoryException
Description copied from interface:LockStateManagerLock a node. Checks whether the node is not locked and then returns a lock object for this node.- Specified by:
lockin interfaceLockStateManagerisDeep- 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 andisDeepistrueRepositoryException- See Also:
LockStateManager.lock(NodeState,boolean,boolean,long,String)
-
unlock
public void unlock(NodeState nodeState) throws LockException, RepositoryException
Description copied from interface:LockStateManagerRemoves the lock on a node.- Specified by:
unlockin interfaceLockStateManager- Throws:
LockException- if this node is not locked or the session does not have the correct lock tokenRepositoryException- See Also:
LockStateManager.unlock(NodeState)
-
getLock
public Lock getLock(NodeState nodeState) throws LockException, RepositoryException
If the session created a lock on the node with the given state, we already know the lock. Otherwise, the node state and its ancestors are searched for properties indicating a lock.
Note, that the flag indicating session-scoped lock cannot be retrieved unless the current session is the lock holder.- Specified by:
getLockin interfaceLockStateManager- Parameters:
nodeState-- Returns:
- lock object
- Throws:
LockException- if this node is not lockedRepositoryException- See Also:
LockStateManager.getLock(NodeState)
-
isLocked
public boolean isLocked(NodeState nodeState) throws RepositoryException
Description copied from interface:LockStateManagerReturnstrueif 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.- Specified by:
isLockedin interfaceLockStateManager- Returns:
trueif 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:
LockStateManager.isLocked(NodeState)
-
checkLock
public void checkLock(NodeState nodeState) throws LockException, RepositoryException
Description copied from interface:LockStateManagerCheck 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:
checkLockin interfaceLockStateManager- Throws:
LockException- if write access to the specified node is not allowedRepositoryException- if some other error occurs- See Also:
LockStateManager.checkLock(NodeState)
-
getLockTokens
public String[] getLockTokens() throws UnsupportedRepositoryOperationException, RepositoryException
Returns the lock tokens present on theSessionInfothis manager has been created with.- Specified by:
getLockTokensin interfaceLockStateManager- Returns:
- The lock tokens associated with the
Sessionthis lock manager has been created for. - Throws:
UnsupportedRepositoryOperationExceptionRepositoryException- See Also:
LockStateManager.getLockTokens()
-
addLockToken
public void addLockToken(String lt) throws LockException, RepositoryException
Delegates this call toWorkspaceManager.addLockToken(String). If this succeeds this method will inform all locks stored in the local map in order to give them the chance to update their lock information.- Specified by:
addLockTokenin interfaceLockStateManager- Parameters:
lt- added lock token- Throws:
LockExceptionRepositoryException- See Also:
LockStateManager.addLockToken(String)
-
removeLockToken
public void removeLockToken(String lt) throws LockException, RepositoryException
If the lock addressed by the token is session-scoped, this method will throw a LockException, such as defined by JSR170 v.1.0.1 forSession.removeLockToken(String).
Otherwise the call is delegated toWorkspaceManager.removeLockToken(String). All locks stored in the local lock map are notified by the removed token in order have them updated their lock information.- Specified by:
removeLockTokenin interfaceLockStateManager- Parameters:
lt- removed lock token- Throws:
LockExceptionRepositoryException- See Also:
LockStateManager.removeLockToken(String)
-
loggingOut
public void loggingOut(Session session)
Description copied from interface:SessionListenerCalled when aSessionis about to be 'closed' by calling. At this moment the session is still valid.Session.logout()- Specified by:
loggingOutin interfaceSessionListener- Parameters:
session- theSessionthat is about to be 'closed'- See Also:
SessionListener.loggingOut(Session)
-
loggedOut
public void loggedOut(Session session)
Description copied from interface:SessionListenerCalled when aSessionhas been 'closed' by calling.Session.logout()- Specified by:
loggedOutin interfaceSessionListener- Parameters:
session- theSessionthat has been 'closed'- See Also:
SessionListener.loggedOut(Session)
-
-