public class EventsHandlerImpl extends ComponentBase implements EventsHandler
EventsHandler
implementation that tracks external EventListener.class
services.
Agent handles can manages their own listeners directly using addListener(EventListener)
and
removeListener(EventListener)
.Constructor and Description |
---|
EventsHandlerImpl(org.osgi.framework.BundleContext bundleContext) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(EventListener listener)
Add a listener.
|
protected void |
onInit() |
protected void |
onStop() |
void |
postEvent(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.String> payload)
Post an event asynchronously.
|
void |
removeListener(EventListener listener)
Remove a listener.
|
void |
sendEvent(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.String> payload)
Post an event synchronously.
|
getAgentContext, getAgentUpdateHandler, getConfigurationHandler, getConnectionHandler, getDeploymentHandler, getDiscoveryHandler, getDownloadHandler, getEventsHandler, getExecutorService, getFeedbackHandler, getIdentificationHandler, getLoggingHandler, getWorkDir, init, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, onStart, start, stop
public EventsHandlerImpl(org.osgi.framework.BundleContext bundleContext) throws java.lang.Exception
java.lang.Exception
public void addListener(EventListener listener)
EventsHandler
addListener
in interface EventsHandler
listener
- The listenerpublic void postEvent(java.lang.String topic, java.util.Map<java.lang.String,java.lang.String> payload)
EventsHandler
postEvent
in interface EventsHandler
topic
- The topic stringpayload
- The payload mappublic void removeListener(EventListener listener)
EventsHandler
removeListener
in interface EventsHandler
listener
- The listenerpublic void sendEvent(java.lang.String topic, java.util.Map<java.lang.String,java.lang.String> payload)
EventsHandler
sendEvent
in interface EventsHandler
topic
- The topic stringpayload
- The payload mapprotected void onInit() throws java.lang.Exception
onInit
in class ComponentBase
java.lang.Exception
protected void onStop() throws java.lang.Exception
onStop
in class ComponentBase
java.lang.Exception