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

Plug-in definition

The file OEBPS_HOME\conf\resources\adapters\formatplugins.properties contains a list of all available plug-ins. For each plug-in, several properties are defined, including the plug-in name to be displayed when selecting the plug-in from the list in the File Adapter configurator, plug-in configurator class, run-time class for data processing, list of available modes, and MIME-type of the plug-in data.
First, decide the modes (Read, Write, Append) supported by the plug-in. The sample plug-in is intended for logging, and hence only the Write /Append mode is required.The most used mode would evidently be "Append" (adding each message to the end of the log-file), but "Write" (rewriting the file to contain only the most current message) also can be useful.
The first step is to define the plug-in and the supported modes in the file OEBPS_HOME\conf\resources\adapters\formatplugins.properties. Open the file in a text editor and add log to the enabled plug-ins, as shown in the list at the top of the page:
enabled=txt,velocity,csv,xml,log
Next, enter the following definition for the new plug-in:
# Log format plugin
name.log=Log
log.runtime=com.savvion.sbm.adapters.file.plugins.Log
log.config=com.savvion.sbm.adapters.file.plugins.LogConfig
log.modes=AW
log.mtype=text/plain
Each plug-in the formatplugins.properties file is defined by an identifier — in our case the identifier is log. The other properties are:
*name.log sets the display name of the plug-in to "Log".
*log.runtime contains the class name of the plug-in at run time.
*log.config contains the class names of the plug-in configurator class.
*log.modes states that the plug-in supports the A (Append) and W (Write) operations.
*log.mtype defines the MIME-type of the plug-in as plain text.
Note: The first mode in the modes property is the default mode for the plug-in. If the user tries to set the plug-in mode to an invalid value, a warning message will appear and the default mode will be automatically selected. If the modes property is not specified, "RWA" is assumed.
After defining the custom plug-in, save the changes and restart Progress Developer Studio for OpenEdge (or Business Process Modeler).