Product file syntax

 

General structure

A product definition XML file contains the <GenerationProducts> element, inside which the elements named after UML metamodel classes are listed (for example, <Class>, <Package>, …).

 

Inside each of these metaclass elements, the elements defining products are listed (for example, <file>, <subproduct>, …).  The list of product elements within a metaclass element defines what will be produced for each UML model element of a particular type, and in what order.

 

 

The <file> product element

The <file> element contains the following attributes:

·         type – informational attribute, can be “header”, “body”, …

·         name – contains a J language expression of string type that should return the name of the file to create, presumably dependent on the current element being processed.

·         condition – contains a J language expression of Boolean type that governs whether or not the file should be generated for this particular element.

 

Inside the <file> element, a <use-template> element is typically placed, with the following attributes:

·         id – contains the ID of a template that is used to generate the file contents. 

 

 

<subproduct> product element

The <subproduct> element contains the following attributes:

·         select – J language expression of Set type, which should return a set of model elements to process recursively.

·         condition – J language expresstion of Boolean type, which governs whether or not the subproducts of the particular current element should be processed.

 

 

Example

<GenerationProducts>

   <Package>

        <!-- things produced for a package -->

        <file type="header" name="getHeaderOutputDir() + this.makeHeaderFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isRamcObject()">

              <use-template id="CxxPackageHeaderFile"/>

        </file>

        <file type="body" name="getBodyOutputDir() + this.makeBodyFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isRamcObject()">

              <use-template id="CxxPackageBodyFile"/>

        </file>

        <subproduct select="this.OwnedElementModelTree" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isRamcObject()"/>

   </Package>

   <Class>

        <!-- things produced for a class -->

        <file type="header" name="getHeaderOutputDir() + this.makeHeaderFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject()">

              <use-template id="CxxClassHeaderFile"/>

        </file>

        <file type="body" name="getBodyOutputDir() + this.makeBodyFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject() &amp;&amp; !this.hasTag(&quot;Cxx.External&quot;)">

              <use-template id="CxxClassBodyFile"/>

        </file>

        <subproduct select="this.InternalStructurePort" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isRamcObject()"/>

   </Class>

   <Interface>

        <!-- things produced for an interface -->

        <file type="header" name="getHeaderOutputDir() + this.makeHeaderFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject()">

              <use-template id="CxxClassHeaderFile"/>

        </file>

        <file type="body" name="getBodyOutputDir() + this.makeBodyFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject()">

              <use-template id="CxxClassBodyFile"/>

        </file>

   </Interface>

   <Port>

        <!-- things produced for an UML2 port -->

        <file type="header" name="getHeaderOutputDir() + this.makeHeaderFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject() &amp;&amp; this.hasSufficientInfo() &amp;&amp; !this.isTyped()">

              <use-template id="CxxPortClassHeaderFile"/>

        </file>

        <file type="body" name="getBodyOutputDir() + this.makeBodyFilename()" condition="!this.hasTag(&quot;Cxx.NoCode&quot;) &amp;&amp; !this.isGrouped() &amp;&amp; !this.isRamcObject() &amp;&amp; !this.hasTag(&quot;Cxx.External&quot;) &amp;&amp; this.hasSufficientInfo() &amp;&amp; !this.isTyped()">

              <use-template id="CxxPortClassBodyFile"/>

        </file>

   </Port>

</GenerationProducts>