Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

All Image Added events and user-defined events may be selected, filtered, and routed to notifiers in the Event Notification configuration. The system supplies a few standard notifiers where event information may be directed to a Log File, a database table, by e-mail, by SNMP or to the System Log. If required, new notifiers can be developed and introduced into the system using the DTK.

Notifier-related classes are located in the package com.digitalroute.devkit.event where the class DRNotifierTarget and possibly DRNotifierTargetUI and DRAbstractStorable can be extended.

Info
titleExample

For a notifier plugin example, see:

com.digitalroute.devkit.examples.event.DynamicLogFile*

DRNotifierTarget

A new notifier plugin is defined by extending DRNotifierTarget. The Code Server will locate all such classes and make them available for configuration in the Event Notification Editor. The configuration of a notifier can be obtained in two ways (or through a combination of both):

  • Static User Interface - This is configuration entered in a user-defined user interface, introduced by extending the DRNotifierTargetUI class. If available, it will appear in the Base Configuration frame of the Notifier Setup in the Event Notification configuration.

  • Dynamic Fields - These are input fields that the Event Notification configuration automatically displays in the Target Field Configuration frame in the Notifier Setup tab. Such fields do not require a user-defined interface and are also possible to populate using formatted input, where values from the incoming events may be picked.


The getName method will return that will be displayed in the Notification Type combo box in the Event Notification configuration. If a static user interface is desired, then the getUIClassName method must return the full class name of a class that extends DRNotifierTargetUI. If dynamic fields are desired, then getDynamicFields must return an array of DRUDRFields. The name of the DRUDR field will be displayed as the label and the data type (DRUDRType) will determine what input component to use, what validation rules will apply, and how the field will be populated. Valid data types are:

DRUDRType.PT_SHORT
DRUDRType.PT_INT
DRUDRType.PT_LONG
DRUDRType.PT_FLOAT
DRUDRType.PT_DOUBLE
DRUDRType.PT_CHAR
DRUDRType.PT_STRING
DRUDRType.PT_BOOLEAN
DRUDRType.PT_DATE
DRUDRType.PT_IPADDRESS

For all data types, apart from PT_STRING, the only population options will be manual input and direct mapping from an event field, whose data type must correspond. In addition, the PT_STRING offers formatted input where many event fields may be mapped into the value. The methods isDynamicFieldMandatory will, for each field, determine if it will validate that input is entered, and isDynamicFieldMultiline will determine if the input component will be a single or a multi-line field.

When a notifier configuration is saved, the initialize method is called. If the notifier was previously saved, the deinitialize method is called first. When the Event Notification configuration receives an event that the notifier subscribes for, the notify method is called. The method is handed the event itself, and if dynamic fields are used, a hash map is keyed by the dynamic field name and a corresponding object as well. The corresponding object will hold the assigned field value. If the value has been manually entered or assigned directly from an event field, then the object will have the same data type as the dynamic field. If the value used formatted input (PT_STRING only) then this value will contain the formatted string, which means any variables will have been substituted by an event field value.

DRNotifierTargetUI

If the notifier requires a static user interface for user configuration, the DRNotifierTargetUI class must be extended. The class extends the Java JPanel which is the main container for the configuration components. When a notifier is selected in the user interface, this panel will be displayed in the Base Configuration frame.

When the panel is displayed, the method reset is called to reset all components, immediately followed by displayConfig. The latter hands over a previously configured configuration object that has to implement DRStorable, and has to be cast into the appropriate type. Unless this data is null, the data will be displayed.

When a notifier is saved in the Event Notification configuration, the validateInput method is called. If the method returns a string, it is displayed as an error message. If it returns null, the collectConfig method is called to create and populate a configuration object. The Platform takes care of storing the configuration.