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 and Description |
---|
LockManagerImpl(WorkspaceManager wspManager,
ItemManager itemManager,
CacheBehaviour cacheBehaviour) |
Modifier and Type | Method and Description |
---|---|
void |
addLockToken(String lt)
Delegates this call to
WorkspaceManager.addLockToken(String) . |
void |
checkLock(NodeState nodeState)
Check whether the given node state is locked by somebody else than the
current session.
|
javax.jcr.lock.Lock |
getLock(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 the
SessionInfo this
manager has been created with. |
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 . |
javax.jcr.lock.Lock |
lock(NodeState nodeState,
boolean isDeep,
boolean isSessionScoped)
Lock a node.
|
javax.jcr.lock.Lock |
lock(NodeState nodeState,
boolean isDeep,
boolean isSessionScoped,
long timeoutHint,
String ownerHint)
Lock a node.
|
void |
loggedOut(javax.jcr.Session session)
Called when a
Session has been 'closed' by
calling . |
void |
loggingOut(javax.jcr.Session session)
Called when a
Session is about to be 'closed' by
calling . |
void |
removeLockToken(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 for
Session.removeLockToken(String) .Otherwise the call is delegated to WorkspaceManager.removeLockToken(String) . |
void |
unlock(NodeState nodeState)
Removes the lock on a node.
|
public LockManagerImpl(WorkspaceManager wspManager, ItemManager itemManager, CacheBehaviour cacheBehaviour)
public javax.jcr.lock.Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
LockStateManager
lock
in interface LockStateManager
isDeep
- whether the lock applies to this node onlyisSessionScoped
- whether the lock is session scopedjavax.jcr.lock.LockException
- if this node already is locked, or some descendant
node is locked and isDeep
is true
javax.jcr.RepositoryException
LockStateManager.lock(NodeState,boolean,boolean)
public javax.jcr.lock.Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerHint) throws javax.jcr.RepositoryException
LockStateManager
lock
in interface LockStateManager
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.javax.jcr.lock.LockException
- if this node already is locked, or some descendant
node is locked and isDeep
is true
javax.jcr.RepositoryException
LockStateManager.lock(NodeState,boolean,boolean,long,String)
public void unlock(NodeState nodeState) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
LockStateManager
unlock
in interface LockStateManager
javax.jcr.lock.LockException
- if this node is not locked or the session does not
have the correct lock tokenjavax.jcr.RepositoryException
LockStateManager.unlock(NodeState)
public javax.jcr.lock.Lock getLock(NodeState nodeState) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
getLock
in interface LockStateManager
nodeState
- javax.jcr.lock.LockException
- if this node is not lockedjavax.jcr.RepositoryException
LockStateManager.getLock(NodeState)
public boolean isLocked(NodeState nodeState) throws javax.jcr.RepositoryException
LockStateManager
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
.isLocked
in interface LockStateManager
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
javax.jcr.RepositoryException
- If an error occurs.LockStateManager.isLocked(NodeState)
public void checkLock(NodeState nodeState) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
LockStateManager
checkLock
in interface LockStateManager
javax.jcr.lock.LockException
- if write access to the specified node is not allowedjavax.jcr.RepositoryException
- if some other error occursLockStateManager.checkLock(NodeState)
public String[] getLockTokens() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
SessionInfo
this
manager has been created with.getLockTokens
in interface LockStateManager
Session
this
lock manager has been created for.javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
LockStateManager.getLockTokens()
public void addLockToken(String lt) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
WorkspaceManager.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.addLockToken
in interface LockStateManager
lt
- added lock tokenjavax.jcr.lock.LockException
javax.jcr.RepositoryException
LockStateManager.addLockToken(String)
public void removeLockToken(String lt) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
Session.removeLockToken(String)
.WorkspaceManager.removeLockToken(String)
.
All locks stored in the local lock map are notified by the removed
token in order have them updated their lock information.removeLockToken
in interface LockStateManager
lt
- removed lock tokenjavax.jcr.lock.LockException
javax.jcr.RepositoryException
LockStateManager.removeLockToken(String)
public void loggingOut(javax.jcr.Session session)
SessionListener
Session
is about to be 'closed' by
calling Session.logout()
. At this
moment the session is still valid.loggingOut
in interface SessionListener
session
- the Session
that is about to be 'closed'SessionListener.loggingOut(Session)
public void loggedOut(javax.jcr.Session session)
SessionListener
Session
has been 'closed' by
calling Session.logout()
.loggedOut
in interface SessionListener
session
- the Session
that has been 'closed'SessionListener.loggedOut(Session)
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.