public class BaseSubscriptionListener extends java.lang.Object implements SubscriptionListener
Adapter class implementing the SubscriptionListener methods
This is a helper class to reduce the code needed to implement the SubscriptionListener interface.
Simply extend this class and override the required methods rather than implement the full SubscriptionListener interface.
A trivial implementation would be as follows :
import com.caplin.streamlink.BaseSubscriptionListener;
import com.caplin.streamlink.NewsEvent;
import com.caplin.streamlink.RecordType1Event;
import com.caplin.streamlink.Subscription;
import com.caplin.streamlink.SubscriptionErrorEvent;
import com.caplin.streamlink.SubscriptionListener;
public class BaseSubscriptionListenerSnippet
{
public BaseSubscriptionListenerSnippet()
{
// Subscribe to the record.
SubscriptionListener listener = new BaseSubscriptionListener() {
// Print error message if there is a subscription error.
@Override
public void onSubscriptionError(Subscription subscription,
SubscriptionErrorEvent event) {
System.out.println("Error: Subject " + event.getSubject()
+ " is " + event.getError());
}
// Print latest record values.
@Override
public void onRecordUpdate(Subscription subscription,
RecordType1Event event) {
System.out.println("Record update for " + event.getSubject() + " fields: "
+ event.getFields());
}
@Override
public void onNewsUpdate(Subscription subscription,
NewsEvent event) {
System.out.println("News Event: " + event.getSubject()
+ " is " + event.getHeadline());
}
};
}
}
Constructor and Description |
---|
BaseSubscriptionListener() |
Modifier and Type | Method and Description |
---|---|
void |
onChatUpdate(Subscription subscription,
ChatEvent event)
Called when a chat update is received.
|
void |
onContainerUpdate(Subscription subscription,
ContainerEvent event)
Called when a container update is received.
|
void |
onDirectoryUpdate(Subscription subscription,
DirectoryEvent event)
Called when a directory update is received.
|
void |
onNewsUpdate(Subscription subscription,
NewsEvent event)
Called when a news headline update is received.
|
void |
onPageUpdate(Subscription argsubscription0,
PageEvent event)
Called when a page update is received.
|
void |
onPermissionUpdate(Subscription subscription,
PermissionEvent event)
Called when a permission update is received.
|
void |
onRecordType2Update(Subscription subscription,
RecordType2Event event)
Called when an update to type 2 data in a record is received.
|
void |
onRecordType3Update(Subscription subscription,
RecordType3Event event)
Called when an update to type 3 data in a record is received.
|
void |
onRecordUpdate(Subscription subscription,
RecordType1Event event)
Called when an update to type 1 data in a record is received.
|
void |
onStoryUpdate(Subscription subscription,
StoryEvent event)
Called when a news story update is received.
|
void |
onSubscriptionError(Subscription subscription,
SubscriptionErrorEvent event)
Called when there is an error in a subscription.
|
void |
onSubscriptionStatus(Subscription subscription,
SubscriptionStatusEvent event)
Called when there is a change in the status of a subscription.
|
public void onRecordUpdate(Subscription subscription, RecordType1Event event)
SubscriptionListener
Called when an update to type 1 data in a record is received. Implementing this method is optional.
onRecordUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The record update.public void onRecordType2Update(Subscription subscription, RecordType2Event event)
SubscriptionListener
Called when an update to type 2 data in a record is received. Implementing this method is optional.
onRecordType2Update
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The record update.public void onRecordType3Update(Subscription subscription, RecordType3Event event)
SubscriptionListener
Called when an update to type 3 data in a record is received. Implementing this method is optional.
onRecordType3Update
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The record update.public void onPermissionUpdate(Subscription subscription, PermissionEvent event)
SubscriptionListener
Called when a permission update is received. Implementing this method is optional.
onPermissionUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The permission update.public void onNewsUpdate(Subscription subscription, NewsEvent event)
SubscriptionListener
Called when a news headline update is received. Implementing this method is optional.
onNewsUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The news headline update.public void onStoryUpdate(Subscription subscription, StoryEvent event)
SubscriptionListener
Called when a news story update is received. Implementing this method is optional.
onStoryUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The news story update.public void onChatUpdate(Subscription subscription, ChatEvent event)
SubscriptionListener
Called when a chat update is received. Implementing this method is optional.
onChatUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The chat update.public void onDirectoryUpdate(Subscription subscription, DirectoryEvent event)
SubscriptionListener
Called when a directory update is received. Implementing this method is optional.
onDirectoryUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The directory update.public void onContainerUpdate(Subscription subscription, ContainerEvent event)
SubscriptionListener
Called when a container update is received. Implementing this method is optional.
onContainerUpdate
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The container update.public void onSubscriptionStatus(Subscription subscription, SubscriptionStatusEvent event)
SubscriptionListener
Called when there is a change in the status of a subscription.
onSubscriptionStatus
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.event
- The subscription status event.public void onSubscriptionError(Subscription subscription, SubscriptionErrorEvent event)
SubscriptionListener
Called when there is an error in a subscription.
This callback being invoked is a final state for the subscription and no further callbacks will be received for it.
onSubscriptionError
in interface SubscriptionListener
subscription
- The subscription for which the error occurred.event
- The subscription error event.public void onPageUpdate(Subscription argsubscription0, PageEvent event)
SubscriptionListener
Called when a page update is received. Implementing this method is optional.
onPageUpdate
in interface SubscriptionListener
argsubscription0
- The subscription for which the update occurred.event
- The page update.Please send bug reports and comments to Caplin support