Jump to: navigation, search

Difference between revisions of "Acceleo/Runtime"

m (Generation engine)
(improvements)
Line 4: Line 4:
  
 
== Compiler ==
 
== Compiler ==
 
+
The Acceleo compiler can be found in the bundle org.eclipse.acceleo.parser. In this bundle, you can use the class AcceleoParser to parse a "mtl" file and return the root of the "emtl" file. That root can then be serialized in a file with the "emtl" extension. The Acceleo parser can parse Java.io.File, org.eclipse.core.resources.IFile or java.lang.StringBuffer and then create the emtl file matching the mtl File or IFile or it can return the emtl in EMF resource.
The Acceleo compiler can be found in the bundle org.eclipse.acceleo.parser. In this bundle, you can use the class AcceleoParser to parse a "mtl" file and return the root of the "emtl" file. That root can then be serialized in a file with the "emtl" extension.
+
  
 
== Generation engine ==
 
== Generation engine ==
 +
The generation engine can launch an Acceleo generation from an Acceleo module and and EMF model.
 +
In order to create a starting point for your generation, you should add a [comment @main] tag in your main template. Thanks to this tag, Acceleo will generate a basic Java class to launch the generation. If you want to customize this class, please take into account that we are using JMerge and as such you should transform some of the "@generated" annotation to "@generated not" because each changes to the module containing the main template will relaunch the generation of the matching Java class and your modification would be lost. This class extends the AbstractAcceleoGenerator and you can easily customize its behavior. If you want to change the loading process of the input model, for example to use an EObject that is already loaded in your application instead of loading it from a serialized file, you can override the "initialize" method.
  
The generation engine can launch an Acceleo generation from an Acceleo module and and EMF model.
+
The generation engine can also produce traceability and profiling information. In order to activate the traceability for your generation, you have to use the AcceleoPreference class (org.eclipse.acceleo.common). In this class, you can activate or desactivate programmatically the traceability and the cache used by the query. The activation of the traceability may slow down your generation. In order to witness the result of your traceability, you just have to open the Result view prior to the generation. The desactivation of the cache of the query can also degrade the performances while improving the memory footprint of your generation. The profiler can also be activated programmatically thanks to the AcceleoEngineUtils class (org.eclipse.acceleo.engine). The profiler contains an EMF model of the profiling data of the generation, it can be queried and serialized just like any EMF model. If the profiling model is saved with a mtlp extension within Eclipse, Acceleo will provide an editor for its manipulation.
  
 
== Stand alone ==
 
== Stand alone ==

Revision as of 04:30, 27 January 2011

Runtime

Acceleo is based on three separate components: the compiler, the generation engine and the tooling. The acceleo runtime is composed of the generation engine and the compiler.

Compiler

The Acceleo compiler can be found in the bundle org.eclipse.acceleo.parser. In this bundle, you can use the class AcceleoParser to parse a "mtl" file and return the root of the "emtl" file. That root can then be serialized in a file with the "emtl" extension. The Acceleo parser can parse Java.io.File, org.eclipse.core.resources.IFile or java.lang.StringBuffer and then create the emtl file matching the mtl File or IFile or it can return the emtl in EMF resource.

Generation engine

The generation engine can launch an Acceleo generation from an Acceleo module and and EMF model. In order to create a starting point for your generation, you should add a [comment @main] tag in your main template. Thanks to this tag, Acceleo will generate a basic Java class to launch the generation. If you want to customize this class, please take into account that we are using JMerge and as such you should transform some of the "@generated" annotation to "@generated not" because each changes to the module containing the main template will relaunch the generation of the matching Java class and your modification would be lost. This class extends the AbstractAcceleoGenerator and you can easily customize its behavior. If you want to change the loading process of the input model, for example to use an EObject that is already loaded in your application instead of loading it from a serialized file, you can override the "initialize" method.

The generation engine can also produce traceability and profiling information. In order to activate the traceability for your generation, you have to use the AcceleoPreference class (org.eclipse.acceleo.common). In this class, you can activate or desactivate programmatically the traceability and the cache used by the query. The activation of the traceability may slow down your generation. In order to witness the result of your traceability, you just have to open the Result view prior to the generation. The desactivation of the cache of the query can also degrade the performances while improving the memory footprint of your generation. The profiler can also be activated programmatically thanks to the AcceleoEngineUtils class (org.eclipse.acceleo.engine). The profiler contains an EMF model of the profiling data of the generation, it can be queried and serialized just like any EMF model. If the profiling model is saved with a mtlp extension within Eclipse, Acceleo will provide an editor for its manipulation.

Stand alone

The Acceleo runtime can be used in a stand alone environment without any dependencies to the Eclipse IDE, as such it can be embedded in a good old Java application. Acceleo 3.1 will feature some specific Ant and Maven tasks in order to call the Acceleo compiler and the Acceleo generator in stand alone easily.



Acceleo Portal
Project Project · Installation · New & noteworthy · Release review · API policy · Retention policy · Next · Checklist
Features Acceleo Features · Runtime · Acceleo editor · Views & Perspective · Debugger · Profiler · Traceability · Wishlist · Interpreter · Maven
User documentation Getting Started · Acceleo operations reference · OCL operations reference · Text Production Rules · Migration From Acceleo 2.x · Best Practices · Videos · FAQ
Developer documentation Source code · How to contribute · Compatibility · MOFM2T specification · OCL specification
Community Conferences · Twitter & Blogs · Professional Support · Report a bug