Event handler sample overview

This event handler sample demonstrates how to write a new event action handler, as described in Creating IBM Director event actions.

Detail of the event handler sample

This sample shows customizable actions, collects the details of events, and writes the results into a flat file. The user can specify the file name, maximum number of records, and sample text associated with the events. Sample code defining four Java classes is provided:

WriteEventToFileEventHandler
This object, an implementation of the class TWGEventHandler, writes event details to a flat file. The WriteEventToFileEventHandler action handler takes four parameters as input in its customized dialog box:

Filename
Takes a valid filename as input. An ASCII text file is opened in the x:\Program Files\IBM\Director\data directory, where x: is the drive on which the IBM Director server is installed.
Event Data Format
Specifies the sample text that goes into the file. A default string is also provided to show how to use substitution parameters.
Maximum Count
Specifies how many event details records are to be stored in the flat file. The file is reset after the count is reached
Action
Specifies whether to append the records to the flat file or to reset the file so that at any point in time there is only one record in the file
EContainer
Container class that stores the list of files and the associated parameters
Store
Holds the customized action parameters. This object is identified by a filename which is the key.
WriteEventToFileBundle
Defines string resources used by the handler.

Source files of the sample