ModeShape Distribution 3.0.0.Beta4

org.modeshape.webdav.locking
Interface IResourceLocks

All Known Implementing Classes:
ResourceLocks

public interface IResourceLocks


Method Summary
 void checkTimeouts(ITransaction transaction, boolean temporary)
          Deletes LockedObjects, where timeout has reached.
 boolean exclusiveLock(ITransaction transaction, String path, String owner, int depth, int timeout)
          Tries to lock the resource at "path" exclusively.
 LockedObject getLockedObjectByID(ITransaction transaction, String id)
          Gets the LockedObject corresponding to specified id.
 LockedObject getLockedObjectByPath(ITransaction transaction, String path)
          Gets the LockedObject on specified path.
 LockedObject getTempLockedObjectByID(ITransaction transaction, String id)
          Gets the LockedObject corresponding to specified id (locktoken).
 LockedObject getTempLockedObjectByPath(ITransaction transaction, String path)
          Gets the LockedObject on specified path.
 boolean lock(ITransaction transaction, String path, String owner, boolean exclusive, int depth, int timeout, boolean temporary)
          Tries to lock the resource at "path".
 boolean sharedLock(ITransaction transaction, String path, String owner, int depth, int timeout)
          Tries to lock the resource at "path" shared.
 boolean unlock(ITransaction transaction, String id, String owner)
          Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

 void unlockTemporaryLockedObjects(ITransaction transaction, String path, String owner)
          Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

 

Method Detail

lock

boolean lock(ITransaction transaction,
             String path,
             String owner,
             boolean exclusive,
             int depth,
             int timeout,
             boolean temporary)
             throws LockFailedException
Tries to lock the resource at "path".

Parameters:
transaction -
path - what resource to lock
owner - the owner of the lock
exclusive - if the lock should be exclusive (or shared)
depth - depth
timeout - Lock Duration in seconds.
temporary -
Returns:
true if the resource at path was successfully locked, false if an existing lock prevented this
Throws:
LockFailedException

unlock

boolean unlock(ITransaction transaction,
               String id,
               String owner)
Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

Parameters:
transaction -
id - id to the resource to unlock
owner - who wants to unlock
Returns:
true if the resources were unlocked, or false otherwise

unlockTemporaryLockedObjects

void unlockTemporaryLockedObjects(ITransaction transaction,
                                  String path,
                                  String owner)
Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

Parameters:
transaction -
path - what resource to unlock
owner - who wants to unlock

checkTimeouts

void checkTimeouts(ITransaction transaction,
                   boolean temporary)
Deletes LockedObjects, where timeout has reached.

Parameters:
transaction -
temporary - Check timeout on temporary or real locks

exclusiveLock

boolean exclusiveLock(ITransaction transaction,
                      String path,
                      String owner,
                      int depth,
                      int timeout)
                      throws LockFailedException
Tries to lock the resource at "path" exclusively.

Parameters:
transaction - Transaction
path - what resource to lock
owner - the owner of the lock
depth - depth
timeout - Lock Duration in seconds.
Returns:
true if the resource at path was successfully locked, false if an existing lock prevented this
Throws:
LockFailedException

sharedLock

boolean sharedLock(ITransaction transaction,
                   String path,
                   String owner,
                   int depth,
                   int timeout)
                   throws LockFailedException
Tries to lock the resource at "path" shared.

Parameters:
transaction - Transaction
path - what resource to lock
owner - the owner of the lock
depth - depth
timeout - Lock Duration in seconds.
Returns:
true if the resource at path was successfully locked, false if an existing lock prevented this
Throws:
LockFailedException

getLockedObjectByID

LockedObject getLockedObjectByID(ITransaction transaction,
                                 String id)
Gets the LockedObject corresponding to specified id.

Parameters:
transaction -
id - LockToken to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists

getLockedObjectByPath

LockedObject getLockedObjectByPath(ITransaction transaction,
                                   String path)
Gets the LockedObject on specified path.

Parameters:
transaction -
path - Path to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists

getTempLockedObjectByID

LockedObject getTempLockedObjectByID(ITransaction transaction,
                                     String id)
Gets the LockedObject corresponding to specified id (locktoken).

Parameters:
transaction -
id - LockToken to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists

getTempLockedObjectByPath

LockedObject getTempLockedObjectByPath(ITransaction transaction,
                                       String path)
Gets the LockedObject on specified path.

Parameters:
transaction -
path - Path to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.