org.apache.jackrabbit.webdav.jcr.transaction
Class TxLockManagerImpl

java.lang.Object
  extended by org.apache.jackrabbit.webdav.jcr.transaction.TxLockManagerImpl
All Implemented Interfaces:
LockManager, TxLockManager

public class TxLockManagerImpl
extends Object
implements TxLockManager

TxLockManagerImpl manages locks with locktype 'dcr:transaction'.


Constructor Summary
TxLockManagerImpl()
           
 
Method Summary
 void addTransactionListener(TransactionListener listener)
          Adds a transaction listener to this TxLockManager.
 ActiveLock createLock(LockInfo lockInfo, DavResource resource)
          Create a new lock.
 ActiveLock getLock(Type type, Scope scope, DavResource resource)
          Always returns null
 ActiveLock getLock(Type type, Scope scope, TransactionResource resource)
          Return the lock applied to the given resource or null
 boolean hasLock(String token, DavResource resource)
          Returns true if the given lock token belongs to a lock that applies to the given resource, false otherwise.
 ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource)
          Refresh the lock indentified by the given lock token.
 void releaseLock(String lockToken, DavResource resource)
          Throws UnsupportedOperationException.
 void releaseLock(TransactionInfo lockInfo, String lockToken, TransactionResource resource)
          Release the lock identified by the given lock token.
 void removeTransactionListener(TransactionListener listener)
          Removes a transaction listener from this TxLockManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TxLockManagerImpl

public TxLockManagerImpl()
Method Detail

createLock

public ActiveLock createLock(LockInfo lockInfo,
                             DavResource resource)
                      throws DavException
Create a new lock.

Specified by:
createLock in interface LockManager
Parameters:
lockInfo - as present in the request body.
resource -
Returns:
the lock
Throws:
DavException - if the lock could not be obtained.
IllegalArgumentException - if the resource is null or does not implement TransactionResource interface.
See Also:
LockManager.createLock(org.apache.jackrabbit.webdav.lock.LockInfo, org.apache.jackrabbit.webdav.DavResource)

refreshLock

public ActiveLock refreshLock(LockInfo lockInfo,
                              String lockToken,
                              DavResource resource)
                       throws DavException
Refresh the lock indentified by the given lock token.

Specified by:
refreshLock in interface LockManager
Parameters:
lockInfo -
lockToken -
resource -
Returns:
the lock
Throws:
DavException
IllegalArgumentException - if the resource is null or does not implement TransactionResource interface.
See Also:
LockManager.refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String, org.apache.jackrabbit.webdav.DavResource)

releaseLock

public void releaseLock(String lockToken,
                        DavResource resource)
                 throws DavException
Throws UnsupportedOperationException.

Specified by:
releaseLock in interface LockManager
Parameters:
lockToken -
resource -
Throws:
DavException
See Also:
LockManager.releaseLock(String, org.apache.jackrabbit.webdav.DavResource)

releaseLock

public void releaseLock(TransactionInfo lockInfo,
                        String lockToken,
                        TransactionResource resource)
                 throws DavException
Release the lock identified by the given lock token.

Specified by:
releaseLock in interface TxLockManager
Parameters:
lockInfo -
lockToken -
resource -
Throws:
DavException

getLock

public ActiveLock getLock(Type type,
                          Scope scope,
                          DavResource resource)
Always returns null

Specified by:
getLock in interface LockManager
Parameters:
type -
scope -
resource -
Returns:
null
See Also:
getLock(Type, Scope, TransactionResource), LockManager.getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope, org.apache.jackrabbit.webdav.DavResource)

hasLock

public boolean hasLock(String token,
                       DavResource resource)
Returns true if the given lock token belongs to a lock that applies to the given resource, false otherwise. The token may either be retrieved from the Lock-Token header or from the TransactionId header.

Specified by:
hasLock in interface LockManager
Parameters:
token -
resource -
Returns:
See Also:
LockManager.hasLock(String token, DavResource resource)

getLock

public ActiveLock getLock(Type type,
                          Scope scope,
                          TransactionResource resource)
Return the lock applied to the given resource or null

Specified by:
getLock in interface TxLockManager
Parameters:
type -
scope -
resource -
Returns:
lock applied to the given resource or null
See Also:
todo: is it correct to return one that specific lock, the current session is token-holder of?

addTransactionListener

public void addTransactionListener(TransactionListener listener)
Adds a transaction listener to this TxLockManager.

Parameters:
listener - the listener to add.

removeTransactionListener

public void removeTransactionListener(TransactionListener listener)
Removes a transaction listener from this TxLockManager.

Parameters:
listener - the listener to remove.


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