public class BaseSubscriptionListener extends java.lang.Object implements SubscriptionListener
A base implementation of SubscriptionListener
that can be used to
easily provide SubscriptionListener
implementations without the need to override
every method. This class can be extended in order to override only the methods a particular
Subscription
is interested in as an alternative to implementing every method
in SubscriptionListener
.
It is highly recommended that you extend this class rather than directly implementing the
SubscriptionListener
interface as this class will log warnings if
callbacks occur upon methods you have not overridden. This is preferable to the simple empty
implementations of an 'adapter' class where unexpected callbacks upon methods you have not
overridden can go unnoticed and are difficult to trace.
Modifier and Type | Field and Description |
---|---|
protected java.util.logging.Logger |
logger
Provides protected access to the logger that was passed to the constructor.
|
Constructor and Description |
---|
BaseSubscriptionListener(java.util.logging.Logger logger)
Creates a
BaseSubscriptionListener that uses the provided
Logger to log warnings about callbacks made on methods that have not
been overridden. |
Modifier and Type | Method and Description |
---|---|
void |
containerUpdated(Subscription subscription,
Peer peer,
ContainerMessage containerMessage)
Called when a container update is received.
|
void |
genericMessageUpdated(Subscription subscription,
Peer peer,
GenericMessage message)
Called when an update to generic message data is received.
|
void |
newsUpdated(Subscription subscription,
Peer peer,
NewsMessage newsMessage)
Called when a news headline update is received.
|
void |
pageUpdated(Subscription subscription,
Peer peer,
PageMessage pageMessage)
Called when a page update is received.
|
void |
permissionUpdated(Subscription subscription,
Peer peer,
PermissionMessage permissionMessage)
Called when when a permission update is received.
|
void |
recordType2Updated(Subscription subscription,
Peer peer,
RecordType2Message recordType2Message)
Called when an update to type 2 data in a record is received.
|
void |
recordType3Updated(Subscription subscription,
Peer peer,
RecordType3Message recordType3Message)
Called when an update to type 3 data in a record is received.
|
void |
recordUpdated(Subscription subscription,
Peer peer,
RecordMessage recordMessage)
Called when an update to type 1 data in a record is received.
|
void |
storyUpdated(Subscription subscription,
Peer peer,
StoryMessage storyMessage)
Called when a story update is received.
|
void |
subjectErrorReceived(Subscription subscription,
Peer peer,
SubjectErrorEvent subjectErrorEvent)
Called when there is an error in a subscription.
|
void |
subjectStatusReceived(Subscription subscription,
Peer peer,
SubjectStatusEvent subjectStatusEvent)
Called when there is a change in the status of a subscription.
|
protected final java.util.logging.Logger logger
public BaseSubscriptionListener(java.util.logging.Logger logger)
BaseSubscriptionListener
that uses the provided
Logger
to log warnings about callbacks made on methods that have not
been overridden.logger
- The Logger
that warning messages are logged to.public void containerUpdated(Subscription subscription, Peer peer, ContainerMessage containerMessage)
SubscriptionListener
Called when a container update is received.
containerUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.containerMessage
- The container update.
The operations on the
ContainerMessage
are not
normalized; therefore the message may contain contradictory operations, for example
an add for an element followed by a delete for the same element.
public void newsUpdated(Subscription subscription, Peer peer, NewsMessage newsMessage)
SubscriptionListener
Called when a news headline update is received.
newsUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.newsMessage
- The news update.public void pageUpdated(Subscription subscription, Peer peer, PageMessage pageMessage)
SubscriptionListener
Called when a page update is received.
pageUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.pageMessage
- The page update.public void permissionUpdated(Subscription subscription, Peer peer, PermissionMessage permissionMessage)
SubscriptionListener
Called when when a permission update is received.
permissionUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.permissionMessage
- The permission update.public void recordType2Updated(Subscription subscription, Peer peer, RecordType2Message recordType2Message)
SubscriptionListener
Called when an update to type 2 data in a record is received.
recordType2Updated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.recordType2Message
- The record update.public void recordType3Updated(Subscription subscription, Peer peer, RecordType3Message recordType3Message)
SubscriptionListener
Called when an update to type 3 data in a record is received.
recordType3Updated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.recordType3Message
- The record update.public void recordUpdated(Subscription subscription, Peer peer, RecordMessage recordMessage)
SubscriptionListener
Called when an update to type 1 data in a record is received.
recordUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.recordMessage
- The record update.public void storyUpdated(Subscription subscription, Peer peer, StoryMessage storyMessage)
SubscriptionListener
Called when a story update is received.
storyUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.storyMessage
- The story update.public void subjectErrorReceived(Subscription subscription, Peer peer, SubjectErrorEvent subjectErrorEvent)
SubscriptionListener
Called when there is an error in a subscription.
subjectErrorReceived
in interface SubscriptionListener
subscription
- The subscription for which the error occurred.peer
- The DataSource peer that sent this subscription error.subjectErrorEvent
- The subscription error.public void subjectStatusReceived(Subscription subscription, Peer peer, SubjectStatusEvent subjectStatusEvent)
SubscriptionListener
Called when there is a change in the status of a subscription.
subjectStatusReceived
in interface SubscriptionListener
subscription
- The subscription for which the status change occurred.peer
- The DataSource peer that sent this change in subscription status.subjectStatusEvent
- The subscription status event.public void genericMessageUpdated(Subscription subscription, Peer peer, GenericMessage message)
SubscriptionListener
Called when an update to generic message data is received.
genericMessageUpdated
in interface SubscriptionListener
subscription
- The subscription for which the update occurred.peer
- The DataSource peer supplying the update.message
- The record update.Please send bug reports and comments to Caplin support