Model-Driven Engineering An introduction to the EMF facilities

Similar documents
CISC836: Models in Software Development: Methods, Techniques and Tools

ADT: Eclipse development tools for ATL

Planned Review Date: June 10, 2009 Communication Channel: eclipse.tools.emf Dave Steinberg and Ed Merks

Acceleo Galileo Simultaneous Release

Christian Doppler Laboratory

Sequence Diagram Generation with Model Transformation Technology

Comparing graphical DSL editors

The Eclipse Modeling Framework and MDA Status and Opportunities

Kermeta tutorial. How to create an EMF meta model? François Tanguy, Didier Vojtisek, Zoé Drey, Marie Gouyette. Abstract

Introduction to Dependable Systems: Meta-modeling and modeldriven

ECLIPSE MODELING PROJECT

with openarchitectureware

Model-Driven Engineering (MDE) Lecture 2: Semantics. Regina Hebig, Thorsten Berger

Institutionen för datavetenskap

Language engineering and Domain Specific Languages

Model Driven Ontology: A New Methodology for Ontology Development

Static analysis and testing of executable DSL specification

Modellierung operationaler Aspekte von Systemarchitekturen. Master Thesis presentation. October 2005 March Mirko Bleyh - Medieninformatik

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

TOPCASED. Toolkit In OPen source for Critical Applications & SystEms Development

TogoDocClient Plug-ins development manual. TogoDocClient plug-ins development manual

(Meta)Models between MetaEdit+

Tutorial: Tools for mobile Linux (TmL) Exercises

Model handling with EMF

Teneo: Integrating EMF & EclipseLink

Technology Tutorial. - Details and Advanced Concepts - Patrick Könemann Software Engineering 2 (02162)

Kermeta tutorial. How to create a metamodel. François Tanguy, Didier Vojtisek. Abstract

MODEL-DRIVEN ENGINEERING FOR IMPLEMENTING THE ISO SERIES OF INTERNATIONAL STANDARDS

EMF Compare Galileo Simultaneous Release

Model-Driven Iterative Development of 3D Web-Applications Using SSIML, X3D and JavaScript

MDD with OMG Standards MOF, OCL, QVT & Graph Transformations

Introduction to OpenArchitectureWare

BLU AGE 2009 Edition Agile Model Transformation

Model driven Engineering & Model driven Architecture

Knowledge Discovery: How to Reverse-Engineer Legacy Systems

Eclipse Modeling Framework (EMF) Paweł Żalejko

UML PROFILING AND DSL


Model-based Software Engineering (02341, Spring 2017) Ekkart Kindler

Introduction to EGF. Benoît Langlois / Thales Global Services.

Tiger EMF Model Transformation Framework (EMT)

Better Metadata Management through Better Metamodels

SCA Tools: new & noteworthy

ATHABASCA UNIVERSITY RULE ENHANCED BUSINESS PROCESS MODELING OF SERVICE ORIENTED ARCHITECTURES LUIS ROCHA. A project submitted in partial fulfillment

A Metamodel independent approach for Conflict Detection to support distributed development in MDE. Mostafa Pordel A THESIS

An introduction to MOF MetaObject Facility.

A universal PNML Tool. Lukasz Zoglowek

A Comparison of Ecore and GOPPRR through an Information System Meta Modeling Approach

Model-Driven Language Engineering

EMFT 1.0 Release Review (OCL, Query, Transaction, and Validation)

Wikileaking Eclipse Modeling - Spilling the beans on how industry uses EMF based tooling successfully! Ronan Barrett, Ericsson

GMF Tooling 3.0 Vision, Architecture, Roadmap

The etrice Eclipse Project Proposal

challenges in domain-specific modeling raphaël mannadiar august 27, 2009

Model Driven Development Unified Modeling Language (UML)

Meta-Model Guided Error Correction for UML Models

Software Engineering 2 A practical course in software engineering. Ekkart Kindler

Model Driven Development with EMF and EclipseLink (experiences in MDD and generating user interfaces)

EMF Compare Ganymede Simultaneous Release

Introduction to MDE and Model Transformation

Advanced User Interface Programming Using the Eclipse Rich Client Platform

Coral: A Metamodel Kernel for Transformation Engines

OCL Tooling for OMG specifications

Dominique Blouin Etienne Borde

What is Metamodeling and Code Generation All About

UML 2.0 State Machines

EMF Europa Simultaneous Release

Advanced Topics in Software Engineering (02265) Ekkart Kindler

Using Eclipse in MIS Research

Start Up Benoît Langlois / Thales Global Services Eclipse (EMFT) EGF 2011 by Thales; made available under the EPL v1.

INF5120 Model-Based System Development

Model-based Software Engineering (02341, Spring 2017) Ekkart Kindler

The Edapt Solution for the Reengineering Case

Software Factories Application within the ASE5 project

Kermeta. in compiled mode

Supporting Modeling in the Large in Fujaba

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Orccad, a Model Driven Architecture and Environment for Real-Time Control. Soraya Arias Florine Boudin Roger Pissard-Gibollet Daniel Simon

Transformation of the system sequence diagram to an interface navigation diagram

Building Java Persistence API Applications with Dali 1.0 Shaun Smith

MAENAD Modeling Workbench

An EMF Framework for Event-B

User s Manual. for. Diagram Consistency and Validation in agenttool III

Model transformations. Model transformations. Model transformations. Model transformations

Design and Prototypical Implementation of a Pivot Model as Exchange Format for Models and Metamodels in a QVT/OCL Development Environment

New and Noteworthy. Peter Friese Bernd Kolb

An Implementation of the Behavior Annex in the AADL-toolset Osate2

IP Log for modeling.mdt.modisco Release Indigo

What Every Xtext User Wished to Know Industry Experience of Implementing 80+ DSLs

CS560: Formal Modelling and Implementation of Systems (Term II) Lecture: CASE A. O Riordan, 2009.

Methods for the Development

Model-Independent Differences

The Unified Modelling Language. Example Diagrams. Notation vs. Methodology. UML and Meta Modelling

From Object Composition to Model Transformation with the MDA

Eclipse 4 Eclipse Day Toulouse 24 mai 2012

Dresden OCL2 in MOFLON

ATESST2 D4.2.1 Grant Agreement

ELEMENTTYPES CONFIGURATION FRAMEWORK

Metamodeling with Metamodels. Using. UML/MOF including OCL

Preserving Non-essential Information Related to the Presentation of a Language Instance. Terje Gjøsæter and Andreas Prinz

Transcription:

An introduction to the EMF facilities F. Mallet Frederic.Mallet@unice.fr Université Nice Sophia Antipolis

Software Engineering Model-Driven Engineering Model-Driven Engineering Build software useful to end-users to solve a particular problem Model-Driven Engineering Build models to help software engineer to build faster, better software able to handle more complex problems F. Mallet 2

Two steps to solve a problem Modularity: Divide and Conquer Modularity vs. Composition Decompose into (simpler) sub-systems Composition Compose partial solutions to build an integrated solution Manual or automatic Manual approaches are not scalable Need tools to decompose and integrate F. Mallet 3

The software crisis is still on! The major cause of the software crisis is that the machines have become several orders of magnitude more powerful! Edsger Dijkstra, 1972 Structured and object-oriented programming aimed at solving the crisis Since the 70s, computer complexity has kept increasing very quickly (Moore s law) The gap between what need to be built and what can be built with today abstractions is increasing! F. Mallet 4

Program or model abstract class AbstractBeast { protected int x, y; // position on the screen int speed; // speed [pix/s] double direction; // radians [0-2 PI[ protected Color color; // Filling color protected BeastField field; // the field static final int SIZE = 10; protected AbstractBeast(BeastField field, int x, int y, Color color) { this.field = field; this.x = x; this.y = y; this.color = color; Random gen = new Random(); direction = gen.nextfloat() * 2 * Math.PI; speed = gen.nextint(field.maxspeed); public abstract void act(); public boolean see(abstractbeast b) { double angle = Math.atan2 (b.gety()-y, b.getx()-x); double diff = Math.abs(angle-direction)%(2*Math.PI); if (diff>math.pi) diff=2*math.pi-diff; return diff<champdevue/2; public double getdistance(ibeast b) { return distancefromapoint(b.getx(), b.gety()); double distancefromapoint(double x1, double y1){ // @returns distance between the beast and a point return Math.sqrt((x1 - x)*(x1-x) + (y1 - y)*(y1 - y)); protected IView view = null; void drawyourself(graphics g) { if (this.view!= null) this.view.draw(g, this); protected IBehavior behavior; F. Mallet final public void translate(double dx, double dy) { this.x += dx; this.y += dy; 5

Program or model F. Mallet 6

M3 M2 M1 M0 F. Mallet Models/Metamodels/Languages Meta-Metamodel Conform to Metamodel Conforms to Model BNF grammar BNF grammar A description of the Thing represents represents représents Implementation Meta-language A set of possible languages Language A set of possible descriptions of the thing Thing 7

Eclipse Modeling Framework Modeling Framework with code generation To build tools based on data models The model is captured as a XMI (XML Metadata Interchange) file Import existing code to build the model Java code with annotations XML documents (XSD XML Schema Definition) UML tools (e.g., Rational Rose) Code generation from the model Set of Java classes and interfaces An Edit/Editor environment (editing tree) Many (and many more coming) extensions Generate a graphical editor (GMF Graphical Modeling Framework) Generate a parser, syntax highlighting (XText, TCS, Sintaks) F. Mallet 8

EMF import/export F. Mallet IBM, Ed. Merks & D. Steinberg, EclipseCon 2005 9

MOF: Meta-metamodel (M3) by OMG Meta-Object Facilities EMOF (Essential MOF) is a subset EMF EMF and UML? Was initially just an implementation of the MOF Has evolved to become ECORE Two very different business models OMG # Eclipse Foundation F. Mallet 10

Ecore: EMF meta-metamodel (M3) EClass Own attributes (data types) and typed references (classes) Can have a super type (autres EClass) [specialization] F. Mallet 11

Ecore: EMF meta-metamodel (M3) Small meta-metamodel Enhance the native introspection of Java Only structural information (no access to the code) F. Mallet 12

Example State Machines Ecore Diagrams StateMachines.ecorediag + StateMachines.ecore F. Mallet 13

Generation model:.genmodel Import Ecore model Create a.genmodel What to generate Where to generate How to generate F. Mallet 14

Abstract model Java interfaces public interface State extends EObject { /** @generated */ String getname(); /** @generated */ void setname(string value); Generate code/edit/editor Implementation With listeners public abstract class StateImpl extends EObjectImpl implements State { protected static final String NAME_EDEFAULT = null; protected String name = NAME_EDEFAULT; public void setname(string newname) { String oldname = name; name = newname; if (enotificationrequired()) enotify(new ENotificationImpl(this, Notification.SET, StsPackage.STATE NAME, oldname, name)); F. Mallet 15

Automatic code generation Automatic generation Tree editor XML Marshalling/Unmashalling XML Validator Wizard for creating new models F. Mallet 16

MODEL TRANSFORMATION F. Mallet 17

Model to text Model-Driven Engineering Kinds of model transformations Generate text (or code) from a model Dedicated languages: XSLT Manual: in Java through the Ecore API Model to model Transform a model into another model Ex: UML State Machines into NuSMV files Dedicated transformation languages ATL, Kermeta, QVTo F. Mallet 18

Standalone applications Accessing the model EMF generates a set of helpers to access/parse/generate models Through an eclipse plugin Small Java program that augments Eclipse Add menu, button, editors, Better/easier integration with other tools Needs Eclipse Modeling (Juno) File/New/Plug-in project F. Mallet 19

An example of plug-in Add a menu to Eclipse (3 extensions needed) org.eclipse.ui.menus Add a menu and menu item into Eclipse org.eclipse.ui.commands Add a command: can be (un)done through menus or toolbars org.eclipse.ui.handlers Attach a handler to a command (code to be executed) F. Mallet 20

org.eclipse.ui.menus 3 stages menucontribution: popup:org.eclipse.ui.popup.any?after=additions menu: with a label command: MenuItem that references a command F. Mallet 21

Select when the menu is visible org.eclipse.ui.menus Ex1: only when a statemachines.statemachine is selected Requires a dependency to the code generated by EMF Ex2: org.eclipse.uml2.uml.statemachine Requires a dependency to org.eclipse.uml2.uml F. Mallet 22

org.eclipse.ui.commands Allows for the creation of commands A command can be done/undone by clicking a menu or a toolbar icon or by code Give a unique id Ex: fr.unice.m1.smtonusmv.command Must be referenced by menus, toolbars, handlers F. Mallet 23

org.eclipse.ui.handlers Specify what code should be executed/attached to a command Reference a command through its id Define a class that must implement org.eclipse.core.commands.ihandler public class SMToNuSMV implements IHandler { public void addhandlerlistener(ihandlerlistener handlerlistener) { public void dispose() { public Object execute(executionevent event) throws ExecutionException { // TODO Auto-generated method stub return null; public boolean isenabled() { return true; public boolean ishandled() { return true; public void removehandlerlistener(ihandlerlistener handlerlistener) { F. Mallet 24

EMF Switches Realize the visitor design patterns Automatically generated by EMF Allows for visiting a complex hierarchical structure F. Mallet 25

Switch: do it yourself Example that counts the number of elements public class SMCountElements extends StatemachinesSwitch<Boolean> { private int nbstatemachines = 0; private int nbstates = 0; private int nbtransitions = 0; public Boolean casestatemachine(statemachine object) { nbstatemachines ++; for(region region : sm.getregions()) doswitch(region); return true; public Boolean caseregion(region region) { for(state state : region.getstates()) doswitch(state); for(transition transition : region.gettransitions()) doswitch(transition); return true; public Boolean casestate(state object) { nbstates++; return true; public Boolean casetransition(transition object) { nbtransitions++; return true; F. Mallet 26

Use the Switch Define the right handler public class SMToNuSMVHandler extends AbstractHandler { @Override public Object execute(executionevent event) throws ExecutionException { ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection(); if (!(selection instanceof StructuredSelection)) return null; Object selected = ((StructuredSelection)selection).getFirstElement(); // The type should be guaranteed by the "isvisiblewhen" assert(selected instanceof StateMachine); SMCountElements counter = new SMCountElements(); counter.doswitch((statemachine)selected); JOptionPane.showMessageDialog(null, counter.getnbstatemachines()+" state machines\n"+ counter.getnbstates()+" states\n"+ counter.getnbtransitions()+" transitions", "State Machines", JOptionPane.INFORMATION_MESSAGE); return null; F. Mallet 27

Practical Generate a NuSMV code from A UML state machine A dedicated model Bring your laptops Install Eclipse Modeling (Kepler) F. Mallet 28