org.apache.jackrabbit.webdav.jcr.lock
Class JcrActiveLock

java.lang.Object
  extended by org.apache.jackrabbit.webdav.lock.AbstractActiveLock
      extended by org.apache.jackrabbit.webdav.jcr.lock.JcrActiveLock
All Implemented Interfaces:
DavConstants, ActiveLock, XmlSerializable

public class JcrActiveLock
extends AbstractActiveLock
implements ActiveLock, 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
JcrActiveLock(Lock lock)
          Create a new ActiveLock object with type 'write' and scope 'exclusive'.
 
Method Summary
 String getOwner()
          Return the name (or id) of the lock owner.
 Scope getScope()
          Return the scope of this lock.
 long getTimeout()
          Since jcr locks do not reveal the time left until they expire, DavConstants.INFINITE_TIMEOUT is returned.
 String getToken()
          Return the lock token if the Session that optained the lock is the lock token holder, null otherwise.
 Type getType()
          Always returns Type.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 owner
 void setTimeout(long timeout)
          Throws UnsupportedOperationException
 
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)
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 ActiveLock
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 interface ActiveLock
Returns:
true if the lock is expired
See Also:
ActiveLock.isExpired()

getToken

public String getToken()
Return the lock token if the Session that optained 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 ActiveLock
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 interface ActiveLock
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 interface ActiveLock
See Also:
ActiveLock.setOwner(String)

getTimeout

public long getTimeout()
Since jcr locks do not reveal the time left until they expire, DavConstants.INFINITE_TIMEOUT is returned. A missing timeout causes problems with Microsoft clients.

Specified by:
getTimeout in interface ActiveLock
Returns:
Always returns DavConstants.INFINITE_TIMEOUT
See Also:
ActiveLock.getTimeout()

setTimeout

public void setTimeout(long timeout)
Throws UnsupportedOperationException

Specified by:
setTimeout in interface ActiveLock
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 interface ActiveLock
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 interface ActiveLock
See Also:
ActiveLock.setIsDeep(boolean)

getType

public Type getType()
Always returns Type.WRITE.

Specified by:
getType in interface ActiveLock
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 interface ActiveLock
Returns:
The scope of this lock, which may either by an exclusive or exlusive session scoped lock.
See Also:
ActiveLock.getScope()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.