}}
This component provides an Ecore definition of KDM and an EMF implementation of the classes defined by this standard.
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.
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:
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.
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.
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:
A discovery parameters dialog opens to let you specify the parameters of the discovery:
Once launched, a progress dialog will appear as soon as the operation begins:
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:
The KDM XMI files (with a filename ending in "_kdm.xmi" by convention) can be opened in any model browser:
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):
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>
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.
The goal of the KDM to UML converter plug-in is to allow practical transformations of KDM models to UML models.
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.
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.
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:
A discovery parameters dialog opens to let you specify the parameters of the discovery:
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:
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:
This UML model can be displayed in any modeler (you can use Papyrus for example). For most modelers, you would usually create a UML class diagram and then drag and drop model elements to the diagram.
The bidirectional UML Association elements are not identified by the rules: two complementary unidirectional UML Association elements are generated.
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):
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 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.
See the KDM Code discoverer from the Java component.
The components can be installed from the MoDisco update site.
All the source code is stored in the Eclipse public source repository:
This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit http://wiki.eclipse.org/MoDisco/Components/KDM/Documentation/0.9