Skip to main content
Jump to: navigation, search

Difference between revisions of "MoDisco/Components/Java/Composition/Documentation/0.9"

(How does it work)
Line 6: Line 6:
  
 
=== Description ===
 
=== Description ===
This metamodel ''JavaApplication'' aims at weaving a MoDisco Java Model with a MoDisco KDM Inventory Model. It relies on the core metamodel described in the  
+
This ''JavaApplication'' metamodel aims at weaving a MoDisco Java Model with a MoDisco KDM Inventory Model. It relies on the core metamodel described in the  
[http://wiki.eclipse.org/MoDisco/Components/KDMSourceExtension/Documentation/0.9 kdm.source extension framework].
+
[[MoDisco/Components/KDMSourceExtension/Documentation/0.9|kdm.source extension framework]].
  
Such a metamodel allows to link java nodes to their physical position in the source files (''JavaNodeSourceRegion'' metaclass owning ''startLine'' ''endLine'' properties).
+
Such a metamodel allows to link java nodes to their physical position in the source files (''JavaNodeSourceRegion'' metaclass owning ''startLine'', ''endLine'' properties).
  
As proposed in [http://wiki.eclipse.org/MoDisco/Components/KDMSourceExtension/Documentation/0.9 kdm.source extension framework], the reference ''JavaASTNodeSourceRegion.javaNode'' derived from ''ASTNodeSourceRegion.node''. So as the ''Java2File.javaUnit'' from ''CodeUnit2File.unit''.
+
As proposed in the [[MoDisco/Components/KDMSourceExtension/Documentation/0.9|kdm.source extension framework]], the reference ''JavaASTNodeSourceRegion.javaNode'' derives from ''ASTNodeSourceRegion.node''. So does ''Java2File.javaUnit'' from ''CodeUnit2File.unit''.
  
 
[[Image:JavaApplicationMetaModel.png|frame|center|JavaApplication Metamodel]]
 
[[Image:JavaApplicationMetaModel.png|frame|center|JavaApplication Metamodel]]
  
Note : the references ''java2DirectoryChildren'' and ''java2FileChildren'' are expected to be containment references. For some technical reasons (memory usage tuning via lazy loading), they are not containment to make sure that the ''Java2Directory'', ''Java2File'' and ''JavaNodeSourceRegion'' instances are managed in their own graph compared with ''JavaApplication'' instances (See [http://wiki.eclipse.org/MoDisco/Components/Java/Composition/Architecture#Benchmark benchmark]).
+
Note : the references ''java2DirectoryChildren'' and ''java2FileChildren'' are expected to be containment references. For some technical reasons (memory usage tuning via lazy loading), they are not containments to make sure that the ''Java2Directory'', ''Java2File'' and ''JavaNodeSourceRegion'' instances are managed in their own graph compared with ''JavaApplication'' instances (see [[MoDisco/Components/Java/Composition/Architecture#Benchmark|benchmark]]).
  
 
==Java Composition Discoverer==
 
==Java Composition Discoverer==
Line 37: Line 37:
 
The plug-in provides the user with a contextual menu to easily create models.  
 
The plug-in provides the user with a contextual menu to easily create models.  
  
By right-clicking on a Java Project in the Eclipse Package Explorer view, you can quickly create the Java Application model of your application (see next Figure).
+
By right-clicking on a Java Project in the Eclipse '''Package Explorer''' view, you can quickly create the Java Application model of your application (see next figure).
  
 
[[Image:Javakdmdiscoverypopup.JPG|frame|center|Discovering a JavaApplication model]]
 
[[Image:Javakdmdiscoverypopup.JPG|frame|center|Discovering a JavaApplication model]]
  
The [http://wiki.eclipse.org/MoDisco/Components/Java/Documentation/0.9#User_manual Java discovery parameters window] appears for customizing the Java Model Discovery step.
+
The [[MoDisco/Components/Java/Documentation/0.9#User_manual|Java discovery parameters window]] appears for customizing the Java Model Discovery step.
  
Once launched, a progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete (see next Figure).  
+
Once launched, a progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete (see next figure).  
  
 
[[Image:MoDisco-JavaDiscoverer progress bar model creation.png|frame|center|Progress bar during model creation]]  
 
[[Image:MoDisco-JavaDiscoverer progress bar model creation.png|frame|center|Progress bar during model creation]]  
Line 49: Line 49:
 
At the end of the process, the newly created model files are added to the root of your project and the main file is automatically opened in the default editor.
 
At the end of the process, the newly created model files are added to the root of your project and the main file is automatically opened in the default editor.
 
A xmi file suffixed by ''_javaapp.xmi'' contains the root element of the model, which refers to the ''.javaxmi'' Java model file and the ''_source.kdm'' Inventory model file.
 
A xmi file suffixed by ''_javaapp.xmi'' contains the root element of the model, which refers to the ''.javaxmi'' Java model file and the ''_source.kdm'' Inventory model file.
Some referenced xmi ''fragment'' files are serialized into a ''xmiFragmentsJavaApp' directory (see Resources distribution in [http://wiki.eclipse.org/MoDisco/Components/Java/Composition/Architecture benchmark]).
+
 
 +
Some referenced xmi ''fragment'' files are serialized into a ''xmiFragmentsJavaApp' directory (see Resources distribution in the [[MoDisco/Components/Java/Composition/Architecture|benchmark]]).
  
 
[[Image:JavakdmResourcesTree.JPG|frame|center|JavaApplication xmi files in the package explorer]]
 
[[Image:JavakdmResourcesTree.JPG|frame|center|JavaApplication xmi files in the package explorer]]
  
Once the main file ''_javaapp.xmi'' has been opened in MoDisco model Browser, you may navigate through the ''JavaApplication'' metamodel instances to the ''Java'' and ''kdm.source'' metamodels instances.
+
Once the main file ''_javaapp.xmi'' has been opened in the MoDisco model Browser, you may navigate through the ''JavaApplication'' metamodel instances to the ''Java'' and ''kdm.source'' metamodels instances.
  
 
[[Image:JavakdmBrowsing.JPG|frame|center|browsing the JavaApplication model]]
 
[[Image:JavakdmBrowsing.JPG|frame|center|browsing the JavaApplication model]]
Line 63: Line 64:
 
[[Image:JavakdmFacetsBrowsing.JPG|frame|center|Navigation shortcut from a java element to the associated source region]]
 
[[Image:JavakdmFacetsBrowsing.JPG|frame|center|Navigation shortcut from a java element to the associated source region]]
  
To take benefit of memory usage tuning (see [http://wiki.eclipse.org/MoDisco/Components/Java/Composition/Architecture benchmark]), for huge Java legacy, the MoDisco global preferences should have the "resources loading depth" set to 1 (0 works but is less interesting for browsing). This setting allows the lazy loading of xmi fragment files, through the model navigation, for less memory usage than with a initial complete resources loading.
+
To take advantage of memory usage tuning (see the [[MoDisco/Components/Java/Composition/Architecture|benchmark]]), for huge Java legacy code, the MoDisco global preferences should have the "resources loading depth" set to 1 (0 works but is less interesting for browsing). This setting allows the lazy loading of xmi fragment files, through the model navigation, for less memory usage than with an initial complete loading of resources.
  
 
[[Image:Resourcesloadingdepth.JPG|frame|center|Setting MoDisco global loading depth preference]]
 
[[Image:Resourcesloadingdepth.JPG|frame|center|Setting MoDisco global loading depth preference]]
  
Using the ''Group by package'' setting will ease the selection in types panel considering the metamodels (EPackages instances) involved.
+
Using the ''Group by package'' setting will ease the selection in the types panel considering the metamodels (EPackages instances) involved.
  
 
[[Image:Modiscobrowsergroup.JPG|frame|center|Group by package in MoDisco model browser]]
 
[[Image:Modiscobrowsergroup.JPG|frame|center|Group by package in MoDisco model browser]]
Line 73: Line 74:
 
=== Discoverer API ===
 
=== Discoverer API ===
  
Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.gmt.modisco.infra.discoverymanager.Discoverer).
+
Each MoDisco discoverer implements a normalized interface and can be called programmatically (see org.eclipse.gmt.modisco.infra.discoverymanager.Discoverer).
  
As an example, you may checkout the code from org.eclipse.gmt.modisco.java.composition.discoverer.tests project.
+
As an example, you may checkout the code from the org.eclipse.gmt.modisco.java.composition.discoverer.tests project.
  
== Java Code Source Synchronization ==
+
== Java source code synchronization ==
 
===Description===
 
===Description===
A new step in java model browsing is to link model elements directly with their source code. This synchronization is possible thanks to the MoDisco Code Source Synchronization Framework. Basically, this new feature allow the MoDisco Model Browser to behave like the Eclipse outline.
+
A new step in Java model browsing is to link model elements directly with their source code. This synchronization is possible thanks to the MoDisco Source Code Synchronization Framework. Basically, this new feature allows the MoDisco Model Browser to behave like the Eclipse outline.
  
 
===How does it work===
 
===How does it work===
  
Prerequisite is to   [[MoDisco/Components/Java/Composition/Documentation/0.9#User_manual|create a Composition model]]
+
Prerequisite is to [[MoDisco/Components/Java/Composition/Documentation/0.9#User_manual|create a Composition model]]
  
Once your composition model opened, all you have to do to navigate from your java model to its source code is to activate the code source synchronization (this will prevent the Eclipse property panel to open):  
+
Once your composition model is opened, all you have to do to navigate from your java model to its source code is to activate the source code synchronization (this will prevent the Eclipse Properties view from opening on double-click):
[[Image:MoDisco-ActivateCodeSynchronization.jpg|frame|center|Code source Synchronisation]]
+
[[Image:MoDisco-ActivateCodeSynchronization.jpg|frame|center|Source code synchronisation]]
  
And then double click on an element to directly open its file a get this element selected : on the following figure we double clicked on the method "setMyInteger"
+
And then double click on an element to directly open its file and get this element selected : on the following figure we double-clicked on the method "setMyInteger"
  
 
[[Image:MoDisco-CodeSynchronizationDoubleClick.jpg|frame|center|Java source file opened and element selected]]
 
[[Image:MoDisco-CodeSynchronizationDoubleClick.jpg|frame|center|Java source file opened and element selected]]
  
If you prefer to keep the action "Open the properties panel" on the double click action, you can use the contextual menu to perform a single synchronization : the result will be exactly the same
+
If you prefer to keep the action "Open the '''Properties''' view" on the double click action, you can use the contextual menu to perform a single synchronization : the result will be exactly the same
  
 
[[Image:MoDisco-CodeSynchronization-ContextualMenujpg.jpg|frame|center|Contextual menu]]
 
[[Image:MoDisco-CodeSynchronization-ContextualMenujpg.jpg|frame|center|Contextual menu]]
Line 113: Line 114:
 
[https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.discoverer/ https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.discoverer/]
 
[https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.discoverer/ https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.discoverer/]
  
Code source repository for Java Source Code Synchronization Strategy :  
+
Source code repository for Java Source Code Synchronization Strategy :
 
[https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.ui  https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.ui/]
 
[https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.ui  https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.ui/]
  
 
[[Category:MoDisco]]
 
[[Category:MoDisco]]

Revision as of 12:50, 18 February 2011

MoDisco
Website
Download
Community
Mailing ListForums
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse SourceProject Set File

Java Composition Metamodel

Description

This JavaApplication metamodel aims at weaving a MoDisco Java Model with a MoDisco KDM Inventory Model. It relies on the core metamodel described in the kdm.source extension framework.

Such a metamodel allows to link java nodes to their physical position in the source files (JavaNodeSourceRegion metaclass owning startLine, endLine properties).

As proposed in the kdm.source extension framework, the reference JavaASTNodeSourceRegion.javaNode derives from ASTNodeSourceRegion.node. So does Java2File.javaUnit from CodeUnit2File.unit.

JavaApplication Metamodel

Note : the references java2DirectoryChildren and java2FileChildren are expected to be containment references. For some technical reasons (memory usage tuning via lazy loading), they are not containments to make sure that the Java2Directory, Java2File and JavaNodeSourceRegion instances are managed in their own graph compared with JavaApplication instances (see benchmark).

Java Composition Discoverer

Description

MoDisco provides a discoverer associated to the metamodel definition described here.

The discovery takes as an entry one workspace Java project.

The first step of the discovery creates one Java model, using the associated discoverer.

The second step of the discovery creates one Kdm inventory model, using the associated discoverer.

The third step creates a model with JavaApplication metamodel instances with references to the two leaf models.

Java and kdm inventory discovery

User manual

The plug-in provides the user with a contextual menu to easily create models.

By right-clicking on a Java Project in the Eclipse Package Explorer view, you can quickly create the Java Application model of your application (see next figure).

Discovering a JavaApplication model

The Java discovery parameters window appears for customizing the Java Model Discovery step.

Once launched, a progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete (see next figure).

Progress bar during model creation

At the end of the process, the newly created model files are added to the root of your project and the main file is automatically opened in the default editor. A xmi file suffixed by _javaapp.xmi contains the root element of the model, which refers to the .javaxmi Java model file and the _source.kdm Inventory model file.

Some referenced xmi fragment files are serialized into a xmiFragmentsJavaApp' directory (see Resources distribution in the benchmark).

JavaApplication xmi files in the package explorer

Once the main file _javaapp.xmi has been opened in the MoDisco model Browser, you may navigate through the JavaApplication metamodel instances to the Java and kdm.source metamodels instances.

browsing the JavaApplication model

Some facets called javaToKdmShortcuts and KdmToJavaShortcuts are available for allowing navigation shortcuts from some Java/Kdm.source model elements. (enabling the "Show Derived Links" option is necessary to view the shorcut links)

Apply related facets
Navigation shortcut from a java element to the associated source region

To take advantage of memory usage tuning (see the benchmark), for huge Java legacy code, the MoDisco global preferences should have the "resources loading depth" set to 1 (0 works but is less interesting for browsing). This setting allows the lazy loading of xmi fragment files, through the model navigation, for less memory usage than with an initial complete loading of resources.

Setting MoDisco global loading depth preference

Using the Group by package setting will ease the selection in the types panel considering the metamodels (EPackages instances) involved.

Group by package in MoDisco model browser

Discoverer API

Each MoDisco discoverer implements a normalized interface and can be called programmatically (see org.eclipse.gmt.modisco.infra.discoverymanager.Discoverer).

As an example, you may checkout the code from the org.eclipse.gmt.modisco.java.composition.discoverer.tests project.

Java source code synchronization

Description

A new step in Java model browsing is to link model elements directly with their source code. This synchronization is possible thanks to the MoDisco Source Code Synchronization Framework. Basically, this new feature allows the MoDisco Model Browser to behave like the Eclipse outline.

How does it work

Prerequisite is to create a Composition model

Once your composition model is opened, all you have to do to navigate from your java model to its source code is to activate the source code synchronization (this will prevent the Eclipse Properties view from opening on double-click):

Source code synchronisation

And then double click on an element to directly open its file and get this element selected : on the following figure we double-clicked on the method "setMyInteger"

Java source file opened and element selected

If you prefer to keep the action "Open the Properties view" on the double click action, you can use the contextual menu to perform a single synchronization : the result will be exactly the same

Contextual menu

Requirements

To use the plug-ins you need:

  • JDK 1.5 or above
  • a version of Eclipse 3.6 or above with the following set of plug-ins installed
  • EMF 2.5.0 or higher

Source Repository

All of the source code is stored in a public source repository, which you can access at:

https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition/

https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.discoverer/

Source code repository for Java Source Code Synchronization Strategy : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.java.composition.ui/

Back to the top