PCMModelMigration

Aus SDQ-Wiki

ModelMigration in Palladio

Description

This page describes how to use the Eclipse plugin for automatic migration of old Palladio models to a newer meta-model version. The main idea of the plugin is to enable an end user to migrate his Palladio models to the newest version.

Prerequisites

The plugin was tested and developed with Eclipse Mars. QVT Operational must be installed as an plugin in eclipse (http://marketplace.eclipse.org/content/qvt-operational?mpc=true&mpc_state=)


How to install the plugin?

To use the plugin the code has to be checked out from the SVN repository, then the plugin has to be built and loaded into your eclipse

  1. Step: checkout https://svnserver.informatik.kit.edu/i43/svn/code/Palladio/Addons/PCMModelMigration/ from the SVN
  2. Step: Load the three project ("org.palladiosimulator.util.modelmigration.transformer", org.palladiosimulator.util.modelmigration.ui", “org.palladiosimulator.util.modelmigration.feature”) into your Eclipse
  3. Step: Build the plugin
    1. File -> Export -> Deployable features
    2. Select “org.palladiosimulator.util.modelmigration.feature”
    3. Select “Install into host. Repository:
  4. Step: Restart Eclipse


How to use the plugin?

  1. Open the plugin wizard. (Menu -> PCM Transformer -> Open Transformer)
  2. Select the version of the old model
  3. Select the version for the new model
  4. Select the file of the old model
  5. Select the destination for the new (transformed) model (The file is created when it not exists)
  6. The model is transformed with the click on the "Next" Button
  7. When the transformation was successful the text "The model was transformed successfully" is printed, when there was an error the Stack trace of the error is printed here.

(The current implementation of the QVT-O transformation just works with .repository files. It is a demo transformation to show that the approach works. It is not a correct transformation yet)

How to add a new transformation to the plugin?

The idea of the plugin is to be extensible for new transformations. This section describes how to add a new QVT-O transformation.

  • Checkout the Modelmigration from the SVN repository
  • The meta-models are located in the "metamodel" directory. When a new meta-model is needed add it to a subdirectory in the "metamodel" directory.
    • Put all the .ecore files in one directory
    • Change the dependencies in the pcm.ecore file
    • For example: Replace “platform:/plugin/de.uka.ipd.sdq.stoex/model/stoex.ecore” with “stoex.ecore”
    • This ensures that the ecore files from the same directory are loaded
  • Add the new QVT-O transformation to the directory "transfromation"
  • Open the class "de.zehnder.philipp.qvto.transformer.Utils"
  • Add the new metamodels to the String array "METAMODELS" and the new transformation to the map "TRANSFORMATION_MAPPINGS"
    • The new entry in the map has to look like this: FROM_VERSION#TO_VERSION
    • The FROM_VERSION and TO_VERSION are the Strings that are presented to the user in the selection dialogue for the versions
  • When all new files are registered correctly, the new transformation can be used within the plugin

Project Structure

The Plugin consists of three Projects.The feature, the ui and the transformer.

The Transformer project is responsible for the QVT-O transformation and the UI project contains the wizard.

Transformer Project

Contains all the files that are necessary for the QVT-O transformation. The files are located in the "metamodels" and "transformation" directories. The Transformer is executed via the "PluginController.execute()" methode. To change the behavior of the QVT-O transformation have a look at the "Transformation" class. The Method "transform(...)" contains the main logic for the transformation.

UI Project

When you want to add new behavior to the ui or add new pages to the wizard, start with the class "TransformerWizard". This class contains the pages of the wizard. When you want to add a new wizard page register it in the "TransformerWizard". To change the behavior of the selection page in the wizard edit the class "SelectionPage". Edit the "Messages" class to change the messages that are presented to the user. To add or remove a valid file type edit the Array Utils.VALID_FILE_TYPES.