Composer

Objectives

This project suggests doing to create code generation software, which will be extensible by the user easily. This software offers the bellow possibilities:

The generation can be launched:

image

Four concepts are introduced in this project:

Interfaces

Composer provides some Services allowing to call/manipulate it.

Generic Allocation Model

This metamodel is a generic metamodel, which defines the common concepts for all allocation metamodels. It defines several classes as Root, File and Type. Type refers to a semantic element, i.e. from the semantic model. An allocation metamodel can be compared to a generation plan. It defines the concept of file. a file has a name and a path and contains types. Each type refers to an element of the semantic model. An allocation metamodel may be extended with several concepts. This separation of concerns allows the developer to make very simple generation scripts without concern about complicated computation and complicated model browsing.

image

Provided by bundle:org.polarsys.kitalpha.composer.metamodel.allocation.base.model

File name: org.polarsys.kitalpha.composer.metamodel.allocation.base.*

Code Manager Launcher

This class allows launching programmatically a complete code generation.

Provided by bundle:org.polarsys.kitalpha.composer.core

File name: org.polarsys.kitalpha.composer.api.CodeManagerLauncher.java

Code Manager Registry

This class allows getting Strategies, Refineries and Generators contributing at the Manager extensions points.

Provided by bundle:org.polarsys.kitalpha.composer.core

File name: org.polarsys.kitalpha.composer.api.CodeManagerRegistry.java

How to use it

Composer is an Eclipse plug-in that defined four extension points:

Contributing an Allocation Metamodel and a Binding to a given semantic metamodel

Define a new EMF metamodel by inheriting the allocation metamodel one, and register it on the given extension point.

Provided by bundle:org.polarsys.kitalpha.composer.core

Extension point name: org.polarsys.kitalpha.composer.allocation.binding.

Contributing a binding to Composer is done through the following extension (in the bundle plugin.xml file):

<extension
         point="org.polarsys.kitalpha.composer.allocation.binding">
      <binding
            Id="org.polarsys.kitalpha.composer.basic.allocation"
            Name="A Basic Allocation Metamodel"
            NsUri="http://my.allocation.metamodel.ns.uri"
      Description="Description body text" >
            <businessMetamodelNsUriDeclaration
                NsUri="http://metamodel.business.ns.uri">
            </businessMetamodelNsUriDeclaration>
            <businessMetamodelNsUriDeclaration
               NsUri="http://another.metamodel.business.ns.uri">
            </businessMetamodelNsUriDeclaration>
      </binding>
 </extension>

Binding Declaration Attributes:

Business Metamodel Declaration Attributes:

Contributing a Strategy

The strategy will allows to create an allocation model from a semantic model

Provided by bundle:org.polarsys.kitalpha.composer.core

Extension point name: org.polarsys.kitalpha.composer.allocation.strategies.

Contributing a strategy to Composer is done through the following extension (in the bundle plugin.xml file):

<extension
         point="org.polarsys.kitalpha.composer.allocation.strategies">
      <strategy
            Class="org.polarsys.kitalpha.composer.example.MyStrategy"
            Id="org.polarsys.kitalpha.composer.example.strategy"
            Name="A simple Strategy"
            NsUri="http://my.allocation.metamodel.ns.uri">
      </strategy>
</extension>

Strategy Declaration Attributes:

API

This interface specifies the contract for providing allocation strategy.

Provided by bundle:org.polarsys.kitalpha.composer.core

File name: org.polarsys.kitalpha.composer.extension.points.IStrategy.java

Contributing a Refinery

Provided by bundle:org.polarsys.kitalpha.composer.core

Extension point name: org.polarsys.kitalpha.composer.allocation.refineries.

Contributing a refinery to Composer is done through the following extension (in the bundle plugin.xml file):

<extension
         point="org.polarsys.kitalpha.composer.allocation.refineries">
      <refinery
            Class="org.polarsys.kitalpha.composer.example.MyRefinery"
            Id="org.polarsys.kitalpha.composer.example.refinery"
            Name="A simple Refinery"
            NsUri="http://my.allocation.metamodel.ns.uri">
      </refinery>
</extension>

Refinery Declaration Attributes:

API

This interface specifies the contract for providing allocation refinery. Provided by bundle:org.polarsys.kitalpha.composer.core File name: org.polarsys.kitalpha.composer. extension.points.IRefinery.java

Contributing a Generator

Provided by bundle:org.polarsys.kitalpha.composer.core

Extension point name: org.polarsys.kitalpha.composer.cots.generators.

Contributing a generator to composer is done through the following extension (in the bundle plugin.xml file):

<extension
         point="org.polarsys.kitalpha.composer.cots.generators">
      <generator
          Class="org.polarsys.kitalpha.composer.cots.example.MyEntryPointGen"
            Id="org.polarsys.kitalpha.composer.example.generator"
            Name="A simple Generator"
            NsUri="http://my.allocation.metamodel.ns.uri">
      </generator>
</extension>

Generator Declaration Attributes:

API

This interface specifies the contract for providing a generator entry point. Provided by bundle:org.polarsys.kitalpha.composer.core File name: org.polarsys.kitalpha.composer.extension.points.IGenerator.java

Presentation

Additional documentation can be found on the presentation.