public class SubscriptionManager<T> extends Object
Constructor and Description |
---|
SubscriptionManager() |
SubscriptionManager(SubscriptionValidator<T> validator) |
Modifier and Type | Method and Description |
---|---|
Set<T> |
getAllGrantedTopics()
Get all topics whose subscription is in granted state.
|
int |
getSubscriptionCount()
Get the number of subscriptions currently registered
|
void |
setSource(T topic,
SubscriptionSource<T> source)
Set a source for a topic.
|
void |
subscribe(T topic,
SubscriptionListener<T> listener)
Subscribe to a topic.
|
void |
subscribe(T topic,
SubscriptionListener<T> listener,
Object hint)
Subscribe to a topic with a hint
|
protected void |
topicSubscriptionAdded(T topic)
Gets called when somebody subscribed to a topic that was not subscribed
before
|
protected void |
topicSubscriptionRemoved(T topic)
Get called when somebody unsubscribed from a topic and it was the last
subscription
|
void |
unsubscribe(T topic,
SubscriptionListener<T> listener) |
void |
unsubscribeAll(SubscriptionListener<T> listener)
Unsubscribe from all subscriptions that the listener has subscribed to
|
public SubscriptionManager(SubscriptionValidator<T> validator)
public SubscriptionManager()
public void unsubscribeAll(SubscriptionListener<T> listener)
listener
- the listener to unsubscribepublic void subscribe(T topic, SubscriptionListener<T> listener) throws ValidationException
topic
- The topic to which the subscription should be madelistener
- The listener which will receive the eventsValidationException
- thrown if the subscription cannot be established (e.g. the
topic is invalid)public void subscribe(T topic, SubscriptionListener<T> listener, Object hint) throws ValidationException
topic
- The topic to which the subscription should be madelistener
- The listener which will receive the eventshint
- The hint is specific to the topicValidationException
- thrown if the subscription cannot be established (e.g. the
topic is invalid)public void unsubscribe(T topic, SubscriptionListener<T> listener)
protected void topicSubscriptionAdded(T topic)
topic
- the topicprotected void topicSubscriptionRemoved(T topic)
topic
- the topicpublic void setSource(T topic, SubscriptionSource<T> source)
topic
- the topicsource
- the source to setpublic int getSubscriptionCount()
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.