[Solved][ATL] problem running ATL programmatically [message #831701] |
Thu, 29 March 2012 08:17 |
david borsodi Messages: 19 Registered: July 2009 |
Junior Member |
|
|
I followed the example and managed to load the models and finally run the atl vm from the code, but there is some internal problem.
in ASMEMFModel.initClassifiers DynamicEObjectImpl is not handled properly, but the loader code initialized my model as a DynaimcEObjectImpl
this is how I loaded it:
ASMEMFModel dbModel = (ASMEMFModel) loader.loadModel("db", loader.getMOF(), new FileInputStream(parentPath + "/mo.ecore"));
Is there any way to force the loader to not handle the model as a DynaimcEobject?
Is this a bug, anyway?
I can run the transformation from eclipse with the ATL profile. With exaclty the same models and metamodels...
I hope someone is here who can answer...
[Updated on: Thu, 29 March 2012 11:57] Report message to a moderator
|
|
|
Re: [ATL] problem running ATL programmatically [message #831740 is a reply to message #831701] |
Thu, 29 March 2012 09:21 |
david borsodi Messages: 19 Registered: July 2009 |
Junior Member |
|
|
I made a quick fix: (the fix is in bold)
private void initClassifiers(Iterator i, Map allClassifiers, String base) {
for ( ; i.hasNext();) {
EObject eo = (EObject)i.next();
if (eo instanceof EPackage) {
String name = ((EPackage)eo).getName();
if (base != null) {
name = base + "::" + name;
}
initClassifiers(((EPackage)eo).eContents().iterator(), allClassifiers, name);
} else if (eo instanceof EClassifier) {
String name = ((EClassifier)eo).getName();
// register the classifier under its simple name
register(allClassifiers, name, eo);
if (base != null) {
name = base + "::" + name;
// register the classifier under its full name
register(allClassifiers, name, eo);
}
}else if(eo instanceof DynamicEObjectImpl) {
initClassifiers(((DynamicEObjectImpl)eo).eClass().getEPackage().eContents().iterator(), allClassifiers, base)
} else {
// No meta-package or meta-class => just keep digging.
// N.B. This situation occurs in UML2 profiles, where
// EPackages containing EClasses are buried somewhere
// underneath other elements.
initClassifiers(eo.eContents().iterator(), allClassifiers, base);
}
}
}
I just don't know how can I repackage and try it, any help welcome, and also any suggestions about this fix.
[Updated on: Thu, 29 March 2012 09:21] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03231 seconds