Model Handling with EMF Eclipse ECESIS Project - 1 - Model handling with EMF An introduction to the Eclipse Modeling Framework ATLAS group (INRIA & LINA),

Slides:



Advertisements
Similar presentations
Extending Eclipse Kai-Uwe Mätzel IBM OTI Labs Zurich
Advertisements

Profiles Construction Eclipse ECESIS Project Construction of Complex UML Profiles UPM ETSI Telecomunicación Ciudad Universitaria s/n Madrid 28040,
Axel Uhl Scalable EMF Notification Management © SAP AG licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany.
June 9, 2006 Transforming models with ATL © 2006 ATLAS Nantes Transforming models with ATL The A TLAS Transformation Language Frédéric Jouault ATLAS.
Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation.
Developing an Eclipse Plug-in David Gallardo. Platform Runtime Workspace Help Team Workbench JFace SWT Eclipse Project Java Development Tools (JDT) Their.
Goals Give you a feeling of what Eclipse is.
Query/Views/Transformations © 2006 ATLAS Nantes Query/Views/Transformations An introduction to the MOF 2.0 QVT standard with focus on the Operational.
Eclipse Architecture Dwight Deugo Nesa Matic
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
Views Dwight Deugo Nesa Matic
1 Plug-in Development Environment (PDE) Guide. 2 Introduction to PDE l What is PDE: »a tool designed to help you develop platform plug-ins while working.
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 The Eclipse Modeling Framework and the IBM Model Transformation Framework.
MDE In A Sales Management System: A Case Study © 2008 INRIA, TUD & SAP MDE In A Sales Management System: A Case Study Mathias Fritzsche, Hugo Bruneliere,
MDD Tutorial for managers Eclipse ECESIS Project A presentation of MDD basics Model-driven development (MDD) tutorial for managers EUROPEAN SOFTWARE INSTITUTE,
XML Metadata Interchange (XMI)
Comparing M2T & M2M Complementary Approaches © 2008 INRIA, University of York & SINTEF Comparing M2T & M2M Complementary Approaches Hugo Bruneliere,
1 Copyright 2008 NexJ Systems Inc. Confidential and Proprietary - Not for Distribution. Open Source Strategy NexJ Systems Inc.
Advanced Applications Of Model-to-Model Transformation © 2008 INRIA Advanced Applications Of Model-to-Model Transformation Hugo Bruneliere & Frédéric.
February Semantion Privately owned, founded in 2000 First commercial implementation of OASIS ebXML Registry and Repository.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Workshop on Integrated Application of Formal Languages, Geneva J.Fischer Mappings, Use of MOF for Language Families Joachim Fischer Workshop on.
Duke University Program Design & Construction Course Application Development Tools Sherry Shavor
Copyright © IBM Corp., | March 17, 2008 Fundamentals of the Eclipse Modeling Framework Dave Steinberg IBM Rational Software Toronto, Canada EMF.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session The Eclipse Modeling Framework Ed Merks, Ph.D. Software Architect IBM Canada Ltd.
MDE Model Driven Engineering Xavier Blanc Université Pierre et Marie Curie
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
Introduction to MDA (Model Driven Architecture) CYT.
Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter.
Modeling Tools for Healthcare Technical Overview April 8, 2009.
Dali JPA Tools. About Dali Dali JPA Tools is an Eclipse Web Tools Platform sub-Project Dali 1.0 is a part of WTP 2.0 Europa coordinated release Goal -
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
Alignment of ATL and QVT © 2006 ATLAS Nantes Alignment of ATL and QVT Ivan Kurtev ATLAS group, INRIA & University of Nantes, France
Android for Java Developers Denver Java Users Group Jan 11, Mike
Copyright © 2009 AtlanMod. All Rights Reserved Frédéric Jouault & Hugo Bruneliere AtlanMod team (INRIA & Mines de Nantes) Possible Benefits of Bridging.
Extending the Eclipse Framework and Rich Client Platform Jeff Myers Languages for Lunch 10/13/2004.
Ontology Engineering and Plugin Development with the NeOn Toolkit Plug-in Development for the NeOn Toolkit June 1st, 2008 Michael Erdmann, Peter Haase,
UML Profiles Eclipse ECESIS Project The UML Profile technology SOFTEAM 144 Ave des Champs Elysées Paris, France
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
Usage of OCL April Usage of OCL for design guidelines of models Christian Hein, Fraunhofer FOKUS April 2006.
Jan Hatje, DESY CSS ITER March 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
Applications Of Model Weaving Techniques © 2008 INRIA & TUD Applications Of Model Weaving Techniques Hugo Bruneliere, Jendrik Johannes INRIA, TUD.
[________________________] Eclipse project briefing materials. Copyright (c) 2002, 2003 IBM Corporation and others. All rights reserved. This.
WP 3.3 © Copyright Xactium, TUBS & TUD How to build a set of DSLs: from Theory to Practise Xactium, TUBS, Jendrik Johannes (TUD)
Selected Topics in Software Engineering - Distributed Software Development.
Abstract We present two Model Driven Engineering (MDE) tools, namely the Eclipse Modeling Framework (EMF) and Umple. We identify the structure and characteristic.
Open Service Gateway Initiative (OSGi) Reporter : 林學灝 侯承育 1.
Introduction to Model-Driven Simulation © 2008 SAP, TU Dresden, XJ Technologies Introduction to Model-Driven Simulation Mathias Fritzsche 1, Jendrik.
An ATL Example © 2005 ATLAS Nantes An ATL Example The BibTeXML to DocBook Transformation ATLAS group (INRIA & LINA), University of Nantes, France.
1 Innovative Solutions For Mission Critical Systems Using EMF Annotations to Drive Program Behavior February 19, 2014.
ModelPedia Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites Centro de Informática – CIn/UFPe ORCAS Group Eclipse GMF Fábio M. Pereira.
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Jan Hatje, DESY CSS GSI Feb. 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
Introduction To Model-to-Model Transformation © 2008 INRIA Introduction To Model-to-Model Transformation Hugo Bruneliere & Frédéric Jouault INRIA.
Declarative Languages and Model Based Development of Web Applications Besnik Selimi South East European University DAAD: 15 th Workshop “Software Engineering.
Introduction – ORM, Helloworld Application
An Introduction to Metamodelling Eclipse ECESIS Project An Introduction to Metamodelling Principles & Fundamentals Department of Computer Science,
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
Eclipse.NET An Integration Platform for ProjectIT-Studio João Saraiva IST & INESC-ID (GSI)
Model Driven Architecture MDA SE-548 Lale Doğan
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
ECLIPSE RICH CLIENT PLATFORM Part 1 Introduction.
Goals Give you a feeling of what Eclipse is.
Software Architecture & Design
Presentation transcript:

Model Handling with EMF Eclipse ECESIS Project Model handling with EMF An introduction to the Eclipse Modeling Framework ATLAS group (INRIA & LINA), University of Nantes France

Model Handling with EMF Eclipse ECESIS Project Context of this work The present courseware has been elaborated in the context of the MODELWARE European IST FP6 project ( Co-funded by the European Commission, the MODELWARE project involves 19 partners from 8 European countries. MODELWARE aims to improve software productivity by capitalizing on techniques known as Model-Driven Development (MDD). To achieve the goal of large-scale adoption of these MDD techniques, MODELWARE promotes the idea of a collaborative development of courseware dedicated to this domain. The MDD courseware provided here with the status of open source software is produced under the EPL 1.0 license.

Model Handling with EMF Eclipse ECESIS Project Outline Model-Driven Engineering Principles Model-Driven Architecture Operating on models The Eclipse platform Handling models with EMF

Model Handling with EMF Eclipse ECESIS Project MDE Principles Current engineering approaches Models not part of engineering processes (documentation) MDE approach Models as first class entities Need for dedicated tools MDE basic concepts System – real world situation Model – abstraction of a system Describe a given aspect of the system Metamodel – rules to define an abstraction

Model Handling with EMF Eclipse ECESIS Project Model-Driven Architecture Metamodel Metamodel element Metametamodel Metametamodel element conformsTometa conformsTo Model Model element conformsTometa repOf System meta MOF Relational metamodel M3 M2 M1 UML metamodel … ……

Model Handling with EMF Eclipse ECESIS Project Model-Driven Architecture: Example repOf Relational Model Book conformsTo Relational Metamodel MOF Metametamodel ClassAssociation source destination conformsTo System ………… ………… AuthorIdPagesNbTitleBookId Type name: String Table name: String + type * + col + owner + keyOf + key 1..** * Column name: String {ordered}

Model Handling with EMF Eclipse ECESIS Project Operating on Models Model persistence Loading/saving Model edition Creation/deletion/modification Model navigation conformsTo/meta relations

Model Handling with EMF Eclipse ECESIS Project Outline Model-Driven Engineering The Eclipse platform Plug-in architecture Platform architecture Handling models with EMF

Model Handling with EMF Eclipse ECESIS Project What is Eclipse? Eclipse is a universal platform for integrating development tools Open, extensible architecture based on plug-ins Java VM Standard Java2 Virtual Machine Platform Eclipse Platform Java development tools JDTPDE Plug-in development environment

Model Handling with EMF Eclipse ECESIS Project Eclipse Plug-in Architecture (1/2) Plug-in - smallest unit of Eclipse function Big example: HTML editor Small example: Action to create zip files Extension point - named entity for collecting “contributions” Example: extension point for workbench preference UI Extension - a contribution Example: specific HTML editor preferences

Model Handling with EMF Eclipse ECESIS Project Eclipse Plug-in Architecture (2/2) Each plug-in Contributes to 1 or more extension points Optionally declares new extension points Depends on a set of other plug-ins Contains Java code libraries and other files May export Java-based APIs for downstream plug-ins Lives in its own plug-in subdirectory Details spelled out in the plug-in manifest Manifest declares contributions Code implements contributions and provides API plugin.xml file in root of plug-in subdirectory

Model Handling with EMF Eclipse ECESIS Project Eclipse Platform Architecture Eclipse Platform Runtime is micro-kernel All functionality supplied by plug-ins Eclipse Platform Runtime handles start up Discovers plug-ins installed on disk Matches up extensions with extension points Builds global plug-in registry Caches registry on disk for next time

Model Handling with EMF Eclipse ECESIS Project Outline Model-Driven Engineering The Eclipse platform Handling models with EMF EMF framework Model persistence Model edition & navigation

Model Handling with EMF Eclipse ECESIS Project EMF Framework (1/2) Object oriented framework Edition of new EMF models Ecore metametamodel XMI as canonical representation Import of existing models UML model XML schema annotated Java code Export of Ecore-based models Java code generation Accessor methods Operations skeletons

Model Handling with EMF Eclipse ECESIS Project Generation of programmatic facilities for generic model handling EMF Framework (2/2) Title: String PagesNb: int Category:String Book Model package class – accessing model metadata EClass bookClass = libraryPackage.getBook(); EAttribute titleAttribute = libraryPackage.getBook_Title(); Model factory class – instantiating modeled classes Book myBook = libraryFactory.createBook();

Model Handling with EMF Eclipse ECESIS Project Model Persistence EMF Persistence Interface URI (Uniform Resource Identifier) Standard for resource identification/location Resource Common interface for different storage types ResourceSet Interface for Resource collections

Model Handling with EMF Eclipse ECESIS Project Model Persistence: URI Interface URI = three parts string Scheme “file”, “jar”, “platform”, etc. Scheme-specific part is scheme-dependent Fragment identifies a part of the contents of the resource specified by the scheme Examples The “library.xml” resource platform:/resource/project/library.xml First book in the “library.xml” resource

Model Handling with EMF Eclipse ECESIS Project Model Persistence: Resource Interface (1/2) EMF Resource interface Common API for different storage types Persistent container of EObjects EObject = base object of the EMF framework Resource location identified by an URI Resource types identified by URI extensions EMF implementations XMLResource XMIResource (default)

Model Handling with EMF Eclipse ECESIS Project Model Persistence: Resource Interface (2/2) Resource interface (excerpt) Interactions with persistent storage void load(Map /*option*/); void save(Map /*option*/); void unload(); Updating contents void getContents().add(Object); void getContents().remove(Object); Accessing contents EObject getEObject(String /*URIFragment*/); String getURIFromEObject(EObject);

Model Handling with EMF Eclipse ECESIS Project Model Persistence: ResourceSet Interface ResourceSet = collection of Resources Resources created or loaded together Resource allocation Automatic loading of cross-referenced Resources ResourceSet interface (excerpt) Empty Resource creation Resource createResource(URI); Accessing contents Resource getResource(URI, boolean /*loadOnDemand*/); EObject getEObject(URI, boolean /*loadOnDemand*/);

Model Handling with EMF Eclipse ECESIS Project Model Persistence: Example Saving to persistent storage Loading from persistent storage Book myBook = new Book(…); … ResourceSet myResourceSet = new ResourceSetImpl(); Resource myResource = myResourceSet.createResource(URI.createURI(“library.xml”)); myResource.getContents().add(myBook); myResource.save(null); ResourceSet myResourceSet = new ResourceSetImpl(); Resource myResource = myResourceSet.getResource(URI.createURI(“library.xml”), true);

Model Handling with EMF Eclipse ECESIS Project Model Edition & Navigation EMF hierarchy Ecore metamodel Ecore navigation EObject interface Generic APIs EMF reflective API Dynamic EMF

Model Handling with EMF Eclipse ECESIS Project Ecore Kernel Ecore is The model used to represent EMF models An EMF model Its own metamodel A metametamodel

Model Handling with EMF Eclipse ECESIS Project Ecore Navigation (excerpt) EClass – a modeled class EStructuralFeature getEStructuralFeature(String /*name*/); EList getEOperations(); boolean isInterface(); boolean isSuperTypeOf(EClass); EStructuralFeature – a class reference/attribute Object getDefaultValue(); EClass getEContainingClass(); EReference – an association end EReference getEOpposite (); boolean isContainment();

Model Handling with EMF Eclipse ECESIS Project EObject Interface EObject Base interface of all modeled objects EMF equivalent of java.lang.Object EObject facilities (excerpt) Model navigation EClass eClass(); EObject eContainer(); Model edition Object eGet(EStructuralFeature); void set(EStructuralFeature, Object /*newValue*/); void eUnset(EStructuralFeature);

Model Handling with EMF Eclipse ECESIS Project EMF Reflective API Generated programmatic facilities Package and Factory classes generated for the model Model-specific classes Package generic API Generic access to models metadata EClass getEClassifier(String /*name*/); Factory generic API Generic allocation of modeled objects EObject create(EClass);

Model Handling with EMF Eclipse ECESIS Project EMF Reflective API: Example Instantiating an object using the reflective API EClass bookClass = libraryPackage.getEClassifier(“Book”); Book myBook = libraryFactory.create(bookClass); EAttribute bookTitle = bookClass.getEStructuralFeature(“Title”); myBook.eSet(bookTitle, “KingLear”); Title PagesNb Category Book “Theater” 118 “King Lear” EClass bookClass = libraryPackage.getEClassifier(“Book”); Book myBook = libraryFactory.create(bookClass); EAttribute bookPagesNb = bookClass.getEStructuralFeature(“PagesNb”); myBook.eSet(bookPagesNb, new Integer(118)); EAttribute bookTitle = bookClass.getEStructuralFeature(“Title”); myBook.eSet(bookTitle, “KingLear”); EAttribute bookCategory = bookClass.getEStructuralFeature(“Category”); myBook.eSet(bookCategory, “Theater”); EAttribute bookPagesNb = bookClass.getEStructuralFeature(“PagesNb”); myBook.eSet(bookPagesNb, new Integer(118));

Model Handling with EMF Eclipse ECESIS Project Dynamic EMF Generic programmatic facilities Core Package/Factory classes Handling different models in a generic way Runtime model generation EcorePackage - access to Ecore’s metadata EcoreFactory - instantiate Ecore model objects EPackage createEPackage(); EClass createEClass(); EAttribute createEAttribute(); EClass getEClass(); EAttribute getEAttribute(); EDataType getEString();

Model Handling with EMF Eclipse ECESIS Project Title: String Dynamic EMF: Example (1/2) Runtime model generation EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EcorePackage ecorePackage = EcorePackage.eINSTANCE; EClass bookClass = ecoreFactory.createEClass(); EPackage libraryPackage = ecoreFactory.createEPackage(); libraryPackage.setName(“library”); libraryPackage.getEClassifiers().add(bookClass); Title: String PagesNb: int Category:String Book Title: EClass bookClass = ecoreFactory.createEClass(); bookClass.setName(“Book”); EAttribute bookTitle = ecoreFactory.createEAttribute(); bookTitle.setName(“Title”); Book EAttribute bookTitle = ecoreFactory.createEAttribute(); bookTitle.setName(“Title”); bookTitle.setEType(ecorePackage.getEString()); EAttribute bookTitle = ecoreFactory.createEAttribute(); bookTitle.setName(“Title”); bookTitle.setEType(ecorePackage.getEString()); bookClass.getEAttributes().add(bookTitle); … EAttribute bookTitle = ecoreFactory.createEAttribute(); bookTitle.setName(“Title”); bookTitle.setEType(ecorePackage.getEString()); bookClass.getEAttributes().add(bookTitle); EClass bookClass = ecoreFactory.createEClass(); bookClass.setName(“Book”);

Model Handling with EMF Eclipse ECESIS Project Dynamic EMF: Example (2/2) Using a dynamically generated model Dynamic creation of instances EFactory libraryFactory = libraryPackage.getEFactoryInstance(); EObject myBook = libraryFactory.create(bookClass); myBook.eSet(bookTitle, “King Lear”); myBook.eSet(bookCategory, “Theater”); myBook.eSet(bookPagesNb, new Integer(118)); Title PagesNb Category Book “Theater” 118 “King Lear” myBook.eSet(bookTitle, “King Lear”); myBook.eSet(bookPagesNb, new Integer(118)); EFactory libraryFactory = libraryPackage.getEFactoryInstance(); EObject myBook = libraryFactory.create(bookClass);

Model Handling with EMF Eclipse ECESIS Project EMF Reflective API vs. Dynamic EMF Dynamic EMF Type-unsafe Model-independent Enable runtime model generation Reflective API Type-safe Better performance Use less memory Provide faster access to data Model-dependent Require generated classes to be maintained as models evolve