com.jalios.jcms.webdav
Class WebdavLock

java.lang.Object
  extended by com.jalios.jcms.webdav.WebdavLock
Direct Known Subclasses:
CatWebdavLock, FileWebdavLock

public abstract class WebdavLock
extends Object

This class is an Abstract Representation of a Webdav Lock handling all webdav mechanism in memory.

Since:
jcms-5.5.0
Version:
$Revision: 25019 $
Author:
Jean-Philippe Encausse

Field Summary
static int DEFAULT_TIMEOUT
           
protected  int depth
           
protected  String id
           
protected  long lastMod
           
static int MAX_TIMEOUT
           
static MessageDigest md5Digest
           
protected  String owner
           
static String REVISION
           
protected  String scope
           
protected  String secret
           
protected  int timeout
           
protected  Collection<String> tokens
           
protected  String type
           
protected  String uri
           
 
Constructor Summary
protected WebdavLock(String uri, WebdavContext ctxt)
          The lock must be a relative URI to the path folders starting and ending by '/'.
 
Method Summary
 void acquire(WebdavResource resource, WebdavContext ctxt)
          This method is called for other mecanism outside of Webdav that need to be notified by lock
 String encode(byte[] binaryData)
          Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
 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
 String getId()
          An MD5 representation of the Lock
 long getLastModified()
          This method retrieve the lastmodified of timeout
 String getOwner()
          This method retrieve the Owner of the Lock
 String getScope()
          This method retrieve the Scope of the Lock
 int getTimeout()
          This method retrieve the Timeout of the Lock without lastMod
 Collection<String> getTokens()
          This method retrieve the Tokens of the Lock
 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(String owner)
          This method set the Owner of the Lock
 void setScope(String scope)
          This method set the Scope of the Lock
 void setTimeout(int timeout)
          This method set the Timeout of the Lock
 void setType(String type)
          This method set the Type of the Lock
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

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 MessageDigest md5Digest

uri

protected String uri

lastMod

protected long lastMod

timeout

protected int timeout

depth

protected int depth

type

protected String type

scope

protected String scope

owner

protected String owner

id

protected String id

secret

protected String secret

tokens

protected Collection<String> tokens
Constructor Detail

WebdavLock

protected WebdavLock(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 String getType()
This method retrieve the Type of the Lock

Returns:
String representing the type of the lock

setType

public void setType(String type)
This method set the Type of the Lock

Parameters:
type - the type of the lock

getScope

public String getScope()
This method retrieve the Scope of the Lock

Returns:
String representing the scope of the lock

setScope

public void setScope(String scope)
This method set the Scope of the Lock

Parameters:
scope - the scope of the lock

getOwner

public String getOwner()
This method retrieve the Owner of the Lock

Returns:
String representing the owner of the lock

setOwner

public void setOwner(String owner)
This method set the Owner of the Lock

Parameters:
owner - the owner of the lock

getId

public String getId()
An MD5 representation of the Lock

Returns:
String representing the id/token of the lock

getTokens

public Collection<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 String toString()
Overrides:
toString in class 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 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 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


Copyright © 2001-2007 Jalios SA. All Rights Reserved.