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

MoDisco/Components/KDMSourceExtension/Documentation/0.9

< MoDisco‎ | Components‎ | KDMSourceExtension
Revision as of 06:40, 17 August 2010 by Fabien.giquel.soprasteria.com (Talk | contribs) (How to develop a discoverer for the composition metamodel)

DEPRECATED use Template:MoDiscoTabs and Template:MoDiscoTab as explain here : Wiki Template for MoDisco

KDM.Source extension : a metamodel for weaving Code models and KDM Inventory models

The component proposes a small framework for building weaving information between code models (Java, C++, ...) and physical resources (disk files and directories).

This framework reuses the KDM "Source" subpackage, which proposes a model for physical resources, known as "Inventory Model" (see figure [here])

KDM inventory model also proposes SourceRegion/SourceRef concepts for weaving other kdm models (kdm code models, ...) with physical representation. Some references exist from other KDM subpackages to the SourceRef concept.

KDM Source Metamodel (from the KDM Specification v 1.1)

MoDisco proposes to compose KDM inventory models with non-KDM models. For technical reasons (generic reuse), a new metamodel extending KDM Source has been created.

A subpart of KDM Source model is extended for linking the SourceRegion concept with non-KDM elements, via the ASTNodeSourceRegion metaclass.

Moreover a recurrent pattern, in such a model composition, is to link KDM SourceFile with a code model element. Such a link is represented with CodeUnit2File metaclass.

MoDisco KDM Source extension Metamodel

How to create a composition metamodel between Code models and KDM Inventory models

Given a particular code metamodel (Such as the Java one), MoDisco proposes to extend KDMSourceExtension to define a metamodel composition between inventory models and code models.

The ASTNodeSourceRegion should be subclassed, and a reference to one concrete code metaclass should "specialize" the ASTNodeSourceRegion->node:EObject reference (one simple way is to set the new reference as derivated from the generic one).

In most cases the CodeUnit2File will be subclassed.

A reference example of such a composition metamodel is the Java Application example.

How to develop a discoverer for the composition metamodel

A discoverer will instantiate elements for the composition metamodel described before. Such a discoverer will have to manipulate the both kdm.source and code models.

A kdm.source model can be discovered using the [KDM Source discoverer]. Note that such a discoverer only provides a representation of files/directories. It does not instantiate SourceRegions subclasses.

A discoverer for the related code model is a prerequisite. The [Java Discoverer] is an example. Such a discoverer is not supposed to instantiate SourceRegions subclasses. To avoid ambiguity, we will talk about it as a "leaf code discoverer".

Instrumenting the leaf code discoverers for retrieving visited source regions

Instantiate source region nodes

Resources Distribution and memory usage

Copyright © Eclipse Foundation, Inc. All Rights Reserved.