org.apache.jackrabbit.webdav.lock
Class DefaultActiveLock

java.lang.Object
  extended byorg.apache.jackrabbit.webdav.lock.AbstractActiveLock
      extended byorg.apache.jackrabbit.webdav.lock.DefaultActiveLock
All Implemented Interfaces:
ActiveLock, DavConstants, XmlSerializable
Direct Known Subclasses:
TxActiveLock

public class DefaultActiveLock
extends AbstractActiveLock

DefaultActiveLock implements the ActiveLock interface and represents an exclusive write lock with a random uuid lock token. Lock owner, timeout and depth is retrieved from the LockInfo object passed in the constructor. If the lockinfo is null, the following default values are set:

 - timeout is set to infinity.
 - isDeep is set to true.
 


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.webdav.DavConstants
creationDateFormat, DEPTH_0, DEPTH_1, DEPTH_INFINITY, DEPTH_INFINITY_S, HEADER_AUTHORIZATION, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_DAV, HEADER_DEPTH, HEADER_DESTINATION, HEADER_ETAG, HEADER_IF, HEADER_LAST_MODIFIED, HEADER_LOCK_TOKEN, HEADER_OVERWRITE, HEADER_TIMEOUT, INFINITE_TIMEOUT, modificationDateFormat, NAMESPACE, OPAQUE_LOCK_TOKEN_PREFIX, PROPERTY_CREATIONDATE, PROPERTY_DISPLAYNAME, PROPERTY_GETCONTENTLANGUAGE, PROPERTY_GETCONTENTLENGTH, PROPERTY_GETCONTENTTYPE, PROPERTY_GETETAG, PROPERTY_GETLASTMODIFIED, PROPERTY_LOCKDISCOVERY, PROPERTY_RESOURCETYPE, PROPERTY_SOURCE, PROPERTY_SUPPORTEDLOCK, PROPFIND_ALL_PROP, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKSCOPE, XML_LOCKTOKEN, XML_LOCKTYPE, XML_MULTISTATUS, XML_OMIT, XML_OWNER, XML_PROP, XML_PROPERTYBEHAVIOR, XML_PROPERTYUPDATE, XML_PROPFIND, XML_PROPNAME, XML_PROPSTAT, XML_REMOVE, XML_RESPONSE, XML_RESPONSEDESCRIPTION, XML_SET, XML_SHARED, XML_SOURCE, XML_STATUS, XML_TIMEOUT, XML_WRITE
 
Constructor Summary
DefaultActiveLock()
          Create a new DefaultActiveLock with default values.
DefaultActiveLock(LockInfo lockInfo)
          Create a new lock
 
Method Summary
 String getOwner()
          Return the name (or id) of the lock owner.
 Scope getScope()
          This is always an exclusive lock.
 long getTimeout()
          Return the number of milliseconds the lock will live until it is expired or -1 if the timeout is not available (or the client is not allowed to retrieve it).
 String getToken()
          Return the lock token.
 Type getType()
          This is always a write lock.
 boolean isDeep()
          Return true if the lock is deep.
 boolean isExpired()
          Returns true, if this lock is already expired.
 boolean isLockedByToken(String lockToken)
          Return true, if the given token matches the lock token present in this lock thus indicating that any lock relevant operation should not fail due to a lock.
 void setIsDeep(boolean isDeep)
          Set the lock deepness.
 void setOwner(String owner)
          Set the name (or id) of the lock owner
 void setTimeout(long timeout)
          Defines the number of milliseconds until the timeout is reached.
 
Methods inherited from class org.apache.jackrabbit.webdav.lock.AbstractActiveLock
toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultActiveLock

public DefaultActiveLock()
Create a new DefaultActiveLock with default values.


DefaultActiveLock

public DefaultActiveLock(LockInfo lockInfo)
Create a new lock

Parameters:
lockInfo -
Throws:
IllegalArgumentException - if either scope or type is invalid.
Method Detail

isLockedByToken

public boolean isLockedByToken(String lockToken)
Description copied from interface: ActiveLock
Return true, if the given token matches the lock token present in this lock thus indicating that any lock relevant operation should not fail due to a lock.

Parameters:
lockToken - to be checked
Returns:
true if the given lock token matches.
See Also:
ActiveLock.isLockedByToken(String)

isExpired

public boolean isExpired()
Description copied from interface: ActiveLock
Returns true, if this lock is already expired.

Returns:
true if the lock is expired
See Also:
ActiveLock.isExpired()

getToken

public String getToken()
Description copied from interface: ActiveLock
Return the lock token.

Returns:
token string representing the lock token.
See Also:
ActiveLock.getToken()

getOwner

public String getOwner()
Description copied from interface: ActiveLock
Return the name (or id) of the lock owner.

Returns:
name (or id) of the lock owner.
See Also:
ActiveLock.getOwner()

setOwner

public void setOwner(String owner)
Description copied from interface: ActiveLock
Set the name (or id) of the lock owner

Parameters:
owner -
See Also:
ActiveLock.setOwner(String)

getTimeout

public long getTimeout()
Description copied from interface: ActiveLock
Return the number of milliseconds the lock will live until it is expired or -1 if the timeout is not available (or the client is not allowed to retrieve it).

Returns:
See Also:
ActiveLock.getTimeout()

setTimeout

public void setTimeout(long timeout)
Description copied from interface: ActiveLock
Defines the number of milliseconds until the timeout is reached.

Parameters:
timeout -
See Also:
ActiveLock.setTimeout(long)

isDeep

public boolean isDeep()
Description copied from interface: ActiveLock
Return true if the lock is deep.

Returns:
true if the lock is deep.
See Also:
ActiveLock.isDeep()

setIsDeep

public void setIsDeep(boolean isDeep)
Description copied from interface: ActiveLock
Set the lock deepness.

Parameters:
isDeep -
See Also:
ActiveLock.setIsDeep(boolean)

getType

public Type getType()
This is always a write lock.

Returns:
the lock type
See Also:
Type.WRITE

getScope

public Scope getScope()
This is always an exclusive lock.

Returns:
the lock scope.
See Also:
Scope.EXCLUSIVE


Copyright © 2005-2006 . All Rights Reserved.