See: Description
Interface | Description |
---|---|
Notification |
A Notification is an object that can be sent to notify a user of a particular event.
|
NotificationListener |
Interface that should be implemented to receive notification change callbacks from
the NotificationProvider
|
ResultListener |
An interface that can be registered to be called back when an operation completes.
|
Trigger |
A Trigger is an object associated with a particular RTTP subject that contains a condition (on the given
subjects fields) that when met will trigger a notification message.
|
TriggerListener |
Interface that should be implemented to receive trigger change callbacks from
the TriggerProvider
|
Class | Description |
---|---|
NotificationService |
A NotificationService subscribes to a Notifications container of the StreamLink user and allows the user
to register a listener to be called when notifications are triggered or dismissed.
|
TriggerService |
A TriggerService subscribes to the Triggers of a StreamLink user and allows the user
to register a listener to be called back when triggers are added, removed or modified.
|
Enum | Description |
---|---|
TriggerState |
Enumeration that defines the different states a
Trigger can be in |
The interfaces within this package provide the functionality of Triggers and Notifications.
The TriggerService
class allows the list of triggers to be monitored and modified.
The NotificationService
class allows the user to listen and dismiss notifications.
A trivial example of how to create and terminate services:
import com.caplin.streamlink.ServiceStatus;
import com.caplin.streamlink.StreamLink;
import com.caplin.streamlink.alerts.*;
public class CreateAndTerminateServiceSnippet
{
private final TriggerService triggerService;
private final NotificationService notificationService;
private TriggerListener triggerListener = new MyTriggerListener();
private NotificationListener notificationListener = new MyNotificationListener();
public CreateAndTerminateServiceSnippet(StreamLink streamLink)
{
triggerService = new TriggerService(streamLink);
notificationService = new NotificationService(streamLink);
//services are now operational and can process operations
triggerService.addListener(triggerListener);
notificationService.addListener(notificationListener);
//services now have a subscription to the notification containers
//and listeners will be notified of triggers
triggerService.removeListener(triggerListener);
notificationService.removeListener(notificationListener);
//services have terminated the internal subscriptions for the listeners
//it's now safe to delete the reference to them
}
private class MyTriggerListener implements TriggerListener
{
@Override public void onTriggerAdded(Trigger trigger)
{
}
@Override public void onTriggerRemoved(Trigger trigger)
{
}
@Override public void onTriggerUpdated(Trigger trigger)
{
}
@Override public void onServiceStatus(ServiceStatus status)
{
}
}
private class MyNotificationListener implements NotificationListener
{
@Override public void onNotification(Notification notification)
{
}
@Override public void onNotificationRemoved(Notification notification)
{
}
@Override public void onServiceStatus(ServiceStatus status)
{
}
}
}
Please send bug reports and comments to Caplin support