|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ISubscription
Encapsulates a single subscription for IEventSource instances. The
subscription has a collection of IEventListener instances that are
registered as listeners against all event sources that are matched by the
subscription. The subscription also stores references to all matching event
sources.
A subscription operates with an ISubscriptionManager. The manager
uses the subscription to determine if it would match an event source and, if
it does, the manager adds the event source as a match reference. On adding,
the subscription registers its listeners against the event source.
Subscriptions are defined by an ISubscriptionParameters instance that
identifies that type, domain and identity attributes of matching event
sources. A subscription can match the attributes exactly or use wildcards.
The wildcard match for the type or domain can be specified using
WILDCARD_TYPE and WILDCARD_DOMAIN
. The identity specified for a subscription is a regular expression matching
one or more event source identities.
| Field Summary | |
|---|---|
static IDomain |
WILDCARD_DOMAIN
Wildcard for domain subscriptions; this allows any domain to be matched by a subscription. |
static String |
WILDCARD_ID_REGEX
Wildcard for identity subscriptions; this allows any identity to be matched by a subscription. |
static IType |
WILDCARD_TYPE
Wildcard for type subscriptions; this allows any type to be matched by a subscription. |
| Method Summary | |
|---|---|
boolean |
addListener(IEventListener listener)
Add the listener to the IEventListener instances associated with
this ISubscription. |
boolean |
addMatch(IEventSource source)
Add the event source as a matched reference. |
List<IEventListener> |
getListeners()
Get a copy of the internal List of all the
IEventListener instances used by the subscription to register
against the subscribed IEventSource instances. |
Collection<IEventSource> |
getMatches()
Get a copy of the internal Collection of all the
IEventSource instances referenced by this subscription. |
boolean |
removeListener(IEventListener listener)
Remove the listener from the IEventListener instances associated
with this ISubscription. |
boolean |
removeMatch(ISubscriptionParameters parameters)
Remove the event source(s) identified by the parameters from this subscription's matched references. |
| Methods inherited from interface fulmine.event.subscription.ISubscriptionParameters |
|---|
includes |
| Methods inherited from interface fulmine.IAddressable |
|---|
getAddress, getDomain, getIdentity, getType |
| Field Detail |
|---|
static final String WILDCARD_ID_REGEX
static final IType WILDCARD_TYPE
static final IDomain WILDCARD_DOMAIN
| Method Detail |
|---|
boolean addMatch(IEventSource source)
The source is only added if the subscription does not already contain the source as a match.
This is an idempotent operation.
source - the event source
true if the event source was added,
false if the subscription already has the source as
a matched referenceboolean removeMatch(ISubscriptionParameters parameters)
Note: if the parameters include wildcards, multiple event sources may be removed.
parameters - the subscription parameters identifying any matching event
sources to remove
true if at least one event source was found and
removed, false if no event source was found to
removeCollection<IEventSource> getMatches()
Collection of all the
IEventSource instances referenced by this subscription. The order
of the collection elements is arbitrary.
IEventSource
instances referenced by this subscriptionList<IEventListener> getListeners()
List of all the
IEventListener instances used by the subscription to register
against the subscribed IEventSource instances.
List of all the listeners
that are registered against all subscribed IEventSource
instances. The order of the listeners is the order of calling
addListener(IEventListener).boolean removeListener(IEventListener listener)
IEventListener instances associated
with this ISubscription. The subscription will remove the
listener from any currently matched IEventSource instances.
This is an idempotent operation.
listener - the listener to remove from the subscription's list of
listeners
true if the listener was removed, false
if it was not foundboolean addListener(IEventListener listener)
IEventListener instances associated with
this ISubscription. The subscription will register the listener
with any currently matched IEventSource instances.
This is an idempotent operation.
listener - the listener to add to the subscription's list of listeners
true if the listener was added, false
if it already existed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||