ocl integration and code generation
TRANSCRIPT
OCL Integration and Code Generation
EclipseCon Europe, Ludwigsburg29th October 2013
Edward Willink
(Eclipse MMT co-lead)Eclipse OCL leadEclipse QVTd leadEclipse QVTo committerOMG OCL 2.4 RTF chairOMG QVT 1.2 RTF chairOMG UML 2.5 FTF rep
Overview
OCL overview
OCL in Ecorecode generation
OCL in Xtext
OCL in UML
OCL in Papyrus
OCL in QVTcode generation
Summary
OCL Overview
Executable specification languageused for the hard bits of UML, ...
simple model opsif self null then self.name else 'no-self' endif
powerful collection operationsself.children->isUnique(name)
Side effect freecontributes to strong analysis and optimisation
Uselessneeds a model providing environment
Out Of The Box EMF Code Generation
OCLinEcore editor for OCL Delegates
OCL Delegates EMF Code Generation
OCL to Java GenModel Options
OCL to Java EMF Code Generation
OCL to Java Dispatch Tables
EMF XXXPackageImplhierarchy of EClass objectsmulti-dimensional searches for types/parameters
OCL to Java XXXTablesflat tablesconstant time lookups
Xtext Integration
Xtext Integration - OCL Document
Xtext Integration - OCL Loading
Wherever selection is convertible to EObjectEObject ==> ResourceSetSample Ecore Editor
Outlines
Xtext editors (including Xtext)
UML editors
load additional Complete OCL ResourceResourceSet-specific EValidator.Registry add-on
Xtext Integration - OCL Helpers
Auto-Content Assist
Comments from declaration
Xtext Integration - OCL Invariants
Invariants support debug/style rules
Extra operations to aid navigation
UML Integration
Papyrus Integration
UML+OCL to Java
Helios, Indigo, JunoOCL in UML exported with obsolete namespace
Keplernamespace fixed (invariants, operations)OCL delegates or OCL to Java code generator
properties in progress
Papyrusquite tricky to get right
needs a UI Wizard
OCL to Java 'for everything'
CurrentlyAbstract Syntax validation rules
QVT declaration code generation
Work In ProgressUML 2.5 embedded OCLavoid need to retranscibe manually
Name lookups
Concrete Syntax to Abstract Syntax mappings
FutureOCL-defined code can be incremental
QVTi Preliminary Performance
20x
Summary
OCL useless by itself
Increasingly useful with IDEmodel tools (Xtext), UML, Papyrus
Increasingly acceptable with Code Generation? QVTi is the first Eclipse MtoM CG
Made available under EPL 1.0