Callisto MDA Implementation
Download
Report
Transcript Callisto MDA Implementation
MDA and QVT in Together Architect 2006
Pavel Kobiakov, Borland Software Corporation
06 December 2005
MDA and QVT in Together Architect 2006
MDA Overview
MDA Implementation in Together 2006
Demo
Questions
2
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
MDA Overview
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)
4
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
MDA applications
Transformations
Model to model (PIM->PSM, PSM->PSM)
Model to text (PSM->code)
Traceability
PIM
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
5
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
PSM
PSM
PSM
Code
Code
Code
Query/View/Transformation
(QVT) language
Language for defining transformations
Spec. has both declarative and imperative parts
Heavily based on OCL
6
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
MDA Implementation in Together
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
8
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
9
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
MDA Implementation: QVT features
QVT specification ad/05-03-02 (draft)
Imperative mappings and queries
Metamodel import
Transformation import
Traceability
Support for native (java) code
10
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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()]);
}
11
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
MDA in Together: QVT editor
12
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
13
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
Demo
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
15
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
16
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
17
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
18
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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.
19
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
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
20
| Copyright © 2005 Borland Software Corporation. All rights reserved. |
22 July 2015
Questions