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.

Principles

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.

Behavior

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

{@link org.apache.slide.lock.NodeLock NodeLock}

The NodeLock class represents a lock.