Class JcrActiveLock
- java.lang.Object
-
- org.apache.jackrabbit.webdav.lock.AbstractActiveLock
-
- org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock
-
- All Implemented Interfaces:
DavConstants
,ActiveLock
,XmlSerializable
public class JcrActiveLock extends AbstractActiveLock implements ActiveLock, DavConstants
JcrActiveLock
wraps aJCR lock
object.
-
-
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 JcrActiveLock(Lock 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()
Return the scope of this lock.long
getTimeout()
Calculates the milliseconds of the timeout fromLock.getSecondsRemaining()
.String
getToken()
Return the lock token if theSession
that obtained the lock is the lock token holder,null
otherwise.
NOTE: currently the token generated by the underlying JCR repository is not checked for compliance with RFC 2518 ("OpaqueLockToken-URI = "opaquelocktoken:" UUID [Extension] ; The UUID production is the string representation of a UUID, as defined in [ISO-11578].Type
getType()
Always returnsType.WRITE
.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 lock token equals the token holding that 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)
ThrowsUnsupportedOperationException
-
Methods inherited from class org.apache.jackrabbit.webdav.lock.AbstractActiveLock
getLockroot, setLockroot, toXml
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.webdav.lock.ActiveLock
getLockroot, setLockroot
-
Methods inherited from interface org.apache.jackrabbit.webdav.xml.XmlSerializable
toXml
-
-
-
-
Constructor Detail
-
JcrActiveLock
public JcrActiveLock(Lock lock)
- Parameters:
lock
-
-
-
Method Detail
-
isLockedByToken
public boolean isLockedByToken(String lockToken)
Return true if the given lock token equals the token holding that lock.- Specified by:
isLockedByToken
in interfaceActiveLock
- Parameters:
lockToken
-- Returns:
- true if the given lock token equals this locks token.
- See Also:
ActiveLock.isLockedByToken(String)
-
isExpired
public boolean isExpired()
Description copied from interface:ActiveLock
Returns true, if this lock is already expired.- Specified by:
isExpired
in interfaceActiveLock
- Returns:
- true if the lock is expired
- See Also:
ActiveLock.isExpired()
-
getToken
public String getToken()
Return the lock token if theSession
that obtained the lock is the lock token holder,null
otherwise.
NOTE: currently the token generated by the underlying JCR repository is not checked for compliance with RFC 2518 ("OpaqueLockToken-URI = "opaquelocktoken:" UUID [Extension] ; The UUID production is the string representation of a UUID, as defined in [ISO-11578]. Note that white space (LWS) is not allowed between elements of this production.").In case of session-scoped JCR 2.0 locks, the token is never exposed even if the current session is lock holder. In order to cope with DAV specific requirements and the fulfill the requirement stated above, the node's identifier is subsequently exposed as DAV-token.
- Specified by:
getToken
in interfaceActiveLock
- 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.- Specified by:
getOwner
in interfaceActiveLock
- 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- Specified by:
setOwner
in interfaceActiveLock
- See Also:
ActiveLock.setOwner(String)
-
getTimeout
public long getTimeout()
Calculates the milliseconds of the timeout fromLock.getSecondsRemaining()
. If the timeout of jcr lock is undefined or infiniteDavConstants.INFINITE_TIMEOUT
is returned.- Specified by:
getTimeout
in interfaceActiveLock
- Returns:
- number of milliseconds.
- See Also:
ActiveLock.getTimeout()
-
setTimeout
public void setTimeout(long timeout)
ThrowsUnsupportedOperationException
- Specified by:
setTimeout
in interfaceActiveLock
- See Also:
ActiveLock.setTimeout(long)
-
isDeep
public boolean isDeep()
Description copied from interface:ActiveLock
Return true if the lock is deep.- Specified by:
isDeep
in interfaceActiveLock
- 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.- Specified by:
setIsDeep
in interfaceActiveLock
- See Also:
ActiveLock.setIsDeep(boolean)
-
getType
public Type getType()
Always returnsType.WRITE
.- Specified by:
getType
in interfaceActiveLock
- Returns:
Type.WRITE
- See Also:
ActiveLock.getType()
-
getScope
public Scope getScope()
Description copied from interface:ActiveLock
Return the scope of this lock.- Specified by:
getScope
in interfaceActiveLock
- Returns:
- The scope of this lock, which may either by an
exclusive
orexclusive session scoped
lock. - See Also:
ActiveLock.getScope()
-
-