Package org.fcrepo.kernel.api.lock
Interface ResourceLock
-
public interface ResourceLock
A simple lock with a type, transaction and resource.It is essential that implementations of this interface implement
Object.equals(Object)andObject.hashCode()so that all locks with the same transaction id and resource id are considered equal.- Since:
- 6.3.1
- Author:
- whikloj
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourceLockTypegetLockType()FedoraIdgetResourceId()StringgetTransactionId()booleanhasLockType(ResourceLockType lockType)Does this lock type match the provided one.booleanhasResource(FedoraId resourceId)Does this lock hold the mentioned item?booleanisAdequate(ResourceLockType lockType)If an exclusive lock is requested, returns true only if this lock is exclusive.
-
-
-
Method Detail
-
getResourceId
FedoraId getResourceId()
- Returns:
- the resource ID that is locked.
-
hasResource
boolean hasResource(FedoraId resourceId)
Does this lock hold the mentioned item?- Parameters:
resourceId- the FedoraId of the resource to check this lock for.- Returns:
- true if this lock holds it.
-
getLockType
ResourceLockType getLockType()
- Returns:
- the lock type
-
hasLockType
boolean hasLockType(ResourceLockType lockType)
Does this lock type match the provided one.- Parameters:
lockType- the provided lock type- Returns:
- true if matches.
-
isAdequate
boolean isAdequate(ResourceLockType lockType)
If an exclusive lock is requested, returns true only if this lock is exclusive. If non-exclusive is requested, then true is always returned.- Parameters:
lockType- the type of lock requested- Returns:
- true if this lock is adequate
-
getTransactionId
String getTransactionId()
- Returns:
- the transaction ID for this lock.
-
-