Download The Eclipse Modeling Framework and the IBM Model

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
IBM Software Group
The Eclipse Modeling Framework and
the IBM Model Transformation Framework
Catherine Griffin
IBM Hursley
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
Agenda
 Eclipse Modeling Framework
 IBM Model Transformation Framework
 Demo
2
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
Eclipse Modeling Framework
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
What is the Eclipse Modeling Framework ?
 Framework for implementing structured data models
XSD
Meta-data:
XMI
(Meta-model)
Data:
(Model)
Meta-class
XML
serialize
XML
XMI
deserialize
4
Java object
University of Nantes Eclipse day
Java object
March 2005
© 2005 IBM Corporation
IBM Software Group
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
5
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
6
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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)
7
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
Code generation
Ecore model
(meta-model)
Model implementation
Simple Eclipse
classes
editor
8
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
9
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
10
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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)
…
11
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
12
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
IBM Model Transformation
Framework
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
14
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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?
15
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
16
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
Transformation treated as two separate processes:
Model(s)
Rules
Constraint
checking:
(Java object
graph)
Check & Identify
constraint violations
Apply changes
Mappings
Reconciliation:
17
University of Nantes Eclipse day
Fix violations
March 2005
© 2005 IBM Corporation
IBM Software Group
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
18
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
Mappings
Reconcile
19
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
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
20
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation
IBM Software Group
For more information..
 Eclipse Modeling Framework available from
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
– Free, 90 day licence
– Alpha – this is a technology to play with
21
University of Nantes Eclipse day
March 2005
© 2005 IBM Corporation