Class LockInfo
java.lang.Object
org.apache.jackrabbit.webdav.lock.LockInfo
- All Implemented Interfaces:
DavConstants,XmlSerializable
LockInfo is a simple utility class encapsulating the information
passed with a LOCK request. It combines both the request body (which if present
is required to by a 'lockinfo' Xml element) and the lock relevant request
headers 'Timeout' and
'Depth'.Note that is class is not intended to perform any validation of the information given, since this left to those objects responsible for the lock creation on the requested resource.
-
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
ConstructorsConstructorDescriptionLockInfo(long timeout) Create a newLockInfoused for refreshing an existing lock.Create a newLockInfoCreate a newLockInfoobject from the given information. -
Method Summary
Modifier and TypeMethodDescriptiongetOwner()Return the owner indicated by the corresponding child element from the 'lockinfo' element ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'owner' element.getScope()Return the lock scope ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'scope' element and the scope has not been set otherwise.longReturns the time until the lock is requested to expire.getType()Returns the lock type ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'type' element and the type has not been set otherwise.booleanisDeep()Returns true if the lock must be applied with depth infinity.booleanReturns true if thisLockInfowas created for a LOCK request intended to refresh an existing lock rather than creating a new one.voidSet the lock scope.voidSet the lock type.Returns the xml representation of this lock info.
NOTE however, that the depth and the timeout are not included in the xml.
-
Constructor Details
-
LockInfo
public LockInfo(long timeout) Create a newLockInfoused for refreshing an existing lock.- Parameters:
timeout-
-
LockInfo
Create a newLockInfo- Parameters:
scope-type-owner-timeout-isDeep-
-
LockInfo
Create a newLockInfoobject from the given information. IfliElementisnullthis lockinfo is assumed to be issued from a 'Refresh Lock' request.- Parameters:
liElement- 'lockinfo' element present in the request body of a LOCK request ornullif the request was intended to refresh an existing lock.timeout- Requested timespan until the lock should expire. A LOCK request MUST contain a 'Timeout' according to RFC 2518.isDeep- boolean value indicating whether the lock should be applied with depth infinity or only to the requested resource.- Throws:
DavException- if theliElementis notnullbut does not start with an 'lockinfo' element.
-
-
Method Details
-
getType
Returns the lock type ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'type' element and the type has not been set otherwise.- Returns:
- type or
null
-
setType
Set the lock type.- Parameters:
type-
-
getScope
Return the lock scope ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'scope' element and the scope has not been set otherwise.- Returns:
- scope or
null
-
setScope
Set the lock scope.- Parameters:
scope-
-
getOwner
Return the owner indicated by the corresponding child element from the 'lockinfo' element ornullif no 'lockinfo' element was passed to the constructor or did not contain an 'owner' element.- Returns:
- owner or
null
-
isDeep
public boolean isDeep()Returns true if the lock must be applied with depth infinity.- Returns:
- true if a deep lock must be created.
-
getTimeout
public long getTimeout()Returns the time until the lock is requested to expire.- Returns:
- time until the lock should expire.
-
isRefreshLock
public boolean isRefreshLock()Returns true if thisLockInfowas created for a LOCK request intended to refresh an existing lock rather than creating a new one.- Returns:
- true if the corresponding LOCK request was intended to refresh an existing lock.
-
toXml
Returns the xml representation of this lock info.
NOTE however, that the depth and the timeout are not included in the xml. They will be passed to the server using the corresponding request headers.- Specified by:
toXmlin interfaceXmlSerializable- Parameters:
document-- Returns:
- xml representation of this lock info.
- See Also:
-