Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo] The template parameter type cannot be resolved
[acceleo] The template parameter type cannot be resolved [message #665692] Fri, 15 April 2011 14:04 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm trying to execute my first Acceleo M2T transformation, and nothing
seems to happen. Executing the sample you get when creating a new
project works, but not the one I've written myself. I've stripped away
everything that could go wrong and the only difference from between my
template and the sample is that my template's parameter is a class from
a package defined in a model plugin, and not EClass. After setting some
breakpoints and inspecting the variables in the AcceleoService's
doGenerate method, I've found out the the argument type, which is a
class from my model plugin, has not and cannot be resolved (eIsProxy() =
true)! The proxy URI does reference my package URI and ends with
#_SDGYLA (actually some other sequence of uppercase characters that look
like an ID). In my generator's registerPackages method, the package
containing this class has been correctly loaded and initialized (at
least it contains the desired class in its list of eClassifiers).

So, what can make the loading of the template to not be able to load the
template's argument type correctly?

Hallvard
Re: [acceleo] The template parameter type cannot be resolved [message #665769 is a reply to message #665692] Fri, 15 April 2011 19:36 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Update: I've created the following module:

[module main('http://org.eclipse.gmt.emfacade/model/emfacade.ecore')/]

[import org::eclipse::gmt::emfacade::tests::generateEClassMapping /]

[template public main(facadeModel : FacadeModel)]

[comment @main /]

[for (eClassMapping : EClassMapping | facadeModel.classMappings)]
[eClassMapping.generate()/]
[/for]

[/template]

The module is run on a file containing one FacedeModel containing one
EClassMapping. Nothing is generated, but I get an error message on the
line containing the for:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid type for
iteration at line 10 in Module main for block for
(facadeModel.classMappings).
org.eclipse.gmt.emfacade.impl.EClassMappingImpl was not an instanceof null.

The eClassMapping variable references an EClassMapping instance, but it
seems that the EClassMapping reference in the template hasn't been resolved.

Hallvard

On 15.04.11 16.04, Hallvard Trætteberg wrote:
> Hi,
>
> I'm trying to execute my first Acceleo M2T transformation, and nothing
> seems to happen. Executing the sample you get when creating a new
> project works, but not the one I've written myself. I've stripped away
> everything that could go wrong and the only difference from between my
> template and the sample is that my template's parameter is a class from
> a package defined in a model plugin, and not EClass. After setting some
> breakpoints and inspecting the variables in the AcceleoService's
> doGenerate method, I've found out the the argument type, which is a
> class from my model plugin, has not and cannot be resolved (eIsProxy() =
> true)! The proxy URI does reference my package URI and ends with
> #_SDGYLA (actually some other sequence of uppercase characters that look
> like an ID). In my generator's registerPackages method, the package
> containing this class has been correctly loaded and initialized (at
> least it contains the desired class in its list of eClassifiers).
>
> So, what can make the loading of the template to not be able to load the
> template's argument type correctly?
>
> Hallvard
Re: [acceleo] The template parameter type cannot be resolved [message #665783 is a reply to message #665769] Fri, 15 April 2011 21:36 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Another update: I have located the module file (an emtl file in the bin
folder, I guess it's the xmi representation of the parsed mtl file) and
it seems to load without problems in the Sample Reflective Ecore Editor.
So why doesn't it load correctly during the execution of the generator?
The model itself load correctly into the same resourceSet as the module,
so the package registry seems correctly set up.

Hallvard

On 15.04.11 21.36, Hallvard Trætteberg wrote:
> Update: I've created the following module:
>
> [module main('http://org.eclipse.gmt.emfacade/model/emfacade.ecore')/]
>
> [import org::eclipse::gmt::emfacade::tests::generateEClassMapping /]
>
> [template public main(facadeModel : FacadeModel)]
>
> [comment @main /]
>
> [for (eClassMapping : EClassMapping | facadeModel.classMappings)]
> [eClassMapping.generate()/]
> [/for]
>
> [/template]
>
> The module is run on a file containing one FacedeModel containing one
> EClassMapping. Nothing is generated, but I get an error message on the
> line containing the for:
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid type for
> iteration at line 10 in Module main for block for
> (facadeModel.classMappings).
> org.eclipse.gmt.emfacade.impl.EClassMappingImpl was not an instanceof null.
>
> The eClassMapping variable references an EClassMapping instance, but it
> seems that the EClassMapping reference in the template hasn't been
> resolved.
>
> Hallvard
>
> On 15.04.11 16.04, Hallvard Trætteberg wrote:
>> Hi,
>>
>> I'm trying to execute my first Acceleo M2T transformation, and nothing
>> seems to happen. Executing the sample you get when creating a new
>> project works, but not the one I've written myself. I've stripped away
>> everything that could go wrong and the only difference from between my
>> template and the sample is that my template's parameter is a class from
>> a package defined in a model plugin, and not EClass. After setting some
>> breakpoints and inspecting the variables in the AcceleoService's
>> doGenerate method, I've found out the the argument type, which is a
>> class from my model plugin, has not and cannot be resolved (eIsProxy() =
>> true)! The proxy URI does reference my package URI and ends with
>> #_SDGYLA (actually some other sequence of uppercase characters that look
>> like an ID). In my generator's registerPackages method, the package
>> containing this class has been correctly loaded and initialized (at
>> least it contains the desired class in its list of eClassifiers).
>>
>> So, what can make the loading of the template to not be able to load the
>> template's argument type correctly?
>>
>> Hallvard
>
Re: [acceleo] The template parameter type cannot be resolved [message #665924 is a reply to message #665692] Mon, 18 April 2011 08:07 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,

Where is your metamodel ? in your workspace or in a plugin installed in your Eclipse ?

If it is in your workspace, Acceleo 3.0.x has some problems with metamodels in the workspace that we have corrected for Acceleo 3.1. Could you try with your metamodel deployed or in a new eclipse instance please ?.

Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
Re: [acceleo] The template parameter type cannot be resolved [message #666317 is a reply to message #665924] Tue, 19 April 2011 21:04 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
The metamodel is installed in a plugin. The uri is http... so cannot be mistaken for a workspace ref.
Re: [acceleo] The template parameter type cannot be resolved [message #666366 is a reply to message #665692] Wed, 20 April 2011 07:57 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

As it stands, I don't really understand what's going on. How are you launching your generation? In standalone or from within Eclipse? If from within Eclipse, are you using an Acceleo launch config? Did you select "Java Application" in the drop down list at the bottom of the launch config by chance? You say that the metamodel is installed and its URI starts with http, but do you also have it in your workspace?

Laurent Goubet
Obeo
Re: [acceleo] The template parameter type cannot be resolved [message #666544 is a reply to message #665924] Wed, 20 April 2011 20:39 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
I have found and solved the problem. I had correctly started the generator using the java launcher. The problem was that one of the references to one of my model classes had been encoded as an id (#ASDF...) instead of a path (#//EClassMapping). The xml:id is not available in a generated package, hence resolving against the generated package didn't work. By replacing the id reference with a path made it work. Tricky bug to identify, but easy to fix.
Previous Topic:[Acceleo] Problems with UI launcher project
Next Topic:Problem with using annotations in acceleo
Goto Forum:
  


Current Time: Thu Apr 25 04:43:24 GMT 2024

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

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

Back to the top