org.olat.core.util.coordinate
Interface Locker

All Known Implementing Classes:
ClusterLocker, SingleVMLocker

public interface Locker

Description:
Interface to acquire Locks (short time locks for gui locking (e.g. i am currently administrating this group) and long term locks for resource locking (e.g. i am editing a qti test)

Initial Date: 19.09.2007

Author:
Felix Jost, http://www.goodsolutions.ch

Method Summary
 LockResult acquireLock(OLATResourceable ores, Identity identity, java.lang.String locksubkey)
           
 java.util.List<LockEntry> adminOnlyGetLockEntries()
          for admin purposes only.
 LockResult aquirePersistentLock(OLATResourceable ores, Identity ident, java.lang.String locksubkey)
          acquires a persistent lock.
 boolean isLocked(OLATResourceable ores, java.lang.String locksubkey)
           
 void releaseLock(LockResult le)
          releases the lock.
 void releasePersistentLock(LockResult le)
          releases a persistent lock.
 

Method Detail

acquireLock

LockResult acquireLock(OLATResourceable ores,
                       Identity identity,
                       java.lang.String locksubkey)
Parameters:
ores - the OLATResourceable to lock upon, e.g a repositoryentry or such
identity - the identity who tries to acquire the lock, not null
locksubkey - null or any string to lock finer upon the resource (e.g. "authors", or "write", ...)
Returns:
lock result

releaseLock

void releaseLock(LockResult le)
releases the lock. can also be called if the lock was not sucessfully acquired

Parameters:
le - the LockResult received when locking

isLocked

boolean isLocked(OLATResourceable ores,
                 java.lang.String locksubkey)
Parameters:
ores -
locksubkey -
Returns:
if the olatresourceable with the subkey is already locked by someone (returns true even if locked by "myself")

aquirePersistentLock

LockResult aquirePersistentLock(OLATResourceable ores,
                                Identity ident,
                                java.lang.String locksubkey)
acquires a persistent lock.

Parameters:
ores -
ident -
locksubkey - may not be longer than 30 chars
Returns:
the LockResult of this lock trial.

releasePersistentLock

void releasePersistentLock(LockResult le)
releases a persistent lock.

Parameters:
le - the LockResult which stems from the lock acquired previously

adminOnlyGetLockEntries

java.util.List<LockEntry> adminOnlyGetLockEntries()
for admin purposes only.

Returns:
a list of lockentries.