|[acceleo] binary/XMI format & java application [message #778147]
||Wed, 11 January 2012 13:31
| Marc Missing name
Registered: March 2011
I'm using acceleo in an external java application, with much success |
I'm now trying to use the binary format for my template instead of XMI (I've read that it's better in terms of performance, which is something I want considering my current perfs are pretty bad). So I flipped the "binary" checkbox in the acceleo projects containing my templates and everything compiles correctly in eclipse. But when I try to run the application, I get the "proxy" error:
org.eclipse.acceleo.engine.AcceleoEvaluationException: The type of the first parameter of the main template named 'generatePackage' is a proxy.
I know that it has something to do with the registration of my metamodel, so I go directly in the 'registerPackages' and add the following:
No luck, this does not fix the problem. Now, I'm trying to understand exactly what should be done and what is currently expected in the code...
In my metamodel, I have use URIs like:
* root -> http://root/1.0
* root.subpack -> http://root/subpack/1.0
* root.subpack.subsubpack -> http://root/subpack/subsubpack/1.0
I've simply followed example in the EMF book. Now, in my acceleo templates, I've always used what the autocompletion gave me:
Until here, everything looks "coherent" to me. I've check at runtime, the getNsURI() is correct.
Then, if I watch the state when the error is raised, I see that the 'argumentType' variable has:
org.eclipse.emf.ecore.impl.EClassImpl@e1f305 (eProxyURI: /metamodel.project.in.workspace/model/root.ecore#//subpack/subsubpack/SomeModelClass)
To add something to my confusion, the generated code contains in comment for the registerPackages() method:
* // The package registration that will be used if the metamodel is not deployed in a plugin.
* // This should be used if your metamodel is in your workspace and if you are using binary resource serialization.
* resourceSet.getPackageRegistry().put("/myproject/myfolder/mysubfolder/MyUMLMetamodel.ecore", UMLPackage.eINSTANCE);
What am I supposed to do ?
Now, I'm lost... I don't understand why there is a problem with package registration when changing XMI to binary...
Any hint ?
[Updated on: Wed, 11 January 2012 13:49]
Report message to a moderator
|Re: [acceleo] binary/XMI format & java application [message #778349 is a reply to message #778147]
||Thu, 12 January 2012 14:14
| Stephane Begaudeau
Registered: April 2010
Location: Nantes (France)
1- Which version of Acceleo are you using?
2- You should add the other two metamodels in your module header [module generatePackage('http://root/1.0', 'http://root/subpack/1.0', 'http://root/subpack/subsubpack/1.0')/] because you may be manipulating element from those subpackages.
3- instead of "resourceSet.getPackageRegistry().put(RootPackage.eINSTANCE.getNsURI(), RootPackage.eINSTANCE);" which tells EMF that the "NsURI" matches your metamodel, you should use "resourceSet.getPackageRegistry().put("/metamodel.project.in.workspace/model/root.ecore", RootPackage.eINSTANCE);" which tells EMF that if it sees something with "/metamodel.project.in.workspace/model/root.ecore", it's from your metamodel. Since BinaryResource are (were?) lacking an URI handler, you need to use the path of the metamodel in the workspace. While working with binary resources, deploying the metamodel in the Eclipse instance is often the best option.
Stephane Begaudeau, Obeo
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Powered by FUDForum
. Page generated in 0.02924 seconds