For migration of AMALTHEA models, plane java approach has been used ( non EMF) along with the following 3rd party libraries :
Using the above specified technologies, eclipse plugin based framework for model migration is developed.
All the above specified components are contributed as extension points in the plugin org.eclipse.app4mc.amalthea.converters.common
Detailed description of each component can be found below:
Converters: This component is responsible for converting the model (xmi) content from one version to another. A Converter component is executed for selected model files and the corresponding referred model files for migration ( each execution is w.r.t. specific model file).
Converter can be registered by adding extension definition for :
org.eclipse.app4mc.amalthea.model.converters and defining the following parameters :
All AMALTHEA/AMALTHEA4Public ITEA releases are specified with prefix itea (e.g: itea.103, itea.110, itea.111) and APP4MC releases are specifeid with their version number (e.g: 0.7.0, 0.7.1)
org.eclipse.app4mc.amalthea.converters.common.base.IConverter interface and providing the definition for method :
public void convert(final File targetFile, final Map<File, Document> fileName_documentsMap, final List<ICache> caches) throws Exception
Converter dependencies can be specified at the extension level in the following way:
Cache Builders: This component is responsible for building the required cache, by querying the input models or storing the necessary information - > before executing the Converters for specific migration step (
e.g: itea.103 to itea.110)
Scope of each Cache Builder component is only during a step of model migration (
e.g: itea.103 to itea.110)
Cache Builder can be registered by adding extension definition for :
org.eclipse.app4mc.amalthea.model.converters.cachebuilders and defining the following parameters :
org.eclipse.app4mc.amalthea.converters.common.base.ICache interface and providing implementation for following methods :
public void buildCache(final Map<File, Document> fileName_documentsMap),
public Map<File, Map<String, Object>> getCacheMap(),
public void clearCacheMap()
Each Cache Builder component is tightly coupled to a specific AMALTHEA model version
Pre Processor: This component is responsible for fetching/modifying specific information before invocation of Cache Builders/Converters components.
This component is tighlty coupled to input version of the AMALTHEA model files which are selected (explicitly/implicitly) for model migration. Each Pre-Processor component is executed only once for the input model files, irrespective of number of migration steps.
Pre Processor component can be registered by adding extension definition for :
org.eclipse.app4mc.amalthea.model.converters.preprocessor and defining the following parameters :
org.eclipse.app4mc.amalthea.converters.common.base.IPreProcessor interface and providing implementation for method :
public void process(final File targetFile, final Map<File, Document> fileName_documentsMap) throws Exception
Each Pre processor component is tightly coupled to the specified AMALTHEA model versions
Post Processor: This component is responsible for adding/modifying specific information after invocation of Cache Builders/Converters components for a specific migration step ( e.g: itea.103 to itea.110)
This component is tighlty coupled to input and output version of the AMALTHEA model files which are selected (explicitly/implicitly) for model migration. Each Pre-Processor component is executed after the migration step if the below criteria is full filled:
Post Processor component can be registered by adding extension definition for :
org.eclipse.app4mc.amalthea.model.converters.postprocessor and defining the following parameters :
org.eclipse.app4mc.amalthea.converters.common.base.IPostProcessor interface and providing implementation for method :
public void process(final Map<File, Document> fileName_documentsMap, final AbstractHelper helper) throws Exception
Example how Post-Processor’s are invoked:
If Post-Processor is defined with input-model-versions : itea.103, itea.110 and outputversion 0.7.0.In case if the migration is invoked from itea.103 to 0.7.0 for the specified AMALTHEA models.Following migration steps are to be performed internally:In this case post-processor is invoked after migration step itea.110 to itea.111.
Flexibility of post-processor’s is, they are defined in a generalized way to specify in the direction which they should be invoked as a part of model migration.
Sequence in which various components are invoked during model migration
As described above, Model Migration framework is part of org.eclipse.app4mc.amalthea.converters.common plugin. This plugin should be added as a dependency to the custom plugin which shall contain Model Migraiton components.
Below are the various extension points available as a part of Model Migration framework:
For defining custom Model Migration, minimum requirement is to define a extension for
org.eclipse.app4mc.amalthea.model.converters extension point and specify the class which has the implementation for migrating the model contents.
CacheBuilders, PreProcessor, PostProcessor components are optional - > based on the scenarios to migrate the model elements, it must me decided if these components are required.