Package org.apache.slide.lock

Provides classes to access and manipulate locks.


Interface Summary
Lock Lock helper class.
UnlockListener An UnlockListener may be passed to the Lock helper in order to have more control on the unlock operation.

Class Summary
LockImpl Lock helper class.
NodeLock NodeLock class.

Exception Summary
LockException Lock exception.
LockTokenNotFoundException Lock token not found.
ObjectIsAlreadyLockedException Object is already locked.
ObjectLockedException Object is already locked.

Package org.apache.slide.lock Description

Provides classes to access and manipulate locks.

Locking is an integral part of Slide. Its model resembles in many ways the security model. When one subject (ie. a user) wants to lock another subject (ie. a file), it specifies which actions (for example read) are locked and for how long. Slide automatically checks if a subject is locked before every action. Alternatively, the client application can directly check for whether a particular subject is locked or whether it can actually lock a given subject.


Every SubjectNode can potentially be locked. A lock consist of the following information tuple:

(target subject,      owner subject,    locked action,   duration,    inheritance)

Here are examples of locks :

(/foo/document.txt,  /user/dave,        /actions/read,     10m,       no)
(/foo/document.txt,  /user/dave,        /actions/write,    10m,       no)
(/foo,               /user/john,        /actions/read,     5m,        yes)

Same as permissions, locks granted on an object are inherited (unless specified otherwise during locking) by the children of the object. For example, a lock obtained on object whose URI is /foo would also apply to the object /foo/bar.


Slide automatically enforces all locks through the use of helper functions used by the client application. If a subject (ie. a file) is accessed and the action is already locked by another subject (ie. another client) an ObjectLockedException is thrown, which is a checked exception, so the client application will know that an underlying lock check failed, and will take appropriate actions.

Object Model


The NodeLock class represents a lock.