[MOFScript] Problems on running a transformation using the Java API [message #491561] |
Wed, 14 October 2009 23:17  |
Eclipse User |
|
|
|
I'm trying to run a transformation programatically, which uses the UML metamodel. I've managed to run a transformation that uses another metamodel in the .ecore format, but now, when I try to run an example which uses the UML metamodel, it doesn't work.
Looking through other posts, I've seen that I must add:
execMgr.lookupAndAddSourceMetaModel("uml","http://www.eclipse.org/uml2/2.1.0/UML");
to my code, in order to load the UML metamodel.
When I execute my java class which runs the transformation (this: http://pastebin.com/f8f8e8ec), I get this as output: http://pastebin.com/f19813ee2
Does anyone know why this might be happening or have a suggestion on what should I do to execute transformations programatically, using the UML metamodel?
|
|
|
|
Re: [MOFScript] Problems on running a transformation using the Java API [message #493386 is a reply to message #493111] |
Sun, 25 October 2009 12:12  |
Eclipse User |
|
|
|
Hi Jon,
thank you for taking the time to answer my message. I didn't know where should I call: UMLPackage lePackage = UMLPackage.eINSTANCE, so I googled it and I came across a solution suggested by Gøran K. Olsen in another message: http://pastebin.com/fda7239e
That solved my problem!
Jon Oldevik wrote on Fri, 23 October 2009 04:12 | Hi Antonio,
you shouldn't have to use the call execMgr.lookupAndAddSourceMetaModel("uml","http://www.eclipse.org/uml2/2.1.0/UML"); -- in your case, since your are parsing the transformation, this is handled in the parser.
However, you need to ensure that the UML is in fact loaded. When running outside of Eclipse, you need to explicitly do this, for instance by adding a call to: UMLPackage lePackage = UMLPackage.eINSTANCE;
Then you also need to ensure that the UML URI in the transformation (http://www.eclipse.org/uml2/2.1.0/UML) matches the UML uri of the UML library you link with you Java app. (Under Galileo, this might be http://www.eclipse.org/uml2/3.0.0/UML).
/ Jon Oldevik
|
|
|
|
Powered by
FUDForum. Page generated in 0.03806 seconds