Class DefaultActiveLock
- java.lang.Object
-
- org.apache.jackrabbit.webdav.lock.AbstractActiveLock
-
- org.apache.jackrabbit.webdav.lock.DefaultActiveLock
-
- All Implemented Interfaces:
DavConstants,ActiveLock,XmlSerializable
- Direct Known Subclasses:
TxActiveLock
public class DefaultActiveLock extends AbstractActiveLock
DefaultActiveLockimplements theActiveLockinterface and represents an exclusive write lock with a random uuid lock token. Lock owner, timeout and depth is retrieved from theLockInfoobject 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_ALL_PROP_INCLUDE, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIME, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_INCLUDE, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKROOT, 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
Constructors Constructor Description DefaultActiveLock()Create a newDefaultActiveLockwith default values.DefaultActiveLock(LockInfo lockInfo)Create a new lock
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetOwner()Return the name (or id) of the lock owner.ScopegetScope()This is always an exclusive lock.longgetTimeout()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).java.lang.StringgetToken()Return the lock token.TypegetType()This is always a write lock.booleanisDeep()Return true if the lock is deep.booleanisExpired()Returns true, if this lock is already expired.booleanisLockedByToken(java.lang.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.voidsetIsDeep(boolean isDeep)Set the lock deepness.voidsetOwner(java.lang.String owner)Set the name (or id) of the lock ownervoidsetTimeout(long timeout)Defines the number of milliseconds until the timeout is reached.-
Methods inherited from class org.apache.jackrabbit.webdav.lock.AbstractActiveLock
getLockroot, setLockroot, toXml
-
-
-
-
Constructor Detail
-
DefaultActiveLock
public DefaultActiveLock()
Create a newDefaultActiveLockwith default values.
-
DefaultActiveLock
public DefaultActiveLock(LockInfo lockInfo)
Create a new lock- Parameters:
lockInfo-- Throws:
java.lang.IllegalArgumentException- if either scope or type is invalid.
-
-
Method Detail
-
isLockedByToken
public boolean isLockedByToken(java.lang.String lockToken)
Description copied from interface:ActiveLockReturn 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:ActiveLockReturns true, if this lock is already expired.- Returns:
- true if the lock is expired
- See Also:
ActiveLock.isExpired()
-
getToken
public java.lang.String getToken()
Description copied from interface:ActiveLockReturn the lock token.- Returns:
- token string representing the lock token.
- See Also:
ActiveLock.getToken()
-
getOwner
public java.lang.String getOwner()
Description copied from interface:ActiveLockReturn the name (or id) of the lock owner.- Returns:
- name (or id) of the lock owner.
- See Also:
ActiveLock.getOwner()
-
setOwner
public void setOwner(java.lang.String owner)
Description copied from interface:ActiveLockSet the name (or id) of the lock owner- See Also:
ActiveLock.setOwner(String)
-
getTimeout
public long getTimeout()
Description copied from interface:ActiveLockReturn 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:
- number of milliseconds.
- See Also:
ActiveLock.getTimeout()
-
setTimeout
public void setTimeout(long timeout)
Description copied from interface:ActiveLockDefines the number of milliseconds until the timeout is reached.- See Also:
ActiveLock.setTimeout(long)
-
isDeep
public boolean isDeep()
Description copied from interface:ActiveLockReturn 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:ActiveLockSet the lock deepness.- 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
-
-