- Enhancement of the EMF Generation: configure your model/edit/editor/tests API generation, and create your genmodel, ecore tools diagrams, or JavaDoc in a few clicks
- Editor and Generator of build chain for continuous integration
Benoit Langlois
mercredi 9 novembre 2011
EGF at EclipseDay Paris 2011
jeudi 17 mars 2011
EMF Generation enriched by the JavaDoc Generation
This version enriches the EMF Generation with the generation of the Java Doc.
Scenario:
- Select a set of ecore models
- Right-click and [New][Other...][EGF Category][GenerationChain Model][Next]
- For the Emf Generation of a model, set the JavaDoc parameter to true
- Then, at runtime, the JavaDoc is generated during the Emf Generation
Precondition: Eclipse must be launched with the JDK (and not with the JRE).
If you are curious and interested, the JavaDoc generation is realized by an activity workflow: 1) an Ant script is dynamically generated with an EGF pattern, 2) this script is provided to an EGF Ant task which executes it on the fly.
A video is available here.
Download of EGF: from Amalgam or the EGF Wiki.
lundi 27 décembre 2010
Enhancement of EMF Generation - Part Two
A first part presented the enhancement of the EMF Generation by EGF, with executable patterns and factory components. Jet remains the support of the EMF Generation but capabilities of Jet are extended with patterns; factory components enable to manage the generation orchestration and to build customized off-the-shelf EMF Generations. This second part continues to explain this enhancement with the notion of generation chain.
A generation chain defines, at a high level of description, a sequence of generations. The objectives of a generation chain are:
- to reduce the time to define a suite of generations,
- to work at an action semantic level, instead of at the implementation level, and to encapsulate the irrelevant details of generation.
The interest is:
- to reduce the complexity to define generations,
- to facilitate the maintenance,
- to manage large generations.
In the EMF Generation context, the user simply declares the EMF Generations to be applied: s/he selects a set of ecore models, sets the main generation features (e.g., plugin, base package names) and executes the generation chain. Before the execution, those features are translated into generation elements at the implementation level. Genmodels are automatically created with the management of the genmodel dependencies, and the management of the [workspace / platform / runtime] priority. Next, the genmodels can be modified at any time.
At the meta-level, the structure of a generation chain is extensible. This means that the EMF Generation can be enriched with other generation aspects, such as the Java doc.
A generation chain is translated on the fly into factory components, for instance to take into account that the model / edit / editor parts are generated or not. However, internally, those factory components can be customized to have a customized EMF Generation. During the translation, this customization is preserved.
Conclusion
This post and the previous one have shown how to enhance the EMF Generation:
- Improvement of the reusability with patterns,
- Ability to support team working,
- Ability to define generation orchestration,
- Ability to create and customize off-the-shelf EMF Generations,
- Definition at a high level of EMF Generations in order to facilitate the creation and maintenance of EMF Generation chains.
EGF is a generation framework and the EMF Generation represents a domain-specific generation for EGF. The interest was to assess EGF on a complex case. The other interest is to offer another operational development context of the EMF Generation but in the continuity of the current practice.
Download EGF by update site with Amalgam or here.
Examples are also available.
A video is available is here
Enhancement of EMF Generation - Part One
The EMF Generation has reached a very good level of maturity. In this context, the interest of EGF is to enhance it with topics such as team working, reusability, customization of off-the-shelf EMF generations, and facilities to create EMF generation chains.
1. Beyond a work in silos...
The EMF Generation is written in Jet to apply a model-to-text transformation from a genmodel file. In order to customize the generated code, it is possible to override or insert code. The inherent problem with a model-to-text language such as Jet is that reusability is limited: inheritance is not supported, model-to-text scripts cannot be reconsidered later in a new project context, and composition of contributions from different team members is impossible. In other words, the EMF Generation works in silo. However, the fact is that the EMF generation is the result of a long experience and, with all the details and subtleties it contains, it would be uneasy to rewrite and modernize it. Then, what kind of improvement is possible?
2. Executable patterns
EGF provides a first formalism, named pattern. A pattern has roles, a precondition, and a set of methods written in a language such as Jet. Pattern inheritance enables to support polymorphism, and then to have a polymorph Jet; pattern composition enables reusability of patterns in different contexts; pattern merge enables to assemble and integrate patterns; pattern substitution enables to change patterns by other ones and then to reconsider later different parts of a generation. To follow the EMF Generation evolution (Helios, Indigo...), an EGF reverse tool automates the Jet-to-pattern transformation.
3. The team working
Pattern merge enables to integrate customizations of EMF generation written by different team members and then to support collaborative work.
4. Customizable off-the-shelf EMF Generations
Pattern inheritance and pattern substitution enable to reconsider later an existing EMF Generation. Generation blocks can completely be modified, added, or deleted. For projects or companies, the interest is to create off-the-shelf EMF generations which can be adapted to a specific context. Several levels of customization can be created.
5. Maturity levels of the EMF Generation
The EMF Generation is today launched from a genmodel. It is possible to automate a sequence of EMF Generation (e.g., a model, edit and editor generation sequence) in Java (via a generator adaptor factory). The evolution is to easily define and change a sequence of generation. In EGF, a factory component encapsulates a production plan (aka activity workflow) which models a sequence of generation. A production plan successively invokes the EMF Generation steps or specific generation activities. The pattern integration is realized at this level.
This following figure is inspired from the OSIMM (The Open Group Service Integration Maturity Model). In order to avoid any confusion with SOA, the term 'capability' is used instead of the term 'service'. The purpose is to figure out that there are different maturity levels for the EMF Generation. At the level 1, the EMF Generation is realized in silo. At the level 2, EMF generation contributions are not isolated; they are integrated for instance for a collaborative work or for reusing generation elements. At the level 3, a component encapsulates the EMF generation: all the logic of generation is described in a component (data, behavior). At the level 4, the EMF Generation is considered as a capability (or a service) which can be executed like another one, and makes sense by its final result; all the internal mechanisms are encapsulated. At the level 5, the EMF Generation can be combined with other capabilities, for instance the generation of Java doc, diagrams, or combined with other EMF components, such as EEF.
Those maturity levels are combined with dimensions. The two first dimensions consider the EMF Generation without and with customizations. The third dimension addresses reusability, and the last one the product line.
EGF starts reusability with patterns, works at the Component level with factory components, where a factory component can invoke another factory component. A factory component is executed by the user or in headless mode. The Capability level is adressed with the notion of generation chain.
6. Hands on...
- Download EGF by update site with Amalgam or here.
- Download examples from the Tutorial page or here
- The org.eclipse.egf.usecase.emf.uc2 plugin provides examples of customization of the EMF generation with patterns (e.g., new get/set methods)
- The org.eclipse.egf.usecase.emf.uc3 plugin examplifies how to integrate customization contributions and how to create two levels of customization
- Examples are in the egf folder. Open an fcore. For execution, right-click on a launcher factory component; the EMF Generation is realized. Patterns are in the pattern viewpoint. The generation sequences are located in a production plan.
7. Conclusion
In order to enhance the EMF Generation, EGF has realized a paradigm shift successively with patterns, factory components and generation chains. Some points of conclusion for this first part:
A/ The EMF Generation is a domain-specific generation for EGF where the domain is EMF
B/ With a pattern-based generation, EGF is able to reproduce the same generation than the EMF generation
C/ Add-value:
- Polymorph Jet with pattern inheritance,
- Reusability of EMF Generation parts,
- EMF Generation in team working mode,
- With a production plan (aka activity workflow), ability to define the different steps of the EMF Generation (model, edit, editor, tests) and to insert specific steps
- Creation and customization of off-the-shelf EMF Generations, with the possibility to define different derivations of EMF Generations
A next post will explain how to easily set up EMF Generations.
lundi 6 décembre 2010
EGF Explained - Generation Chain
First document of the series: Generation Chain. The objectives of a generation chain? Reducing the time to define a suite of generations; Working at a high level of description, in order to encapsulate the irrelevant details of generation, with the possibility to refine this description later.
Generation chains are first applied to Emf.
mardi 16 novembre 2010
EGF is here
=> http://eclipse.org/egf
EGF was very active during the last past months:
- Aggregation in Indigo/M3
- Two generation portfolios already available: customization of the EMF generation, a build chain editor and generator
- A simple activity workflow, but able to support Java and JRuby
- etc.
More news and materials in the coming weeks...
Benoit