Class SubscriptionManagerImpl

  • All Implemented Interfaces:
    TransactionListener, org.apache.jackrabbit.webdav.observation.SubscriptionManager

    public class SubscriptionManagerImpl
    extends Object
    implements org.apache.jackrabbit.webdav.observation.SubscriptionManager, TransactionListener
    SubscriptionManager collects all subscriptions requested, handles the subscription timeout and provides METHODS to discover subscriptions present on a given resource as well as events for an specific subscription.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterCommit​(org.apache.jackrabbit.webdav.transaction.TransactionResource resource, String lockToken, boolean success)
      This method is called after the commit has been executed.
      void beforeCommit​(org.apache.jackrabbit.webdav.transaction.TransactionResource resource, String lockToken)
      This method is called right before a transaction is committed.
      org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery getSubscriptionDiscovery​(org.apache.jackrabbit.webdav.observation.ObservationResource resource)
      Retrieve the SubscriptionDiscovery object for the given resource.
      org.apache.jackrabbit.webdav.observation.EventDiscovery poll​(String subscriptionId, long timeout, org.apache.jackrabbit.webdav.observation.ObservationResource resource)
      Retrieve all event bundles accumulated since for the subscription specified by the given id.
      org.apache.jackrabbit.webdav.observation.Subscription subscribe​(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info, String subscriptionId, org.apache.jackrabbit.webdav.observation.ObservationResource resource)
      Create a new Subscription or update an existing Subscription and add it as eventlistener to the ObservationManager.
      void unsubscribe​(String subscriptionId, org.apache.jackrabbit.webdav.observation.ObservationResource resource)
      Unsubscribe the Subscription with the given id and remove it from the ObservationManager as well as from the internal map.
    • Constructor Detail

      • SubscriptionManagerImpl

        public SubscriptionManagerImpl()
    • Method Detail

      • getSubscriptionDiscovery

        public org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery getSubscriptionDiscovery​(org.apache.jackrabbit.webdav.observation.ObservationResource resource)
        Retrieve the SubscriptionDiscovery object for the given resource. Note, that the discovery object will be empty if there are no subscriptions present.
        Note that all subscriptions present on the given resource are returned. However, the subscription id will not be visible in order to avoid abuse by clients not having registered the subscription originally.
        Specified by:
        getSubscriptionDiscovery in interface org.apache.jackrabbit.webdav.observation.SubscriptionManager
        Parameters:
        resource -
      • subscribe

        public org.apache.jackrabbit.webdav.observation.Subscription subscribe​(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info,
                                                                               String subscriptionId,
                                                                               org.apache.jackrabbit.webdav.observation.ObservationResource resource)
                                                                        throws org.apache.jackrabbit.webdav.DavException
        Create a new Subscription or update an existing Subscription and add it as eventlistener to the ObservationManager.
        Specified by:
        subscribe in interface org.apache.jackrabbit.webdav.observation.SubscriptionManager
        Parameters:
        info -
        subscriptionId -
        resource -
        Returns:
        Subscription that has been added to the ObservationManager
        Throws:
        org.apache.jackrabbit.webdav.DavException - if the subscription fails
      • unsubscribe

        public void unsubscribe​(String subscriptionId,
                                org.apache.jackrabbit.webdav.observation.ObservationResource resource)
                         throws org.apache.jackrabbit.webdav.DavException
        Unsubscribe the Subscription with the given id and remove it from the ObservationManager as well as from the internal map.
        Specified by:
        unsubscribe in interface org.apache.jackrabbit.webdav.observation.SubscriptionManager
        Parameters:
        subscriptionId -
        resource -
        Throws:
        org.apache.jackrabbit.webdav.DavException
      • poll

        public org.apache.jackrabbit.webdav.observation.EventDiscovery poll​(String subscriptionId,
                                                                            long timeout,
                                                                            org.apache.jackrabbit.webdav.observation.ObservationResource resource)
                                                                     throws org.apache.jackrabbit.webdav.DavException
        Retrieve all event bundles accumulated since for the subscription specified by the given id.
        Specified by:
        poll in interface org.apache.jackrabbit.webdav.observation.SubscriptionManager
        Parameters:
        subscriptionId -
        timeout - timeout in milliseconds
        resource -
        Returns:
        object encapsulating the events.
        Throws:
        org.apache.jackrabbit.webdav.DavException
      • beforeCommit

        public void beforeCommit​(org.apache.jackrabbit.webdav.transaction.TransactionResource resource,
                                 String lockToken)
        This method is called right before a transaction is committed.
        Specified by:
        beforeCommit in interface TransactionListener
        Parameters:
        resource - the transaction resource which will be committed.
        lockToken - the lock token
      • afterCommit

        public void afterCommit​(org.apache.jackrabbit.webdav.transaction.TransactionResource resource,
                                String lockToken,
                                boolean success)
        This method is called after the commit has been executed.
        Specified by:
        afterCommit in interface TransactionListener
        Parameters:
        resource - the transaction resource which had been committed.
        lockToken - the lock token.
        success - if the commit was successful.