Class SubscriptionRegistry

java.lang.Object
org.somda.sdc.dpws.soap.wseventing.helper.SubscriptionRegistry

public class SubscriptionRegistry extends Object
Thread-safe provision of a set of a subscription managers plus tracking mechanism.
  • Method Details

    • addSubscription

      public void addSubscription(SourceSubscriptionManager subscriptionManager)
      Adds a subscription to the subscription registry.
      Parameters:
      subscriptionManager - the subscription manager to add to the registy.
    • removeSubscription

      public Optional<SourceSubscriptionManager> removeSubscription(String subscriptionId)
      Removes a subscription from the subscription registry.
      Parameters:
      subscriptionId - the identifier of the subscription to remove.
      Returns:
      the removed SourceSubscriptionManager instance if found, otherwise Optional.empty().
    • getSubscription

      public Optional<SourceSubscriptionManager> getSubscription(String subscriptionId)
      Gets a subscription from the subscription registry.
      Parameters:
      subscriptionId - the identifier of the subscription to retrieve.
      Returns:
      the SourceSubscriptionManager instance if found, otherwise Optional.empty().
    • getSubscriptions

      public Map<String,SourceSubscriptionManager> getSubscriptions()
      Returns a copied snapshot of all available subscription managers.
      Returns:
      all subscription managers as a copy.
    • registerObserver

      public void registerObserver(Object observer)
      Registers an EventBus observer to enable tracking of subscription insertion and deletion.
      Parameters:
      observer - an observer with Subscribe annotated methods and the first argument of type SubscriptionAddedMessage or SubscriptionRemovedMessage.
      See Also:
      • EventBus.register(Object)
    • unregisterObserver

      public void unregisterObserver(Object observer)
      Removes an observer formerly registered via registerObserver(Object).
      Parameters:
      observer - the observer to unregister.
      See Also:
      • EventBus.unregister(Object)