Corona Design Container Events
Context Container Event Model
The event model used by Corona is centered on the ContextContainer. Each container has its own set of events associated with it. Corona uses the ContextContainer to logically group events together within the same context.
The ContextContainer event model is based upon OSGi’s event model. It ensures that the OSGi events are properly initialized for the Corona environment as well as Serializable so that they can be shared within a distributed environment.
The ContextContainerEvent is a collection of name/value properties. The values must be Serializable so that they can be shared within the distributed environment. The ContextContainerEvent has a set of default properties that are required. Optional properties can also be defined to provide additional value within the given context of the event.
The default set of properties defined for each ContextContainerEvent ensure that the event can be handled properly within the local environment as well as shared within the distributed environment.
The following table lists the default set of ContextContainerEvent properties.
|event.topic||The event's topic|
|event.subject||The subject of the event within its topic|
|event.action||The action with respect to the topic/subject|
|event.version||The version of the event's content|
|event.trace||the list of Corona GUIDs where this event has traveled.|
|container.uri||The URI that uniquely identifies the ContextContainer associated with this event.|
|container.type||The type of context container|
|container.name||The name of the context container|
|remote.uri||A comma seperated list of URIs to remote environments to distribute the event to.|
|router.id||The unique id of the event router where the event originated from.|
ContextContainer events are created using the ContextContainerEventFactory. This factory pattern has creation methods that will create a ContextConatinerEvent for a specific ContextContainer.
Corona’s container event model provides a specialized event handling class, AbstractContextContainerEventHandler. This abstract base class is used to process events in their own thread (Eclipse Job). The ContextContainerEventManager interacts with the OSGi EventAdmin service. Each OSGi event is transformed into a ContextContainerEvent. The manager will post a reference of the ContextContainerEvent to each AbstractContextContainerEventHandler’s event processing queue.
ContextContainer event handlers can define an optional event filter. This filter is based upon the LDAP filter syntax that is provided by the OSGi Filter.