Try OpenEdge Now
skip to main content
Managed Adapters Guide
File Managed Adapter : Writing custom format plug-ins
 

Writing custom format plug-ins

If you want to use a data format that is not covered by the default plug-ins, you can develop custom plug-ins suited to your requirements. This section guides you through the step-by-step process of the custom plug-in development.
As an example, we will develop a simple plug-in for logging messages in a file. The plug-in stamps the current date and time for each message logged, and allows some level of customization of the message format.

Objective

The custom Format plug-in supports a combination of the three modes - Read, Write, or Append.
The Read mode is where a plug-in is presented with an open stream to the file data, and is expected to produce a number of output parameters (outputs) from the file data. Each of these outputs can be mapped to a process dataslot. The master file adapter takes care of locating the file and opening the input stream.
From the plug-in point of view, the Write and Append mode are the same — the plug-in is presented with an open output stream to the file, and a set of input parameters (inputs). Its task is to generate data in whatever format the plug-in was designed to handle, and to write this data to the output stream. Locating and opening the output file in the correct mode, as well as supplying the input parameters, is done by the File Adapter and not by the plug-in.
Apart from the input and output data, and the input or output stream, the plug-ins are also passed a custom configuration object. This plug-in specific configuration contains any extra information that is needed by the plug-in to function.
The plug-in can be graphically represented by the following figure.
Figure 6. File Adapter - Custom format plug-in
Note that the diagram represents only the Write/Append mode.
The message, or input parameter, to be logged is received from Business Process Server. The format of the log record is the custom configuration. The plug-in formats the log message according to the configuration and writes it to the provided output stream.
* Plug-in definition
* Plug-in Configurator
* Writing the Plug-in run time
* Installing and running the plug-in
* Troubleshooting the custom format plug-in