The Eclipse Modelling Framework (EMF) is an open source framework that can generate Java program code based on structured models. The central component in this framework is the code generation engine, which was developed by the Eclipse Foundation as a plug-in for the open source platform Eclipse. A relevant subproject of EMF is Java Emitter Templates (JET), a tool that supports the generation of different text artifacts like SQL, Java, XML or text in general. One of the initiators of EMF was IBM, who provided the core of Rational Rose to the project.
Development phases of Eclipse Modelling Framework (EMF)The original goal was to implement the Meta Object Facility (MOF), but this turned out to be too complex during development. Therefore, EMF is considered to be an implementation of a subset of MOF, also called Essential MOF (EMOF). The metamodel of EMF is called Ecore. EMF uses the XML Metadata Interchange (XMI) format to define models. The model itself can be created from XML schema, Java code with annotations, UML diagrams or a special tree editor provided by Eclipse. Furthermore, functionalities such as persistence or validation of models are offered. In addition, EMF can be used to generate JUnit code, which can be used to test the generated Java program code. By using EMF, parts of the source code can be generated automatically, thus reducing time-consuming typing and possible errors. An advantage of EMF is also the good integration into Eclipse, so that the interaction with other Eclipse projects - for example in the generation of UI components or with regard to the Eclipse Graphical Modelling Framework (GMF) - is possible without further effort.
The Object Management Group (OMG) defines with the Model Driven Architecture (MDA) a closed procedure for the development of software based on models. EMF enables the model-driven development of Eclipse plug-ins, Java or even rich client platforms (RCP). The models of MDA consist of a set of UML diagrams such as class diagrams or state diagrams. EMF maps part of MDA and represents the part of UML that describes class diagram s. These can be in different notations, so the following options can be used to create a model in EMF:
- An XMI document is created directly using an XML or text editor.
- An XMI document is exported from a modeling tool such as Rational Rose or similar.
- The model can be created from Java interfaces annotated with modeling properties.
- XML Schema can be used to specify the format of the serialization of the model.
The Metamodel of (EMF)The EMF metamodel is called ecore and is very close to the Meta Object Facility (MOF) of the OMG. Here, the MOF specification defines an abstract language as well as a framework to generate and manage metamodels independent of a particular technology. Thus, EMF is an implementation of part of the MOF specification. Like MOF, ecore defines itself recursively, so that an endless number of meta-levels are excluded by definition. Ecore is modeled on Essential MOF (EMOF) and differs only slightly in this respect, so EMF can read and write EMOF notations transparently. In addition to the ecore metamodel, EMF also integrates the following components:
- Java Emitter Templates (JET) a tools for generating different output - SQL, Java, XML, Text ...- following the syntax of Java Server Pages (JSP),
- JMerge for controlling modifications to models and the generated classes,
- A reference implementation of Service Data Objects (SDO), a specification of a vendor-independent framework for unified data access.
EMF is thus a powerful tool for realizing model-driven software development with little equipment. Models can be created without much effort and corresponding code can be generated without using further complex tools. Thus, the approaches of modeling and programming are combined advantageously.