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) and
Object.hashCode() so that all locks with the same transaction id and resource id are considered equal.
- Since:
- 6.3.1
- Author:
- whikloj
-
Method Summary
Modifier and TypeMethodDescriptionbooleanhasLockType(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 Details
-
getResourceId
- Returns:
- the resource ID that is locked.
-
hasResource
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
- Returns:
- the lock type
-
hasLockType
Does this lock type match the provided one.- Parameters:
lockType- the provided lock type- Returns:
- true if matches.
-
isAdequate
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
- Returns:
- the transaction ID for this lock.
-