Class WebdavLock

  • Direct Known Subclasses:
    CatWebdavLock, FileWebdavLock

    public abstract class WebdavLock
    extends java.lang.Object
    This class is an Abstract Representation of a Webdav Lock handling all webdav mechanism in memory.
    Since:
    jcms-5.5.0
    Version:
    $Revision: 107554 $
    Author:
    Jean-Philippe Encausse
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_TIMEOUT  
      protected int depth  
      protected java.lang.String id  
      protected long lastMod  
      static int MAX_TIMEOUT  
      static java.security.MessageDigest md5Digest  
      protected java.lang.String owner  
      static java.lang.String REVISION  
      protected java.lang.String scope  
      protected java.lang.String secret  
      protected int timeout  
      protected java.util.Collection<java.lang.String> tokens  
      protected java.lang.String type  
      protected java.lang.String uri  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected WebdavLock​(java.lang.String uri, WebdavContext ctxt)
      The lock must be a relative URI to the path folders starting and ending by '/'.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acquire​(WebdavResource resource, WebdavContext ctxt)
      This method is called for other mecanism outside of Webdav that need to be notified by lock
      java.lang.String encode​(byte[] binaryData)
      Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
      java.lang.String generateId​(WebdavContext ctxt)
      Generate an MD5 id from the given locks parameters
      int getDepth()
      This method retrieve the Depth of the Lock
      long getExpiredTime()
      This method retrieve the expired timeout
      java.lang.String getId()
      An MD5 representation of the Lock
      long getLastModified()
      This method retrieve the lastmodified of timeout
      java.lang.String getOwner()
      This method retrieve the Owner of the Lock
      java.lang.String getScope()
      This method retrieve the Scope of the Lock
      int getTimeout()
      This method retrieve the Timeout of the Lock without lastMod
      java.util.Collection<java.lang.String> getTokens()
      This method retrieve the Tokens of the Lock
      java.lang.String getType()
      This method retrieve the Type of the Lock
      boolean hasExpired()  
      boolean isExclusive()  
      void refresh​(WebdavResource resource, WebdavContext ctxt)
      This method is called for other mecanism outside of Webdav that need to be notified by unlock
      void release​(WebdavResource resource, WebdavContext ctxt)
      This method is called for other mecanism outside of Webdav that need to be notified by unlock
      void setDepth​(int depth)
      This method set the Depth of the Lock
      void setOwner​(java.lang.String owner)
      This method set the Owner of the Lock
      void setScope​(java.lang.String scope)
      This method set the Scope of the Lock
      void setTimeout​(int timeout)
      This method set the Timeout of the Lock
      void setType​(java.lang.String type)
      This method set the Type of the Lock
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • md5Digest

        public static final java.security.MessageDigest md5Digest
      • uri

        protected java.lang.String uri
      • lastMod

        protected long lastMod
      • timeout

        protected int timeout
      • depth

        protected int depth
      • type

        protected java.lang.String type
      • scope

        protected java.lang.String scope
      • owner

        protected java.lang.String owner
      • id

        protected java.lang.String id
      • secret

        protected java.lang.String secret
      • tokens

        protected java.util.Collection<java.lang.String> tokens
    • Constructor Detail

      • WebdavLock

        protected WebdavLock​(java.lang.String uri,
                             WebdavContext ctxt)
        The lock must be a relative URI to the path folders starting and ending by '/'. ie /my/path/resource.ext -> /my/path/resource.ext
        ie /my/path/ -> /my/path/
        Parameters:
        uri - the lock uri
        ctxt - the Webdav Context
        See Also:
        WebdavFileSystem.getLocks(WebdavResource, WebdavContext)
    • Method Detail

      • getDepth

        public int getDepth()
        This method retrieve the Depth of the Lock
        Returns:
        int representing the Depth of the lock
      • setDepth

        public void setDepth​(int depth)
        This method set the Depth of the Lock
        Parameters:
        depth -
      • getExpiredTime

        public long getExpiredTime()
        This method retrieve the expired timeout
        Returns:
        long the expired timeout
      • getLastModified

        public long getLastModified()
        This method retrieve the lastmodified of timeout
        Returns:
        long the lastmodified timeout call
      • getTimeout

        public int getTimeout()
        This method retrieve the Timeout of the Lock without lastMod
        Returns:
        long representing the Timeout of the lock
      • setTimeout

        public void setTimeout​(int timeout)
        This method set the Timeout of the Lock
        Parameters:
        timeout - the timeout since mdate
      • getType

        public java.lang.String getType()
        This method retrieve the Type of the Lock
        Returns:
        String representing the type of the lock
      • setType

        public void setType​(java.lang.String type)
        This method set the Type of the Lock
        Parameters:
        type - the type of the lock
      • getScope

        public java.lang.String getScope()
        This method retrieve the Scope of the Lock
        Returns:
        String representing the scope of the lock
      • setScope

        public void setScope​(java.lang.String scope)
        This method set the Scope of the Lock
        Parameters:
        scope - the scope of the lock
      • getOwner

        public java.lang.String getOwner()
        This method retrieve the Owner of the Lock
        Returns:
        String representing the owner of the lock
      • setOwner

        public void setOwner​(java.lang.String owner)
        This method set the Owner of the Lock
        Parameters:
        owner - the owner of the lock
      • getId

        public java.lang.String getId()
        An MD5 representation of the Lock
        Returns:
        String representing the id/token of the lock
      • getTokens

        public java.util.Collection<java.lang.String> getTokens()
        This method retrieve the Tokens of the Lock
        Returns:
        Collection of tokens
      • isExclusive

        public boolean isExclusive()
        Returns:
        boolean true if the lock is exclusive
      • hasExpired

        public boolean hasExpired()
        Returns:
        boolean true if the lock has expired
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • acquire

        public void acquire​(WebdavResource resource,
                            WebdavContext ctxt)
        This method is called for other mecanism outside of Webdav that need to be notified by lock
        Parameters:
        ctxt - the Webdav Context
      • release

        public void release​(WebdavResource resource,
                            WebdavContext ctxt)
        This method is called for other mecanism outside of Webdav that need to be notified by unlock
        Parameters:
        ctxt - the Webdav Context
      • refresh

        public void refresh​(WebdavResource resource,
                            WebdavContext ctxt)
        This method is called for other mecanism outside of Webdav that need to be notified by unlock
        Parameters:
        ctxt - the Webdav Context
      • generateId

        public java.lang.String generateId​(WebdavContext ctxt)
        Generate an MD5 id from the given locks parameters
        Parameters:
        ctxt - the WebDav Context
        Returns:
        String the given Id
      • encode

        public java.lang.String encode​(byte[] binaryData)
        Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
        Parameters:
        binaryData - Array containing the digest
        Returns:
        Encoded MD5, or null if encoding failed