Home » Modeling » MoDisco » EMF editor for Java metamodel: is it possible?(Can't create EMF project using java metamodel)
EMF editor for Java metamodel: is it possible? [message #772740] |
Fri, 30 December 2011 08:27  |
Eclipse User |
|
|
|
The Java Discoverer in MoDisco is simply fantastic. However, I am a little bit confused about how to use it.
It gives me an XMI file, which must be a serialization of a model that complies with Java Metamodel from MoDisco project. I've noticed that the generated discovery results can only be opened with reflective ecore model editor (besides MoDisco editor). This is Helios btw.
Being the lazy person I am, I try to generate a clean EMF project using java metamodel, but it fails because the model project can't export packages prefixed with java (generated as a result of java metamodel) Once model project can't export properly, neither edit nor editor plugins can work of course.
Am I missing something here? I'll be checking out the plugin source from MoDisco discovery results browser, but I suspect that the only way to use java metamodel (ecore) is through emf reflection. Is that correct?
Your help can save me a lot time (and some more black hair on my head...)
|
|
| | |
Re: EMF editor for Java metamodel: is it possible? [message #774167 is a reply to message #774138] |
Tue, 03 January 2012 06:59   |
Eclipse User |
|
|
|
Hi Grégoire,
I've used version 0.8 of Modisco. What I've done is, I've taken only metamodel file from the source directory of Modisco, and tried to generate an EMF project with it. This led to Eclipse creating a gen file for the ecore file. When I tried to do "generate all" with this gen model, the resulting model project's Meta-Inf attempted to export package java, which is normal since the ecore model includes a model named java!
I've realized that the source directory also contains a gen file, next to ecore file, and when I used both in an empty EMF project, the problem went away. To be honest, I did not check out the difference between the gen file from the project source and the one generated by Eclipse (Helios), but I can repeat the experiment and give more detail if that helps.
Which brings me to my goal, and Hugo's question. I've not looked into Modisco browser project to avoid understanding code that I would not be using directly. What I want to do is to obtain an XMI output from the discoverer (very easy thanks to Modisco plugin), and execute some logic on the results. I thought that using the usual EMF practices (ecore -> model <and maybe edit>) would give me what I want. There may be some duality of functionality with Modisco browser code, but maybe I should see how much functionality I can use from Modisco plugins to do what I want.
I think this is a fantastic project, which is probably going to save me months in a very critical piece of work. So thanks in advance to all those who made it possible. Also, thanks for the responses 
Cheers
Seref
|
|
|
Re: EMF editor for Java metamodel: is it possible? [message #774632 is a reply to message #774167] |
Wed, 04 January 2012 05:10   |
Eclipse User |
|
|
|
Hello,
> I've used version 0.8 of Modisco.
If you can, you should use the version 0.9 because 0.8 is not maintained since February 2011.
> What I've done is, I've taken only metamodel file from the source directory of MoDisco, and tried to generate an EMF project with it.
I'm not sure this is a good idea. To my mind, you (and other users) should use released binaries of meta-model plug-ins because they are known, tested and validated by the 'MoDisco' team. But you can use it to generate edit and editor plug-ins.
> When I tried to do "generate all" with this gen model, the resulting model project's Meta-Inf attempted to export package java, which is normal since the ecore model includes a model named java!
Ok, I didn't know that we get the following error if we try to add a packaged prefixed by "java" in the section 'Export-Package' of a MANIFEST.MF file: "Cannot export packages prefixed with 'java'"
> I've realized that the source directory also contains a gen file, next to ecore file, and when I used both in an empty EMF project, the problem went away. To be honest, I did not check out the difference between the gen file from the project source and the one generated by Eclipse (Helios), but I can repeat the experiment and give more detail if that helps.
To get generated classes in packages prefixed with the plug-in name, we changed the value of attribute 'basePackage'.
<genPackages prefix="Java" basePackage="org.eclipse.gmt.modisco" disposableProviderFactory="true"
loadInitialization="true" metaDataPackageSuffix="emf" classPackageSuffix="emf.impl"
utilityPackageSuffix="emf.util" providerPackageSuffix="emf.provider" presentationPackageSuffix="emf.presentation"
testsPackageSuffix="emf.tests" literalsInterface="false" ecorePackage="java.ecore#/">
> What I want to do is to obtain an XMI output from the discoverer (very easy thanks to Modisco plugin),
Ok.
> and execute some logic on the results.
If your "logic on the result" are model transformations (written with Java, ATL, etc.) you should be able to run them without any additional plug-ins.
If you want to be able to use the EMF command framework, you will need to generate the edit plug-in.
If you want to manually edit the javaxmi model (with your mouse and your keyboard), you can:
- use the MoDisco browser (without to care of the source code) ;
- use the 'Sample Reflexive Ecore Model editor';
- use an EMF generated editor (you will then have to generate the edit and editor plug-ins).
> I thought that using the usual EMF practices (ecore -> model <and maybe edit>) would give me what I want.
This is quite true: we just did half of the work for you We do not provide the edit and editor plug-ins when we think that they are not required. This avoid to have to download big plug-ins.
Regards,
Grégoire
|
|
|
Re: EMF editor for Java metamodel: is it possible? [message #774651 is a reply to message #774632] |
Wed, 04 January 2012 05:45  |
Eclipse User |
|
|
|
You've done a lot more than half of the work, be fair to your self
I guess I'll move to 0.9, it is just that getting things stable with an Eclipse distribution is not a trivial task, so once you're settled and comfy with Helios, you begin to dislike the idea of Indigo. Modisco is a reason good enough to move though.
There are multiple options to do what I want to do, but as a matter of principle, I start with the most flexible method, and move to more abstract methods once I can identify patterns in what I'm doing. So EMF based coding will do initially, and if I think I can use ATL or Acceleo, that will definitely be the next step.
I think the other killer feature is Java source code generation from the meta model. Just the discoverer and source code generator, based on the meta model is worth of thousands of hours. Too bad I can't buy you guys a beer and thank your for this
|
|
|
Goto Forum:
Current Time: Thu May 15 13:18:13 EDT 2025
Powered by FUDForum. Page generated in 0.08595 seconds
|