Package com.caplin.streamlink.alerts
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)
{
}
}
}
-
ClassDescriptionA Notification is an object that can be sent to notify a user of a particular event.Interface that should be implemented to receive notification change callbacks from the NotificationProviderA 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.An interface that can be registered to be called back when an operation completes.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.Interface that should be implemented to receive trigger change callbacks from the TriggerProviderA 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.Enumeration that defines the different states a
Trigger
can be in