Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Metamodel registered, but still...("there are no model elements that matches at least.....")
[Acceleo] Metamodel registered, but still... [message #707935] Tue, 02 August 2011 08:42 Go to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Hi,

I'm creating a plugin for Papyrus, in which I perform M2M and M2T. It works as follows : first, a native metamodel transformation from UML to a dedicated metamodel. Then, an extension point "modelTransformation" is set to accept model transformations from this dedicated metamodel to any other, and it has an attribute "codeGeneration" to link this transformation to a code generation module.
I didn't have any trouble transforming models, but I can't get to launch the code generation. I've got this error
!ENTRY org.eclipse.acceleo.engine 2 0 2011-08-02 10:03:47.137
!MESSAGE The generation fail to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates. 
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator.


The metamodel I use isn't registered, it would seem. But it is well registered indeed, as I used the extension org.eclipse.emf.ecore.dynamic_package to get it done, and I can tell it works because (for example) modisco browser can go through the generated xmi.

Let's see then how the code generation is executed :
@Override
					public void run() throws Exception {
						((AbstractAcceleoGenerator) codeGen).initialize(URI.createURI(model),currentProject.getFullPath().toFile(), args);
						((AbstractAcceleoGenerator) codeGen).doGenerate(new BasicMonitor());
					}


model is a string containing the full name of the xmi file. The URI created from it contains the first Element (an EClassImpl) of the xmi file. I guess that's how it's supposed to be.
currentProject is the current active IProject, I tested it and it correspond to what's expected.

I tried in the template to replace the package ns uri with a relative and an absolute path, it didn't change a thing (wasn't worse tho).

I should mention that the generation works when executed alone in my dev eclipse instance.

I really don't know what to do. If you could please point me to the right direction, it would help a lot. Thank you for reading all this.

A

[Updated on: Tue, 02 August 2011 09:04]

Report message to a moderator

Re: [Acceleo] Metamodel registered, but still... [message #709710 is a reply to message #707935] Thu, 04 August 2011 08:03 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

This issue can come from two things : either 1) the metamodel wasn't properly registered, or 2) the input model wasn't loaded as it should. This is an area where we need to enhance Acceleo so that it diagnoses the model loading issues.

I would say that your case is the 2). Please try to change your "model" URI to a fragment-less URI (i.e : "The URI created from it contains the first Element (an EClassImpl) of the xmi file" : remove the "first Element" from the URI). Your URI currently looks like "protocol:/path/to/model.xmi#//EClass1". It should be of the form :

- "platform:/resource/project/path/to/model.xmi" or
- "file:/absolute/path/to/model.xmi" or even
- "platform:/plugin/pluginID/path/to/model.xmi".

Acceleo will handle the search for the "input" EObjects itself. If you have a "main" template that takes an EClass as its input, Acceleo will call the generation for all EClasses contained by your model. Your best bet would be to debug the launch that works ("the generation works when executed alone in my dev eclipse instance") and see what the URI that is used in that case looks like.

Laurent Goubet
Obeo
Re: [Acceleo] Metamodel registered, but still... [message #709763 is a reply to message #709710] Thu, 04 August 2011 09:16 Go to previous messageGo to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Hi laurent,

I may haven't be clear about the model URI : it is not a fragment, and its toString() method returns "platform:/resource/ProjectName/ModelName.xmi", what I ment is that modelURI.eResource().getContents() returns "[org.eclipse.emf.ecore.impl.DynamicEObjectImpl@145d3317 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@7c0e4e8c (name: Project) ....". This eClass matches the first template of my .mtl file :

[template public generateProject(aProject : Project)]

Anyway, I'll try to debug the launch that works.

Thank you for your time ! If you think of something else, I'm all ears.

A
Re: [Acceleo] Metamodel registered, but still... [message #709765 is a reply to message #709763] Thu, 04 August 2011 09:18 Go to previous messageGo to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
By the way, I'm not using the "registerPackages" method, maybe it's a necessary step ?
Re: [Acceleo] Metamodel registered, but still... [message #713211 is a reply to message #709765] Mon, 08 August 2011 08:16 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,

You can see in the following screenshot an example of the use of Acceleo with a dynamic metamodel. You can even see in this example multiple metamodels in several folders.

https://lh5.googleusercontent.com/-GG07ZkOhGiE/TaWiybT6r0I/AAAAAAAAAbc/H-U1mOt-LpQ/s600/DynamicMetamodelDependencies.png

The registration of the package should not be necessary as long as you are launching your generation with the Acceleo Plugin-in Application runner in the run configuration.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo] Metamodel registered, but still... [message #713868 is a reply to message #713211] Tue, 09 August 2011 08:52 Go to previous messageGo to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Thanks Stephane, although I'm not launching my generation with the acceleo app runner, but within another plugin by calling the initialize and dogenerate methods. My Acceleo project looks like yours, except the metamodel I use isn't in the acceleo project.
I don't think my problem comes from a bad package registration, but as Laurent said, more from a bad URI. It's weird though because the URI I use is of the form "platform:/resource/projectName/filename.xmi", and it is valid because ATL handles it.
Maybe it comes from the File instance representing the project needed in the initialize method, to get it I did : IProjectInstance.getFullPath().getFile() .
Re: [Acceleo] Metamodel registered, but still... [message #714644 is a reply to message #713868] Thu, 11 August 2011 07:28 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,

Are you using Acceleo 3.1? If yes, you can improve the way Acceleo handle URIs by switching to the XMI serialization of the Acceleo modules (right click on the project -> properties -> Acceleo -> check XMI). Binary is faster and lighter but XMI is "smarter".

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo] Metamodel registered, but still... [message #714745 is a reply to message #714644] Thu, 11 August 2011 12:33 Go to previous messageGo to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Thank you for your answer Stephane. But I still can't generate code :'-( I've tried everything, I must have done a stupid mistake and yet I just can't see it...
There must be some kind of incompatibility between the registered package and the xmi file, because on the one hand, my metamodel is registered, and on the other hand the xmi file exists (I tried to give bad URI and exceptions were thrown).
This is weird since it works with the same xmi file when running it via eclipse.


Well, I'll keep searching.

[Updated on: Thu, 11 August 2011 14:26]

Report message to a moderator

Re: [Acceleo] Metamodel registered, but still... [message #715061 is a reply to message #714745] Fri, 12 August 2011 08:55 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
Messages: 174
Registered: July 2009
Senior Member
Le 11/08/2011 14:33, A Vernotte a écrit :
> Thank you for your answer Stephane. But I still can't generate code :'-(
> I've tried everything, I must have done a stupid mistake and yet I just
> can't see it...
>
>
> Well, I'll keep searching.

You may provide us a zipped version of your projects on a bugzilla entry
if possible for you.

It will be easier for us to reproduce your problem and understand what
goes wrong.

Regards,

Mariot
--
Mariot Chauvin @ Obeo

Blog : http://mariot-thoughts.blogspot.com
Twitter :http://twitter.com/mchv
Professional support : http://obeo.fr/pages/maintenance-and-support/
Re: [Acceleo] Metamodel registered, but still... [message #715145 is a reply to message #715061] Fri, 12 August 2011 14:12 Go to previous message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Hi, I've created a bug entry : https://bugs.eclipse.org/bugs/show_bug.cgi?id=354619
You may find a zip file containing my projects.

And thank you, by the way.

A
Previous Topic:EMF metamodel with acceleo
Next Topic:[Acceleo] strange behaviour of Acceleo
Goto Forum:
  


Current Time: Sat Nov 09 01:54:42 GMT 2024

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

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

Back to the top