* Level 2 only *

* A lock is associated with an item and a user (not a ticket) * * @author Markus Nix * @package phpcr * @subpackage lock */ interface Lock { /** * Returns the user ID of the user who owns this lock. This is the value of the * jcr:lockOwner property of the lock-holding node. It is also the * value returned by Session.getUserId at the time that the lock was * placed. The lock owner's identity is only provided for informational purposes. * It does not govern who can perform an unlock or make changes to the locked nodes; * that depends entirely upon who the token holder is. * @return a user ID. */ public function getLockOwner(); /** * Returns true if this is a deep lock; false otherwise. * * @return a boolean */ public function isDeep(); /** * Returns the lock holding node. Note that N.getLock().getNode() * (where N is a locked node) will only return N * if N is the lock holder. If N is in the subtree * of the lock holder, H, then this call will return H. * * @return an Node. */ public function getNode(); /** * May return the lock token for this lock. *

* If this Session holds the lock token for this lock, then this method will * return that lock token. If this Session does not hold the applicable lock * token then this method will return null. * * @return a String. */ public function getLockToken(); /** * Returns true if this Lock object represents a lock that is currently in effect. * If this lock has been unlocked either explicitly or due to an implementation-specific limitation * (like a timeout) then it returns false. Note that this method is intended for * those cases where one is holding a Lock Java object and wants to find out * whether the lock (the JCR-level entity that is attached to the lockable node) that this * object originally represented still exists. For example, a timeout or explicit * unlock will remove a lock from a node but the Lock * Java object corresponding to that lock may still exist, and in that case its * isLive method will return false. * @return a boolean. */ public function isLive(); /** * Returns true if this is a session-scoped lock. Returns * false if this is an open-scoped lock. * * @return a boolean */ public function isSessionScoped(); /** * Refreshes (brings back to life) a previously unlocked Lock object * (one for which isLive returns false). If this lock * is still live (isLive returns true) or if this Session * does not hold the correct lock token for this lock, then a LockException * is thrown. A RepositoryException is thrown if another error occurs. * * The implementation may either revive an existing lock or issue a new lock * (removing this one from the session and substituting the new one). * This is an implementation-specific issue. * @throws LockException if this lock is still live (isLive returns true) * or if this Session does not hold the correct lock token for this lock. * @throws RepositoryException if another error occurs. */ public function refresh(); } ?>