Skip to main content



      Home
Home » Eclipse Projects » Sirius » Problem with reference to the metamodel when implementing Java Service
Problem with reference to the metamodel when implementing Java Service [message #1741958] Tue, 30 August 2016 16:09 Go to next message
Eclipse UserFriend
Hi everyone.

I have started to use Sirius recently. I've finished all of the tutorials and also read the documentation. Then I started to develop my own modeller. But I got stuck in one point.

I need to write a Java Service. As it is stated in the documentation I can only implement services (methods) which has at least one parameter. The type of the parameter should be the metamodel class, on the instances of which I would like to run the service. So I need to refer to the metamodel to point to the appropriate type. I can use the "import" statement to do that, but Eclipse seems to not see the metamodel - I cannot refer to the metamodel without any errors.

I've done everything like in the tutorials. In the first instance of Eclipse I have the project with my metamodel loaded. In the second instance of Eclipse (launched from the first one) I have my Viewpoint Specification Project and the project with the example instance of the model for my domain as well. I referred to the metamodel in the manifest file and in all the "Metamodels" tabs in all the diagrams. Everything seems to work perfectly (creation of mappings, tools and so on) - the only place where there is something clearly wrong is the "import" statement in Java Services files.

To be honest I'm an absolute beginner in Eclipse technologies. I haven't developed any Eclipse Plug-ins in my life. So when the tutorial wanted me to deliver my metamodel plug-in to the Eclipse I simply created the Ecore Modeling Project (I'm familiar with the Ecore Tools application), designed my domain metamodel and attached such a project every time I was asked for the metamodel plug-in. Maybe here I did something wrong.

So my question is: has anyone experienced such a problem? Any idea for the solution?

I would appreciate any help from you. Thanks in advance!
Re: Problem with reference to the metamodel when implementing Java Service [message #1742085 is a reply to message #1741958] Wed, 31 August 2016 05:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rafal,

To reference your metamodel in your java services you should add a dependency of it in the MANIFEST.MF in META-INF in your odesign project.
For that, open MANIFEST.MF file, in tab depedencies click on Add button and find your metamodel.
Now you can import classes of your metamodel in your java services.

Regards,
Re: Problem with reference to the metamodel when implementing Java Service [message #1742100 is a reply to message #1741958] Wed, 31 August 2016 08:32 Go to previous messageGo to next message
Eclipse UserFriend
And that is exactly what I did... But it didn't work... I can't refer to any classes from the metamodel in my Java Services files...
Re: Problem with reference to the metamodel when implementing Java Service [message #1742106 is a reply to message #1742100] Wed, 31 August 2016 09:04 Go to previous messageGo to next message
Eclipse UserFriend
You can find an example in New/Example/Sirius Examples/Basic Family Sample Modeler Definition
The project imported will not compiled (because metamodel sources is not installed) but for example it's sufficient.
You can see that the MANIFEST.MF is in Error. Because the referece to Metamodel is not correct. Did you refer your Metamodel Project and not Metamodel.edit or Metamodel.editor plugin.
After, you can see in src directory how is imported the referenced classes.
If you fail to import your metamodel classes in your java services, could you add your use case (Metamodel + odesign project) to see where problem from?

Regards,

Julien

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Problem with reference to the metamodel when implementing Java Service [message #1742125 is a reply to message #1741958] Wed, 31 August 2016 11:30 Go to previous messageGo to next message
Eclipse UserFriend
I have seen how it is done in the examples. But I am not able to recreate the proper behaviour in my case.

I cannot place here my metamodel because of the property rights (I base my editor on the work of someone else from my team). But I created another metamodel (simple class diagram metamodel) and the fragment of another modeller (the simplest possible one). The same problem with references to metamodel types in Java Services appears here (because every time I do something wrong).

The archive named "parolr.classes.zip" contains the project with the metamodel.
The archive named "parolr.classes.siriuseditor.zip" containt the Viewpoint Specification Project.

The example Java Service is placed in source folder named "services" and is called "ClassServices".

I've got the following error:
"The import parolr.classes.Class cannot be resolved ClassServices.java /parolr.classes.siriuseditor/services/parolr/classes/siriuseditor/services line 3 Java Problem"

I would appreciate any suggestions on what I do wrong.
Re: Problem with reference to the metamodel when implementing Java Service [message #1742959 is a reply to message #1742125] Thu, 08 September 2016 17:38 Go to previous message
Eclipse UserFriend
OK Guys I solved it by myself...

The problem was that I did not have any code generated for my metamodel in my metamodel's project. I had a .genmodel file but I did not do anything with that. So when I generated the code with the use of my .genmodel file everything started to work.

[Updated on: Thu, 08 September 2016 17:56] by Moderator

Previous Topic:Example for Element Based Edge needed
Next Topic:Container Child Attribute Visualization
Goto Forum:
  


Current Time: Thu Mar 20 15:27:02 EDT 2025

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

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

Back to the top