|Discovering a Java Project [message #1246589]
||Sat, 15 February 2014 07:25
| Jeremie Bresson
Registered: October 2011
Modisco seems to be a tool that I could use, but I am still in the phase of figuring out how it works. Sorry if this might be a Newbee question...|
I have a simple Java project (with one main class):
On the project node "simple java", I have opened the context menu: Discovery > Discoverers > Discover Java Project...
I let the parameter dialog I did not change anything
And I get an EMF-Editor with the analysis result.
From what I can tell, everything works well. I am not sure what I can get from the editor, but it definitively corresponds to my code.
I was expecting to be able to save the model corresponding to my Java code somewhere (some xmi file).
I would really appreciate some inputs...
* * *
I add a look at How to Discover Model and Generate Code programmatically.
After a lot of trials (and errors) I managed to execute the discover code snippet to generate the .xmi file programmatically. I did the classic game: start a second eclipse application (coming up with a second workspace, where I imported my "simple.java" project).
I am also not sure about the appropriate location for the proposed "modelDiscovery(String, String)" code snippet...
At the end, I could open the generated xmi file in the "Trace file viewer" Editor:
I am sure there is an easier way to get the xmi file corresponding to the java project...
Side question: is there another editor (for example with the Java Icons)?
* * *
Some other thoughts: I have some analysis to perform on an existing java project (finding and parsing several java classes to produce something else).
Instead of building directly on top of some tools (probably JDT or any other Java Parser), my idea is to use the model of the Java Project produced by MoDisco as interface. This way I decouple the "parse the java project" phase from my analysis.
I am hoping that reading (and reacting to) the MoDisco model is easier than involving a java Parser and navigating through the tree of files.
Maybe this assumption is wrong (do not hesitate to give your opinion on it).
* * *
Thank you a lot for all the ideas and pointers you can provide.
|Re: Discovering a Java Project [message #1248695 is a reply to message #1248523]
||Mon, 17 February 2014 15:02
| Hugo Bruneliere
Registered: July 2009
The Trace File Viewer is not a MoDisco component. It is probably coming from another tool you've installed but it looks very similar to the Sample Reflective Editor as basically provided with EMF.
In order to browse Java models discovered with MoDisco (but also any compelx model in general, I encourage you to use the MoDisco Model Browser).
Regarding your overall approach, the idea of 1) discovering a Java model from your project and 2) performing the analysis at the model-level is perfectly relevant.
In order to "handle" your Java model, you can use either directly Java code or dedicated model-to-model transformation languages (e.g. Eclipse ATL).
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
Powered by FUDForum
. Page generated in 0.01656 seconds