Interface Subscriber
Allows a Transformer module to subscribe, and unsubscribe, listeners interested in receiving updates for objects that match a particular name pattern, or are of a specific object type.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default Subscriber flag.static final int
Setting this flag on subscribe will cause the subscriber to behave as an accessory listener. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubscriptionListener
(ObjectType objectType, SubscriptionListener listener) Adds the subscription listener for the specified object type and returns the current data for that object to the listener.void
addSubscriptionListener
(ObjectType objectType, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object type and returns the current data for that object to the listener.void
addSubscriptionListener
(String objectNamePattern, SubscriptionListener listener) Adds the subscription listener for the specified object name pattern and returns the current data for that object to the listener.void
addSubscriptionListener
(String objectNamePattern, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object name pattern and returns the current data for that object to the listener.void
addSubscriptionListener
(Collection<String> objectNamePatterns, SubscriptionListener listener) Adds the subscription listener for the specified object name patterns and returns the current data for those objects to the listener.void
addSubscriptionListener
(Collection<String> objectNamePatterns, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object name patterns and returns the current data for those objects to the listener.void
removeSubscriptionListener
(ObjectType objectType, SubscriptionListener listener) Removes the subscription listener for the specified object type.void
removeSubscriptionListener
(String objectNamePattern, SubscriptionListener listener) Removes the subscription listener for the specified object name pattern.void
removeSubscriptionListener
(Collection<String> objectNamePatterns, SubscriptionListener listener) Removes the subscription listener for the specified object name patterns.
-
Field Details
-
F_DEFAULT
static final int F_DEFAULTDefault Subscriber flag.- See Also:
-
F_LISTENER_ACCESSORY
static final int F_LISTENER_ACCESSORYSetting this flag on subscribe will cause the subscriber to behave as an accessory listener. Accessory listeners will not necessarily result in objects being requested by the Transformer. Instead, the 'accessory listener' listens to subscriptions made by other subscribing clients.
Objects which are 'listened to' by an accessory listener can be discarded and dropped from the Transformer cache. This can occur when there are no other subscribing clients.- See Also:
-
-
Method Details
-
addSubscriptionListener
Adds the subscription listener for the specified object name pattern and returns the current data for that object to the listener. The listener will now be informed of all the updates for any object with a name that matches the pattern.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectNamePattern
- The object name pattern the listener was subscribed with.listener
- The listener that should be informed when an update occurs for an object with a name that matches the specified pattern.- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
addSubscriptionListener
void addSubscriptionListener(String objectNamePattern, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object name pattern and returns the current data for that object to the listener. The listener will now be informed of all the updates for any object with a name that matches the pattern.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectNamePattern
- The object name pattern the listener was subscribed with.listener
- The listener that should be informed whensubscriptionFlags
- Enables flags to be set for this subscription. Settable flags includeF_DEFAULT
,F_LISTENER_ACCESSORY
. an update occurs for an object with a name that matches the specified pattern.- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
addSubscriptionListener
void addSubscriptionListener(Collection<String> objectNamePatterns, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object name patterns and returns the current data for those objects to the listener. The listener will now be informed of all the updates for any object with a name that matches any of the patterns.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectNamePatterns
- A Collection of object name patterns the listener was subscribed with.listener
- The listener that should be informed when an update occurs for an object with a name that matches the specified pattern.subscriptionFlags
- Enables flags to be set for this subscription. Settable flags includeF_DEFAULT
,F_LISTENER_ACCESSORY
- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
addSubscriptionListener
void addSubscriptionListener(ObjectType objectType, SubscriptionListener listener, int subscriptionFlags) Adds the subscription listener for the specified object type and returns the current data for that object to the listener. The listener will now be informed of all the updates for any object of that type.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectType
- The type of object the listener is interested in.listener
- The listener that should be informed when an update occurs for any object of the specified type.subscriptionFlags
- Enables flags to be set for this subscription. Settable flags includeF_DEFAULT
,F_LISTENER_ACCESSORY
- Throws:
NullPointerException
- If either the objectType or listener arguments are null.
-
addSubscriptionListener
Adds the subscription listener for the specified object name patterns and returns the current data for those objects to the listener. The listener will now be informed of all the updates for any object with a name that matches any of the patterns.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectNamePatterns
- A Collection of object name patterns the listener was subscribed with.listener
- The listener that should be informed when an update occurs for an object with a name that matches the specified pattern.- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
addSubscriptionListener
Adds the subscription listener for the specified object type and returns the current data for that object to the listener. The listener will now be informed of all the updates for any object of that type.
A listener can be added for multiple subscriptions, so that it can be called several times for the same object update. For example, an update to the record /LO/VOD will result in the
update
method being invoked three times for a listener that has been registered for the pattern /??/VOD, for the pattern /LO/* and for the object type record.- Parameters:
objectType
- The type of object the listener is interested in.listener
- The listener that should be informed when an update occurs for any object of the specified type.- Throws:
NullPointerException
- If either the objectType or listener arguments are null.
-
removeSubscriptionListener
Removes the subscription listener for the specified object name pattern. If the listener was added multiple times for the specified object name pattern, then only the first instance will be removed.
- Parameters:
objectNamePattern
- The object name pattern the listener was subscribed with.listener
- The listener that had been subscribed for the specified pattern.- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
removeSubscriptionListener
void removeSubscriptionListener(Collection<String> objectNamePatterns, SubscriptionListener listener) Removes the subscription listener for the specified object name patterns. If the listener was added multiple times for the specified object name pattern, then only the first instance will be removed.
- Parameters:
objectNamePatterns
- The object name patterns the listener was subscribed with.listener
- The listener that had been subscribed for the specified pattern.- Throws:
NullPointerException
- If either the objectNamePattern or listener arguments are null.
-
removeSubscriptionListener
Removes the subscription listener for the specified object type. If the listener was added multiple times for the specified object type, then only the first instance will be removed.
- Parameters:
objectType
- The type of object the listener was subscribed with.listener
- The listener that had been subscribed for the specified object type.- Throws:
NullPointerException
- If either the objectType or listener arguments are null.
-