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 Bresson
Messages: 728
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):
[01_simple_java.png]

On the project node "simple java", I have opened the context menu: Discovery > Discoverers > Discover Java Project...
[02_discover_java.png]

I let the parameter dialog I did not change anything
[03_param.png]

And I get an EMF-Editor with the analysis result.
[04_MoDisco_Model_Browser.png]

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:
[05_Trace_file_viewer.png]

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 Bresson
Messages: 118
Registered: November 2010
Senior Member
Hi,

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

Quote:
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


index.php/fa/17491/0/

I get the expected simple.java_java.xmi

index.php/fa/17492/0/

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 Bruneliere
Messages: 604
Registered: July 2009
Senior Member
Hello,

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: Tue Sep 30 10:20:31 GMT 2014

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

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