|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.lock.XALockManager
Session-local lock manager that implements the semantical changes inside transactions. This manager validates lock/unlock operations inside its view of the locking space.
Constructor Summary | |
XALockManager(SessionImpl session,
LockManagerImpl lockMgr)
Create a new instance of this class. |
Method Summary | |
void |
afterOperation(TransactionContext tx)
Invoked after one of the InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext) , InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method has been called. |
void |
associate(TransactionContext tx)
Associate this resource with a transaction. All further operations on the object should be interpreted as part of this transaction and changes recorded in some attribute of the transaction context. |
void |
beforeOperation(TransactionContext tx)
Invoked before one of the InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext) , InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext) or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext) method is called. |
void |
checkLock(NodeImpl node)
Check whether the node given 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. |
void |
checkLock(Path path,
Session session)
Check whether the path given is locked by somebody else than the session described. 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. |
void |
commit(TransactionContext tx)
Commit transaction. The transaction is identified by a transaction context. If the method throws, other resources get their changes rolled back. This will finish the update and unlock the shared lock manager. |
boolean |
differentXAEnv(org.apache.jackrabbit.core.lock.AbstractLockInfo info)
Return a flag indicating whether a lock info belongs to a different XA environment. |
Lock |
getLock(NodeImpl node)
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. |
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. Checks whether the node is not locked and then returns a lock object for this 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 |
prepare(TransactionContext tx)
Prepare transaction. The transaction is identified by a transaction context. |
void |
rollback(TransactionContext tx)
Rollback transaction. The transaction is identified by a transaction context. This will undo all updates and unlock the shared lock manager. |
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 XALockManager(SessionImpl session, LockManagerImpl lockMgr)
session
- sessionlockMgr
- lockMgr global lock managerMethod Detail |
public Lock lock(NodeImpl node, boolean isDeep, boolean isSessionScoped) throws LockException, RepositoryException
lock
in interface LockManager
node
- 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
RepositoryException
Node.lock(boolean, boolean)
public Lock getLock(NodeImpl node) throws LockException, RepositoryException
getLock
in interface LockManager
node
- node
LockException
- if this node is not locked
RepositoryException
Node.getLock()
public void unlock(NodeImpl node) throws LockException, RepositoryException
unlock
in interface LockManager
node
- node
LockException
- if this node is not locked or the session
does not have the correct lock token
RepositoryException
Node.unlock()
public boolean holdsLock(NodeImpl node) throws 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
RepositoryException
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 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
RepositoryException
Node.isLocked()
public void checkLock(NodeImpl node) throws LockException, RepositoryException
checkLock
in interface LockManager
node
- node to check
LockException
- if write access to the specified node is not allowed
RepositoryException
- if some other error occurspublic void checkLock(Path path, Session session) throws LockException, RepositoryException
checkLock
in interface LockManager
path
- path to checksession
- session
RepositoryException
- if some other error occurs
LockException
- if write access to the specified path is not allowedpublic 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 associate(TransactionContext tx)
associate
in interface InternalXAResource
tx
- transaction context, if null
disassociatepublic void beforeOperation(TransactionContext tx)
InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext)
, InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext)
or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext)
method is called.
beforeOperation
in interface InternalXAResource
tx
- transaction contextpublic void prepare(TransactionContext tx) throws TransactionException
prepare
in interface InternalXAResource
tx
- transaction context
TransactionException
- if an error occurspublic void commit(TransactionContext tx)
commit
in interface InternalXAResource
tx
- transaction contextpublic void rollback(TransactionContext tx)
rollback
in interface InternalXAResource
tx
- transaction context.public void afterOperation(TransactionContext tx)
InternalXAResource.prepare(org.apache.jackrabbit.core.TransactionContext)
, InternalXAResource.commit(org.apache.jackrabbit.core.TransactionContext)
or
InternalXAResource.rollback(org.apache.jackrabbit.core.TransactionContext)
method has been called.
afterOperation
in interface InternalXAResource
tx
- transaction contextpublic boolean differentXAEnv(org.apache.jackrabbit.core.lock.AbstractLockInfo info)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |