Data Model Generation

For using the data model generation, use the dmgen-maven-plugin. The data model is specified in a datamodel specification xml file, usually called datamodel.xml.  Its location is given by the parameter dmSpecFile of the dmgen-maven-plugin.  Based on that file, the generator can generate various kinds of source code.  The decision what to generate is given in a configuration file, usually called generator.xml.  Its location is given by the parameter dmConfigFile of the dmgen-maven-plugin.

A common usecase is having the datamodel.xml file in the api project, and using it for generation both in the api and in the impl project, with a generator.xml in both projects.  To make this work, one must include the datamodel.xml file into the api bundle as a resource, and then refer to it from the impl bundle.

The datamodel specification file

The datamodel specification xml file has the structure given below.  Some general notes:

The structure of the specification xml file:

The generator xml file

The generator xml file defines, which pieces of code are generated at which location.  It consists of a top level node called GeneratorConfig, and a number of child nodes called Generate.  Each of those child nodes corresponds to one code concept to be generated.  At present, only generation of various kinds of Java code is supported. The following attributes of node Generate must be given always:

The following concepts are supported; some of them with specific parameters which are given as attributes of node Generate: