Custom Expanders

As of version 3.2.1, it is possible to configure which artefacts are expanded and to include custom expanders by providing a configuration file during expansion.

The file can be included during expansion with the option ‘–expanderConfig’:

java -cp $CP net.democritus.runner.ExpandApplicationFromPath $APP $VERSION $APPINST --expanderConfig custom-expanders.yaml

Structure of the config file

The config file is a yaml file that lists several expanders. If included, the config will be added as a changeset to the default configuration.

The config file has the following structure:

!expanders
applicationExpanders:
  expanders:
  ...
componentExpanders:
  expanders:
  ...
dataElementExpanders:
  expanders:
  ...
userElementExpanders:
  expanders:
  ...
taskElementExpanders:
  expanders:
  ...
flowElementExpanders:
  expanders:
  ...
serviceElementExpanders:
  expanders:
  ...
valueTypeExpanders:
  expanders:
  ...
finderExpanders:
  expanders:
  ...
projectionExpanders:
  expanders:
  ...
commandExpanders:
  expanders:
  ...
hierarchyExpanders:
  expanders:
  ...

Each expander entry has the following structure:

- expanderClass: <name of expander class>
  artefact: <unique artefact name>
  technology: <technology>
  layer: <layer>
  active: <true|false>
  • the name of the expander class is the fully qualified name of the expander class
  • the name of the artefact is a logical name for the artefact being generated
  • technology is the technology the expanded artefact requires, a.t.m. values are limited to:

    STRUTS2, COCOON2, EJB2, EJB3, EJB3_0, EJB3_1, JPA, ANT and YAML.

    If it is not applicable, leave out or use COMMON

  • layer is the layer to which the artefact is to be added, correct values are:

    SHARED_LAYER, CLIENT_LAYER, VIEW_LAYER, CONTROL_LAYER, PROXY_LAYER, LOGIC_LAYER and DATA_LAYER

    If it is not applicable, leave out or use COMMON

  • active can be used to switch expanders on or off

The layer and technology settings will be used to check if the expander is supposed to run depending on the application settings. They will not have any effect of how or where the artefact is generated.

Adding a custom Expander

As an example, we could be trying to add two custom data-element-expanders:

The file would look like this:

!expanders
dataElementExpanders:
  expanders:
  - expanderClass: net.democritus.TestExpander1
    artefact: test1
    technology: COMMON
    layer: SHARED_LAYER
  - expanderClass: net.democritus.TestExpander2
    artefact: test2
    technology: COMMON
    layer: LOGIC_LAYER

Disabling expanders

It is also possible to skip some expanders using the active attribute:

!expanders
componentExpanders:
  expanders:
  - expanderClass: net.democritus.co.ejb3.ComponentProxyAgentsExpander
    active: false
  - expanderClass: net.democritus.co.ejb3.ComponentAgentsInterfaceExpander
    active: false
  - expanderClass: net.democritus.co.ejb3.ComponentLocalAgentsExpander
    active: false