|
||||||||||
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)
Create a new instance of this class. |
Method Summary | |
---|---|
void |
beginUpdate()
Start an update operation. |
void |
cancelUpdate()
Cancel an update operation. |
void |
checkLock(NodeImpl node)
Check whether the node given is locked by somebody else than the current session. |
void |
checkLock(Path path,
javax.jcr.Session session)
Check whether the path given is locked by somebody else than the session described. |
void |
close()
Close 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 userId)
Handle an external lock operation. |
void |
externalUnlock(NodeId nodeId)
Handle an external unlock operation. |
javax.jcr.lock.Lock |
getLock(NodeImpl node)
Returns the Lock object that applies to a node. |
AbstractLockInfo |
getLockInfo(NodeId id)
Return the most appropriate lock information for a node. |
javax.jcr.lock.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 |
boolean |
isLockHolder(javax.jcr.Session session,
NodeImpl node)
Returns true if the specified session holds a lock on the
given node; otherwise returns false . |
javax.jcr.lock.Lock |
lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped)
Lock a node. |
void |
lockTokenAdded(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been added. |
void |
lockTokenRemoved(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been removed. |
void |
onEvent(javax.jcr.observation.EventIterator events)
|
void |
setEventChannel(LockEventChannel eventChannel)
Set a lock event channel |
void |
unlock(NodeImpl node)
Removes the lock on a node given by its path. |
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) throws javax.jcr.RepositoryException
session
- system sessionfs
- file system for persisting locks
javax.jcr.RepositoryException
- if an error occursMethod Detail |
---|
public void close()
public AbstractLockInfo getLockInfo(NodeId id) throws javax.jcr.RepositoryException
null
if node is not locked
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.lock.Lock lock(NodeImpl node, boolean isDeep, boolean isSessionScoped) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
lock
in interface LockManager
node
- nodeisDeep
- whether the lock applies to this node onlyisSessionScoped
- whether the lock is session scoped
javax.jcr.lock.LockException
- if this node already is locked, or some descendant
node is locked and isDeep
is true
javax.jcr.RepositoryException
Node.lock(boolean, boolean)
public javax.jcr.lock.Lock getLock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
getLock
in interface LockManager
node
- node
javax.jcr.lock.LockException
- if this node is not locked
javax.jcr.RepositoryException
Node.getLock()
public javax.jcr.lock.Lock[] getLocks(SessionImpl session) throws javax.jcr.RepositoryException
getLocks
in interface LockManager
session
- session
javax.jcr.RepositoryException
- if an error occursSessionImpl.getLocks()
public void unlock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
unlock
in interface LockManager
node
- node
javax.jcr.lock.LockException
- if this node is not locked or the session
does not have the correct lock token
javax.jcr.RepositoryException
Node.unlock()
public boolean holdsLock(NodeImpl node) throws javax.jcr.RepositoryException
true
if the node given holds a lock;
otherwise returns false
.
holdsLock
in interface LockManager
node
- node
true
if the node given holds a lock;
otherwise returns false
javax.jcr.RepositoryException
Node.holdsLock()
public boolean isLockHolder(javax.jcr.Session session, NodeImpl node) throws javax.jcr.RepositoryException
true
if the specified session holds a lock on the
given node; otherwise returns false
.
Note that isLockHolder(session, node)==true
implies
holdsLock(node)==true
.
isLockHolder
in interface LockManager
session
- sessionnode
- node
false
javax.jcr.RepositoryException
public boolean isLocked(NodeImpl node) throws javax.jcr.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 LockManager
node
- 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
javax.jcr.RepositoryException
Node.isLocked()
public void checkLock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
checkLock
in interface LockManager
node
- node to check
javax.jcr.lock.LockException
- if write access to the specified node is not allowed
javax.jcr.RepositoryException
- if some other error occurspublic void checkLock(Path path, javax.jcr.Session session) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
checkLock
in interface LockManager
path
- path to checksession
- session
javax.jcr.lock.LockException
- if write access to the specified path is not allowed
javax.jcr.RepositoryException
- if some other error occurspublic void lockTokenAdded(SessionImpl session, String lt)
lockTokenAdded
in interface LockManager
session
- session that has a added lock tokenlt
- added lock tokenpublic void lockTokenRemoved(SessionImpl session, String lt)
lockTokenRemoved
in interface LockManager
session
- session that has a removed lock tokenlt
- removed lock tokenpublic void beginUpdate()
public void endUpdate()
public void cancelUpdate()
public void onEvent(javax.jcr.observation.EventIterator events)
onEvent
in interface javax.jcr.observation.EventListener
public void setEventChannel(LockEventChannel eventChannel)
eventChannel
- lock event channelpublic void externalLock(NodeId nodeId, boolean isDeep, String userId) throws javax.jcr.RepositoryException
externalLock
in interface LockEventListener
nodeId
- node idisDeep
- true
if the lock is deep;
false
otherwiseuserId
- user id
javax.jcr.RepositoryException
- if the lock cannot be processedpublic void externalUnlock(NodeId nodeId) throws javax.jcr.RepositoryException
externalUnlock
in interface LockEventListener
nodeId
- node id
javax.jcr.RepositoryException
- if the unlock cannot be processedpublic void dump(PrintStream ps)
PrintStream
given.
dump
in interface Dumpable
ps
- print stream to dump to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |