mda and qvt in together architect 2006 pavel kobiakov, borland software corporation 06 december...

21
MDA and QVT in Together Architect 2006 Pavel Kobiakov, Borland Software Corporation 06 December 2005

Post on 19-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

MDA and QVT in Together Architect 2006Pavel Kobiakov, Borland Software Corporation

06 December 2005

2 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA and QVT in Together Architect 2006

MDA Overview

MDA Implementation in Together 2006

Demo

Questions

MDA Overview

4 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA Overview

MDA stands for “Model Driven Architecture”Set of OMG standards:

Meta-Object Facility (MOF) Unified Modeling Language (UML), UML Profiles XML Metadata Interchange (XMI) Query/View/Transformation RFP (QVT) MOF Model to Text Transformation Language RFP

Models Computation independent model (CIM) Platform independent model (PIM) Platform specific model (PSM)

5 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA applications

Transformations Model to model (PIM->PSM, PSM->PSM) Model to text (PSM->code) Traceability

Sample application PIM (UML) -> DB PSM (UML+Profile) -> SQL PIM (UML) -> .NET PSM (Custom model) -> HTML/C#

code PIM (UML) -> J2EE PSM (Custom model) -> HTML/Java

code

Not 100% automated, customizations might be required Changing generated models/code, continuous application Generating parts of the system

PIM

PSM

Code

PSMPSM

CodeCode

6 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Query/View/Transformation (QVT) language

Language for defining transformations Spec. has both declarative and imperative parts Heavily based on OCL

MDA Implementation in Together

8 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA in Together 2006

Together 2006 is based on Eclipse platform EMF (Eclipse Modeling Framework) instead of MOF PIMs: Together UML projects, EMF models PSMs: Together UML projects, EMF models Together models available via EMF-compliant APIs

Transformations: Operational QVT for model to model transformations Java (via EMF API) for model to model transformations Java (with JET) for model to text transformations

9 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA in Together: Transformations

Model to model QVT

Editor with highlighting, code sense, etc. Concise syntax (OCL) Eclipse QVT debugger Automated traceability

Java Standard Java editor Verbose syntax Standard Eclipse Java debugger Manual traceability

Model to text Java, Java Emitter Templates (JET)

Transformation framework integration Apply transformations being developed Deploy transformation as Eclipse plugins Run deployed transformations directly or as Eclipse builders

10 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA Implementation: QVT features

QVT specification ad/05-03-02 (draft)Imperative mappings and queriesMetamodel importTransformation importTraceabilitySupport for native (java) code

11 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

QVT (OCL) vs Java example: getBaseClasses()

-- QVTquery getBaseClasses(pack: ecore::EPackage): Bag(ecore::EClass) { pack.eClassifiers.oclAsType(ecore::EClass)->select(c | c.eSuperTypes->isEmpty())}

// Javapublic static EClass[] getBaseClasses(EPackage pack) { List baseClasses = new ArrayList(); for (Iterator it = pack.getEClassifiers().iterator(); it.hasNext(); ) { EClassifier classifier = (EClassifier) it.next(); if (classifier instanceof EClass == false) { continue; }

EClass klass = (EClass) classifier; if (klass.getESuperTypes().isEmpty()) { baseClasses.add(klass); } }

return (EClass[]) baseClasses.toArray(new EClass[baseClasses.size()]);}

12 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA in Together: QVT editor

13 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

MDA in Together: Related Functionality

EMF APIs for Together Projects UML 1.4 UML 2.0 Business processes (BPMN)

OCL 2.0 Model Search Model QA (audits and metrics) Documentation generation Code generation

Invariants, pre/post conditions, operations bodies

Demo

15 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Sample transformation: Uml2Ecore Demo

New MDA Transformation Project New QVT Transformation

Input/output metamodels

Transformation code Mappings and queries Method context Traceability – resolve*()

Apply Transformation Wizard, QVT Launch Configuration Examining transformation results

Trace View

Demo

16 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Debugging Uml2Ecore Transformation

Standard Eclipse debugger for QVT Stepping (Step Over/Step Into, Step Return, Run to Line) Line breakpoints Variables view Expressions view Demo

17 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Deploying Uml2Ecore transformation

MDA Transformation Project is an Eclipse plugin Project File/Export/Deployable plugins and fragments Apply Compiled Transformation Wizard QVT Transformation Builder Demo

18 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Creating “external” models

Use existing XSDs to generate EMF metamodels Generate EMF metamodel from XSD, deploy Write transformation against the new metamodel

Demo: create AbiWord document xsd from http://www.abisource.com/awml.xsd (needs minor

changes) Fix metamodel: AbiWordType persistence, Ns prefix, plugin.xml:

awml->abw Generate metamodel code, deploy Write QVT Create sample AbiWord document from a UML 2.0 model

19 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Transformation samples

Bundled samples UML 2.0 to XHTML UML 2.0 to XSD SimpleUML to RDB UML 2.0 to Ecore (via Together EMF API) Ecore to UML 2.0 RDB to DDL

Other areas Web Services, J2EE, etc.

20 April 18, 2023| Copyright © 2005 Borland Software Corporation. All rights reserved. |

Resources

OMG web site http://www.omg.org/mda/ EMF http://www.eclipse.org/emf/ OCL http://www.omg.org/cgi-bin/doc?ptc/03-10-14 QVT http://www.omg.org/cgi-bin/doc?ad/05-03-02 Together Architect 2006 (trial version)

http://www.borland.com/downloads/download_together.html Books:

MDA Explained: The Model Driven Architecture--Practice and Promise by Anneke Kleppe, et al

Model Driven Architecture: Applying MDA to Enterprise Computing by David S. Frankel (Paperback)

MDA Distilled (Addison-Wesley Object Technology Series) by Stephen J. Mellor, et al (Paperback)

The Object Constraint Language: Getting Your Models Ready for MDA, Second Edition by Jos Warmer, Anneke Kleppe

Questions