Configuring an Event with the Provider

Modify the getProviderEvents() method in the TimerProvider class to return a map containing event names and its corresponding objects.

The pojoProvider server internally converts the data to the JSON format as required by the Expresso server during provider registration.

public HashMap<String, AbstractExpressoEvent> getProviderEvents() 
{

HashMap<String, AbstractExpressoEvent> events = new HashMap<String, AbstractExpressoEvent>();

//Event 1: 
/Create an object of the Event created above.

TimerEvent timerEvent = new TimerEvent();

//Set the name, description and usage of that event.

timerEvent.setEventDetails("TimerEvent","Generates events after specific time intervals","Timer event received with message :{message}");

//Set the class whose object will be returned as event data.

timerEvent.setEventSchemaClass(TimerEventData.class);

//Set the name of the provider to which this class belongs, this is used while  
//notifying an event Expresso 

timerEvent.setProviderName("Timer");

//Put the object in a map with the event name as key, make sure that the key 
//matches exactly to the event name as it will be used by the provider 
//server to lookup later.

events.put("TimerEvent", timerEvent);

//More events can be added in a similar way to the map.

return events;

}