Event Definition

Events are defined in Cúram in XML files that specify both the event classes and the event types. These files are created with a .evx extension and are placed in the events of a Cúram component from where they are picked up and processed by the build scripts. The format of an event file is shown below:

Figure 1. Event definition file
<events package="curam.util.events">
    <event-class identifier="EVENT_CLASS_ONE" value="CLASS1">
      <annotation>Some event class.</annotation>
      <event-type identifier="EVENT_TYPE_ONE" value="EVENT1"/>
      <event-type identifier="EVENT_TYPE_TWO" value="EVENT2"/>
    </event-class>
    <event-class identifier="EVENT_CLASS_TWO" value="CLASS2">
      <event-type identifier="EVENT_TYPE_ONE" value="EVENT1">
        <annotation>Some event type.</annotation>
      </event-type>
      <event-type identifier="EVENT_TYPE_TWO" value="EVENT2"/>
      <event-type identifier="EVENT_TYPE_THREE" value="EVENT3"/>
    </event-class>
  </events>
events
This is the root tag of an event definition file under which all the event classes and types are defined.
package
This specifies the Java code package into which the Java constants for event classes and their types are generated.
annotation
This is an optional element specified for both event classes and types intended for descriptive text for the element. The text specified in an annotation is generated into the Java constant files as javadoc comments.
event-class
Defines an event class, which qualifies all the event types associated with that class.
identifier
This is the identifier of the event class for code generation and will be the class name for the constant class containing all the event types in the class. Since this will be a Java class name it must be a valid Java identifier.
value
This is how an event class is referenced at runtime and it is this value that event handlers are registered against. This value should be unique in the system and is a 100 character string.
event-type
Defines an event type within a given class. Since an event is identified by it's own name and that of it's parent class, an event type only needs to be unique within a given class.
identifier
This is the identifier of the event type for code generation and will be the field name for the constant containing the value of the event type. Since this will be a Java field name it must be a valid Java identifier.
value
This is how an event type is referenced at runtime and the value should be unique within a given event class and is a 100 character string.