Copyright © IBM Corp., 2005-2008 | March 17, 2008 Fundamentals of the Eclipse Modeling Framework Dave Steinberg IBM Rational Software Toronto, Canada EMF.

Slides:



Advertisements
Similar presentations
Ganymede Simultaneous Release Review © 2008 by Borland Software Corp., made available under the EPL v1.0 MDT UML2Tools 0.8 Ganymede Simultaneous Release.
Advertisements

IAAnalyzer: Towards a Model-Driven Modeling and Analysis Framework for C ONNECT(ors) Massimo Tivoli, University of L’Aquila (UNIVAQ)
© 2008 by Borland Software Corp; made available under the EPL v1.0 | 17 March 2008 Introduction to the Graphical Modeling Framework Artem Tikhomirov, Borland.
Copyright © IBM Corp., All rights reserved. The presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. RESTful Service Oriented.
Copyright © IBM Corp., Introducing the new Web Tools JavaScript™ Features Phil Berkland IBM Software Group 9/26/2007.
Copyright  2005 Symbian Software Ltd. 1 Lars Kurth Technology Architect, Core Toolchain The Template Engine CDT Developer Conference, Oct 2005.
MDA and QVT in Together Architect 2006  Pavel Kobiakov, Borland Software Corporation  06 December 2005.
2006 JavaOne SM Conference | Session TS-4160 | © 2006 by IBM Create, Test, and Consume Web Services with the Eclipse Web Tools Platform Jeffrey Liu, Release.
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.
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 The Eclipse Modeling Framework and the IBM Model Transformation Framework.
© 2008 IBM Corporation Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008.
Design Management: When Model Driven Engineering Embraces the Semantic Web NECSIS 2012, Gatineau, QC 27 June 2012 Maged Elaasar.
Standards for Technology in Automotive Retail STAR Workbench 1.0 Michelle Vidanes & Dave Carver STAR XML Data Architects, Certified Scrum Masters.
© 2006 by IBM 1 How to use Eclipse to Build Rich Internet Applications With PHP and AJAX Phil Berkland IBM Software Group Emerging.
© 2011 IBM Corporation Overview on Modeling RESTful Services August, 2011 Manoj Paul, Software Developer, Rational,
Copyright © IBM Corp., All rights reserved. Plastic Surgery For Eclipse: Custom SWT Widgets, RCP Customization, and more Benjamin Pasero.
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
Faculty of Informatics and Information Technologies Slovak University of Technology Peter Kajsa and Ľubomír Majtás Design.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session The Eclipse Modeling Framework Ed Merks, Ph.D. Software Architect IBM Canada Ltd.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 20, 2008 | Short Talk Standards based systems management: An.
MDA and QVT  Tom Gullion, Director of Product Management, Together Products.
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.
Model Handling with EMF Eclipse ECESIS Project Model handling with EMF An introduction to the Eclipse Modeling Framework ATLAS group (INRIA & LINA),
Modeling Tools for Healthcare Technical Overview April 8, 2009.
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
Copyright © IBM Corp., All rights reserved. This presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. OpenDocument Format.
Europa Simultaneous Release Review | © 2007 by IBM Corporation, made available under the EPL v1.0 1 Model Development Tools (MDT) 1.0 Europa Simultaneous.
2nd TTCN-3 User Conference, June The TTCN-3 Metamodel – A Basis for Tool Integration Ina Schieferdecker TU Berlin/Fraunhofer Fokus Hajo Eichler,
Copyright © 2009 AtlanMod. All Rights Reserved Frédéric Jouault & Hugo Bruneliere AtlanMod team (INRIA & Mines de Nantes) Possible Benefits of Bridging.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 19, 2008 | Short Talk Extending TPTP for TTCN-3 Paul Slauenwhite.
Copyright © IBM Corp., The Eclipse™ Babel Project Translation Server Kit Lo IBM™ Corporation.
Selected Topics in Software Engineering - Distributed Software Development.
Copyright © IBM Corp., All rights reserved. From SWT to RCP: Experiences implementing RSSOwl 2.0 with RCP Benjamin Pasero.
© 2008 by Matt Flaherty & Mary Ruddy; made available under the EPL v1.0 Security & Identity : From present to future Matt Flaherty, IBM Mary Ruddy, Meristic.
ABC of Platform Workspace | Copyright © IBM Corp., ABC of Platform Workspace Szymon Brandys Tomasz Zarna IBM Krakow Software Lab.
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.
Ganymede Simultaneous Release | © 2008 by Springsite B.V., The Netherlands made available under the EPL v1.0 Teneo Ganymede Simultaneous Release.
Technical Overview The Fastest Way to Create Architecture!
Copyright © IBM Corp., | March | Creating Robust Scalable DSLs with UML Tutorial (172) James Bruck, Christian Damus IBM Rational Software.
Copyright © IBM Corp., Introduction to the Eclipse™ Babel Project Kit Lo IBM™ Corporation.
Copyright © IBM Corp., All rights reserved; made available under the EPL v1.0 | March 18, 2008 | Nitin Dahyabhai What can the WTP Snippets View do.
Functional Testing with Eclipse TPTP | Copyright © IBM Corp., All rights reserved. Source code in this presentation is made available under.
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
® IBM Software Group © 2009 IBM Corporation Essentials of Modeling with IBM Rational Software Architect, V7.5 Module 18: Applying Patterns and Transformations.
Chapter – 8 Software Tools.
Copyright © 2010 Obeo, Made available under the Eclipse Public License v SCA Tools (Helios) Release Review Planned Review Date: June 11, 2010.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
Domino iSeries Multi-Versioning © 2002 IBM Corporation | Lotus software © 2002 IBM Corporation Domino Multi-Versioning Mike Gordon – IBM Global Services.
Model Driven Architecture MDA SE-548 Lale Doğan
Review for Eclipse Release Review | © 2012 by Review for Eclipse Committers, made available under the EPL v1.0 1 Review for Eclipse (R4E) 0.11 Release.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
Comparison between EPF Composer and Rational Method Composer
Java Beans Sagun Dhakhwa.
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Evaluating Compuware OptimalJ as an MDA tool
EMFT Mint (Incubation) 0.7 Ganymede Simultaneous Release Review
Teneo Ganymede Simultaneous Release Graduation Review
Object Constraint Language (MDT OCL) 1
Execute your Processes
Presentation transcript:

Copyright © IBM Corp., | March 17, 2008 Fundamentals of the Eclipse Modeling Framework Dave Steinberg IBM Rational Software Toronto, Canada EMF Committer

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Goal Learn about modeling and how the Eclipse Modeling Framework can help you write your application in significantly less time, simply by leveraging the data model you’ve probably already defined (although you might not know it yet)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Model Driven Architecture (MDA) A software architecture proposed by the OMG (Object Management Group) Application specified in high-level, Platform Independent Model (PIM) Transformation technologies used to convert PIM to Platform Specific Model (PSM), implementation code Includes several open modeling standards:  UML ™ (Unified Modeling Language)  MOF (Meta-Object Facility)  XMI (XML Metadata Interchange)  CWM (Common Warehouse Model)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., MDA – Are We There Yet? Doubts exist about the ability of MDA to deliver on its promises:  Ambitiousness of vision  Model expressiveness vs. complexity  Availability of implementations (“vaporware”)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Enter EMF! EMF is a simple, pragmatic approach to modeling:  Allows us to generate some of the code that we write over and over, paving the way for more complex systems (including more ambitious MDA tools)  Models are simple, but meant to be mixed with hand-written code  It’s real, proven technology (since 2002)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Model Driven Development with EMF Contrary to the belief of many programmers, modeling is useful for more than just documentation Almost every program we write manipulates some data model  Defined using UML, XML Schema, some other definition language, or implicitly in Java ™ EMF aims to extract this intrinsic “model” and generate some of the implementation code  Can be a tremendous productivity gain

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., EMF at Eclipse.org Foundation for the Eclipse Modeling Project  EMF project incorporates core and additional mature components: Query, Transaction, Validation  EMF Technology project incubates complementary components: CDO, Teneo, Compare, Search, Temporality, Ecore Tools…  Other projects build on EMF: Graphical Modeling Framework (GMF), Model Development Tools (MDT), Model to Model Transformation (M2M), Model to Text Transformation (M2T)… Other uses: Web Tools Platform (WTP), Data Tools Platform (DTP), Business Intelligence and Reporting Tools (BIRT), SOA Tools Platform (STP)… Large open source user community

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., What is an EMF “Model”? Specification of an application’s data  Object attributes  Relationships (associations) between objects  Operations available on each object  Simple constraints (e.g. multiplicity) on objects and relationships Essentially, the Class Diagram subset of UML

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Model Sources EMF models can be defined in (at least) three ways: 1. Java Interfaces 2. UML Class Diagram 3. XML Schema Choose the one matching your perspective or skills and EMF can create the others, as well as the implementation code

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Java Interfaces Classes can be defined completely by a subset of members, supplemented by annotations public interface PurchaseOrder { String getShipTo(); void setShipTo(String value); String getBillTo(); void setBillTo(String value); List getItems(); // containment } public interface Item { String getProductName(); void setProductName(String value); int getQuantity(); void setQuantity(int value) float getPrice(); void setPrice(float value); }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., UML Class Diagram Built-in support for Rational Rose ® UML2 support available with UML2 (from MDT)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., XML Schema <xsd:schema xmlns:xsd=" targetNamespace=" xmlns:po=" <xsd:element name="items" type=“po:Item" minOccurs="0" maxOccurs="unbounded"/>

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Unifying UML, XML and Java All three forms provide the same information  Different visualization/representation  The application’s data “model” or structure  Model importers can be added for different model representations (e.g. RDB Schema) From a model definition, EMF can generate…  Java implementation code, including UI  XML Schemas  Eclipse “plug-in” artifacts

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., EMF Architecture EMF Runtime EMF Tools CoreEdit Codegen ModelEditor Application Generates Eclipse Platform

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., EMF Components Core Runtime  Notification framework  Ecore metamodel  Persistence (XML/XMI), validation, change model EMF.Edit  Support for model-based editors and viewers  Default reflective editor Codegen  Code generator for application models and editors  Extensible model importer/exporter framework

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Ecore EMF’s metamodel (model of a model)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Ecore Application models (e.g. purchase order model) are instances of Ecore EClass (name="PurchaseOrder") EClass (name="Item") EAttribute (name="shipTo") EAttribute (name="billTo") EReference (name="items") eReferenceType EAttribute (name=“productName")

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Ecore Persistent format is XMI (.ecore file) Alternate format is Essential MOF XMI (.emof file) <eClassifiers xsi:type="ecore:EClass" name="PurchaseOrder"> <eStructuralFeatures xsi:type="ecore:EReference" name="items" eType="#//Item" upperBound="-1" containment="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="shipTo" eType="ecore:EDataType

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Model Import and Generation Ecore Model UML XML Schema IMPORTIMPORT Java EditJava Editor GENERATE Java Model Generator features:  Customizable, JSP-like templates (JET)  JDT-integrated, command-line or Ant  Full support for regen and merge

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Direct Ecore Modeling Ecore models can be created directly  Sample Ecore editor (in EMF)  Ecore Tools graphical editor (from EMFT)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., EMF and Java 5.0 EMF 2.3 began exploiting the capabilities of Java 5.0  Generics  Typesafe enums  Annotations  Enhanced for loop  Autoboxing EMF 2.3 and later provide 5.0-targeted runtime that only runs on a Java 5.0 or later VM The code generator can also produce application code that runs on a 1.4 VM against the 2.2 runtime This is a recognition that Java 5.0 is the way forward, but the transition need not be painful for the user

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Generated Model Code Interface and implementation for each modeled class  Includes get/set accessors for attributes and references public interface PurchaseOrder extends EObject { String getShipTo(); void setShipTo(String value); String getBillTo(); void setBillTo(String value); EList getItems(); } public class PurchaseOrderImpl extends EObjectImpl implements PurchaseOrder {... }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Change Notification Every EObject is also a notifier  Sends notification whenever an attribute or reference is changed  Observers can update views, dependent objects  Observers are also adapters Adapter adapter =... purchaseOrder.eAdapters().add(adapter);

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Change Notification: Feature Accessors Efficient notification from set methods public String getBillTo() { return billTo; } public void setBillTo(String newBillTo) { String oldBillTo = BillTo; billTo = newBillTo; if (eNotificationRequired()) eNotify(new ENotificationImpl(this,..., oldBillTo, billTo); }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Bidirectional References public interface PurchaseOrder {... PurchaseOrder getNext(); void setNext(PurchaseOrder value); PurchaseOrder getPrevious(); void setPrevious(PurchaseOrder value); } Bidirectional reference imposes invariant: po.getNext().getPrevious() == po

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Bidirectional Reference Handshaking Multi-step procedure implemented using InternalEObject methods:  eInverseRemove()  eInverseAdd() Framework list implementations and generated setters directly invoke them on target objects as needed Notifications accumulated using a NotificationChain and fired off at the end  Not used to implement the handshaking

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., next previous next Bidirectional Reference Handshaking p1.setNext(p3); p2 next previous p1 next p2p3 previous change notification

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Typesafe Enums Typesafe enum pattern for enumerated types public enum Status implements Enumerator { PENDING(0, "Pending", "Pending"), BACK_ORDER(1, "BackOrder", "BackOrder"), COMPLETE(2, "Complete", "Complete"); public static final int PENDING_VALUE = 0; public static final int BACK_ORDER_VALUE = 1; public static final int COMPLETE_VALUE = 2; private final int value; private final String name; private final String literal; private Status(int value, String name, String literal) {... }... }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Factories and Packages Factory to create instances of model classes Package provides access to metadata POFactory factory = POFactory.eINSTANCE; PurchaseOrder order = factory.createPurchaseOrder(); POPackage poPackage = POPackage.eINSTANCE; EClass itemClass = POPackage.Literals.ITEM; //or poPackage.getItem() EAttribute priceAttr = POPackage.Literals.ITEM__PRICE; //or poPackage.getItem_Price() //or itemClass.getEStructuralFeature(POPackage.ITEM__PRICE)

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Reflective EObject API All EMF classes implement EObject interface Provides an efficient API for manipulating objects reflectively  Used by framework (e.g. persistence framework, copy utility, editing commands)  Key to integrating EMF-based tools and applications public interface EObject { EClass eClass(); Object eGet(EStructuralFeature sf); void eSet(EStructuralFeature sf, Object val);... }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Reflective EObject API Efficient generated switch-based implementation of reflective methods public Object eGet(int featureID,...) { switch (featureID) { case POPackage.PURCHASE_ORDER__ITEMS: return getItems(); case POPackage.PURCHASE_ORDER__SHIP_TO: return getShipTo(); case POPackage.PURCHASE_ORDER__BILL_TO: return getBillTo();... }... }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Summary of Generated Artifacts Model  Interfaces and classes  Type-safe enums  Package (metadata)  Factory  Switch utility  Adapter factory base  Validator  Custom resource  XML Processor Manifests, plug-in classes, properties, icons… Edit (UI Independent)  Item providers  Item provider adapter factory Editor  Model Wizard  Editor  Action bar contributor  Advisor (RCP) Tests  Test cases  Test suite  Stand-alone example

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Regeneration and Merge The EMF generator is a merging elements are replaced/removed To preserve changes NOT /** * */ public String getName() { return name; }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Regeneration and Merge Generated methods can be extended through redirection public String getName() { return format(getNameGen()); } /** * */ public String getNameGen() { return name; }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Persistence Persisted data is referred to a resource Objects can be spread out among a number of resources, within a resource set Proxies represent referenced objects in other resources

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Resource Set Context for multiple resources that may have references among them Usually just an instance of ResourceSetImpl Provides factory method for creating new resources in the set Also provides access to the registries, URI converter and default load options for the set ResourceSet rs = new ResourceSetImpl(); URI uri = URI.createFileURI("C:/data/po.xml"); Resource resource = rs.createResource(uri);

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Registries Resource Factory Registry  Returns a resource factory for a given type of resource  Based on URI scheme, filename extension or content type  Determines the format for save/load  If no registered resource factory found locally, delegates to global registry: Resource.Factory.Registry.INSTANCE Package Registry  Returns the package identified by a given namespace URI  Used during loading to access factory for instantiating classes  If no registered package found locally, delegates to global registry: EPackage.Registry.INSTANCE

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Resource Container for objects that are to be persisted together  Convert to and from persistent form via save() and load()  Access contents of resource via getContents() EMF provides generic XMLResource implementation  Other, customized implementations, too (e.g. XMI, EMOF) URI uri = URI.createFileURI("C:/data/po.xml"); Resource resource = rs.createResource(uri); resource.getContents().add(p1); resource.save(null); John Doe p2.xml#p2

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., proxyURI="p2.xml#p2" next p2 next Proxy Resolution and Demand Load p1 p1.xmlp2.xml PurchaseOrder p2 = p1.getNext();

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., XML Schema-Conformant Serialization A DocumentRoot class is included in models created from XML Schema  Includes one containment reference per global element...

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., XML Schema-Conformant Serialization To serialize an instance document  Use an XMLResource with extended metadata enabled (e.g. use the resource factory generated with your model)  Use an instance of the DocumentRoot in the resource’s contents  Set the appropriate reference to select the root element PurchaseOrder p1 =... URI uri = URI.createFileURI("C:/data/order.po"); resource resource = rs.createResource(uri); DocumentRoot root = POFactory.eINSTANCE.createDocumentRoot(); resource.getContents().add(root); root.setOrder(p1); resource.save(null);

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Reflection Setting an attribute using generated API Using reflective API PurchaseOrder po =... po.setBillTo("123 Elm St."); EObject po =... EClass poClass = po.eClass(); po.eSet(poClass.getEStructuralFeature("billTo"), "123 Elm St.");

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Dynamic EMF An Ecore model can also be defined at runtime using Ecore API or loaded from persistent form  No generated code required  Dynamic implementation of reflective EObject API provides same runtime behavior as generated code  Can create dynamic subclasses of generated classes The framework treats all model instances the same, whether generated or dynamic

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Change Recording The change model represents changes to instances of any EMF model

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Change Recording Change recorder  Adapter that creates change description based on notifications, to describe reverse delta  Provides transaction capability ChangeRecorder changeRecorder = new ChangeRecorder(resourceSet); try { // modifications within resource set } catch (Exception e) { changeRecorder.endRecording().apply(); }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Validation Models can define named constraints and invariants for batch validation  Invariant  Defined directly on class, as > operation  Stronger statement about validity than a constraint  Constraint  Externally defined via a validator Invariants and constraints are invoked by a validator, which is generated for a package, if needed  Bodies of invariants and constraints are usually hand-coded

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Automatically Implemented Constraints EObjectValidator validates basic constraints on all EObjects (multiplicity, data type values, etc.)  Used as base of generated validators and directly for packages without additional constraints defined In XML Schema, constraints can be defined as facets on simple types  Full implementation generated in validator

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Diagnostician Diagnostician walks a containment tree of objects, dispatching to package-specific validators  Diagnostician.validate() is the usual entry point  Detailed results accumulated as Diagnostics Diagnostician validator = Diagnostician.INSTANCE; Diagnostic diagnostic = validator.validate(order); if (diagnostic.getSeverity() == Diagnostic.ERROR) { // handle error } for (Diagnostic child : diagnostic.getChildren()) { // handle child diagnostic }

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., EMF Utilities Class EcoreUtil provides various static convenience utilities for working with EObjects  Copying  Testing equality  Also, cross referencing, contents/container navigation, annotation, proxy resolution, adapter selection, and more… EObject copy = EcoreUtil.copy(original); boolean equal = EcoreUtil.equals(eObject1, eObject2);

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Agenda What is Modeling? Defining a Model with EMF EMF Architecture Code Generation Programming with EMF Summary

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Summary EMF is low-cost modeling for the Java mainstream Leverages the intrinsic model in an application  No high-level modeling tools required Mixes modeling with programming to maximize the effectiveness of both Boosts productivity and integrates integration The foundation for model-driven development and data integration in Eclipse

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Resources EMF documentation in Eclipse Help  Overviews, tutorials, API reference EMF project Web site   Downloads, documentation, FAQ, newsgroup, Bugzilla, Wiki Eclipse Modeling Framework, by Frank Budinsky et al.  ISBN:  Rough cut of second edition available 

Fundamentals of the Eclipse Modeling Framework | Copyright © IBM Corp., Legal Notices Copyright © IBM Corp., All rights reserved. Source code in this presentation is made available under the EPL, v1.0. The remainder of the presentation is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License ( IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation in the United States, other countries or both. Rational and the Rational logo are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries or both. Java and all Java-based marks, among others, are trademarks or registered trademarks of Sun Microsystems in the United States, other countries or both. Unified Modeling Language and UML are trademarks of Object Management Group Inc. in the United States, other countries or both. Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc. Other company, product and service names may be trademarks or service marks of others. The information discussed in this presentation is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information, it is provided "as is" without warranty of any kind, express or implied, and IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, such information. Any information concerning IBM's product plans or strategy is subject to change by IBM without notice.