MDA and QVT in Together Architect 2006 Pavel Kobiakov, Borland Software Corporation 06 December 2005
22 June 2015| 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
42 June 2015| 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)
52 June 2015| 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 PSM Code
62 June 2015| 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
82 June 2015| 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
92 June 2015| 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
102 June 2015| Copyright © 2005 Borland Software Corporation. All rights reserved. | MDA Implementation: QVT features QVT specification ad/ (draft) Imperative mappings and queries Metamodel import Transformation import Traceability Support for native (java) code
112 June 2015| Copyright © 2005 Borland Software Corporation. All rights reserved. | QVT (OCL) vs Java example: getBaseClasses() -- QVT query getBaseClasses(pack: ecore::EPackage): Bag(ecore::EClass) { pack.eClassifiers.oclAsType(ecore::EClass)->select(c | c.eSuperTypes->isEmpty()) } // Java public 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()]); }
122 June 2015| Copyright © 2005 Borland Software Corporation. All rights reserved. | MDA in Together: QVT editor
132 June 2015| 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
152 June 2015| 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
162 June 2015| 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
172 June 2015| 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
182 June 2015| 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 (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
192 June 2015| 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.
202 June 2015| Copyright © 2005 Borland Software Corporation. All rights reserved. | Resources OMG web site EMF OCL QVT Together Architect 2006 (trial version) 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