[acceleo] The template parameter type cannot be resolved [message #665692] |
Fri, 15 April 2011 14:04 |
Hallvard Traetteberg 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 |
Hallvard Traetteberg 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 |
Hallvard Traetteberg 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 #666366 is a reply to message #665692] |
Wed, 20 April 2011 07:57 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04198 seconds