[Acceleo] Multi-model to text transformation [message #1766269] |
Mon, 19 June 2017 16:41 |
Cristina Vicente-Chicote Messages: 5 Registered: April 2017 |
Junior Member |
|
|
Dear all,
I am trying to use Acceleo to generate some text from a root.xmi model, defined in terms of a rootMM.ecore meta-model. This metamodel has some dependencies on other meta-models. As a consequence, my root.xmi model needs to load some "external models" in memory when the required attributes/references need to be displayed/modified in the model editor. This means that these "external models" are only loaded in memory on demand... not when the root.xmi model is opened!! I guess this is why I am not being able to generate text from some parts of my root.xmi model, in particular, for the attributes of objects stored in those "external models".
When I try to write one of these attributes I always get "invalid". However, if I manage to load these elements in memory in advance (e.g., using an odd "getter" implemented just for that purpose in the corresponding class of the external meta-model), I get the right value of the attribute.
Do you know how to force the load in memory of all the models required by a given xmi model? I guess this would definitively solve the problem.
Thanks in advance,
Cristina
|
|
|
|
Re: [Acceleo] Multi-model to text transformation [message #1766292 is a reply to message #1766281] |
Tue, 20 June 2017 03:29 |
Cristina Vicente-Chicote Messages: 5 Registered: April 2017 |
Junior Member |
|
|
Dear Ed,
Thanks a lot for your prompt answer!
The same problem arises when running my acceleo transformation within the local Eclipse where I wrote the .mtl file, and when I execute it in another Eclipse, launched from the former :-(
Where shall I invoke EcoreUtil.resolveAll to see if it works? In the main method of the GenerateXXX.java associated to the main Acceleo template? After getting the input model URI?, i.e., after:
URI modelURI = URI.createFileURI(args[0]);
or after creating the generator object?, i.e., after:
GenerateXXX generator = new GenerateXXX (modelURI, folder, arguments);
EcoreUtil.resolveAll requires a ResourceSet as an input, right? Where do I get that ResourceSet from?
Thanks in advance!
Cheers,
Cristina
|
|
|
Re: [Acceleo] Multi-model to text transformation [message #1766310 is a reply to message #1766292] |
Tue, 20 June 2017 07:51 |
|
Hi Cristina,
"resolveAll" will only do what EMF would normally without interferences, it will just do it eagerly instead of on-demand and should not be of any help in your case.
Could you share us the template bits that get you "invalid", as well as the models (or samples reduced to just the problematic parts) that get you your issue? Without more info, there's nothing we can really say about what's happening in your case.
Laurent Goubet
Obeo
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03462 seconds