Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Discovering a Java Project(Where is the discover output?)
Discovering a Java Project [message #1246589] Sat, 15 February 2014 07:25 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1163
Registered: October 2011
Senior Member
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 "" 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 #1248523 is a reply to message #1246589] Mon, 17 February 2014 11:03 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 118
Registered: November 2010
Senior Member

I missed it in the documentation: (MoDisco Documentation > MoDisco User Guide > Technologies > Java) [link]

At the end of the process, the newly created model files are added to the root of your project if you set SERIALIZE_TARGET to true


I get the expected simple.java_java.xmi


My question about an alternative tree viewer for the trace is still open. (The answer is maybe that if I want user-friendly icons, I should use the MoDisco Model Browser).

Re: Discovering a Java Project [message #1248695 is a reply to message #1248523] Mon, 17 February 2014 15:02 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 645
Registered: July 2009
Senior Member

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
Previous Topic:enable discoverers' stack-trace / activity-logging
Next Topic:Reading a _java.xmi file programmatically
Goto Forum:

Current Time: Sat Apr 30 22:42:38 GMT 2016

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

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