In some cases, a migration of representation files or VSMs between two versions of meta-model is required. The migration process has been rewritten to be performed automatically at resource loading time. This migration is transparent for the end-user.
If you have extended Viewpoint meta-models, you may need to implement your own migration rules.
To contribute to the Viewpoint migration process, you need to implement an
fr.obeo.dsl.viewpoint.business.api.migration.IMigrationParticipant and provide it through the
fr.obeo.dsl.viewpoint.migrationParticipant extension point.
The
fr.obeo.dsl.viewpoint.migrationParticipant extension point allows to contribute migration participants. Each contribution must provide an implementation of
IMigrationParticipant and a «kind» attribute which gives informations about what kind of file is concerned (
REPRESENTATIONSFILE_KIND for Representation files and
VSM_KIND for VSMs).
Each methods of an
IMigrationParticipant receives the current version of the model to migrate, corresponding to the
fr.obeo.dsl.viewpoint bundle version.
EStructuralFeature getAttribute(EClass eClass, String name, String version) is called during the parsing of XMIResources (at loading time). It allows to retrieve a renamed
EAttribute from its old name. For example, if an attribute
foo has been renamed to
bar, then your MigrationParticipant should return the
bar attribute when given the
'foo' name.
EStructuralFeature getLocalElement(EClass eClass, String name, String version) is called during the parsing of XMIResources (at loading time). If the feature name has changed, you should return the correct one.
EClassifier getType(EPackage ePackage, String name, String version) is called during the parsing of XMIResources (at loading time). If an
EClassifier name has changed, then you should return the correct one.
Object getValue(EObject object, EStructuralFeature feature, Object value, String version) is called during the parsing of XMIResources (at loading time). If a feature value has changed since a previous version, use this method to return the correct expected value.
void postLoad(XMLResource resource, String version) is called after the resource loading. All other structural changes in meta-models should be migrated here.