Class SubscriptionRegistry
-
- All Implemented Interfaces:
-
org.somda.sdc.dpws.soap.wseventing.Subscriptions
public class SubscriptionRegistry implements Subscriptions
Thread-safe provision of a set of a subscription managers plus tracking mechanism.
-
-
Method Summary
Modifier and Type Method Description voidaddSubscription(SourceSubscriptionManager subscriptionManager)Adds a subscription to the subscription registry. Optional<SourceSubscriptionManager>removeSubscription(String subscriptionId)Removes a subscription from the subscription registry. Optional<SourceSubscriptionManager>getSubscription(String subscriptionId)Gets a subscription from the subscription registry. Map<String, SourceSubscriptionManager>getSubscriptions()Returns a copied snapshot of all available subscription managers. voidregisterObserver(Object observer)Registers an EventBus observer to enable tracking of subscription insertion and deletion. voidunregisterObserver(Object observer)Removes an observer formerly registered via registerObserver. Optional<SourceSubscriptionManager>get(String subscriptionId)Gets a specific subscription. Map<String, SourceSubscriptionManager>getAll()Returns an immutable map of all active subscriptions. -
-
Method Detail
-
addSubscription
void addSubscription(SourceSubscriptionManager subscriptionManager)
Adds a subscription to the subscription registry.
- Parameters:
subscriptionManager- the subscription manager to add to the registry.
-
removeSubscription
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 empty.
-
getSubscription
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 empty.
-
getSubscriptions
Map<String, SourceSubscriptionManager> getSubscriptions()
Returns a copied snapshot of all available subscription managers.
- Returns:
all subscription managers as a copy.
-
registerObserver
void registerObserver(Object observer)
Registers an EventBus observer to enable tracking of subscription insertion and deletion.
- Parameters:
observer- an observer with com.google.common.eventbus.Subscribe annotated methods and the first argument of type SubscriptionAddedMessage or SubscriptionRemovedMessage.
-
unregisterObserver
void unregisterObserver(Object observer)
Removes an observer formerly registered via registerObserver.
- Parameters:
observer- the observer to unregister.
-
get
Optional<SourceSubscriptionManager> get(String subscriptionId)
Gets a specific subscription.
- Parameters:
subscriptionId- the identifier of the subscription to retrieve.- Returns:
the SourceSubscriptionManager instance if found, otherwise empty.
-
getAll
Map<String, SourceSubscriptionManager> getAll()
Returns an immutable map of all active subscriptions.
- Returns:
all subscription managers.
-
-
-
-