Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MoDisco/Components/KDM/Documentation/0.9"

Line 2: Line 2:
  
 
== EMF Implementation ==
 
== EMF Implementation ==
This component provides a ECore definition of KDM and a EMF implementation of the classes defined by this standard.
+
This component provides an Ecore definition of KDM and an EMF implementation of the classes defined by this standard.
  
 
== KDM Source Discoverer ==
 
== KDM Source Discoverer ==
Line 10: Line 10:
 
=== Details ===
 
=== Details ===
  
This plug-in aims at analyzing the file system hierarchy of an application and providing a model describing the information found, conforming to the KDM Source sub package. (see next Figure)
+
This plug-in aims at analyzing the file system hierarchy of an application and providing a model describing the information found, conforming to the KDM Source sub package:
  
 
[[Image:MoDisco-Kdm Source metamodel.png|frame|center|KDM Source Metamodel (from the KDM Specification v 1.1)]]
 
[[Image:MoDisco-Kdm Source metamodel.png|frame|center|KDM Source Metamodel (from the KDM Specification v 1.1)]]
Line 19: Line 19:
 
[[Image:MoDisco_KDMSourceDiscoverer_Overview.jpg|frame|center|Overview of the KDM Source Discoverer]]
 
[[Image:MoDisco_KDMSourceDiscoverer_Overview.jpg|frame|center|Overview of the KDM Source Discoverer]]
  
For an input folder, the KDM source discoverer visits each folder and file. For each file, it creates the appropriate sub-class of InventoryItem using the [[Resources|Resources]] content type API. This plugin defines its own content types to properly classify file types.
+
For an input folder, the KDM source discoverer visits each folder and file. For each file, it creates the appropriate sub-class of InventoryItem using the [[Resources]] content type API. This plugin defines its own content types to properly classify file types.
  
 
=== User manual ===
 
=== User manual ===
  
The plug-in provides the user with a contextual menu to easily create models.
+
Right-click on a project in the Eclipse '''Package Explorer''' view and choose '''Discovery > Discoverers > Discover KDM Source...''' to create the KDM Source model of your application:
  
By right-clicking on a container (folder or project) in the Eclipse Package Explorer view, you can quickly create the KDM Source model of your application (see next Figure). Each of these models can then be used with any other tool compliant with the corresponding metamodel.
+
[[Image:MoDisco_KDM_Discoverer_menu.png|frame|center|Menu in Eclipse to create a KDM Source model from a Java project]]
  
[[Image:MoDisco-Kdm Source popup menu.png|frame|center|Menus in Eclipse to create KDM Source model]]
+
A discovery parameters dialog opens to let you specify the parameters of the discovery:
  
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 might take some time to complete (see next Figure).
+
[[Image:MoDisco_Launching_discovery_org.eclipse.modisco.kdm.source.discoverer.javaElement.png|frame|center|KDM discoverer parameters dialog]]
+
[[Image:MoDisco-JavaDiscoverer progress bar.jpg|frame|center|Progress bar during models creation]]
+
  
At the end of the process, the newly created model file is added at the root of your project and is automatically opened in the default editor (see next Figure).
+
* Set '''SERIALIZE_TARGET''' to true if you want to save the model to a file
 +
* You can define '''TARGET_URI''' to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.<br>'''Beware: the file will be overwritten if it already exists!'''
  
[[Image:MoDisco-Kdm Source model.png|frame|center|KDM Source model in the package explorer]]
+
Once launched, a progress dialog will appear as soon as the operation begins:
  
It can be opened in the MoDisco model browser (see next Figure) which brings some graphical improvements.
+
[[Image:MoDisco_discoverer_org.eclipse.modisco.kdm.source.discoverer.javaElement_in_progress.png|frame|center|Progress dialog during model creation]]
  
[[Image:MoDisco-Kdm Source model in MoDisco browser.png|frame|center|KDM Source model viewed with MoDisco browser]]
+
At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true, and the model is opened in the default model browser if you selected '''Open model in editor after discovery''':
  
=== Requirements ===
+
[[Image:MoDisco_KDMSource_DiscoveredModel_inModelBrowser.png|frame|center|KDM Source model in the MoDisco model browser]]
  
To use the plug-in you need:
+
The KDM XMI files (with a filename ending in "_kdm.xmi" by convention) can be opened in any model browser:
* JDK 1.5 or above
+
* a version of Eclipse 3.3 or above with the following set of plugins installed
+
** [[EMF|EMF]] 2.3.0 or higher
+
** [[MoDisco/Components/KDM|KDM metamodel]]
+
  
=== Source Repository ===
+
[[Image:MoDisco_KDMSource_OpenWith.png|frame|center|Opening a KDM Source model]]
  
All of the source code is stored in a public source repository, which you can access at:
+
=== Discoverer API  ===
 +
 
 +
Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.modisco.infra.discovery.core.IDiscoverer<T>).
 +
 
 +
First, add the following plug-in dependencies to your project ('''Require-Bundle''' in your Manifest.MF):
 +
* org.eclipse.gmt.modisco.omg.kdm
 +
* org.eclipse.modisco.kdm.source.discoverer
 +
* org.eclipse.modisco.infra.discovery.core
  
[https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.gmt.modisco.kdm.source.discoverer/ https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.gmt.modisco.kdm.source.discoverer/]
+
You can easily discover a KDM model from a project programmatically:
 +
<source lang="java">
 +
DiscoverSourceModelFromJavaElement discoverer = new DiscoverSourceModelFromJavaElement();
 +
discoverer.discoverElement(javaProject, monitor);
 +
Resource kdmModel = discoverer.getTargetModel();
 +
</source>
  
You can also browse it [http://dev.eclipse.org/viewsvn/index.cgi/plugins/trunk/org.eclipse.gmt.modisco.kdm.source.discoverer/?root=Modeling_MODISCO through the Web interface].
+
To have a monitor to pass to the <code>discoverElement</code> method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting.
  
 
== KDM to UML Converter ==
 
== KDM to UML Converter ==
Line 67: Line 74:
 
[[Image:MoDisco-KDM Kdm to Uml converter overview.jpg|frame|center|Overall approach of the KDM to UML converter]]
 
[[Image:MoDisco-KDM Kdm to Uml converter overview.jpg|frame|center|Overall approach of the KDM to UML converter]]
  
The converter is mainly implemented by an [[ATL|ATL model-to-model transformation]] taking as input a model conforming to the KDM meta model and producing as output a model conforming to the [[MoDisco/Components/KDM|KDM models]] into [http://www.uml.org/ UML meta model].  
+
The converter is mainly implemented by an [[ATL|ATL model-to-model transformation]] taking as input a model conforming to the KDM meta model and producing as output a model conforming to the [http://www.uml.org/ UML meta model].
  
 
The mapping between [[MoDisco/Components/KDM|KDM]] and [[MDT/UML2|UML]] is described in the following table:
 
The mapping between [[MoDisco/Components/KDM|KDM]] and [[MDT/UML2|UML]] is described in the following table:
Line 107: Line 114:
 
=== User manual ===
 
=== User manual ===
  
The plug-in also provides the user with a contextual menu in order to create models easily. By right-clicking on a [[MoDisco/Components/KDM|KDM model]] in the Eclipse Package Explorer view you can generate the [[MDT/UML2|UML model]], with or without traces (see next figure).
+
Right-click on a KDM model file (ending in "_kdm.xmi") and choose '''Discovery > Discoverers > Discover UML model from KDM model...''' to create the UML model from the KDM model:
  
[[Image:MoDisco-KDM converter popup menu.jpg|frame|center|Generating a UML model from a KDM model]]
+
[[Image:MoDisco_KDMToUML_menu.png|frame|center|Menu in Eclipse to create a UML model from a KDM model]]
  
From a KDM source model:
+
A discovery parameters dialog opens to let you specify the parameters of the discovery:
  
[[Image:MoDisco-KDM Kdm source model.jpg|frame|center|KDM model]]
+
[[Image:MoDisco_Launching_discovery_org.eclipse.modisco.kdm.uml2converter.discoverUmlModelFromKdmModel.png|frame|center|Discoverer parameters dialog]]
  
We obtain a UML target model :
+
* Set '''SERIALIZE_TARGET''' to true if you want to save the model to a file
 +
* You can define '''TARGET_URI''' to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.<br>'''Beware: the file will be overwritten if it already exists!'''
 +
* You can set a '''CUSTOM_TRANSFORMATION''', by providing the location of an ATL ".asm" file (compiled ATL transformation) that replaces the default transformation
  
[[Image:MoDisco-KDM Uml target model.jpg|frame|center|UML model]]
+
Once launched, a progress dialog will appear as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete:
 +
 
 +
[[Image:MoDisco_discoverer_org.eclipse.modisco.kdm.uml2converter.discoverUmlModelFromKdmModel_in_progress.png|frame|center|Progress dialog during model creation]]
 +
 
 +
At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true:
 +
 
 +
[[Image:MoDisco_KDMtoUML_File_inPackageExplorer.png|frame|center|UML model in the Package Explorer]]
 +
 
 +
And the model is opened in the default model browser if you selected '''Open model in editor after discovery''':
 +
 
 +
[[Image:MoDisco_KDMtoUML_model_inModelBrowser.png|frame|center|UML model in MoDisco model browser]]
  
 
This UML model can be displayed in any modeler:
 
This UML model can be displayed in any modeler:
Line 129: Line 148:
 
=== 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 responds to a normalized interface and can be called programmatically (see org.eclipse.modisco.infra.discovery.core.IDiscoverer<T>).
  
As an example, you may checkout the code from org.eclipse.gmt.modisco.kdm.uml2converter.tests project.
+
First, add the following plug-in dependencies to your project ('''Require-Bundle''' in your Manifest.MF):
 +
* org.eclipse.uml2.uml
 +
* org.eclipse.modisco.kdm.uml2converter
 +
* org.eclipse.modisco.infra.discovery.core
  
=== Requirements ===
+
You can easily discover a UML model from the KDM model programmatically:
 +
<source lang="java">
 +
DiscoverUmlModelFromKdmModel discoverer = new DiscoverUmlModelFromKdmModel();
 +
discoverer.discoverElement(kdmModelFile, monitor);
 +
Resource umlModel = discoverer.getTargetModel();
 +
</source>
  
To use the plug-in you need:
+
To have a monitor to pass to the <code>discoverElement</code> method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting.
* JDK 1.5 or above
+
* a version of Eclipse 3.3 or above with the following set of plug-ins installed
+
** [[EMF|EMF 2.3.0 or higher]]
+
** [[ATL|ATL 2.0.0 or higher]]
+
** [[MDT/UML2|UML 2.1.0 or higher]]
+
** [[MoDisco/Components/KDM|KDM 1.0.0 or higher]]
+
  
=== Install ===
+
As an example, you may checkout the code from project org.eclipse.modisco.kdm.uml2converter.tests.
  
==== Runtime  ====
+
== Installation ==
 
The components can be [[MoDisco/Installation|installed]] from the MoDisco update site.
 
The components can be [[MoDisco/Installation|installed]] from the MoDisco update site.
  
==== Sources ====
+
== Source Repository  ==
You will find a version of this plug-in in:
+
* https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.gmt.modisco.kdm.uml2converter
+
 
+
Here are installation instructions :
+
 
+
* Import the project in your workspace using a SVN client.
+
* Use the "export" menu to export this project as a plug-in (Deployable plug-ins and fragments) in your Eclipse installation. Don't forget to choose the "Package plug-ins as individual jar archives" option.
+
* Re-start your Eclipse to take this plug-in into account.
+
  
[[MoDisco/SVN|(connection parameters to the SVN repository)]].
+
All the source code is stored in the Eclipse public source repository:
  
 +
* KDM metamodel : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.gmt.modisco.omg.kdm
 +
* KDM Source discoverer : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.kdm.source.discoverer/
 +
* KDM to UML discoverer : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.kdm.uml2converter
  
 
{{MoDisco}}
 
{{MoDisco}}
 
[[Category:MoDisco]]
 
[[Category:MoDisco]]

Revision as of 08:44, 30 March 2011

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

EMF Implementation

This component provides an Ecore definition of KDM and an EMF implementation of the classes defined by this standard.

KDM Source Discoverer

The goal of the KDM Source Discoverer plug-in is to allow practical extractions of KDM Source models from the file hierarchy of an application.

Details

This plug-in aims at analyzing the file system hierarchy of an application and providing a model describing the information found, conforming to the KDM Source sub package:

KDM Source Metamodel (from the KDM Specification v 1.1)

The Source package defines a set of meta-model elements whose purpose is to represent the physical artifacts of the existing system, such as source files, images, configuration files, resource descriptions, etc.

Overview of the KDM Source Discoverer

For an input folder, the KDM source discoverer visits each folder and file. For each file, it creates the appropriate sub-class of InventoryItem using the Resources content type API. This plugin defines its own content types to properly classify file types.

User manual

Right-click on a project in the Eclipse Package Explorer view and choose Discovery > Discoverers > Discover KDM Source... to create the KDM Source model of your application:

Menu in Eclipse to create a KDM Source model from a Java project

A discovery parameters dialog opens to let you specify the parameters of the discovery:

KDM discoverer parameters dialog
  • Set SERIALIZE_TARGET to true if you want to save the model to a file
  • You can define TARGET_URI to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.
    Beware: the file will be overwritten if it already exists!

Once launched, a progress dialog will appear as soon as the operation begins:

Progress dialog during model creation

At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true, and the model is opened in the default model browser if you selected Open model in editor after discovery:

KDM Source model in the MoDisco model browser

The KDM XMI files (with a filename ending in "_kdm.xmi" by convention) can be opened in any model browser:

Opening a KDM Source model

Discoverer API

Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.modisco.infra.discovery.core.IDiscoverer<T>).

First, add the following plug-in dependencies to your project (Require-Bundle in your Manifest.MF):

  • org.eclipse.gmt.modisco.omg.kdm
  • org.eclipse.modisco.kdm.source.discoverer
  • org.eclipse.modisco.infra.discovery.core

You can easily discover a KDM model from a project programmatically:

DiscoverSourceModelFromJavaElement discoverer = new DiscoverSourceModelFromJavaElement();
discoverer.discoverElement(javaProject, monitor);
Resource kdmModel = discoverer.getTargetModel();

To have a monitor to pass to the discoverElement method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting.

KDM to UML Converter

The goal of the KDM to UML converter plug-in is to allow practical transformations of KDM models to UML models.

Description

This tool aims at converting KDM models into UML models in order to allow integrating KDM-compliant tools (i.e. discoverers) with UML-compliant tools (e.g. modelers, model transformation tools, code generators, etc), as shown in the next figure.

Overall approach of the KDM to UML converter

The converter is mainly implemented by an ATL model-to-model transformation taking as input a model conforming to the KDM meta model and producing as output a model conforming to the UML meta model.

The mapping between KDM and UML is described in the following table:

KDM to UML mapping
KDM UML
LanguageUnit Package
CodeModel Model
CodeAssembly Model
Package Package
ClassUnit Class
InterfaceUnit Interface
MethodUnit Operation
ParameterUnit Parameter
Extends, Implements Generalization
PrimitiveType PrimitiveType
MemberUnit Property, Association


This mapping can be changed or completed easily by updating the ATL rules.

The converter can also generate a trace file of the transformation to UML and a transformation log.

User manual

Right-click on a KDM model file (ending in "_kdm.xmi") and choose Discovery > Discoverers > Discover UML model from KDM model... to create the UML model from the KDM model:

Menu in Eclipse to create a UML model from a KDM model

A discovery parameters dialog opens to let you specify the parameters of the discovery:

Discoverer parameters dialog
  • Set SERIALIZE_TARGET to true if you want to save the model to a file
  • You can define TARGET_URI to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.
    Beware: the file will be overwritten if it already exists!
  • You can set a CUSTOM_TRANSFORMATION, by providing the location of an ATL ".asm" file (compiled ATL transformation) that replaces the default transformation

Once launched, a progress dialog will appear as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete:

Progress dialog during model creation

At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true:

UML model in the Package Explorer

And the model is opened in the default model browser if you selected Open model in editor after discovery:

UML model in MoDisco model browser

This UML model can be displayed in any modeler:

UML diagram

Current Limitations

The bidirectional UML Association elements are not identified by the rules: two complementary unidirectional UML Association elements are generated.

Discoverer API

Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.modisco.infra.discovery.core.IDiscoverer<T>).

First, add the following plug-in dependencies to your project (Require-Bundle in your Manifest.MF):

  • org.eclipse.uml2.uml
  • org.eclipse.modisco.kdm.uml2converter
  • org.eclipse.modisco.infra.discovery.core

You can easily discover a UML model from the KDM model programmatically:

DiscoverUmlModelFromKdmModel discoverer = new DiscoverUmlModelFromKdmModel();
discoverer.discoverElement(kdmModelFile, monitor);
Resource umlModel = discoverer.getTargetModel();

To have a monitor to pass to the discoverElement method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting.

As an example, you may checkout the code from project org.eclipse.modisco.kdm.uml2converter.tests.

Installation

The components can be installed from the MoDisco update site.

Source Repository

All the source code is stored in the Eclipse public source repository:


MoDisco
Components Infrastructure: KDM · SMM · GASTM · Model Browser · Discovery Manager · MoDisco Workflow · Query Manager · Facet Manager · Metrics Visualization Builder · KDM Source Extension
Technologies: Java · JEE · EjbJar · WebApp · XML
Use Cases: Simple Transformation Chain · Model Filter
Help Installation · SVN
Project API Policy · Retention Policy · Project Plan · metrics · Accessibility Guidelines · Capabilities Disablement

Back to the top