Skip to main content

Using Data Resources to Provide Data

Data resources can add additional configuration to the expansion. The functionality of different data types will be explained below, but first we'll focus on how to add data resource files to the expansion-resource.


Due to standard behavior, some plurals are oddly constructed as singular + 's'.

Configuring Data Resources

Let's say we want to add some a new layerImplementation with some libraries. Files necessary will look like this:


The libraries.xml and layerImplementations.xml files contain the actual data, which will be explained below.

The _data.xml file defines which data resource files are present and, most importantly, how they should be read. The content of the file should look like this:


Each record contains 2 things:

  • The path of the resource relative to the root of the jar file, in normal circumstances this is the path within the resources directory.
  • The qualified java name of the element within the file. This will be used at expand time to load the correct Composite and CompositeFactory classes.

If everything went correctly, you should see the dataResources appear in the expansionResource.xml file:

<expansionResource name="org.example:example-expanders">

To test if the data has been configured correctly, we can call the validate-data mojo:


This will try to load the configuration during the maven verify phase to check if the data can be loaded correctly. It might be necessary to add a dependency on prime-data if the data references predefined data (such as standard layerTypes):

data XML file name

The _data.xml file can be called anything as long as it ends with Data.xml or data.xml and has <dataResources> as root tag.

Data Resource Types


New concerns can be added as follows:

<concernType name="SEARCH ENGINE">
<description>Implements indexing of data and provides advanced search functionality</description>

Concern types are purely descriptive and don't add any functional differences.


By defining a new technology, we can use it in expanders to group all expanders of that specific technology.

E.g. the following

<technology name="APACHE SOLR">
<concernType name="SEARCH ENGINE"/>

Both concernType and description are only there as information for the developers. Subdir will define the name of the sub-directory created for generated and external files for this technology.


A layerImplementation encapsulates the expanders, libraries and source-types that together implement a concern in a specific layer with a certain technology.

E.g. we can add a layerImplementation for Solr in the data layer:

<layerImplementation name="Solr Search">
<technology name="APACHE SOLR"/>
<layerSource name="sources">
<sourceType name="SRC"/>
<layerSource name="resources">
<sourceType name="RESOURCE"/>
<library name="solr-solrj"/>
  • Condition describes when the layerImplementation should be added. This is decided on component level.
  • LayerSources defines which sourceTypes can be included for this technology. It will create a subdirectory for ext and gen in the corresponding layer. The name of the subdirectory is decided by the subdir defined in the technology.
  • LayerDependencies define which libraries should be added to the build. The names refer to instances of libraries, described below.


Libraries can be defined to add them to layerImplementations in order to have them available at runtime or compile time.

<library name="solr-solrj">
<technology name="APACHE SOLR"/>

Type can be declared as one of the 3 following types:

  • runtime: needed during runtime
  • compilation: only needed during compilation
  • test: only needed during test

Source types

Source types can be defined as follows:

<sourceType name="CONFIGURATION">
<description>Configuration files</description>

Subdir defines the directory of the sources.


In maven, all source types will be added as resources, except for SOURCE or JAVA, which are added as sources.