[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [henshin-dev] Technical details for Henshin model migration
|
Hi Felix,
I don't think it is a good idea to do the migration with Henshin,
because you can't use reflection in Henshin.
In plain Java, the migration can be implemented with minimal effort. It
could look like this:
// List of old model instances (dynamic!):
List<EObject> oldObjects;
// Map from old to new model elements:
Map<EObject,EObject> newElements = new HashMap();
// Create corresponding new elements:
for (EObject oldObj : oldObjects) {
String type = oldObj.eClass().getName();
if ("AmalgamationUnit".equals(type)) {
continue; // skip amalgamation units
}
EObject newObj = HenshinFactory.eINSTANCE.create(type);
newElements.put(oldObj, newObj);
// copy attributes from oldObj to newObj...
}
// now copy cross references (ignore amalgamation units)...
// update nested rules for all amalgamation units...
// Done!
I planned to start as soon as the new model is fixed and support for
testing (i.e. executing) the transformed rules is available. We seem
to still be discussing a few interesting semantic aspects of rule
execution at the time. If the new model is considered final, I will
start by creating the transformation rules for henshin files and
testing them extensively to ensure perfect conversion of lots of
henshin files. This will be especially important, as correcting files
before or after transformation will be difficult. Having a couple of
rather complex henshin files which use henshin's current feature set
will likely increase the quality of automatic conversion due to better
testing. Since I do not have many henshin files using the full
spectrum of henshin's features, any help in obtaining more henshin
files for testing will be greatly appreciated.
When this will be done, the diagram transformation and wizards can be
created.
Felix