public abstract class ContextSubscriber extends Subscriber
ContextProvider
.ContextEventPattern
s as their
initial subscriptions and can always add new (and remove old) subscriptions
dynamically.busResourceURI, owner, theBus
Modifier | Constructor and Description |
---|---|
protected |
ContextSubscriber(ModuleContext connectingModule,
ContextEventPattern[] initialSubscriptions)
Creates a Context Subscriber and immediately registers a set of Context
Event Patterns for it, so it receives the matching events.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addNewRegParams(ContextEventPattern[] newSubscriptions)
Registers more ContextEventPattern for this Subscriber in addition to
those that might have passed initially
|
void |
busDyingOut(AbstractBus b)
This method is called when the bus is stopped to announce this to the bus
members.
|
abstract void |
communicationChannelBroken()
Method to be called when the communication of the Subsccriber with the
Context Bus is lost.
|
ContextEventPattern[] |
getAllProvisions()
Returns all provisions registered by all
ContextPublisher s on all
instances of context bus in the current Space. |
String |
getMyID() |
abstract void |
handleContextEvent(ContextEvent event)
Method to be called when an Event forwarded in the Context Bus matches
one of the Patterns registered by this Subscriber.
|
void |
handleEvent(BusMessage m) |
protected void |
removeMatchingRegParams(ContextEventPattern[] oldSubscriptions)
Unregisters a set of ContextEventPattern that had been previously
registered for this Subscriber.
|
close, getComment, getLabel, getType, getURI, setComment, setLabel
protected ContextSubscriber(ModuleContext connectingModule, ContextEventPattern[] initialSubscriptions)
connectingModule
- The module context of the module creating the PublisherinitialSubscriptions
- Array of ContextEventPattern that are immediately registered
for this SubscriberNullPointerException
- if newSubscriptions is null or one of the elements of that
array is nullprotected final void addNewRegParams(ContextEventPattern[] newSubscriptions)
newSubscriptions
- The additional array of ContextEventPatternNullPointerException
- if newSubscriptions is null or one of the elements of that
array is nullprotected final void removeMatchingRegParams(ContextEventPattern[] oldSubscriptions)
oldSubscriptions
- public abstract void communicationChannelBroken()
public final void busDyingOut(AbstractBus b)
BusMember
busDyingOut
in class BusMember
b
- bus on which this member has been registeredAbstractBus
public ContextEventPattern[] getAllProvisions()
ContextPublisher
s on all
instances of context bus in the current Space.public abstract void handleContextEvent(ContextEvent event)
event
- The Context Event that matched the registered PatternsNullPointerException
- if the event is nullpublic final void handleEvent(BusMessage m)
public String getMyID()
Copyright © 2018 universAAL Consortium. All rights reserved.