Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.slide.lock
Class LockImpl

    java.lang.Object
      org.apache.slide.lock.LockImpl

All Implemented Interfaces:
  Lock

public final class LockImpl
extends java.lang.Object
implements Lock

Lock helper class.

Version:
  $Revision: 1.47.2.1 $

Constructor Summary
`LockImpl(Namespace namespace, NamespaceConfig namespaceConfig, Security securityHelper)` Constructor.

Method Summary
`void` | `checkLock(SlideToken token, ObjectNode object, ActionNode action)` Utility function for lock checking.
`void` | `checkLock(SlideToken slideToken, ObjectNode subject, SubjectNode user, ActionNode action)` Check locking for a specific action and credential.
`boolean` | `checkLockOwner(SlideToken slideToken, NodeLock token)` Returns true, if the principal from the credentials token is either the lock-owner of has kill-lock privileges
`boolean` | `checkLockToken(SlideToken slideToken, NodeLock token)` Return true if a lock token for this lock has been given in the credentials token.
`void` | `clearExpiredLocks(SlideToken slideToken, java.lang.String objectUri, UnlockListener listener)` Clears the expired locks from the specified resource.
`java.util.Enumeration` | `enumerateLocks(SlideToken slideToken, java.lang.String objectUri)` Enumerate locks on a subject, including any locks inherited from parent subjects.
`java.util.Enumeration` | `enumerateLocks(SlideToken slideToken, java.lang.String objectUri, boolean inherited)` Enumerate locks on a subject, optionally excluding locks inherited from parent subjects.
`boolean` | `isLocked(SlideToken slideToken, NodeLock token, boolean tryToLock)` Tests if an element is locked.
`boolean` | `isLocked(SlideToken slideToken, ObjectNode subject, SubjectNode user, ActionNode action, boolean tryToLock)` Tests if an element is locked.
`boolean` | `isLocked(SlideToken slideToken, ObjectNode subject, SubjectNode user, ActionNode action, boolean inheritance, boolean tryToLock)` Tests if an element is locked.
`void` | `kill(SlideToken slideToken, SubjectNode subject)` Kills locks.
`void` | `lock(SlideToken slideToken, NodeLock lockToken)` Put a lock on a subject.
`void` | `renew(SlideToken slideToken, NodeLock lockToken, java.util.Date newExpirationDate)` Renew a lock.
`void` | `renew(SlideToken slideToken, java.lang.String objectUri, java.lang.String lockId, java.util.Date newExpirationDate)` Renew a set of linked locks.
`boolean` | `unlock(SlideToken slideToken, NodeLock lockToken)` Removes a lock.
`void` | `unlock(SlideToken slideToken, java.lang.String objectUri, java.lang.String lockId)` Removes a set of linked locks.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LockImpl

    public LockImpl(Namespace namespace,
                    NamespaceConfig namespaceConfig,
                    Security securityHelper)

  Constructor.

Parameters:
  `namespace` - Associated namespace
  `namespaceConfig` - Namespace configuration
  `securityHelper` - Security helper

Method Detail

### lock

    public void lock(SlideToken slideToken,
                     NodeLock lockToken)
              throws ServiceAccessException,
                     ObjectIsAlreadyLockedException,
                     AccessDeniedException,
                     ObjectNotFoundException,
                     VetoException

  Put a lock on a subject.

  Specified by:
    `lock` in interface `Lock`
  Parameters:
    `slideToken` - The token to access slide.
    `lockToken` - Object containing all the lock information
  Throws:
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found
    `ObjectIsAlreadyLockedException` - Object is already locked with an incompatible lock token
    `AccessDeniedException` - Insufficient credentials to allow object locking
    `VetoException`

### unlock

    public boolean unlock(SlideToken slideToken,
                          NodeLock lockToken)
                   throws ServiceAccessException,
                          LockTokenNotFoundException,
                          VetoException

  Removes a lock.

  Specified by:
    `unlock` in interface `Lock`
  Parameters:
    `slideToken` - The token to access slide.
    `lockToken` - Object containing all the lock information
  Returns:
    `true` if the lock could be removed
  Throws:
    `ServiceAccessException` - Low level service access exception
    `LockTokenNotFoundException` - Cannot find the Lock in the Lock Store service
    `VetoException`

### unlock

    public void unlock(SlideToken slideToken,
                       java.lang.String objectUri,
                       java.lang.String lockId)
                throws ServiceAccessException,
                       LockTokenNotFoundException,
                       ObjectNotFoundException,
                       VetoException

  Removes a set of linked locks.

  Specified by:
    `unlock` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `objectUri` - Uri of the locked object.
    `lockId` - The id of the locks, which will be removed.
  Throws:
    `ServiceAccessException` - Low level service access exception
    `LockTokenNotFoundException` - Cannot find the Lock in the Lock Store service
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found
    `VetoException`

### renew

    public void renew(SlideToken slideToken,
                      NodeLock lockToken,
                      java.util.Date newExpirationDate)
               throws ServiceAccessException,
                      LockTokenNotFoundException,
                      VetoException

  Renew a lock.

  Specified by:
    `renew` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `lockToken` - Token containing the lock info.
    `newExpirationDate` - the desired expiration date
  Throws:
    `ServiceAccessException` - Low level service access exception
    `LockTokenNotFoundException` - Cannot find the Lock in the Lock Store service
    `VetoException`

### renew

    public void renew(SlideToken slideToken,
                      java.lang.String objectUri,
                      java.lang.String lockId,
                      java.util.Date newExpirationDate)
               throws ServiceAccessException,
                      LockTokenNotFoundException,
                      ObjectNotFoundException,
                      VetoException

  Renew a set of linked locks.

  Specified by:
    `renew` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `objectUri` - Uri of the locked object
    `lockId` - Id of the locks, which will be renewed.
    `newExpirationDate` - The new expiration date of the locks
  Throws:
    `ServiceAccessException` - Low level service access exception
    `LockTokenNotFoundException` - Cannot find the Lock in the Lock Store service
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found
    `VetoException`

### kill

    public void kill(SlideToken slideToken,
                     SubjectNode subject)
              throws ServiceAccessException,
                     AccessDeniedException,
                     LockTokenNotFoundException,
                     ObjectNotFoundException,
                     VetoException

  Kills locks.

  Specified by:
    `kill` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `subject` - Subject on which locks are to be removed
  Throws:
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found
    `LockTokenNotFoundException` - Cannot find the Lock in the Lock Store service
    `AccessDeniedException` - Insufficient credentials to allow forced removal of locks
    `VetoException`

### enumerateLocks

    public java.util.Enumeration enumerateLocks(SlideToken slideToken,
                                                java.lang.String objectUri)
                                         throws ServiceAccessException,
                                                ObjectNotFoundException,
                                                LockTokenNotFoundException

  Description copied from interface: `Lock`
  Enumerate locks on a subject, including any locks inherited from parent subjects.

  Specified by:
    `enumerateLocks` in interface `Lock`
  Parameters:
    `slideToken` - the slide token
    `objectUri` - the URI of the object of which we want to enumerate active locks
  Returns:
    an Enumeration of NodeLock objects
  Throws:
    `ObjectNotFoundException` - one of the objects referenced in the lock token were not found
    `ServiceAccessException` - low level service access exception
    `LockTokenNotFoundException`

### enumerateLocks

    public java.util.Enumeration enumerateLocks(SlideToken slideToken,
                                                java.lang.String objectUri,
                                                boolean inherited)
                                         throws ServiceAccessException,
                                                ObjectNotFoundException,
                                                LockTokenNotFoundException

  Description copied from interface: `Lock`
  Enumerate locks on a subject, optionally excluding locks inherited from parent subjects.

  Specified by:
    `enumerateLocks` in interface `Lock`
  Parameters:
    `slideToken` - the slide token
    `objectUri` - the URI of the object of which we want to enumerate active locks
    `inherited` - if true, locks inherited from parent objects will be included in the result, otherwise, only locks that explicitly lock the object will be returned
  Returns:
    an Enumeration of NodeLock objects
  Throws:
    `ObjectNotFoundException` - one of the objects referenced in the lock token were not found
    `LockTokenNotFoundException` - cannot find the lock in the lock store service
    `ServiceAccessException` - low level service access exception

### checkLock

    public void checkLock(SlideToken token,
                          ObjectNode object,
                          ActionNode action)
                   throws ServiceAccessException,
                          ObjectNotFoundException,
                          ObjectLockedException

  Utility function for lock checking. Mirrors Security.checkCredentials.

  Specified by:
    `checkLock` in interface `Lock`
  Parameters:
    `token` - Slide token
    `object` - Object on which the action is performed
    `action` - Action to test
  Throws:
    `ObjectLockedException` - Can't perform specified action on object
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found

### checkLock

    public void checkLock(SlideToken slideToken,
                          ObjectNode subject,
                          SubjectNode user,
                          ActionNode action)
                   throws ServiceAccessException,
                          ObjectNotFoundException,
                          ObjectLockedException

  Check locking for a specific action and credential.

  Specified by:
    `checkLock` in interface `Lock`
  Parameters:
    `slideToken` - Credetials token
    `subject` - Subject to test
    `user` - User to test
    `action` - Action to test
  Throws:
    `ObjectLockedException` - Can't perform specified action on object
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found

### isLocked

    public boolean isLocked(SlideToken slideToken,
                            ObjectNode subject,
                            SubjectNode user,
                            ActionNode action,
                            boolean tryToLock)
                     throws ServiceAccessException,
                            ObjectNotFoundException

  Tests if an element is locked.

  Specified by:
    `isLocked` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `subject` - Subject to test
    `user` - User to test
    `action` - Locked for action
  Returns:
    boolean True if the subject is locked
  Throws:
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found

### isLocked

    public boolean isLocked(SlideToken slideToken,
                            ObjectNode subject,
                            SubjectNode user,
                            ActionNode action,
                            boolean inheritance,
                            boolean tryToLock)
                     throws ServiceAccessException,
                            ObjectNotFoundException

  Tests if an element is locked.

  Specified by:
    `isLocked` in interface `Lock`
  Parameters:
    `slideToken` - Slide token
    `subject` - Subject to test
    `user` - User to test
    `action` - Locked for action
    `inheritance` - Set to true if we want to check if any children is locked with an incompatible lock
    `tryToLock` - True if the check is intended to check whether or not we can put a new lock
  Returns:
    boolean True if the subject is locked
  Throws:
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found

### isLocked

    public boolean isLocked(SlideToken slideToken,
                            NodeLock token,
                            boolean tryToLock)
                     throws ServiceAccessException,
                            ObjectNotFoundException

  Tests if an element is locked.

  Specified by:
    `isLocked` in interface `Lock`
  Parameters:
    `token` - Lock token to test
  Returns:
    boolean True if locked
  Throws:
    `ServiceAccessException` - Low level service access exception
    `ObjectNotFoundException` - One of the objects referenced in the lock token were not found

### clearExpiredLocks

    public void clearExpiredLocks(SlideToken slideToken,
                                  java.lang.String objectUri,
                                  UnlockListener listener)
                           throws SlideException

  Clears the expired locks from the specified resource.

  Specified by:
    `clearExpiredLocks` in interface `Lock`
  Parameters:
    `slideToken` - a SlideToken
    `objectUri` - a String
    `listener` - an UnlockListener
  Throws:
    `SlideException`

### checkLockToken

    public boolean checkLockToken(SlideToken slideToken,
                                  NodeLock token)

  Return true if a lock token for this lock has been given in the credentials token.

  Specified by:
    `checkLockToken` in interface `Lock`
  Parameters:
    `slideToken` - Current credentials token
    `token` - Lock token

### checkLockOwner

    public boolean checkLockOwner(SlideToken slideToken,
                                  NodeLock token)
                           throws ObjectNotFoundException,
                                  ServiceAccessException

  Returns true, if the principal from the credentials token is either the lock-owner of has kill-lock privileges

  Specified by:
    `checkLockOwner` in interface `Lock`
  Parameters:
    `slideToken` - a SlideToken
    `token` - a NodeLock
  Returns:
    a boolean
  Throws:
    `ObjectNotFoundException`
    `ServiceAccessException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD