Class JcrActiveLock

  • All Implemented Interfaces:
    org.apache.jackrabbit.webdav.DavConstants, org.apache.jackrabbit.webdav.lock.ActiveLock, org.apache.jackrabbit.webdav.xml.XmlSerializable

    public class JcrActiveLock
    extends org.apache.jackrabbit.webdav.lock.AbstractActiveLock
    implements org.apache.jackrabbit.webdav.lock.ActiveLock, org.apache.jackrabbit.webdav.DavConstants
    JcrActiveLock wraps a JCR 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)
      Create a new ActiveLock object with type 'write' and scope 'exclusive'.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getOwner()  
      org.apache.jackrabbit.webdav.lock.Scope getScope()  
      long getTimeout()
      Calculates the milliseconds of the timeout from Lock.getSecondsRemaining().
      String getToken()
      Return the lock token if the Session 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].
      org.apache.jackrabbit.webdav.lock.Type getType()
      Always returns Type.WRITE.
      boolean isDeep()  
      boolean isExpired()  
      boolean isLockedByToken​(String lockToken)
      Return true if the given lock token equals the token holding that lock.
      void setIsDeep​(boolean isDeep)  
      void setOwner​(String owner)  
      void setTimeout​(long timeout)
      Throws UnsupportedOperationException
      • Methods inherited from class org.apache.jackrabbit.webdav.lock.AbstractActiveLock

        getLockroot, setLockroot, toXml
      • 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)
        Create a new ActiveLock object with type 'write' and scope 'exclusive'.
        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 interface org.apache.jackrabbit.webdav.lock.ActiveLock
        Parameters:
        lockToken -
        Returns:
        true if the given lock token equals this locks token.
        See Also:
        ActiveLock.isLockedByToken(String)
      • isExpired

        public boolean isExpired()
        Specified by:
        isExpired in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.isExpired()
      • getToken

        public String getToken()
        Return the lock token if the Session 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 interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.getToken()
      • getOwner

        public String getOwner()
        Specified by:
        getOwner in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.getOwner()
      • setOwner

        public void setOwner​(String owner)
        Specified by:
        setOwner in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.setOwner(String)
      • getTimeout

        public long getTimeout()
        Calculates the milliseconds of the timeout from Lock.getSecondsRemaining(). If the timeout of jcr lock is undefined or infinite DavConstants.INFINITE_TIMEOUT is returned.
        Specified by:
        getTimeout in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.getTimeout()
      • setTimeout

        public void setTimeout​(long timeout)
        Throws UnsupportedOperationException
        Specified by:
        setTimeout in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.setTimeout(long)
      • isDeep

        public boolean isDeep()
        Specified by:
        isDeep in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.isDeep()
      • setIsDeep

        public void setIsDeep​(boolean isDeep)
        Specified by:
        setIsDeep in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        See Also:
        ActiveLock.setIsDeep(boolean)
      • getType

        public org.apache.jackrabbit.webdav.lock.Type getType()
        Always returns Type.WRITE.
        Specified by:
        getType in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        Returns:
        Type.WRITE
        See Also:
        ActiveLock.getType()
      • getScope

        public org.apache.jackrabbit.webdav.lock.Scope getScope()
        Specified by:
        getScope in interface org.apache.jackrabbit.webdav.lock.ActiveLock
        Returns:
        The scope of this lock, which may either by an exclusive or exclusive session scoped lock.
        See Also:
        ActiveLock.getScope()