Download presentation
Presentation is loading. Please wait.
Published byHomer Pierce Modified over 9 years ago
1
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 The Eclipse Modeling Framework and the IBM Model Transformation Framework Catherine Griffin IBM Hursley
2
IBM Software Group © 2005 IBM Corporation 2University of Nantes Eclipse dayMarch 2005 Agenda Eclipse Modeling Framework IBM Model Transformation Framework Demo
3
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 Eclipse Modeling Framework Sectional slide
4
IBM Software Group © 2005 IBM Corporation 4University of Nantes Eclipse dayMarch 2005 What is the Eclipse Modeling Framework ? Framework for implementing structured data models Data: XML Java object XML XMI Meta-data: deserialize serialize Meta-class XSD XMI (Model) (Meta-model)
5
IBM Software Group © 2005 IBM Corporation 5University of Nantes Eclipse dayMarch 2005 Models and meta-models From a definition of the meta-model, EMF generates Java classes Generated Java classes extend the EMF class EObject They maintain model consistency: –Two-way references –Containment –Type-checking They have access to a representation of their meta-model
6
IBM Software Group © 2005 IBM Corporation 6University of Nantes Eclipse dayMarch 2005 Ecore A meta-model is a model; and its meta-model is supplied by EMF and is called Ecore So a meta-model is an Ecore model Ecore has concepts like: –Class – inheritance, have properties –Property – name, multiplicity, type Essentially this is a simplified version of class modeling in UML
7
IBM Software Group © 2005 IBM Corporation 7University of Nantes Eclipse dayMarch 2005 Creating an Ecore model Various methods of creating an Ecore model are supported: –Rational Rose models –Java interfaces with added annotations –XML Schema –EMF Java APIs (write a program) –Eclipse.org UML2 models, IBM Rational Software Modeler –Other tools – e.g.Omondo (Eclipse UML editor)
8
IBM Software Group © 2005 IBM Corporation 8University of Nantes Eclipse dayMarch 2005 Code generation Ecore model (meta-model) Model implementation classes Simple Eclipse editor
9
IBM Software Group © 2005 IBM Corporation 9University of Nantes Eclipse dayMarch 2005 Customizing generated code You can edit the generated code, and your changes will be maintained when the code is re-generated You need to edit the generated code in order to implement any operations defined in your meta-model, or properties that are derived from other properties You can also use different templates for code generation –You might want to do this to change the standard file header, or conform to your preferred naming conventions
10
IBM Software Group © 2005 IBM Corporation 10University of Nantes Eclipse dayMarch 2005 Loading and Saving EMF Models EMF has built in support for serializing models as XML – either XMI or as defined by an XML schema XMI is the OMG standard for representing models (and meta-models) in XML If you need to, you can write your own custom serialization/deserialization code and have whatever data format you like EMF can manage references within and between files
11
IBM Software Group © 2005 IBM Corporation 11University of Nantes Eclipse dayMarch 2005 More features.. Reflection APIs Model change notification support Reusable parts for building Eclipse tools Change model - supports recording, applying and undoing changes Mapping model and support for building mapping tools SDO implementation (JSR 235) …
12
IBM Software Group © 2005 IBM Corporation 12University of Nantes Eclipse dayMarch 2005 Who is using EMF today? IBM Rational Software Architect, IBM Rational Application Developer for WebSphere, etc Eclipse projects –Hyades Project (testing and logging) –XSD Project (manipulate XML Schemas) –UML2 (UML 2.0) Others –TogetherSoft (UML editor and code generation) –Ensemble (support for Weblogic servers) –Versata (extend J2EE to capture their business rules) –Omondo (UML editor tightly coupled to EMF tools) More coming aboard
13
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 IBM Model Transformation Framework
14
IBM Software Group © 2005 IBM Corporation 14University of Nantes Eclipse dayMarch 2005 Model transformation ‘Model’ means – any data format that can be represented as an EMF model ‘Transformation’ means, e.g. –Generate XML Schema from UML (or vice versa) –Expand patterns (templates) –Merge two versions of the same model A model transformation has built-in support for maintaining model consistency – unlike a text or XML transformation
15
IBM Software Group © 2005 IBM Corporation 15University of Nantes Eclipse dayMarch 2005 What makes transformations difficult ? Reverse transformations Round-tripping Updating instead of over-writing Preserving non-conflicting content (merging) Reconciling changes What to do when the transformation ‘gets stuck’ – incorporating human decision making Traceability – what rule was applied to which elements?
16
IBM Software Group © 2005 IBM Corporation 16University of Nantes Eclipse dayMarch 2005 Model Transformation Framework Aims to: –Speed up implementation of transformations on EMF models –Support for those ‘difficult’ transformation problems (some assembly required) Based on: –rules language for defining “consistency rules” (not transformation rules!) –transformation engine which interprets those rules Use in Java applications or Eclipse plug-ins
17
IBM Software Group © 2005 IBM Corporation 17University of Nantes Eclipse dayMarch 2005 Transformation treated as two separate processes: Rules Check & Identify constraint violations Fix violations Apply changes Reconciliation: Constraint checking: Model(s) (Java object graph) Mappings
18
IBM Software Group © 2005 IBM Corporation 18University of Nantes Eclipse dayMarch 2005 Mappings The output from constraint checking (and also from reconciliation) is a set of mappings and constraint violations A mapping records that a rule was applied to one or more model elements Mappings may be saved to a file and later loaded back into the transformation engine
19
IBM Software Group © 2005 IBM Corporation 19University of Nantes Eclipse dayMarch 2005 Mappings Reconcile
20
IBM Software Group © 2005 IBM Corporation 20University of Nantes Eclipse dayMarch 2005 Rules language Rules define types of mappings: relate xyz (X x, Y y, Z z) Pre-conditions on creation of mappings relate xyz (X x, Y y, Z z) when equals(x.name, y.name) Further constraints to apply to the mapping relate xyz (X x, Y y, Z z) when equals(x.name, y.name) { another_rule(over x.contents, over y.contents), ref yet_another_rule(x.refersTo, z.links) } A rule is actually a class –mappings that are applications of that rule are instances of it –MTF extends the EMF Ecore meta-model
21
IBM Software Group © 2005 IBM Corporation 21University of Nantes Eclipse dayMarch 2005 For more information.. Eclipse Modeling Framework available from www.eclipse.org/emf www.eclipse.org/emf –Open source –There is a book available –OMG Meta-Object Facility 2.0 (standard for meta-modelling) IBM Model Transformation Framework available from www.alphaworks.ibm.com/tech/mtf www.alphaworks.ibm.com/tech/mtf –Free, 90 day licence –Alpha – this is a technology to play with
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.