PervML Generative Tool

The PervML Generative Tool (PervGT) supports the model driven method proposed for the development of pervasive services in ubiquitous environments. The tool, which is based on the Eclipse platform, allows pervasive systems developers the creation of graphical diagrams and the automatic translation of these diagrams into the final implementation code using a transformation engine. For that, PervGT provides to the developers support to the Model Management, the Graphical Model Edition and the Code Generation. Next, every one is briefly described.

 

  • Model Management: The PervGT tool provides support to the creation and edition of PervML model instances. This metamodel has been implemented as an Ecore model. Thus, from the PervML Ecore model the plug-in EMF generates a set of Java classes representing each one of the PervML metamodel concepts. Moreover, the generated Java classes provide methods to modify PervML models according to the PervML metamodel.

    To save/store the PervML model instances PervGT makes use of the EMF runtime persistency capabilities. The model persistency is achieved according to XMI 2.0. XMI is the OMG standard for interchanging models.

 

  • Graphical Model Edition: The PervML language proposes different models for each one of the parts of the pervasive system that is going to be specified. According to this, the PervGT tool provides a graphical editor for each one of the different models that are proposed in the PervML. For instance, the below figure shows the Structural Model Editor.

    These
    graphical editors has been developed using the GMF Eclipse plug-in. The GMF plug-in provides an editor to specify in a declarative way graphical editors, and also provides a runtime where common functionality related to graphical editors is already implemented, like model printing or automatic layout algorithms.

 

 

 

Furthermore, in PervGT there are defined some constraints to guarantee the correction of the model edition. All constraints of the diagrams are defined in the GMF plug-in using OCL expressions. An example of constrain could be the following:

 

 
 
(Defined over the metaelement Service)
 
Not(Self.Name.equals(‘PervMLService’))
 

 

 

Besides, in order to build a complete PervML model, the graphical diagrams must be completed with a textual specification. PervML uses the UML Action Semantics Language (ASL) in order to specify part of the system behaviour. The tool provides an editor of textual models where users define ASL expressions. This editor of textual models has been developed using the Xtext framework from the openArchitectureWare (oAW) plug-in. oAW is a generator framework that provides facilities to create text editors, checks constraints and has strong support of EMF.

 

  • Code generation: Once the pervasive system is modelled, the transformation engine can be applied to generate the code. Models are used as input to a transformation engine which produces as output source code the pervasive system code. For this task, we have used the MOFScript language which provides capabilities navigating models, creating files, etc.

    MOFScript takes as input one model (or several) and applies over this the rules that generate the output code. Thus, we have implemented a set of rules that translates the PervML model into Java code, which extends an OSGi-based framework in order to build the final pervasive applications. Below, a Mofscript rule is shown, this rule is in charge to reach all the Component instances in order to generate its code (using other Mofscript rule).


 

 

pervml.PervMLModel::main() {

...

if ( generateComponents == true ){

self.StructuralModel.Component

->forEach(c:pervml.Component){

c.generateFromComponent()

}

}

...

}

 

 


 

Publications

A more detailed description of PervGT can be found in:

Tool Support for Model Driven Development of Pervasive Systems. Carlos Cetina, Estefanía Serral, Javier Muñoz, Vicente Pelechano. MOMPES 2007, Braga, (Portugal). pp. 33-41, ISBN:0-7695-2769-8

 paperpaper       slidesslides

 

Carlos Cetina senior thesis:  "Diseno y Desarrollo de una Herramienta CASE para la Generacion Automatica de Codigo para Sistemas Pervasivos".

documentdocument     slidesslides