Try OpenEdge Now
skip to main content
Customization Guide
Developing custom Managed Adapters : Defining configuration files
 

Defining configuration files

Most managed adapters have a custom adapter configurator GUI. This GUI is invoked by Progress Developer Studio for OpenEdge when the adapter is used in a workstep, and allows the user to specify various configuration parameters.
Alternatively, if the adapter is simple, it may not need the customized configurator GUI. A static configuration file can be used instead. In this tutorial, we will demonstrate both approaches, but for simplicity, let’s start with defining a static configuration file first.
The file will define all the adapter inputs, outputs, and configuration parameters, and will also describe how this data must be presented in the map configurator GUI (this GUI is provided by OpenEdge Business Process Server).
Following is the list of parameters for the Math adapter (see Figure 12):
Table 17. List of parameters for Demo Adapter
Parameter(s)
Access
Data type
Description
X, Y
input
INTEGER
The two input values.
Operation
configuration (hidden input)
CHARACTER
The arithmetical operation to be performed (one of add, sub, mul, or div)
Rounding
configuration (hidden input)
CHARACTER
Set to "true" if the result should be rounded, "false" otherwise.
Result
output
INTEGER
The result of the operation performed on the input numbers.
As we already defined in the mapping.prop file, we will use the GroupMapConfigurator GUI. It allows, when the adapter inputs and outputs are mapped to dataslots, parameters to be grouped under several tabs for better presentation and logical structure. In our case it is convenient to have the "X" and "Y" input parameters in one tab, and the "RESULT" parameter in another tab. The "OPERATION" and "ROUNDING" parameters must also be given to the map configurator and since we do not want them to be visible when dataslot mapping is done, we can put them in a separate "hidden" tab.
All this information is specified in the configuration file. In the <workspace>/.com.savvion.studio/adapters/DemoAdapters/MathAdapter directory, create a file named config.xml with the following content:
config.xml
<configform>
  <block title="Config" description="Config" hidden="true">
    <param name="OPERATION" access="HIDDEN" description="OPERATION"
        type="java.lang.String" value="add"/>
    <param name="ROUNDING" access="HIDDEN" description="ROUNDING"
        type="java.lang.String" value="false"/>
  </block>
  <block title="Inputs" description="Inputs">
    <param name="X" access="I" description="X"
          type="java.lang.Double" mandatory="true"/>
    <param name="Y" access="I" description="Y"
          type="java.lang.Double" mandatory="true"/>
  </block>
  <block title="Outputs" description="Outputs">
    <param name="RESULT" access="O" description="RESULT"
        type="java.lang.Double"/>
  </block>
</configform>
Here, enclosed by a pair of "<configform> … </configform>" tags are three "blocks". Each block will be presented as a separate tab by the GroupMapConfigurator GUI and will contain a logical group of input or output parameters. The exception is the block containing the configuration parameters "OPERATION" and "ROUNDING", which we do not want to show as a tab in the map configurator.
For each of the three blocks – "Inputs", "Outputs", and "Config" – we must provide title and description. The title is used to uniquely identify the block, and the description is a short label, that will be displayed on the corresponding tab.
Note that the "Config" block has one extra attribute – hidden="true". When set to "true", this attribute tells the map configurator not to display the tab, or the parameters in it.
The parameters are listed in each block. Each parameter is defined by a name (used for identification), access (attribute specifying if the parameter is input, output or a hidden configuration parameter), description (a short label displayed by the GUI for this parameter), data type (fully qualified java class name, one of the supported types listed in Supporteddata types) and optionally, a default value.
Although we have not yet written the adapter itself, the following two figures provide a preview of how the map configurator GUI will interpret and represent this config.xml file (that is, when the completed adapter is used):
Figure 11. Map Configurator - Inputs tab and Outputs tab
If you need any further information regarding the config.xml file, the complete syntax is described in File formats.