Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo] binary/XMI format & java application
[acceleo] binary/XMI format & java application [message #778147] Wed, 11 January 2012 13:31 Go to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
I'm using acceleo in an external java application, with much success Smile

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.
	at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:566)
	at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:193)
	at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:158)


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:

resourceSet.getPackageRegistry().put(RootPackage.eINSTANCE.getNsURI(),
                RootPackage.eINSTANCE);


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:

[module generatePackage('http://root/1.0')/]


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 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

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.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [acceleo] binary/XMI format & java application [message #778624 is a reply to message #778349] Fri, 13 January 2012 14:54 Go to previous message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
I'm using acceleo 3.2.0. Using workspace relative path to ecore file worked. I should have tested that earlier, before coming here and ask for help... But I thought that using workspace path would only work if running inside eclipse..

Thanks again !
Marc
Previous Topic:[XPAND] Casting possibilities
Next Topic:[Acceleo] What UML2 modeling tool provides a complete integration with Acceleo?
Goto Forum:
  


Current Time: Thu Apr 25 20:39:59 GMT 2024

Powered by FUDForum. Page generated in 0.03084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top