Modeling for fun and profit
© Anyware Technologies-All Right Reserved




                                                      David Sciamma
                                                Eclipse Technical Manager
                                                  Anyware Technologies
                                                      May 25th, 2009
Anyware Technologies


                                            Identity                                                   M2MSolutions
                                             Founded in 2000                                             Central management of remote
                                                                                                       equipment based on a generic, secure
                                             Headquarters: Toulouse (France)
                                                                                                       and distributed Machine-to-Machine
                                             Regional subsidies: Paris (France),                       services platform
                                             Munich (Germany), RTP (US)
                                             80 people including a team of 65
                                             experts.
                                             Became Wavecom subsidiary in Q1
© Anyware Technologies-All Right Reserved




                                             2008 and Sierra Wireless/Wavecom
                                             group Subsidiary in March 2009
                                                                                                       Open Source Solutions and Services
                                             Website: www.anyware-tech.com                               Expertise, consulting and numerous
                                                                                                       services around open source kernels
                                                                                                       (Eclipse, Apache, …), web technologies
                                                                                                       and IT integration.




                                                                Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Anyware Technologies OS3

                                            Designer of Software Solutions

                                             ► Relevant and customized solutions
                                                 − which optimizes the performance of business processes
                                                 − which benefits of the best of the technologies
                                                 − Which are built from open sources kernels and components

                                             ► Our specificity
                                                 − An unique expertise around relevant technologies (Java, XML, XSL-T, Ajax,
© Anyware Technologies-All Right Reserved




                                                   JavaScript, JCR, RCP, CDO, EMF, GMF, GEF, ...)
                                                 − A company deeply involved in the most famous open source communities
                                                 − An industrial and agile approach to warranty costs, delays and quality.




                                             ► Keeping the experience brought by projects in order to develop products
                                               or new open source components

                                                              Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
© Anyware Technologies-All Right Reserved




                                            Why ? How ?
                                                          Modeling for fun and profit
Issue

                                                                  • Small development team
                                                                  • Fast prototyping
                                            Constraints           • Recurring kinds of
                                                                    application
© Anyware Technologies-All Right Reserved




                                                                  • Model Driven Approach
                                                                  • Meta Modeling
                                             Solution             • Generation and generic
                                                                    framework

                                                     Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Recurring kind of application

                                                                 • Create the same kind of
                                                                   application for different
                                             Need                  domains
                                                                 • Ex: a graphical editor, a form
© Anyware Technologies-All Right Reserved




                                                                 • Pragmatic Model Driven
                                                                 • Progressive commoditization
                                            Solution             • Progressive improvement of
                                                                   the generator

                                                    Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Definition of a generator

                                            • Creation of the domain specific language (DSL)
                                               ► Ex: UML, Autosar, Petri Net… genealogy

                                            • Definition of the target
                                               ► Ex: graphical editor framework, web framework
© Anyware Technologies-All Right Reserved




                                            • Creation of a model describing this target
                                               ► Ex: graphical editor metamodel, CRUD application metamodel

                                            • Creation of the generator

                                            • Don’t try to generate everything !
                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Definition of a generator
                                                         instantiate                                               UML, Autosar, PetriNet…
                                              Ecore                             DSL



                                            Generation   instantiate       Generation
                                                                                                                   Define the generation parameters
                                            metamodel                        model



                                                                           Generation                              Scripts: JET, xPand, Acceleo…
                                                                           templates                               implement the generation from
                                                                                                                   the generation model
© Anyware Technologies-All Right Reserved




                                                                           Generation
                                                                                                                   Execute the generation templates
                                                                            engine

                                                                                                                   Set of generated files:
                                                                           Generated                               compose the targeted application
                                                                           application

                                                          Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Creation of a generator

                                             Generation                                                                            Generated
                                                                                  Generator v1
                                            metamodel v1                                                                          application v1
                                                                        Improvements




                                             Generation                                                                            Generated
                                                                                  Generator v2
                                            metamodel v2                                                                          application v3
© Anyware Technologies-All Right Reserved




                                                                            Improvements




                                             Generation                                                                      Generated application
                                                                                 Generator vN
                                            metamodel vN                                                                             vN




                                                           Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
© Anyware Technologies-All Right Reserved




                                            Examples
                                                       Modeling for fun and profit
Complete modeling environment


                                                                  • Create a set of tools for a given
                                             Need                   modeling language
                                                                      • Ecore, UML, Autosar…
© Anyware Technologies-All Right Reserved




                                                                 • Generate tools from the
                                                                   metamodel
                                            Solution             • Allow to create homogeneous tools
                                                                 • Speed up integration of a new
                                                                   language


                                                    Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Concrete implementations

                                            • TOPCASED
                                               ► UML, AADL, SAM, SysML…

                                            • Autosar

                                            • CoFluent Studio
© Anyware Technologies-All Right Reserved




                                            • Ecore Tools




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
TOPCASED
                                                                                              DSL



                                            Tabbed Properties              Diagram                     Model navigator                 Context menu
© Anyware Technologies-All Right Reserved




                                                                Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Medany

                                                                 • Mobile application
                                                                 • Disconnected mode
                                             Need                • Synchronization with a server
                                                                 • Administration
                                                                 •…
© Anyware Technologies-All Right Reserved




                                                                 • Modeling environment to define your
                                                                   mobile application
                                            Solution             • Generation of applications using a
                                                                   common core



                                                    Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Medany
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Medany

                                                                                     Medany metamodel




                                                                                         Medany model
© Anyware Technologies-All Right Reserved




                                                Mobile App                RCP                     Web App                     Web Admin    Synchro

                                                      OR                                               OR


                                            Android        eRCP                           Struts               GWT




                                                                  Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Concrete implementations

                                            • VNF

                                            • ONSil
© Anyware Technologies-All Right Reserved




                                                      Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
M2M Developer Suite


                                                                 • Ease embedded development
                                                                   (Machine-to-Machine)
                                             Need                • Define a structure for embedded
                                                                   applications
                                                                 • Accelerate creation fo M2M Solutions
© Anyware Technologies-All Right Reserved




                                                                 • Modeling environment
                                                                 • Component-oriented approach
                                            Solution             • Code generation
                                                                 • Round tripping


                                                    Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Concrete implementations

                                            • Home automation

                                            • Fleet Tracking
© Anyware Technologies-All Right Reserved




                                                          Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling for fun and profit
                                                Eclipse Modeling Project
© Anyware Technologies-All Right Reserved
Eclipse Modeling project

                                            • Created in March 2006

                                            • Provides a complete open source tool stack

                                            • Leader: IBM

                                            • Active members:
© Anyware Technologies-All Right Reserved




                                               ► Anyware Technologies
                                               ► Itemis
                                               ► Obeo
                                               ► Borland
                                               ► Embarcadero Technologies
                                               ► Lots of individuals
                                               ►…

                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                            Framework to use models

                                                            incubation

                                             EMF            EMFT            GMF              M2M                M2T                TMF             MDT    GMT
                                                 EMF          Ecore Tools                           ATL              xPand               xText      UML    …
                                                Model            EMF                            Procedural
                                                                                                                    Acceleo                         OCL
                                              Validation       Compare                             QVT

                                                 Model                                         Declarative
                                              Transaction
                                                              EMF Search
                                                                                                  QVT
                                                                                                                       JET                           …
© Anyware Technologies-All Right Reserved




                                                Model
                                                Query             …
                                                 CDO


                                                Teneo


                                                  …
                                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                 Framework to create graphical editors


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                          Framework to create transformations between models


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                                                Framework to generate text from models


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                                                                Framework to generate model from text


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                                                                  Reference implementations of OMG standards


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects

                                                                                                                                                Research projects


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT     GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText       UML       …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                          OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling Projects (Focus)


                                            EMF           EMFT           GMF              M2M                M2T                TMF             MDT    GMT
                                               EMF         Ecore Tools                           ATL              xPand               xText      UML    …
                                              Model           EMF                            Procedural
                                                                                                                 Acceleo                         OCL
                                            Validation      Compare                             QVT

                                               Model                                        Declarative
                                            Transaction
                                                           EMF Search
                                                                                               QVT
                                                                                                                    JET                           …
© Anyware Technologies-All Right Reserved




                                              Model
                                              Query            …
                                               CDO


                                              Teneo


                                                …
                                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling for fun and profit
                                             Eclipse Modeling Framework - EMF
© Anyware Technologies-All Right Reserved
EMF

                                            • Framework used to create tools based on a model

                                            • Ecore is used to create meta models.

                                            • Ecore provides :
                                               ► Simple and reverse references
© Anyware Technologies-All Right Reserved




                                               ► Composition

                                               ► Types

                                            • Close to UML class diagram.


                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
EMF

                                            • EMF bounds the modeling and development worlds :
                                               ► It transforms models into java

                                               ► Allows to use the model in your application

                                               ► Gives tools to increase development productivity

                                            • Open-source
© Anyware Technologies-All Right Reserved




                                            • Strong and tested technology (used since 2002)




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
EMF Generation



                                                                                  Ecore Model




                                                                                     GenModel
© Anyware Technologies-All Right Reserved




                                                                   Display and
                                                                                                    Model tree
                                            Java Model              edit basic                                                  Tests code
                                                                                                      editor
                                                                    functions



                                                         Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling for fun and profit
                                            Graphical Modeling Framework - GMF
© Anyware Technologies-All Right Reserved
GMF

                                            • Ease the development of graphical editor for models

                                            • Runtime
                                               ► Framework with a lot of common features for graphical model
                                                 editors

                                            • Generator
© Anyware Technologies-All Right Reserved




                                               ► Tool to generate a graphical editor from a model and the editor
                                                 definition




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
GMF
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
GMF
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling for fun and profit
                                                 Model to Text - xPand
© Anyware Technologies-All Right Reserved
xPand

                                            • Designed specifically for text generation
                                               ► OO template engine supporting template polymorphism

                                               ► Template Varibility using AOP

                                               ► Editor with Code Completion and Syntax

                                               ► Highlighting
© Anyware Technologies-All Right Reserved




                                            • Debugger




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
xPand

                                            • Example of template:
                                                  «IMPORT model»
                                                  «DEFINE file FOR SourceComponentClass»
                                                  «FILE project.name.toLowerCase() + "/" + name + ".java"-»
                                                  package «project.name.toLowerCase()»;

                                                  public class «name» extends ComponentClass {

                                                  «IF methods.select(m | m.kind.toString() == "EVENT").size > 0»
                                                       public void receiveEvent(int inputEventMethod, Object value) {
© Anyware Technologies-All Right Reserved




                                                  «FOREACH methods.select(m | m.kind.toString() == "EVENT") AS m-»
                                                            // TODO handle Event: " + «m.name.toUpperCase()»:
                                                  «ENDFOREACH-»
                                                       }
                                                  «ENDIF»
                                                  }
                                                  «ENDFILE»
                                                  «ENDDEFINE»




                                                             Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
How to integrate all the components ?
                                                  The M2M Developer Suite Use case
© Anyware Technologies-All Right Reserved
Requirements

                                            • Embedded development (Machine-to-Machine)

                                            • Modeling environment

                                            • Component-oriented approach

                                                  Model     Code                Binary              Target             Execution   Debug
© Anyware Technologies-All Right Reserved




                                                                                                    What is Machine-to-Machine (M2M)

                                                                                          M2M refers to data communication between machines.




                                                          Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Requirements

                                            • Users profiles
                                               ► Newbies

                                               ► Solution providers

                                            • Multiple targets
                                               ► Wavecom devices
© Anyware Technologies-All Right Reserved




                                               ► Embedded Linux

                                               ►…

                                               ► Lego Mindstorms


                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features

                                                                                    Editors
                                                     Validation                                                Navigator




                                                                                   Model


                                                                                                                          Editor
© Anyware Technologies-All Right Reserved




                                              Compilation                          Code
                                                                                                                       Navigator




                                            Communication                         Target                                Navigator




                                                        Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features




                                                                       Model
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling
                                                                                                                                        Model

                                            • EMF - Eclipse Modeling Framework
                                               ► The model is the pillar of the tool

                                               ► Used to model what is an embedded project

                                               ► Benefits from EMF
                                                   − Notifications
© Anyware Technologies-All Right Reserved




                                                   − Serialization

                                                   − Reflective API

                                                   − … all the incredible EMF tools (GMF, Validation, xPand…)



                                                              Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Modeling
                                                                                                                      Model
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features


                                                                                                   Navigator




                                                                       Model
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Navigator
                                                                                                                                            Navigator




                                            • Objectives                                                                            Model



                                               ► 1:1 Mapping between Project and Model

                                               ► Display informations in the model as project’s artefacts


                                            • Workspace integration
© Anyware Technologies-All Right Reserved




                                               ► EMF Transaction

                                                  − Global model repository

                                                  − Transactional Editing Domain



                                                             Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Navigator
                                                                                                                                            Navigator




                                            • Project Explorer                                                                      Model



                                               ► Displays model objects as the Project structure

                                               ► Based on Common Navigator Framework

                                                  − Extensible tree view

                                                  − Rather complex API
© Anyware Technologies-All Right Reserved




                                                  − But really powerful

                                                        Extension Points: org.eclipse.ui.navigator.*
                                                        Excellent tutorial: Building a Common Navigator based viewer

                                               ► We use an internal model to define the structure (nodes only
                                                 used to group or display informations)
                                                             Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Navigator
                                                                                                                                                            Navigator




                                            • Project Explorer                                                                                      Model



                                               ► Result



                                                          EMF Objects
                                                                                                                      Model contribution
© Anyware Technologies-All Right Reserved




                                                      Navigation nodes


                                                                                                                      CDT contribution




                                                                                                                      Default display (resources)




                                                                 Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features

                                                                        Editors
                                                                                                   Navigator




                                                                       Model
© Anyware Technologies-All Right Reserved




                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model edition
                                                                                                                                             Editors




                                            • Forms editors                                                                                  Model
                                                ► Forms + EMF + databinding
                                                       − Create UI
                                                   private void createContent(FormToolkit toolkit, Composite parent) {
                                                        Composite composite = toolkit.createComposite(parent, SWT.NONE);
                                                        GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
                                                        GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);

                                                         toolkit.createLabel(composite, "Name:", SWT.NONE);
                                                         _textName = toolkit.createText(composite, "", SWT.BORDER);
© Anyware Technologies-All Right Reserved




                                                         GridDataFactory.fillDefaults().grab(true, false).applyTo(_textName);
                                                   }



                                                       − Bind UI to model
                                            private void bind() {
                                                 DataBindingContext bindingContext = new EMFDataBindingContext();
                                                 // -- Bind the Name
                                                 bindingContext.bindValue(SWTObservables.observeText(_textName, SWT.FocusOut),
                                                      EMFEditObservables.observeDetailValue(Realm.getDefault(), getEditingDomain(),
                                                      _myEObject, M2MPackage.eINSTANCE.getINamedElement_Name()), null, null);
                                            }
                                                                  Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model edition
                                                                                                                                           Editors




                                            • Forms editors                                                                                Model


                                               ► Result
© Anyware Technologies-All Right Reserved




                                                          Available in PDE Incubator:
                                                          Forms EMF editor will be used to implement new PDE editors

                                                                Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model edition
                                                                                                                                              Editors




                                            • Graphical Editor: GMF                                                                           Model


                                               ► Uses GMF generator to bootstrap

                                                                       GMF generation
                                                       Model
                                                                                       Generated                  Customization
                                                                                         editor
                                                                                                                                   Modified
© Anyware Technologies-All Right Reserved




                                                                                                                                    editor


                                               ► Heavy use of GMF Runtime




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model edition
                                                                                                                                     Editors




                                            • Graphical Editor: GMF                                                                  Model


                                               ► Result
© Anyware Technologies-All Right Reserved




                                                          Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features

                                                                           Editors
                                            Validation                                                Navigator




                                                                          Model
© Anyware Technologies-All Right Reserved




                                               Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model validation
                                                                                                                                      Validation




                                                                                                                                                   Model
                                            • EMF Validation
                                               ► Extensible (needed for specific-target constraints)

                                               ► Constraints are registered using an extension point

                                                             Extension points: org.eclipse.emf.validation.*
© Anyware Technologies-All Right Reserved




                                               ► We use only the batch mode
                                                public IStatus validate (EObject model, IProgressMonitor monitor) {
                                                     IBatchValidator batchValidator = ModelValidationService.getInstance()
                                                                                  .newValidator(EvaluationMode.BATCH);
                                                     batchValidator.setIncludeLiveConstraints(true);
                                                     batchValidator.setReportSuccesses(false);
                                                     return batchValidator.validate(model, monitor);
                                                }



                                                               Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Model validation
                                                                                                                                  Validation




                                            ► Integrated in a builder                                                                          Model


                                                − Transparent and automatic (on save)

                                                − Uses Problem Markers

                                                − Coupled with quick fixes for a better user experience
© Anyware Technologies-All Right Reserved




                                                                             Validation decorators are based on
                                                                             markers generated by the Validation builder




                                                           Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features

                                                                           Editors
                                            Validation                                                Navigator




                                                                          Model
© Anyware Technologies-All Right Reserved




                                                                          Code




                                               Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Code generation
                                                                                                                                    Model



                                            • xPand                                                                                 Code

                                              ► Example of template

                                                «IMPORT model»
                                                «DEFINE file FOR SourceComponentClass»
                                                «FILE project.name.toLowerCase() + "/" + name + ".java"-»
                                                package «project.name.toLowerCase()»;

                                                public class «name» extends ComponentClass {
© Anyware Technologies-All Right Reserved




                                                «IF methods.select(m | m.kind.toString() == "EVENT").size > 0»
                                                     public void receiveEvent(int inputEventMethod, Object value) {
                                                «FOREACH methods.select(m | m.kind.toString() == "EVENT") AS m-»
                                                          // TODO handle Event: " + «m.name.toUpperCase()»:
                                                «ENDFOREACH-»
                                                     }
                                                «ENDIF»
                                                }
                                                «ENDFILE»
                                                «ENDDEFINE»



                                                             Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Code generation
                                                                                                                                           Model



                                                • xPand                                                                                    Code

                                                   ► Call the xPand generator programmatically
                                            public void generate(final EObject object, IProgressMonitor monitor) throws CoreException {
                                                 Generator generator = new Generator();

                                                 // define the metamodel used in the template
                                                 MetaModel m2mMetamodel = new EmfMetaModel(M2MPackage.eINSTANCE);
                                                 generator.addMetaModel(m2mMetamodel);
                                                 // define the template
                                                 generator.setExpand("templates::SourceComponentClass::file FOR component");
© Anyware Technologies-All Right Reserved




                                                 // define the output folder
                                                 Outlet outlet = new Outlet("C:/myOutput/src");
                                                 generator.addOutlet(outlet);
                                                 // configure protected regions
                                                 generator.setPrSrcPaths("C:/myOutput/src");
                                                 generator.setPrDefaultExcludes(true);
                                                 // define the EObject input
                                                 WorkflowContextDefaultImpl ctx = new WorkflowContextDefaultImpl();
                                                 ctx.set("component", object);
                                                 // run the generator
                                                 generator.invoke(ctx, new ProgressMonitorAdapter(monitor), new IssuesImpl());
                                            }

                                                                    Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Code generation
                                                                                                                                   Model



                                            • Integrated in a builder                                                              Code

                                               ► Transparent and automatic (on save)

                                               ► Synchronization between model and code

                                               ► Incremental generation
© Anyware Technologies-All Right Reserved




                                                            Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Features

                                                                                     Editors
                                                     Validation                                                Navigator
                                                                                           Forms
                                                                        EMF Validation     GMF
                                                                                                              Project Explorer + CNF

                                                                                    Model

                                                                           xPand               AST
                                                                                                                          Editor
                                                                  CDT
© Anyware Technologies-All Right Reserved




                                              Compilation                            Code                      CDT + DLTK


                                                                                                                       Navigator



                                                                  TCF                                      RSE
                                            Communication                           Target                              Navigator




                                                        Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
Questions?
                                                  David Sciamma
                                            david.sciamma@anyware-tech.com
© Anyware Technologies-All Right Reserved

Modeling for Fun and Profit

  • 1.
    Modeling for funand profit © Anyware Technologies-All Right Reserved David Sciamma Eclipse Technical Manager Anyware Technologies May 25th, 2009
  • 2.
    Anyware Technologies Identity M2MSolutions Founded in 2000 Central management of remote equipment based on a generic, secure Headquarters: Toulouse (France) and distributed Machine-to-Machine Regional subsidies: Paris (France), services platform Munich (Germany), RTP (US) 80 people including a team of 65 experts. Became Wavecom subsidiary in Q1 © Anyware Technologies-All Right Reserved 2008 and Sierra Wireless/Wavecom group Subsidiary in March 2009 Open Source Solutions and Services Website: www.anyware-tech.com Expertise, consulting and numerous services around open source kernels (Eclipse, Apache, …), web technologies and IT integration. Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 3.
    Anyware Technologies OS3 Designer of Software Solutions ► Relevant and customized solutions − which optimizes the performance of business processes − which benefits of the best of the technologies − Which are built from open sources kernels and components ► Our specificity − An unique expertise around relevant technologies (Java, XML, XSL-T, Ajax, © Anyware Technologies-All Right Reserved JavaScript, JCR, RCP, CDO, EMF, GMF, GEF, ...) − A company deeply involved in the most famous open source communities − An industrial and agile approach to warranty costs, delays and quality. ► Keeping the experience brought by projects in order to develop products or new open source components Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 4.
    © Anyware Technologies-AllRight Reserved Why ? How ? Modeling for fun and profit
  • 5.
    Issue • Small development team • Fast prototyping Constraints • Recurring kinds of application © Anyware Technologies-All Right Reserved • Model Driven Approach • Meta Modeling Solution • Generation and generic framework Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 6.
    Recurring kind ofapplication • Create the same kind of application for different Need domains • Ex: a graphical editor, a form © Anyware Technologies-All Right Reserved • Pragmatic Model Driven • Progressive commoditization Solution • Progressive improvement of the generator Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 7.
    Definition of agenerator • Creation of the domain specific language (DSL) ► Ex: UML, Autosar, Petri Net… genealogy • Definition of the target ► Ex: graphical editor framework, web framework © Anyware Technologies-All Right Reserved • Creation of a model describing this target ► Ex: graphical editor metamodel, CRUD application metamodel • Creation of the generator • Don’t try to generate everything ! Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 8.
    Definition of agenerator instantiate UML, Autosar, PetriNet… Ecore DSL Generation instantiate Generation Define the generation parameters metamodel model Generation Scripts: JET, xPand, Acceleo… templates implement the generation from the generation model © Anyware Technologies-All Right Reserved Generation Execute the generation templates engine Set of generated files: Generated compose the targeted application application Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 9.
    Creation of agenerator Generation Generated Generator v1 metamodel v1 application v1 Improvements Generation Generated Generator v2 metamodel v2 application v3 © Anyware Technologies-All Right Reserved Improvements Generation Generated application Generator vN metamodel vN vN Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 10.
    © Anyware Technologies-AllRight Reserved Examples Modeling for fun and profit
  • 11.
    Complete modeling environment • Create a set of tools for a given Need modeling language • Ecore, UML, Autosar… © Anyware Technologies-All Right Reserved • Generate tools from the metamodel Solution • Allow to create homogeneous tools • Speed up integration of a new language Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 12.
    Concrete implementations • TOPCASED ► UML, AADL, SAM, SysML… • Autosar • CoFluent Studio © Anyware Technologies-All Right Reserved • Ecore Tools Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 13.
    TOPCASED DSL Tabbed Properties Diagram Model navigator Context menu © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 14.
    Medany • Mobile application • Disconnected mode Need • Synchronization with a server • Administration •… © Anyware Technologies-All Right Reserved • Modeling environment to define your mobile application Solution • Generation of applications using a common core Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 15.
    Medany © Anyware Technologies-AllRight Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 16.
    Medany Medany metamodel Medany model © Anyware Technologies-All Right Reserved Mobile App RCP Web App Web Admin Synchro OR OR Android eRCP Struts GWT Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 17.
    Concrete implementations • VNF • ONSil © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 18.
    M2M Developer Suite • Ease embedded development (Machine-to-Machine) Need • Define a structure for embedded applications • Accelerate creation fo M2M Solutions © Anyware Technologies-All Right Reserved • Modeling environment • Component-oriented approach Solution • Code generation • Round tripping Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 19.
    Concrete implementations • Home automation • Fleet Tracking © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 20.
    Modeling for funand profit Eclipse Modeling Project © Anyware Technologies-All Right Reserved
  • 21.
    Eclipse Modeling project • Created in March 2006 • Provides a complete open source tool stack • Leader: IBM • Active members: © Anyware Technologies-All Right Reserved ► Anyware Technologies ► Itemis ► Obeo ► Borland ► Embarcadero Technologies ► Lots of individuals ►… Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 22.
    Modeling Projects EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 23.
    Modeling Projects Framework to use models incubation EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 24.
    Modeling Projects Framework to create graphical editors EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 25.
    Modeling Projects Framework to create transformations between models EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 26.
    Modeling Projects Framework to generate text from models EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 27.
    Modeling Projects Framework to generate model from text EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 28.
    Modeling Projects Reference implementations of OMG standards EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 29.
    Modeling Projects Research projects EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 30.
    Modeling Projects (Focus) EMF EMFT GMF M2M M2T TMF MDT GMT EMF Ecore Tools ATL xPand xText UML … Model EMF Procedural Acceleo OCL Validation Compare QVT Model Declarative Transaction EMF Search QVT JET … © Anyware Technologies-All Right Reserved Model Query … CDO Teneo … Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 31.
    Modeling for funand profit Eclipse Modeling Framework - EMF © Anyware Technologies-All Right Reserved
  • 32.
    EMF • Framework used to create tools based on a model • Ecore is used to create meta models. • Ecore provides : ► Simple and reverse references © Anyware Technologies-All Right Reserved ► Composition ► Types • Close to UML class diagram. Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 33.
    EMF • EMF bounds the modeling and development worlds : ► It transforms models into java ► Allows to use the model in your application ► Gives tools to increase development productivity • Open-source © Anyware Technologies-All Right Reserved • Strong and tested technology (used since 2002) Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 34.
    EMF Generation Ecore Model GenModel © Anyware Technologies-All Right Reserved Display and Model tree Java Model edit basic Tests code editor functions Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 35.
    Modeling for funand profit Graphical Modeling Framework - GMF © Anyware Technologies-All Right Reserved
  • 36.
    GMF • Ease the development of graphical editor for models • Runtime ► Framework with a lot of common features for graphical model editors • Generator © Anyware Technologies-All Right Reserved ► Tool to generate a graphical editor from a model and the editor definition Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 37.
    GMF © Anyware Technologies-AllRight Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 38.
    GMF © Anyware Technologies-AllRight Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 39.
    Modeling for funand profit Model to Text - xPand © Anyware Technologies-All Right Reserved
  • 40.
    xPand • Designed specifically for text generation ► OO template engine supporting template polymorphism ► Template Varibility using AOP ► Editor with Code Completion and Syntax ► Highlighting © Anyware Technologies-All Right Reserved • Debugger Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 41.
    xPand • Example of template: «IMPORT model» «DEFINE file FOR SourceComponentClass» «FILE project.name.toLowerCase() + "/" + name + ".java"-» package «project.name.toLowerCase()»; public class «name» extends ComponentClass { «IF methods.select(m | m.kind.toString() == "EVENT").size > 0» public void receiveEvent(int inputEventMethod, Object value) { © Anyware Technologies-All Right Reserved «FOREACH methods.select(m | m.kind.toString() == "EVENT") AS m-» // TODO handle Event: " + «m.name.toUpperCase()»: «ENDFOREACH-» } «ENDIF» } «ENDFILE» «ENDDEFINE» Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 42.
    How to integrateall the components ? The M2M Developer Suite Use case © Anyware Technologies-All Right Reserved
  • 43.
    Requirements • Embedded development (Machine-to-Machine) • Modeling environment • Component-oriented approach Model Code Binary Target Execution Debug © Anyware Technologies-All Right Reserved What is Machine-to-Machine (M2M) M2M refers to data communication between machines. Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 44.
    Requirements • Users profiles ► Newbies ► Solution providers • Multiple targets ► Wavecom devices © Anyware Technologies-All Right Reserved ► Embedded Linux ►… ► Lego Mindstorms Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 45.
    Features Editors Validation Navigator Model Editor © Anyware Technologies-All Right Reserved Compilation Code Navigator Communication Target Navigator Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 46.
    Features Model © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 47.
    Modeling Model • EMF - Eclipse Modeling Framework ► The model is the pillar of the tool ► Used to model what is an embedded project ► Benefits from EMF − Notifications © Anyware Technologies-All Right Reserved − Serialization − Reflective API − … all the incredible EMF tools (GMF, Validation, xPand…) Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 48.
    Modeling Model © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 49.
    Features Navigator Model © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 50.
    Navigator Navigator • Objectives Model ► 1:1 Mapping between Project and Model ► Display informations in the model as project’s artefacts • Workspace integration © Anyware Technologies-All Right Reserved ► EMF Transaction − Global model repository − Transactional Editing Domain Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 51.
    Navigator Navigator • Project Explorer Model ► Displays model objects as the Project structure ► Based on Common Navigator Framework − Extensible tree view − Rather complex API © Anyware Technologies-All Right Reserved − But really powerful Extension Points: org.eclipse.ui.navigator.* Excellent tutorial: Building a Common Navigator based viewer ► We use an internal model to define the structure (nodes only used to group or display informations) Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 52.
    Navigator Navigator • Project Explorer Model ► Result EMF Objects Model contribution © Anyware Technologies-All Right Reserved Navigation nodes CDT contribution Default display (resources) Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 53.
    Features Editors Navigator Model © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 54.
    Model edition Editors • Forms editors Model ► Forms + EMF + databinding − Create UI private void createContent(FormToolkit toolkit, Composite parent) { Composite composite = toolkit.createComposite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite); toolkit.createLabel(composite, "Name:", SWT.NONE); _textName = toolkit.createText(composite, "", SWT.BORDER); © Anyware Technologies-All Right Reserved GridDataFactory.fillDefaults().grab(true, false).applyTo(_textName); } − Bind UI to model private void bind() { DataBindingContext bindingContext = new EMFDataBindingContext(); // -- Bind the Name bindingContext.bindValue(SWTObservables.observeText(_textName, SWT.FocusOut), EMFEditObservables.observeDetailValue(Realm.getDefault(), getEditingDomain(), _myEObject, M2MPackage.eINSTANCE.getINamedElement_Name()), null, null); } Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 55.
    Model edition Editors • Forms editors Model ► Result © Anyware Technologies-All Right Reserved Available in PDE Incubator: Forms EMF editor will be used to implement new PDE editors Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 56.
    Model edition Editors • Graphical Editor: GMF Model ► Uses GMF generator to bootstrap GMF generation Model Generated Customization editor Modified © Anyware Technologies-All Right Reserved editor ► Heavy use of GMF Runtime Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 57.
    Model edition Editors • Graphical Editor: GMF Model ► Result © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 58.
    Features Editors Validation Navigator Model © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 59.
    Model validation Validation Model • EMF Validation ► Extensible (needed for specific-target constraints) ► Constraints are registered using an extension point Extension points: org.eclipse.emf.validation.* © Anyware Technologies-All Right Reserved ► We use only the batch mode public IStatus validate (EObject model, IProgressMonitor monitor) { IBatchValidator batchValidator = ModelValidationService.getInstance() .newValidator(EvaluationMode.BATCH); batchValidator.setIncludeLiveConstraints(true); batchValidator.setReportSuccesses(false); return batchValidator.validate(model, monitor); } Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 60.
    Model validation Validation ► Integrated in a builder Model − Transparent and automatic (on save) − Uses Problem Markers − Coupled with quick fixes for a better user experience © Anyware Technologies-All Right Reserved Validation decorators are based on markers generated by the Validation builder Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 61.
    Features Editors Validation Navigator Model © Anyware Technologies-All Right Reserved Code Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 62.
    Code generation Model • xPand Code ► Example of template «IMPORT model» «DEFINE file FOR SourceComponentClass» «FILE project.name.toLowerCase() + "/" + name + ".java"-» package «project.name.toLowerCase()»; public class «name» extends ComponentClass { © Anyware Technologies-All Right Reserved «IF methods.select(m | m.kind.toString() == "EVENT").size > 0» public void receiveEvent(int inputEventMethod, Object value) { «FOREACH methods.select(m | m.kind.toString() == "EVENT") AS m-» // TODO handle Event: " + «m.name.toUpperCase()»: «ENDFOREACH-» } «ENDIF» } «ENDFILE» «ENDDEFINE» Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 63.
    Code generation Model • xPand Code ► Call the xPand generator programmatically public void generate(final EObject object, IProgressMonitor monitor) throws CoreException { Generator generator = new Generator(); // define the metamodel used in the template MetaModel m2mMetamodel = new EmfMetaModel(M2MPackage.eINSTANCE); generator.addMetaModel(m2mMetamodel); // define the template generator.setExpand("templates::SourceComponentClass::file FOR component"); © Anyware Technologies-All Right Reserved // define the output folder Outlet outlet = new Outlet("C:/myOutput/src"); generator.addOutlet(outlet); // configure protected regions generator.setPrSrcPaths("C:/myOutput/src"); generator.setPrDefaultExcludes(true); // define the EObject input WorkflowContextDefaultImpl ctx = new WorkflowContextDefaultImpl(); ctx.set("component", object); // run the generator generator.invoke(ctx, new ProgressMonitorAdapter(monitor), new IssuesImpl()); } Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 64.
    Code generation Model • Integrated in a builder Code ► Transparent and automatic (on save) ► Synchronization between model and code ► Incremental generation © Anyware Technologies-All Right Reserved Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 65.
    Features Editors Validation Navigator Forms EMF Validation GMF Project Explorer + CNF Model xPand AST Editor CDT © Anyware Technologies-All Right Reserved Compilation Code CDT + DLTK Navigator TCF RSE Communication Target Navigator Pragmatic MDA – May 25h, 2009 – David Sciamma – Anyware Technologies
  • 66.
    Questions? David Sciamma david.sciamma@anyware-tech.com © Anyware Technologies-All Right Reserved