Events Manager

What is it?

It is a bundle which administrates the delivery of events through the different bundles propagating between the ASTRA nodes.

Provided Functionality

This bundle provides functionality for:

Access

The main idea for using the EventsManager is to follow these steps:

Notification

1- Retrieve the EventsServer reference:
    private void getEventsManagerReference(){
        ServiceReference sr = bc.getServiceReference(IEventsServer.class.getName());
        if (sr == null) {
            es = null;
            return;
        }
        es = (IEventsServer)bc.getService(sr);
    }
2.- Import into the project the package eu.ist.astra.em.events
3.- Notify the event (Example:)
es.notify(this, new NewTagAstraEvent("user@astra", "my_application", "tag1"), "PUBLIC");

Subscription

1- Retrieve the EventsServer reference:
    private void getEventsManagerReference(){
        ServiceReference sr = bc.getServiceReference(IEventsServer.class.getName());
        if (sr == null) {
            es = null;
            return;
        }
        es = (IEventsServer)bc.getService(sr);
    }
2.- Implement the interface eu.ist.astra.em.IEventsListener
3.- Override the update method.
public void update(Object sender,AstraEvent e,String channel){
    //TODO: implement the handler
}
4.- Subscribe to the desired Event and Channel
es.addListener(this, TagAstraEvent.class , "PUBLIC");

Design

Connection with other bundles

EventsManager makes use of the following bundles:

+Info, contact, etc.:

AstraWiki: EventsManager (last edited 2009-08-07 06:22:02 by alfredo)