Domain Plug-in Configuration

Domain plug-ins are configured by means of an XML configuration file. The format is simple: the file contains a domains root element; for each domain to be configured, a domain element is inserted; within that element, plug-in elements are used to specify the name of the type of plug-in and the Java class that implements the operations of that type of plug-in. The domain elements are not nested within other domain elements to reflect the domain hierarchy. The configuration information is relatively "flat"; each entry configures a separate domain and the inheritance of plug-ins is determined automatically. Here is a sample of such a configuration file:

Figure 1. Sample Domain Configuration
<dc:domains>
  <dc:domain name="SVR_INT64">
    <dc:plug-in name="converter" class=
      "curam.util.client.domain.convert.SvrInt64Converter"/>
    <dc:plug-in name="comparator" class=
      "curam.util.client.domain.compare.SvrInt64Comparator"/>
    <dc:plug-in name="default" class=
      "curam.util.client.domain.defaults.SvrInt64Default"/>
  </dc:domain>
  <dc:domain name="INTERNAL_ID">
    <dc:plug-in name="converter" class=
      "curam.util.client.domain.convert.InternalIDConverter"/>
  </dc:domain>
</dc:domains>

The configuration elements are defined in the XML namespace shown above. In the example, the namespace declaration assigns the prefix "dc" to this namespace, so that prefix is used before the element names. While you must declare this namespace in your configuration file, you can declare it to be a default namespace and omit the prefix, or even use a different prefix, but you must not omit the namespace declaration.

The example shows the configuration of two domains (these are the actual default configurations for these domains, as provided in the out-of-the-box Cúram application). Three plug-ins are configured for the Cúram root domain SVR_INT64. This is a complete set of plug-ins, as the "options" plug-in is built-in and is never directly configured. All descendant domains of SVR_INT64 will inherit these plug-ins unless further configured. Such a configuration is provided for the INTERNAL_ID domain. This domain is a descendant of SVR_INT64, but a different converter plug-in is configured; the comparator and default plug-ins will be inherited from SVR_INT64. This particular configuration is used within the Cúram application to override the format operation for INTERNAL_ID values so that grouping separators are not used in the string representations of the integers. An integer formatted by the SvrInt64Converter plug-in as "1,234,567" will be formatted by the InternalIDConverter class as "1234567". This ensures that values such as case identifiers (the CASE_ID domain is a descendant of the INTERNAL_ID domain) are not represented as ordinary numerical values, but as more abstract unique key values. However, sorting and the calculation of default values remains unchanged, as these plug-ins are not overridden and the inherited plug-ins will be used.

There is a master configuration file called domains-config.xml located in your CDEJ installation's lib/curam/xml/config folder. This file contains the complete domain configuration information for all of the Cúram root domains and some descendant domains. You must not make any changes to this file; it is overwritten each time the development environment is upgraded. However, the information in this file is useful when you need to make customizations. You can override or extend any configuration setting in this file using the mechanism described here.

Domain plug-in configuration follows the typical pattern used for when configuring other aspects of application components. You create configuration files, place them in component folders, and the component order determines which parts of each file take precedence when the files are merged together. A single custom configuration results and this may override or extend the master configuration without limitation. The domain elements in the configuration are merged where they have the same domain name defined in the name attribute. The plug-in elements of the merged domains are then collected and those with the same name attribute value as an existing plug-in element take precedence over that setting. New domain configurations can also be introduced. If the newly configured domain has descendant domains, they will inherit the new configuration. When configuring plug-ins, the name returned by a plug-in's getName method must match the name attribute value defined on the plug-in element in the configuration file; this helps to avoid mistakes in the configuration file.

The configuration files that you place in your component folders must be named DomainsConfig.xml (a slightly different name to the master configuration file to prevent confusion of the two). You can create one or more of these files (one in each component), but a single file is probably sufficient for most purposes. The format is just that shown in the example above. Further configuration examples are included in Customization Guidelines.