Class TxLockManagerImpl

  • All Implemented Interfaces:
    org.apache.jackrabbit.webdav.lock.LockManager, org.apache.jackrabbit.webdav.transaction.TxLockManager

    public class TxLockManagerImpl
    extends Object
    implements org.apache.jackrabbit.webdav.transaction.TxLockManager
    TxLockManagerImpl manages locks with locktype 'dcr:transaction'.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTransactionListener​(TransactionListener listener)
      Adds a transaction listener to this TxLockManager.
      org.apache.jackrabbit.webdav.lock.ActiveLock createLock​(org.apache.jackrabbit.webdav.lock.LockInfo lockInfo, org.apache.jackrabbit.webdav.DavResource resource)
      Create a new lock.
      org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope, org.apache.jackrabbit.webdav.DavResource resource)
      Always returns null
      org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope, org.apache.jackrabbit.webdav.transaction.TransactionResource resource)
      Return the lock applied to the given resource or null
      boolean hasLock​(String token, org.apache.jackrabbit.webdav.DavResource resource)
      Returns true if the given lock token belongs to a lock that applies to the given resource, false otherwise.
      org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock​(org.apache.jackrabbit.webdav.lock.LockInfo lockInfo, String lockToken, org.apache.jackrabbit.webdav.DavResource resource)
      Refresh the lock identified by the given lock token.
      void releaseLock​(String lockToken, org.apache.jackrabbit.webdav.DavResource resource)
      Throws UnsupportedOperationException.
      void releaseLock​(org.apache.jackrabbit.webdav.transaction.TransactionInfo lockInfo, String lockToken, org.apache.jackrabbit.webdav.transaction.TransactionResource resource)
      Release the lock identified by the given lock token.
      void removeTransactionListener​(TransactionListener listener)
      Removes a transaction listener from this TxLockManager.
    • Constructor Detail

      • TxLockManagerImpl

        public TxLockManagerImpl()
    • Method Detail

      • createLock

        public org.apache.jackrabbit.webdav.lock.ActiveLock createLock​(org.apache.jackrabbit.webdav.lock.LockInfo lockInfo,
                                                                       org.apache.jackrabbit.webdav.DavResource resource)
                                                                throws org.apache.jackrabbit.webdav.DavException
        Create a new lock.
        Specified by:
        createLock in interface org.apache.jackrabbit.webdav.lock.LockManager
        Parameters:
        lockInfo - as present in the request body.
        resource -
        Returns:
        the lock
        Throws:
        org.apache.jackrabbit.webdav.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 org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock​(org.apache.jackrabbit.webdav.lock.LockInfo lockInfo,
                                                                        String lockToken,
                                                                        org.apache.jackrabbit.webdav.DavResource resource)
                                                                 throws org.apache.jackrabbit.webdav.DavException
        Refresh the lock identified by the given lock token.
        Specified by:
        refreshLock in interface org.apache.jackrabbit.webdav.lock.LockManager
        Parameters:
        lockInfo -
        lockToken -
        resource -
        Returns:
        the lock
        Throws:
        org.apache.jackrabbit.webdav.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,
                                org.apache.jackrabbit.webdav.DavResource resource)
                         throws org.apache.jackrabbit.webdav.DavException
        Throws UnsupportedOperationException.
        Specified by:
        releaseLock in interface org.apache.jackrabbit.webdav.lock.LockManager
        Parameters:
        lockToken -
        resource -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        LockManager.releaseLock(String, org.apache.jackrabbit.webdav.DavResource)
      • releaseLock

        public void releaseLock​(org.apache.jackrabbit.webdav.transaction.TransactionInfo lockInfo,
                                String lockToken,
                                org.apache.jackrabbit.webdav.transaction.TransactionResource resource)
                         throws org.apache.jackrabbit.webdav.DavException
        Release the lock identified by the given lock token.
        Specified by:
        releaseLock in interface org.apache.jackrabbit.webdav.transaction.TxLockManager
        Parameters:
        lockInfo -
        lockToken -
        resource -
        Throws:
        org.apache.jackrabbit.webdav.DavException
      • getLock

        public org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type,
                                                                    org.apache.jackrabbit.webdav.lock.Scope scope,
                                                                    org.apache.jackrabbit.webdav.DavResource resource)
        Always returns null
        Specified by:
        getLock in interface org.apache.jackrabbit.webdav.lock.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,
                               org.apache.jackrabbit.webdav.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 org.apache.jackrabbit.webdav.lock.LockManager
        Parameters:
        token -
        resource -
        Returns:
        See Also:
        LockManager.hasLock(String token, DavResource resource)
      • getLock

        public org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type,
                                                                    org.apache.jackrabbit.webdav.lock.Scope scope,
                                                                    org.apache.jackrabbit.webdav.transaction.TransactionResource resource)
        Return the lock applied to the given resource or null
        Specified by:
        getLock in interface org.apache.jackrabbit.webdav.transaction.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.