Difference between revisions of "EMF"

From Suhrid.net Wiki
Jump to navigationJump to search
(Created page with "=Intro = * Eclipe Modeling Framework (EMF) is a modeling framework and code generation facility for building tools and other applications based on a structured data model. * Fr...")
 
Line 6: Line 6:
 
* Eclipse EMF is used to model these domain models.EMF makes a distinction between Meta models and actual model. The meta model describes the structure of the model and the model with data is an instance of this meta model.  
 
* Eclipse EMF is used to model these domain models.EMF makes a distinction between Meta models and actual model. The meta model describes the structure of the model and the model with data is an instance of this meta model.  
 
* In the UML world, this is equivalent to a class diagram which describes the meta-model and an object digram describes the actual model.
 
* In the UML world, this is equivalent to a class diagram which describes the meta-model and an object digram describes the actual model.
 +
* In fact, EMF is only concerned with one aspect of UML - Class Modeling.
 
* EMF provides a pluggable framework to store the model definition, the default method is to use XMI.  
 
* EMF provides a pluggable framework to store the model definition, the default method is to use XMI.  
 
* The Meta model can be specified in different ways - XMI, Java annotations, UML/XML schema, textual syntax called EMFatic, Graphical editors within EMF.
 
* The Meta model can be specified in different ways - XMI, Java annotations, UML/XML schema, textual syntax called EMFatic, Graphical editors within EMF.

Revision as of 05:25, 21 June 2012

Intro

  • Eclipe Modeling Framework (EMF) is a modeling framework and code generation facility for building tools and other applications based on a structured data model.
  • From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, along with a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.
  • The most important benefit of EMF, as with modeling in general is the boost in productivity that results from automatic code generation. [pp 23. 2.4 Generating Code Eclipse EMF.]
  • A domain model represents that data we want to work with. The data should be modeled irrespective of the application logic.
  • Eclipse EMF is used to model these domain models.EMF makes a distinction between Meta models and actual model. The meta model describes the structure of the model and the model with data is an instance of this meta model.
  • In the UML world, this is equivalent to a class diagram which describes the meta-model and an object digram describes the actual model.
  • In fact, EMF is only concerned with one aspect of UML - Class Modeling.
  • EMF provides a pluggable framework to store the model definition, the default method is to use XMI.
  • The Meta model can be specified in different ways - XMI, Java annotations, UML/XML schema, textual syntax called EMFatic, Graphical editors within EMF.

EMF Metamodels

  • Two metamodels: Ecore and Genmodel.

ECore

  • The Ecore metamodel contains the information about the defined classes.
  • The Ecore model allows the definition of the following elements:
    • EClass
    • EAttribute
    • EReference: One end of an association between two classes.
    • EDataType: Type of an attribute.
  • Ecore model editor shows the model itself as the root, followed by the packages, then classes and then attributes.
  • UML2 modeling is an EMF-based implementation of the UML 2.x metamodel for the Eclipse platform.

GenModel

  • The Genmodel contains additional information for generating code, e.g. the path and file information. The genmodel contains also the control parameter how the coding should be generated.
  • Where to place generated code, what prefix to use for generated factory and package class names - the kind of information that is not stored in the Ecore model, but is user settable. The EMF code generator uses a generator model to store this information. Like Ecore, the generator model is itself an EMF model.
  • The genmodel provides all the data required for code generation by wrapping the Ecore model.

Runtime Framework

  • Every generated EMF class is a notifier, it can send notification whenever an attribute or reference is changed. This allows EMF objects to be observed.
  • Notification observers/listeners in EMF are called adapters, because they're used to extend the behaviour of the object they are attached to.
  • The ability to persist and reference other persisted objects, is one of the most important benefits of EMF modeling.