org.apache.jackrabbit.core.lock
Class AbstractLockInfo

java.lang.Object
  extended by org.apache.jackrabbit.core.lock.AbstractLockInfo

public abstract class AbstractLockInfo
extends Object

Common information about a lock.


Field Summary
protected  boolean deep
          Flag indicating whether lock is deep
protected  boolean live
          Flag indicating whether this lock is live
protected  SessionImpl lockHolder
          Session currently holding lock
protected  String lockOwner
          Lock owner, determined on creation time
protected  org.apache.jackrabbit.core.lock.LockToken lockToken
          Lock token
protected  boolean sessionScoped
          Flag indicating whether lock is session scoped
 
Constructor Summary
AbstractLockInfo(org.apache.jackrabbit.core.lock.LockToken lockToken, boolean sessionScoped, boolean deep, String lockOwner)
          Create a new instance of this class.
AbstractLockInfo(org.apache.jackrabbit.core.lock.LockToken lockToken, boolean sessionScoped, boolean deep, String lockOwner, long timeoutHint)
          Create a new instance of this class.
 
Method Summary
 NodeId getId()
          Return the ID of the lock holding node
 SessionImpl getLockHolder()
          Return the session currently holding the lock
 String getLockToken(Session session)
          Return the lock token as seen by the session passed as parameter.
 long getSecondsRemaining()
          Return the number of seconds remaining until the lock expires.
 boolean isLive()
          Return a flag indicating whether the lock is live
 boolean isSessionScoped()
          Return a flag indicating whether the lock is session-scoped
 boolean mayChange()
          Return a flag indicating whether the lock information may still change.
 void setLive(boolean live)
          Set the live flag
 void setLockHolder(SessionImpl lockHolder)
          Set the session currently holding the lock
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lockToken

protected final org.apache.jackrabbit.core.lock.LockToken lockToken
Lock token


sessionScoped

protected final boolean sessionScoped
Flag indicating whether lock is session scoped


deep

protected final boolean deep
Flag indicating whether lock is deep


lockOwner

protected final String lockOwner
Lock owner, determined on creation time


lockHolder

protected SessionImpl lockHolder
Session currently holding lock


live

protected boolean live
Flag indicating whether this lock is live

Constructor Detail

AbstractLockInfo

public AbstractLockInfo(org.apache.jackrabbit.core.lock.LockToken lockToken,
                        boolean sessionScoped,
                        boolean deep,
                        String lockOwner)
Create a new instance of this class.

Parameters:
lockToken - lock token
sessionScoped - whether lock token is session scoped
deep - whether lock is deep
lockOwner - owner of lock

AbstractLockInfo

public AbstractLockInfo(org.apache.jackrabbit.core.lock.LockToken lockToken,
                        boolean sessionScoped,
                        boolean deep,
                        String lockOwner,
                        long timeoutHint)
Create a new instance of this class.

Parameters:
lockToken - lock token
sessionScoped - whether lock token is session scoped
deep - whether lock is deep
lockOwner - owner of lock
timeoutHint - the timeoutHint
Method Detail

setLive

public void setLive(boolean live)
Set the live flag

Parameters:
live - live flag

getId

public NodeId getId()
Return the ID of the lock holding node

Returns:
the id

getLockHolder

public SessionImpl getLockHolder()
Return the session currently holding the lock

Returns:
session currently holding the lock

setLockHolder

public void setLockHolder(SessionImpl lockHolder)
Set the session currently holding the lock

Parameters:
lockHolder - session currently holding the lock

getLockToken

public String getLockToken(Session session)
Return the lock token as seen by the session passed as parameter. If this session is currently holding the lock, it will get the lock token itself, otherwise a null string.

Parameters:
session - The session asking for the lock token.
Returns:
lock token.

isLive

public boolean isLive()
Return a flag indicating whether the lock is live

Returns:
true if the lock is live; otherwise false

mayChange

public boolean mayChange()
Return a flag indicating whether the lock information may still change.

Returns:
true if the lock is still alive.

isSessionScoped

public boolean isSessionScoped()
Return a flag indicating whether the lock is session-scoped

Returns:
true if the lock is session-scoped; otherwise false

getSecondsRemaining

public long getSecondsRemaining()
Return the number of seconds remaining until the lock expires.

Returns:
number of seconds remaining until the lock expires.

toString

public String toString()

Overrides:
toString in class Object


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