com.ithit.webdav.server
Interface Lock


public interface Lock

Defines methods that WebDAV Class 2 compliant server hierarchy items must implement.

Classes that implement this interface represent WebDAV Class 2 hierarchy items. To create WebDAV Class 2 compliant server you must implement this interface on your file items and folder items.


Method Summary
 java.util.List<LockInfo> getActiveLocks()
          Gets the array of all locks for this item.
 LockResult lock(boolean shared, boolean deep, long timeout, java.lang.String owner)
          Locks this item.
 RefreshLockResult refreshLock(java.lang.String token, long timeout)
          Updates lock timeout information on this item.
 void unlock(java.lang.String lockToken)
          Removes lock with the specified token from this item.
 

Method Detail

getActiveLocks

java.util.List<LockInfo> getActiveLocks()
                                        throws ServerException
Gets the array of all locks for this item.

This method must return all locks for the item including deep locks on any of the parent folders. All fields of each LockInfo structure in the array must be set.

Returns:
Array of locks.
Throws:
ServerException - In case of an error.

lock

LockResult lock(boolean shared,
                boolean deep,
                long timeout,
                java.lang.String owner)
                throws LockedException,
                       MultistatusException,
                       ServerException
Locks this item.

In your Lock implementation you must generate lock token and create LockResult class instance. You must also associate generated token with the hierarchy item in your repository during this call. The token is sent to the WebDAV client.

Parameters:
shared - Indicates whether a lock is shared or exclusive.
deep - Indicates whether a lock is enforceable on the subtree.
timeout - Lock expiration time in seconds. Negative value means never.
owner - Provides information about the principal taking out a lock.
Returns:
Actually applied lock (Server may modify timeout).
Throws:
LockedException - The item is locked, so the method has been rejected.
MultistatusException - Errors have occured during processing of the subtree.
ServerException - In case of an error

refreshLock

RefreshLockResult refreshLock(java.lang.String token,
                              long timeout)
                              throws PreconditionFailedException,
                                     ServerException
Updates lock timeout information on this item.

Parameters:
token - The lock token associated with a lock.
timeout - Lock expiration time in seconds. Negative value means never.
Returns:
Actually applied lock (Server may modify timeout).
Throws:
PreconditionFailedException - Included lock token was not enforceable on this item.
ServerException - In case of an error.

unlock

void unlock(java.lang.String lockToken)
            throws PreconditionFailedException,
                   ServerException
Removes lock with the specified token from this item.

If this lock included more than one hierarchy item, the lock is removed from all items included in the lock.

Parameters:
lockToken - Lock with this token should be removed from the item.
Throws:
PreconditionFailedException - Included lock token was not enforceable on this item.
ServerException - In case of an error.


Copyright © 2009 ITHit. All Rights Reserved.