|
OSGi™ Service Platform Release 4 Version 4.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Listener for Events.
EventHandler
objects are registered with the Framework service
registry and are notified with an Event
object when an
event is sent or posted.
EventHandler
objects can inspect the received
Event
object to determine its topic and properties.
EventHandler
objects must be registered with a service
property EventConstants.EVENT_TOPIC
whose value is the list of
topics in which the event handler is interesed.
For example:
String[] topics = new String[] {EventConstants.EVENT_TOPIC, "com/isv/*"}; Hashtable ht = new Hashtable(); ht.put(EVENT_TOPIC, topics); context.registerService(EventHandler.class.getName(), this, ht);Event Handler services can also be registered with an
EventConstants.EVENT_FILTER
service propery 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 Event
objects will require ServicePermission[EventHandler,REGISTER]
to register an EventHandler
service. The bundle must also have
TopicPermission[topic,SUBSCRIBE]
for the topic specified in the
event in order to receive the event.
Event
Method Summary | |
void |
handleEvent(Event event)
Called by the EventAdmin service to notify the listener of an event. |
Method Detail |
public void handleEvent(Event event)
EventAdmin
service to notify the listener of an event.
event
- The event that occurred.
|
OSGi™ Service Platform Release 4 Version 4.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |