generating jmi model transformation code from uml profile ...€¦ · sdm gt specifications sdm gt...

24
Generating JMI model transformation code from UML profile models for SDM Aligning Graph Rewriting with MDA-light Pieter Van Gorp Hans Schippers Formal Techniques in Software Engineering {Pieter. VanGorp ,Hans. Schippers }@ua.ac.be Segravis School on Foundations of Visual Modelling Techniques, May 2004, Schloss Dagstuhl

Upload: others

Post on 01-Jul-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

GeneratingJMI model transformation code

from UML profile models for SDMAligning Graph Rewriting with MDA-light

Pieter Van GorpHans SchippersFormal Techniques in Software Engineering{Pieter.VanGorp,Hans.Schippers}@ua.ac.be

Segravis School on Foundations of Visual Modelling Techniques, May 2004, Schloss Dagstuhl

Page 2: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

2/24

Overview

1. Demo 1:– Fujaba Refactoring Cycle– Refactoring Implementation¸ Pull Up Method

2. Problem: Tool Lock-In3. Solution: (Reflective) MDA Light4. Demo 2:

– Integrated Tool Context– Pull Up Method Refactoring¸ Pull Up Method

Page 3: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

3/24

Fujaba Refactoring Cycle

Import Java Sources (by directory)

Rearrange diagrams

Execute Refactoring

New SourcesOld Sources

regenerate

parse1

2

3

4

Page 4: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

4/24

Refactoring: Structural Design

Fujaba’s Metamodel Example Refactoring Classes

Page 5: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

5/24

Refactoring Behavior: SDM

1. Bind method > (Hidden) Cast target

2. Bind container > Link Navigation

3. Bind stub > Link Navigation

4. Bind superclass > Link Navigation

5. Remove method from container

6. Add method to superclass

Model Transformation as Graph Transformation

Page 6: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

6/24

Constraint Checking: SDM

[ failure]

[p1.getIndex()]

Page 7: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

7/24

Overview

1. Demo 1:– Fujaba Refactoring Cycle– Refactoring Implementation¸ Pull Up Method

2. Problem: Tool Lock-In3. Solution: (Reflective) MDA Light4. Demo 2:

– Integrated Tool Context– Pull Up Method Refactoring¸ Pull Up Method

Page 8: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

8/24

1. SDM could only be drawn in Fujabaß Industry Requires Commercial Support

2. Fujaba code generator assumes target repositorycomplies to Fujaba API.ß XMI + JMI + EMF + … desirable

Problem: Vendor Lock-In

Page 9: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

9/24

1. SDM could only be drawn in Fujabaß Solution: UML Profile for SDM

2. Fujaba code generator assumes target repositorycomplies to Fujaba API.ß Solution: Pluggable Code Templates

Solution: Reflective MDA Light

Bézivin, J., Farcet, N., Jézéquel, J.-M., Langlois, B., Pollet, D. Reflective Model Driven Engineering. UML 2003, October, 2003

Page 10: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

10/24

Reflective Architecture

Page 11: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

11/24

Reflective Architecture (cont.)

Page 12: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

12/24

Example “Fujaba vs JMI Specific Code”

JMI:// delete linkmethod.setOwner(null)// create linkmethod.setOwner(superclass);

Page 13: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

13/24

Overview

1. Demo 1:– Fujaba Refactoring Cycle– Refactoring Implementation¸ Pull Up Method

2. Problem: Tool Lock-In3. Solution: (Reflective) MDA Light4. Demo 2:

– Integrated Tool Context– Pull Up Method Refactoring¸ Pull Up Method

Page 14: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

14/24

Integrated Tool Context

Poseidon (or …):Transformation Specifications

SDM as UML 1.4 Profile

MM as Class Diagram

XMI

NetBeans MDR

Poseidon embedded MDR“Application” Models

JMI Manipulation + Poseidon Plugin Code

Page 15: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

15/24

MM Class Diagram in PoseidonMetamodel Class Diagram

Page 16: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

16/24

Transformation Component

SDM GT Specifications

SDM GT Specifications

SDM GT Specifications

Stereotypes as flags

Page 17: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

17/24

High Level SDM Control Flow

Page 18: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

18/24

Code Activity(demo purpose only)

Page 19: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

19/24

Loop Activity(again with stereotype)

Use tagged value as reference

Page 20: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

20/24

Path NavigationCreate Links

Remove Links

Page 21: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

21/24

Attribute Assignments(demo purpose only)

Page 22: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

22/24

Compiler Resultsÿ JMI Repository

Manipulation Code– View Updating through

small “hack”…

ÿ Poseidon Plugin– Extra menu item for

launching transformation

Page 23: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

23/24

Conclusions (1/2)1. Now transformation writers can…ß Create visual model transformations in Magicdraw, Together,

Objecteering, Poseidon, …ß Execute them on JMI repositories (opt: CASE tool plugins)

2. Now, Fujaba can…ß be migrated to MDR

3. Now, other CASE tool vendors can…ß Provide a plugin for enhanced visualization (cfr. nesting)

Page 24: Generating JMI model transformation code from UML profile ...€¦ · SDM GT Specifications SDM GT Specifications SDM GT Specifications Stereotypes as flags. 17/24 High Level SDM

24/24

Conclusions (2/2)ÿ Lessons Learned

– MDA Light¸ UML Profiles: adequate if MM close to UML¸ Code Templates: reuse problems

– Graph Rewriting¸Convenient for specifying Refactorings

ÿ Future Work– EMF support… if necessary, solve reuse problems with stepwise refinement– Model Refinement & Weaving Case Studies– Compare to (and align with) ATL

Publications– Pieter Van Gorp, Niels Van Eetvelde, and Dirk Janssens. Implementing Refactorings as Graph Rewrite Rules on a

Platform Independent Metamode. In Proceedings of the 1st International Fujaba Days. University of Kassel,Germany October 13-14, 2003.

– Hans Schippers. JMI Conforme Model Transformator Generator (JCMTG). Master Thesis, University of Antwerp,2004. Upcoming Paper...