|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.lock.LockManagerImpl
public class LockManagerImpl
Provides the functionality needed for locking and unlocking nodes.
| Constructor Summary | |
|---|---|
LockManagerImpl(SessionImpl session,
FileSystem fs,
ScheduledExecutorService executor)
Create a new instance of this class. |
|
| Method Summary | |
|---|---|
void |
addLockToken(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been added. |
void |
beginUpdate()
Start an update operation. |
void |
cancelUpdate()
Cancel an update operation. |
protected void |
checkLock(LockInfo info,
Session session)
Check whether a lock info allows access to a session. |
void |
checkLock(NodeImpl node)
Check whether the node given is locked by somebody else than the current session. |
void |
checkLock(Path path,
Session session)
Check whether the path given is locked by somebody else than the session described. |
protected void |
checkUnlock(LockInfo info,
Session session)
Check whether a session is allowed to unlock a node. |
void |
checkUnlock(Session session,
NodeImpl node)
Returns true if the specified session is allowed to unlock
the node; otherwise returns false. |
void |
close()
Close this lock manager. |
void |
copyOpenScopedLocksFrom(LockManagerImpl source)
Helper method that copies all the active open-scoped locks from the given source to this lock manager. |
void |
dump(PrintStream ps)
Dump contents of path map and elements included to PrintStream given. |
void |
endUpdate()
End an update operation. |
void |
externalLock(NodeId nodeId,
boolean isDeep,
String lockOwner)
Handle an external lock operation. |
void |
externalUnlock(NodeId nodeId)
Handle an external unlock operation. |
Lock |
getLock(NodeImpl node)
Returns the Lock object that applies to a node. |
LockInfo |
getLockInfo(NodeId id)
Return the most appropriate lock information for a node. |
Lock[] |
getLocks(SessionImpl session)
Returns all locks owned by the specified session. |
boolean |
holdsLock(NodeImpl node)
Returns true if the node given holds a lock;
otherwise returns false. |
boolean |
isLocked(NodeImpl node)
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(NodeImpl node,
boolean isDeep,
boolean isSessionScoped)
Lock a node. |
Lock |
lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped,
long timoutHint,
String ownerInfo)
Lock a node. |
void |
onEvent(EventIterator events)
|
protected void |
removeLockProperties(NodeImpl node)
|
void |
removeLockToken(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been removed. |
void |
setEventChannel(LockEventChannel eventChannel)
Set a lock event channel |
void |
unlock(NodeImpl node)
Removes the lock on a node given by its path. |
protected void |
writeLockProperties(NodeImpl node,
String lockOwner,
boolean isDeep)
Add the lock related properties to the target node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LockManagerImpl(SessionImpl session,
FileSystem fs,
ScheduledExecutorService executor)
throws RepositoryException
session - system sessionfs - file system for persisting locksexecutor - scheduled executor service for handling lock timeouts
RepositoryException - if an error occurs| Method Detail |
|---|
public void close()
public void copyOpenScopedLocksFrom(LockManagerImpl source)
source - source lock managerRepositoryCopier
public LockInfo getLockInfo(NodeId id)
throws RepositoryException
null if node is not locked
RepositoryException - if an error occurs
public Lock lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped)
throws LockException,
RepositoryException
lock in interface LockManagernode - nodeisDeep - whether the lock applies to this node onlyisSessionScoped - whether the lock is session scoped
LockException - if this node already is locked, or some descendant
node is locked and isDeep is true
RepositoryExceptionNode.lock(boolean, boolean)
public Lock lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped,
long timoutHint,
String ownerInfo)
throws LockException,
RepositoryException
LockManager
lock in interface LockManagernode - Node to create the lock for.isDeep - whether the lock applies to this node onlyisSessionScoped - whether the lock is session scopedtimoutHint - Desired lock timeout in seconds.ownerInfo - Optional string acting as information about the owner.
LockException - if this node already is locked, or some descendant
node is locked and isDeep is true
RepositoryExceptionLockManager.lock(String, boolean, boolean, long, String)
public Lock getLock(NodeImpl node)
throws LockException,
RepositoryException
getLock in interface LockManagernode - node
LockException - if this node is not locked
RepositoryExceptionNode.getLock()
public Lock[] getLocks(SessionImpl session)
throws RepositoryException
getLocks in interface LockManagersession - session
RepositoryException - if an error occursSessionImpl.getLocks()
public void unlock(NodeImpl node)
throws LockException,
RepositoryException
unlock in interface LockManagernode - node
LockException - if this node is not locked or the session
does not have the correct lock token
RepositoryExceptionNode.unlock()
public boolean holdsLock(NodeImpl node)
throws RepositoryException
true if the node given holds a lock;
otherwise returns false.
holdsLock in interface LockManagernode - node
true if the node given holds a lock;
otherwise returns false
RepositoryException - If an exception occurs.Node.holdsLock()
public boolean isLocked(NodeImpl node)
throws RepositoryException
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 LockManagernode - node
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
RepositoryException - If an exception occurs.Node.isLocked()
public void checkLock(NodeImpl node)
throws LockException,
RepositoryException
checkLock in interface LockManagernode - node to check
LockException - if write access to the specified node is not allowed
RepositoryException - if some other error occurs
public void checkLock(Path path,
Session session)
throws LockException,
RepositoryException
checkLock in interface LockManagerpath - path to checksession - session
LockException - if write access to the specified path is not allowed
RepositoryException - if some other error occurs
protected void checkLock(LockInfo info,
Session session)
throws LockException,
RepositoryException
info - info to checksession - session
LockException - if write access to the specified path is not allowed
RepositoryException - if some other error occurs
public void checkUnlock(Session session,
NodeImpl node)
throws LockException,
RepositoryException
true if the specified session is allowed to unlock
the node; otherwise returns false.
checkUnlock in interface LockManagersession - sessionnode - node
LockException - if write access to the specified path is not allowed
RepositoryException - if some other error occurs
protected void checkUnlock(LockInfo info,
Session session)
throws LockException,
RepositoryException
info - info to checksession - session
LockException - if unlocking is denied
RepositoryException - if some other error occurs
public void addLockToken(SessionImpl session,
String lt)
throws LockException,
RepositoryException
addLockToken in interface LockManagersession - session that has a added lock tokenlt - added lock token
LockException
RepositoryException
public void removeLockToken(SessionImpl session,
String lt)
throws LockException,
RepositoryException
removeLockToken in interface LockManagersession - session that has a removed lock tokenlt - removed lock token
LockException
RepositoryExceptionpublic void beginUpdate()
public void endUpdate()
public void cancelUpdate()
protected void writeLockProperties(NodeImpl node,
String lockOwner,
boolean isDeep)
throws RepositoryException
node - lockOwner - isDeep -
RepositoryException
protected void removeLockProperties(NodeImpl node)
throws RepositoryException
node -
RepositoryExceptionpublic void onEvent(EventIterator events)
onEvent in interface EventListenerpublic void setEventChannel(LockEventChannel eventChannel)
eventChannel - lock event channel
public void externalLock(NodeId nodeId,
boolean isDeep,
String lockOwner)
throws RepositoryException
externalLock in interface LockEventListenernodeId - node idisDeep - true if the lock is deep;
false otherwiselockOwner - lock owner
RepositoryException - if the lock cannot be processed
public void externalUnlock(NodeId nodeId)
throws RepositoryException
externalUnlock in interface LockEventListenernodeId - node id
RepositoryException - if the unlock cannot be processedpublic void dump(PrintStream ps)
PrintStream given.
dump in interface Dumpableps - print stream to dump to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||