Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] - Problem with types invoking Java Wrappers
[Acceleo] - Problem with types invoking Java Wrappers [message #686425] Wed, 22 June 2011 08:24 Go to next message
Jesus  is currently offline Jesus
Messages: 5
Registered: June 2011
Junior Member
Hi people.

I have worked with Acceleo for the last month and I'm satisfied with the tool. However, I have a problem I don't know how to solve it.

I have created a Java Wrapper, and it receives as parameter a domain class (csp.Constraint) of an ecore project. But it produces an exception when i invoke it from acceleo code.
I have tried to change the type to EObject, an then it works. However, the object received is a DynamicEObjectImpl, and when i try to cast to csp.Constraint, I obtain a ClassCastException.
I have read that I need to invoke MyPackage.eINSTANCE.getClass() to force the load, but i receive also an exception:
org.eclipse.emf.ecore.impl.EFactoryImpl cannot be cast to csp.CSPFactory


Thanks in advance.
Jesus.
Re: [Acceleo] - Problem with types invoking Java Wrappers [message #686589 is a reply to message #686425] Wed, 22 June 2011 14:49 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
Jesus,

Please post the stack trace of the exceptions you get, that will allow us to better understand what's happening behind the scene.

Without the exception traces, I can only guess that what you are missing might be the registration of your Package. You should have a generated ".java" class along your "main" template (the class you use in order to launch the generation). In that class is the method "registerPackages(ResourceSet)". Make sure that this method has a line for your CSPPackage; something of the sort :

resourceSet.getPackageRegistry().put(csp.CSPPackage.eINSTANCE.getNsURI(), csp.CSPPackage.eINSTANCE);


If that does not help, we'll need the exception traces Smile.

Laurent Goubet
Obeo
Re: [Acceleo] - Problem with types invoking Java Wrappers [message #688052 is a reply to message #686589] Thu, 23 June 2011 19:10 Go to previous message
Jesus  is currently offline Jesus
Messages: 5
Registered: June 2011
Junior Member
Thank you Laurent!! It works Smile. I modified registerPackages and registerResourceFactories methods to add my metamodel.

Thanks again Smile

Jesus.
Previous Topic:[Xpand] Query regarding Extension (.ext) file
Next Topic:[Acceleo] Problem with Quickstart Guide
Goto Forum:
  


Current Time: Thu Oct 30 13:44:21 GMT 2014

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

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