org.apache.slide.lock
Class NodeLock

java.lang.Object
  |
  +--org.apache.slide.lock.NodeLock
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class NodeLock
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

NodeLock class.

Version:
$Revision: 1.8 $
Author:
Remy Maucherat
See Also:
Serialized Form

Field Summary
protected  boolean exclusive
          Lock is shared.
protected  java.util.Date expirationDate
          Expiration date of the lock.
protected  boolean inheritance
          Lock is inheritable.
protected  java.lang.String lockId
          Lock Id.
protected static org.apache.util.MD5Encoder md5Encoder
          The MD5 helper object for this class.
protected static java.security.MessageDigest md5Helper
          MD5 message digest provider.
protected  java.lang.String objectUri
          Locked object.
protected  java.lang.String subjectUri
          User who is the lock owner.
protected  java.lang.String typeUri
          Lock type.
 
Constructor Summary
NodeLock()
          Constructor.
NodeLock(NodeLock lock, java.lang.String typeUri)
          Constructor.
NodeLock(ObjectNode locked, SubjectNode user, ActionNode lockType, java.util.Date expirationDate, boolean inheritance)
          Constructor.
NodeLock(ObjectNode locked, SubjectNode user, ActionNode lockType, java.util.Date expirationDate, boolean inheritance, boolean exclusive)
          Constructor.
NodeLock(java.lang.String objectUri, java.lang.String subjectUri, java.lang.String typeUri, java.util.Date expirationDate, boolean inheritance)
          Constructor.
NodeLock(java.lang.String objectUri, java.lang.String subjectUri, java.lang.String typeUri, java.util.Date expirationDate, boolean inheritance, boolean exclusive)
          Constructor.
NodeLock(java.lang.String lockId, java.lang.String objectUri, java.lang.String subjectUri, java.lang.String typeUri, java.util.Date expirationDate, boolean inheritance, boolean exclusive)
          Constructor.
 
Method Summary
(package private) static void ()
           
 NodeLock cloneObject()
          Clone.
 boolean equals(java.lang.Object obj)
          Equals.
 java.util.Date getExpirationDate()
          Expiration date accessor.
 java.lang.String getLockId()
          Get lock identifier.
 java.lang.String getObjectUri()
          Locked object accessor.
 java.lang.String getSubjectUri()
          Lock owner uri accessor.
 java.lang.String getTypeUri()
          Lock type uri accessor.
 boolean hasExpired()
          Expiration test.
 boolean isExclusive()
          Exclusive flag accessor.
 boolean isInheritable()
          Inheritance flag accessor.
 boolean isShared()
          Exclusive flag accessor.
(package private)  void setExclusive(boolean exclusive)
          Exclusive flag mutator.
(package private)  void setExpirationDate(java.util.Date expirationDate)
          Expiration date mutator.
(package private)  void setInheritable(boolean inheritance)
          Inheritance flag mutator.
(package private)  void setObjectUri(java.lang.String objectUri)
          Locked object mutator.
(package private)  void setSubjectUri(java.lang.String subjectUri)
          Lock owner uri mutator.
(package private)  void setTypeUri(java.lang.String typeUri)
          Lock type mutator.
 void validate(java.lang.String expectedUri)
          Validate.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectUri

protected java.lang.String objectUri
Locked object.

subjectUri

protected java.lang.String subjectUri
User who is the lock owner.

typeUri

protected java.lang.String typeUri
Lock type.

expirationDate

protected java.util.Date expirationDate
Expiration date of the lock.

inheritance

protected boolean inheritance
Lock is inheritable.

exclusive

protected boolean exclusive
Lock is shared.

lockId

protected java.lang.String lockId
Lock Id.

md5Helper

protected static java.security.MessageDigest md5Helper
MD5 message digest provider.

md5Encoder

protected static final org.apache.util.MD5Encoder md5Encoder
The MD5 helper object for this class.
Constructor Detail

NodeLock

public NodeLock()
Constructor.

NodeLock

public NodeLock(ObjectNode locked,
                SubjectNode user,
                ActionNode lockType,
                java.util.Date expirationDate,
                boolean inheritance)
Constructor.
Parameters:
locked - Locked object
user - Lock owner
lockType - Type of the lock
expirationDate - Date of expiration of the lock
inheritance - True if lock is inheritable

NodeLock

public NodeLock(ObjectNode locked,
                SubjectNode user,
                ActionNode lockType,
                java.util.Date expirationDate,
                boolean inheritance,
                boolean exclusive)
Constructor.
Parameters:
locked - Locked object
user - Lock owner
lockType - Type of the lock
expirationDate - Date of expiration of the lock
inheritance - True if lock is inheritable

NodeLock

public NodeLock(java.lang.String objectUri,
                java.lang.String subjectUri,
                java.lang.String typeUri,
                java.util.Date expirationDate,
                boolean inheritance)
Constructor.
Parameters:
objectUri - Locked object uri
subjectUri - Lock owner uri
typeUri - Lock type uri
expirationDate - Date of expiration of the lock
inheritance - True if lock is inheritable

NodeLock

public NodeLock(java.lang.String objectUri,
                java.lang.String subjectUri,
                java.lang.String typeUri,
                java.util.Date expirationDate,
                boolean inheritance,
                boolean exclusive)
Constructor.
Parameters:
objectUri - Locked object uri
subjectUri - Lock owner uri
typeUri - Lock type uri
expirationDate - Date of expiration of the lock
inheritance - True if lock is inheritable

NodeLock

public NodeLock(NodeLock lock,
                java.lang.String typeUri)
Constructor. Creates a new lock linked to another given lock.
Parameters:
lock - Linked lock

NodeLock

public NodeLock(java.lang.String lockId,
                java.lang.String objectUri,
                java.lang.String subjectUri,
                java.lang.String typeUri,
                java.util.Date expirationDate,
                boolean inheritance,
                boolean exclusive)
Constructor.
Parameters:
objectUri - Locked object uri
subjectUri - Lock owner uri
typeUri - Lock type uri
expirationDate - Date of expiration of the lock
inheritance - True if lock is inheritable
Method Detail

static void ()

getObjectUri

public java.lang.String getObjectUri()
Locked object accessor.
Returns:
String Locked subject uri

setObjectUri

void setObjectUri(java.lang.String objectUri)
Locked object mutator.
Parameters:
objectUri - Locked subject

getSubjectUri

public java.lang.String getSubjectUri()
Lock owner uri accessor.
Returns:
String Lock owner

setSubjectUri

void setSubjectUri(java.lang.String subjectUri)
Lock owner uri mutator.
Parameters:
subjectUri - Lock owner

getTypeUri

public java.lang.String getTypeUri()
Lock type uri accessor.
Returns:
String Lock type uri

setTypeUri

void setTypeUri(java.lang.String typeUri)
Lock type mutator.
Parameters:
typeUri - Lock type

getExpirationDate

public java.util.Date getExpirationDate()
Expiration date accessor.
Returns:
Date Exipiration date

setExpirationDate

void setExpirationDate(java.util.Date expirationDate)
Expiration date mutator.
Parameters:
expirationDate - Expiration date

hasExpired

public boolean hasExpired()
Expiration test.
Returns:
boolean True if this lock has expired

isInheritable

public boolean isInheritable()
Inheritance flag accessor.
Returns:
boolean True if token is inheritable

setInheritable

void setInheritable(boolean inheritance)
Inheritance flag mutator.
Parameters:
inheritance - Inheritance flag

isExclusive

public boolean isExclusive()
Exclusive flag accessor.
Returns:
boolean True if token is exclusive

isShared

public boolean isShared()
Exclusive flag accessor.
Returns:
boolean True if token is shared (ie, not exclusive)

setExclusive

void setExclusive(boolean exclusive)
Exclusive flag mutator.
Parameters:
exclusive - Exclusive flag

getLockId

public java.lang.String getLockId()
Get lock identifier.
Returns:
String lock id

cloneObject

public NodeLock cloneObject()
Clone.
Returns:
Object clone

equals

public boolean equals(java.lang.Object obj)
Equals.
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to test
Returns:
boolean True if the two object are equal :
  • obj is of type SlidePermission and is not null
  • All three Uris are equal

  • validate

    public void validate(java.lang.String expectedUri)
    Validate.
    Parameters:
    expectedUri - Uri