Package com.jalios.jcms.webdav
Class WebdavLock
- java.lang.Object
-
- com.jalios.jcms.webdav.WebdavLock
-
- Direct Known Subclasses:
CatWebdavLock,FileWebdavLock
public abstract class WebdavLock extends java.lang.ObjectThis class is an Abstract Representation of a Webdav Lock handling all webdav mechanism in memory.- Since:
- jcms-5.5.0
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_TIMEOUTprotected intdepthprotected java.lang.Stringidprotected longlastModstatic intMAX_TIMEOUTstatic java.security.MessageDigestmd5Digestprotected java.lang.Stringownerprotected java.lang.Stringscopeprotected java.lang.Stringsecretprotected inttimeoutprotected java.util.Collection<java.lang.String>tokensprotected java.lang.Stringtypeprotected java.lang.Stringuri
-
Constructor Summary
Constructors Modifier Constructor Description protectedWebdavLock(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 voidacquire(WebdavResource resource, WebdavContext ctxt)This method is called for other mecanism outside of Webdav that need to be notified by lockjava.lang.Stringencode(byte[] binaryData)Encodes the 128 bit (16 bytes) MD5 into a 32 character String.java.lang.StringgenerateId(WebdavContext ctxt)Generate an MD5 id from the given locks parametersintgetDepth()This method retrieve the Depth of the LocklonggetExpiredTime()This method retrieve the expired timeoutjava.lang.StringgetId()An MD5 representation of the LocklonggetLastModified()This method retrieve the lastmodified of timeoutjava.lang.StringgetOwner()This method retrieve the Owner of the Lockjava.lang.StringgetScope()This method retrieve the Scope of the LockintgetTimeout()This method retrieve the Timeout of the Lock without lastModjava.util.Collection<java.lang.String>getTokens()This method retrieve the Tokens of the Lockjava.lang.StringgetType()This method retrieve the Type of the LockbooleanhasExpired()booleanisExclusive()voidrefresh(WebdavResource resource, WebdavContext ctxt)This method is called for other mecanism outside of Webdav that need to be notified by unlockvoidrelease(WebdavResource resource, WebdavContext ctxt)This method is called for other mecanism outside of Webdav that need to be notified by unlockvoidsetDepth(int depth)This method set the Depth of the LockvoidsetOwner(java.lang.String owner)This method set the Owner of the LockvoidsetScope(java.lang.String scope)This method set the Scope of the LockvoidsetTimeout(int timeout)This method set the Timeout of the LockvoidsetType(java.lang.String type)This method set the Type of the Lockjava.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
-
MAX_TIMEOUT
public static final int MAX_TIMEOUT
- See Also:
- Constant Field Values
-
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 urictxt- 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:
toStringin classjava.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
-
-