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 Details

    • 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

      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

      Returns:
      the transaction ID for this lock.