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
DefaultActiveLock
implements theActiveLock
interface and represents an exclusive write lock with a random uuid lock token. Lock owner, timeout and depth is retrieved from theLockInfo
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_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 newDefaultActiveLock
with default values.DefaultActiveLock(LockInfo lockInfo)
Create a new lock
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 ownervoid
setTimeout(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 newDefaultActiveLock
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- 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:
- number of milliseconds.
- 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.- 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.- 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
-
-