Class TxLockManagerImpl
- java.lang.Object
-
- org.apache.jackrabbit.webdav.jcr.transaction.TxLockManagerImpl
-
- All Implemented Interfaces:
LockManager
,TxLockManager
public class TxLockManagerImpl extends Object implements TxLockManager
TxLockManagerImpl
manages locks with locktype 'dcr:transaction
'.
-
-
Constructor Summary
Constructors Constructor Description TxLockManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransactionListener(TransactionListener listener)
Adds a transaction listener to thisTxLockManager
.ActiveLock
createLock(LockInfo lockInfo, DavResource resource)
Create a new lock.ActiveLock
getLock(Type type, Scope scope, DavResource resource)
Always returns nullActiveLock
getLock(Type type, Scope scope, TransactionResource resource)
Return the lock applied to the given resource ornull
boolean
hasLock(String token, DavResource resource)
Returns true if the given lock token belongs to a lock that applies to the given resource, false otherwise.ActiveLock
refreshLock(LockInfo lockInfo, String lockToken, DavResource resource)
Refresh the lock identified by the given lock token.void
releaseLock(String lockToken, DavResource resource)
Throws UnsupportedOperationException.void
releaseLock(TransactionInfo lockInfo, String lockToken, TransactionResource resource)
Release the lock identified by the given lock token.void
removeTransactionListener(TransactionListener listener)
Removes a transaction listener from thisTxLockManager
.
-
-
-
Method Detail
-
createLock
public ActiveLock createLock(LockInfo lockInfo, DavResource resource) throws DavException
Create a new lock.- Specified by:
createLock
in interfaceLockManager
- Parameters:
lockInfo
- as present in the request body.resource
-- Returns:
- the lock
- Throws:
DavException
- if the lock could not be obtained.IllegalArgumentException
- if the resource isnull
or does not implementTransactionResource
interface.- See Also:
LockManager.createLock(org.apache.jackrabbit.webdav.lock.LockInfo, org.apache.jackrabbit.webdav.DavResource)
-
refreshLock
public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource) throws DavException
Refresh the lock identified by the given lock token.- Specified by:
refreshLock
in interfaceLockManager
- Parameters:
lockInfo
-lockToken
-resource
-- Returns:
- the lock
- Throws:
DavException
IllegalArgumentException
- if the resource isnull
or does not implementTransactionResource
interface.- See Also:
LockManager.refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String, org.apache.jackrabbit.webdav.DavResource)
-
releaseLock
public void releaseLock(String lockToken, DavResource resource) throws DavException
Throws UnsupportedOperationException.- Specified by:
releaseLock
in interfaceLockManager
- Parameters:
lockToken
-resource
-- Throws:
DavException
- See Also:
LockManager.releaseLock(String, org.apache.jackrabbit.webdav.DavResource)
-
releaseLock
public void releaseLock(TransactionInfo lockInfo, String lockToken, TransactionResource resource) throws DavException
Release the lock identified by the given lock token.- Specified by:
releaseLock
in interfaceTxLockManager
- Parameters:
lockInfo
-lockToken
-resource
-- Throws:
DavException
-
getLock
public ActiveLock getLock(Type type, Scope scope, DavResource resource)
Always returns null- Specified by:
getLock
in interfaceLockManager
- Parameters:
type
-scope
-resource
-- Returns:
- null
- See Also:
getLock(Type, Scope, TransactionResource)
,LockManager.getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope, org.apache.jackrabbit.webdav.DavResource)
-
hasLock
public boolean hasLock(String token, DavResource resource)
Returns true if the given lock token belongs to a lock that applies to the given resource, false otherwise. The token may either be retrieved from theLock-Token header
or from theTransactionId header
.- Specified by:
hasLock
in interfaceLockManager
- Parameters:
token
-resource
-- Returns:
- See Also:
LockManager.hasLock(String token, DavResource resource)
-
getLock
public ActiveLock getLock(Type type, Scope scope, TransactionResource resource)
Return the lock applied to the given resource ornull
- Specified by:
getLock
in interfaceTxLockManager
- Parameters:
type
-scope
-resource
-- Returns:
- lock applied to the given resource or
null
- See Also:
todo: is it correct to return one that specific lock, the current session is token-holder of?
-
addTransactionListener
public void addTransactionListener(TransactionListener listener)
Adds a transaction listener to thisTxLockManager
.- Parameters:
listener
- the listener to add.
-
removeTransactionListener
public void removeTransactionListener(TransactionListener listener)
Removes a transaction listener from thisTxLockManager
.- Parameters:
listener
- the listener to remove.
-
-