Package org.osgi.service.event
Interface EventHandler
-
@ConsumerType public interface EventHandlerListener for Events.EventHandlerobjects are registered with the Framework service registry and are notified with anEventobject when an event is sent or posted.EventHandlerobjects can inspect the receivedEventobject to determine its topic and properties.EventHandlerobjects must be registered with a service propertyEventConstants.EVENT_TOPICwhose value is the list of topics in which the event handler is interested.For example:
String[] topics = new String[] {"com/isv/*"}; Hashtable ht = new Hashtable(); ht.put(EventConstants.EVENT_TOPIC, topics); context.registerService(EventHandler.class.getName(), this, ht);Event Handler services can also be registered with anEventConstants.EVENT_FILTERservice property to further filter the events. If the syntax of this filter is invalid, then the Event Handler must be ignored by the Event Admin service. The Event Admin service should log a warning.Security Considerations. Bundles wishing to monitor
Eventobjects will requireServicePermission[EventHandler,REGISTER]to register anEventHandlerservice. The bundle must also haveTopicPermission[topic,SUBSCRIBE]for the topic specified in the event in order to receive the event.- See Also:
Event
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidhandleEvent(Event event)Called by theEventAdminservice to notify the listener of an event.
-
-
-
Method Detail
-
handleEvent
void handleEvent(Event event)
Called by theEventAdminservice to notify the listener of an event.- Parameters:
event- The event that occurred.
-
-