Skip to main content

Expansion Configuration Composite

The ExpansionConfigurationComposite exists to have a central object to keep important information for the expansion process.

Here are some useful objects that can be accessed from the ExpansionConfigurationComposite.

DataRegistry

The DataRegistryComposite is a singleton that contains the Composites of all DataResources loaded during the model loading.

DataRegistryComposite dataRegistry = expansionConfiguration.getDataRegistry();

// Get all instances of LayerType
List<LayerTypeComposite> layerTypes = dataRegistry.getComposites(LayerTypeComposite.class);
List<LayerTypeComposite> layerTypes = dataRegistry.getComposites("net.democritus.elements.LayerType");

// Get a single instance based on it's name or functional key
Optional<LayerTypeComposite> controlLayer = dataRegistry.getComposite("CONTROL_LAYER", LayerTypeComposite.class);
tip

The DataRegistry object is directly accessible in the mapping file. Just use dataRegistry:

<value name="layerTypes" eval="dataRegistry.getComposites('net.democritus.elements.LayerType')"/>

ExpansionSettings

The ExpansionSettingsComposite object that can be found in the ExpansionConfigurationComposite is a fully linked version of the expansionSettings.xml file.

It contains the absolute paths for the model-directories and the expansion-directory.

It also contains a list of the expansion-resources currently in use. Expansion-resources that were included because of dependencies will also be present here.

Programs

The ExpansionConfigurationComposite also contains a list of ProgramComposites.

This is normally 1 ProgramComposite, but can contain more if multiple ProgramExpansions are defined in the expansionSettings.xml.

Retrieving the ExpansionConfigurationComposite

In Expanders, the ExpansionConfigurationComposite is available in the mapping scope as expansionConfiguration.

In AdditionalExpansionSteps, you can access the ExpansionConfigurationComposite through the expansionContext:

expansionContext.getContext()
.getContext(ExpansionConfigurationContext.class).getValue();