Skip to main content
Version: 8.2411.x.x RR

Configuration Section

In the Configuration section you can parameterize your configuration by defining typed variables.

The following basic types are supported:

  • string (default),
  • char,
  • int, and
  • boolean.
info

If no explicit type is defined then string is assumed.

Scalar Variables

Scalar variables are defined using the cfgVal element. The following examples illustrate the use of typed scalar variables.

<dp:cfgVal name="intValue" value="13" type="int"/>
<dp:cfgVal name="boolValue" value="true" type="bool"/>
<dp:cfgVal name="charValue" value="c" type="char"/>
<dp:cfgVal name="stringValue" value="string" type="string"/>

List Variables

You can also define list variables, with the element cfgList. The following examples illustrate how a list is defined:

<dp:cfgList name="valueList">
<value>red</value>
<value>blue</value>
<value>green</value>
</dp:cfgList>

There is a more compact syntax, based on the element cfgVal together with the optional attribute separator:

<dp:cfgVal name="valueList" value="red blue green" separator=" "/>

Note that the element cfgVal is normally used for scalar variables.

Map Variables

In addition to scalars and lists, you can also define maps. Each member value of map elements can have its own type. This in contrast to lists, where all element members are of the same type. Maps are defined using the element cfgMap. The following example shows a map definition:

<dp:cfgMap name="objectCache">
<value name="enable" value="true" type="bool"/>
<value name="cacheSize" value="5" type="int"/>
<value name="type" value="java.lang.Object"/>
</dp:cfgMap>

Complex Types Through Nesting of Maps and Lists

It is possible to build more complex types by using the map and list types, which can be nested to arbitrarily complex data structures.

<dp:cfgMap name="userConfig">
<map name="settings">
<value name="enabled" value="true" type="bool"/>
<value name="domain" value="ACME"/>
</map>
<list name="defaultRoles">
<value>SelfAmdin</value>
<value>User</value>
</list>
</dp:paraMap>

Externally Defined Variables

You may also read configuration values from an external source when you use the cfgDSource element. It uses a DataSource, thus values can be read from an external source, e.g., a CSV file. Normally this type is not used in the configuration section but within DataFilters. The following example creates a variable called members in the output objects. Its value is a list containing all values from the column "name" from the given CSV-file.

<dataFilter type="ELMappingFilter">
<dp:attrDSource name="members" value="#{in.members.name}">
<dataSource type="CSVDataSource">
<dp:paraVal name="filename" value="etc/csv.in"/>
<dp:paraList name="attributes" value="id name" separator=" "/>
</dataSource>
</dp:attrDSource>
</dataFilter>

If you want to read values from an external source into a scalar (i.e. non list) variable it is required to define a separator. All values read from the external source are then concatenated to a string separated by the string defined in the separator attribute. The following example creates a variable called members. Its value is a string containing all values from the column "name" from the given CSV-file separated by a comma.

<dp:attrDSource name="members" value="#{in.members.name}" separator=",">
<dataSource type="CSVDataSource">
<dp:paraVal name="filename" value="etc/csv.in"/>
<dp:paraList name="attributes" value"id, name" separator=" "/>
</dataSource>
</dp:attrDSource>

Summary of the Configuration Section

Attributes like configuration values may be scalars, lists or map-based attributes.

  • The element cfgVal is used to define scalar variables. In combination with the separator attribute, lists may also be defined using cfgVal.
  • The element cfgList is used to define list variables. All members in the list are of the same type.
  • The element cfgMap is used to define maps of variables. Each member of the map has its own type.
  • The element cfgDSource is used to define scalar and list variables where the values are taken from a DataSource (see The DataSource Plug-In). This allows for the externalization of the configuration.

List and map can only contain name-value pairs. Nested structures cannot be defined in the Configuration section.