it is due on April 26. It is an assignment about EMF (described at the end of this lecture) It can be done in a couple of hours (very simple) We give you a week so you can organize as needed No extensions If you have an exam on April 26, complete the assignment before (today, tomorrow, etc.)
§ Look to the review done in lecture 16 § Additionally, a) Software design, i.e., class diagrams, coding, match code and design b) Design Smells, i.e., is this a correct design (y/n) ? c) Software Architecture and Architecture Patterns d) Model-Driven Development and EMF
This allows to configure properties for the code generation that are not part of the model itself. § Generate a maximum of four different plugins for a defined model: 1. Model plugin contains all entities, packages and factories to create instances of the model. 2. Edit plugin contains providers to display a model in a UI. For example, the providers offer a label for every model element, which can be used to display an entity showing an icon and a name. 3. Editor plugin is a generated example editor to create and modify instances of a model. 4. Test plugin contains templates to write tests cases for a model.
click the model folder in the project then § New → Other… → EMF Generator Model → Next § and enter myModel.genmodel as the file name. § Select Ecore model as the model importer. § select Browse Workspace… and select our previously created myModel.ecore
on the generator model, we can now generate the source code. § EMF allows you to generate 4 different plugins. § To generate the plugins, right-click on the root node of the genmodel and select the plugin. For our tutorial, please select “generate all”.
there is a corresponding generated § Java interface § Java implementation class § For each package, there is a § XXXPackage interface and implementation class § XXXFactory interface and implementation class
instances use § XXXPackage.eINSTANCE § XXXFactory.eINSTANCE § Use the Factory to create instances of your model classes, e.g: TaskList t = ExampleFactory.eINSTANCE.createTaskList(); § Use the Package to access the meta-model definition, e.g: EClass c = ExamplePackage.eINSTANCE.getTaskList(); List attrs = c.getEAttributes();
Model in EMF (take a screen shoot) 2. Generate Code (take a screen shoot) 3. Use the Code to Create a Class Diagram (only the Model package but include both interfaces and implementations). It will be bigger and more complex that the one provided