In ATL engine terminology, a model handler is a library providing primitives for handling models:
- Creating new models,
- Loading and saving models,
- Adding and deleting elements,
- Reading and writing element properties.
A model handler driver is a piece of Java code making it possible to use the corresponding model handler with the ATL Virtual Machine.
The current version of ATL Virtual Machine provides two model handler drivers:
Creating New Model Handler Drivers
Here is a brief description of the work to be done:
- Extend ASMModel to implement specific model-level behavior. There are already two examples: ASMEMFModel and ASMMDRModel.
- Extend ASMModelElement to implement specific model-element-level behavior. There are already two examples: ASMEMFModelElement and ASMMDRModelElement.
- Extend AtlModelHandler to implement model loading and saving. There are already two examples: AtlEMFModelHandler and AtlMDRModelHandler.
- Use the
org.atl.eclipse.engine.modelhandlerextension point in your plugin.xml to register your model handler driver. There is already one example: mdr4atl plugin.xml
When to Create a New Model Handler Driver
In practice, there are exceptions. For instance, the Eclipse/UML2 plugin implements the UML 2.0 metamodel by using EMF. However, it seems that UML2 models created with this plugin cannot be handled by EMF without the additional Java code available in the Eclipse/UML2 plugin (see ATL_Language_Troubleshooter#UML2_Profiles and this thread). This means that the UML2 metamodel that is implemented does not strictly follows EMF rules but adds its own rules. One example is profile and stereotype application: the profile must be applied before the stereotype. Such an ordering constraint is beyond EMF semantics. For this reason, full support for the Eclipse/UML2 plugin can only be properly achieved by adding code specific to this plugin in the model handler driver. Instead of doing this in emf4atl, which is metamodel-independant, a uml24atl model handler driver could be developed.