Jump to: navigation, search

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.

ContextContainerEvent.png

ContextContainerEvent

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.

Default Properties

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.

NameValue
event.topicThe event's topic
event.subjectThe subject of the event within its topic
event.actionThe action with respect to the topic/subject
event.versionThe version of the event's content
event.tracethe list of Corona GUIDs where this event has traveled.
container.uriThe URI that uniquely identifies the ContextContainer associated with this event.
container.typeThe type of context container
container.nameThe name of the context container
remote.uriA comma seperated list of URIs to remote environments to distribute the event to.
router.idThe unique id of the event router where the event originated from.

ContextContainerEventFactory

ContextContainer events are created using the ContextContainerEventFactory. This factory pattern has creation methods that will create a ContextConatinerEvent for a specific ContextContainer.

Event Handling

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.

Event Filtering

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.