View
214
Download
1
Tags:
Embed Size (px)
Citation preview
1Telecom and Informatics
26.02.2007 :: INF5120 :: Mansur Abbasi & Svein Melby
Assignment 1 – First aid- Clarifications, issues and insight
2Telecom and Informatics
Agenda
1. Overviewa. Overall purpose and ultimate goalsb. General workbenchc. Specific workbenchd. Process (overview)e. Metamodelf. Resources
2. Detailsa. EMF insightb. GMF insightc. ATL insightd. MOFScript insight
3. Final notes
3Telecom and Informatics
Part 1 – Overview
4Telecom and Informatics
1a. Overall purpose and ultimate goal
Role: Developer of a customized development environment for …
Ultimate goals: Understand the essence of:
Metamodelling Language Driven Engineering Domain-specific workbenches / tool chains Transformations
By-products: Familiarization with Eclipse-based technologies for MDSD Background knowledge that will be useful in assignment 2
5Telecom and Informatics
1b. The general workbench
Eclipse SDK w/ plugins: EMF – Eclipse Modeling Framework GMF – Graphical Modeling Framework (GEF – Graphical Editing Framework [not displayed]) ADT – Atlas Development Tools MOFScript – MOFScript tool
6Telecom and Informatics
1c. The domain-specific workbench
Customized workbench: A – Model editor B – Graphical editor (realized on top of model editor) C – Transformation definitions to enable one-click generation of
desired target artifact(s) from models
7Telecom and Informatics
1d. Process overview
Define metamodel (abstract syntax) Generate model editor
Define notational model (concrete syntax) Generate graphical diagram editor
Can be viewed as a graphical overlay on the model editor
Define metamodel(s) for target artifact(s) Define mapping from source metamodel to target
metamodel and automate this by defining transformations
8Telecom and Informatics
1e. Metamodel
In assignment 1, the domain is SOA concepts. Your task is to construct the domain-specific workbench for the
SOA concepts DSL. PIM4SOA describes the abstract syntax. You have the tutorials to aid you.
Could have chosen a different domain Only difference would be the abstract syntax you would start with
9Telecom and Informatics
1f. Resources
Tutorials EMF tutorial GMF tutorial Transformation tutorial
User guides ATL / ADT user guide MOFScript user guide
More/better material on EMF and GMF can be found at www.eclipse.org
www.modelbased.net/mdi/
10Telecom and Informatics
Part 2 – Details
11Telecom and Informatics
EMF insight
Metamodel (ecore) Discribes the grammar of our PIM4SOA model
EMF model (genmodel) Contains the information needed to generat code
Model code Is created in the src folder of the project Contains a factory class (++) that makes it possible to create
models programatically from Java Editor Code
Works as an adapter between the model code and Eclipse Uses the model code to create instances of our model and
preseting them to Eclipse
12Telecom and Informatics
PIM4SOA metamodel - Ecore
13Telecom and Informatics
GMF insight
Makes it possible to define graphical syntax for our metamodel – the concrete syntax
14Telecom and Informatics
Graphical definiton
A model (gmfgraph) describing the figures that shall be used in our graphical editor
Defines a set of figures (Figure Gallery) Either by choosing one of the predefined figures Or creating a custom figure
Also defines a set of Nodes, Connectios, Comparments and Labels.
These are then mapped together to define how each of the Nodes, Connections, Compartments and Labels will be shown graphicaly
Is not connected to the metamodel by any means at this stage
15Telecom and Informatics
Graphical definiton for our PIM4SOA metamodel
16Telecom and Informatics
Tooling Definition(1)
A model (gmftool) describing the tools that will be used to create elements in our editor
Defines a Pallette consisteing of one or more tool groups The tool groups consists of one or more tools (In our case
creation tools) Each tool needs a small and a large image to represent
the tool in the editor The small images: The large images:
17Telecom and Informatics
Tooling Definition(2)
The tooling model has no information on which artefacts to create. It’s simply a set of tools with names
18Telecom and Informatics
Tooling definition for our PIM4SOA metamodel
19Telecom and Informatics
Mapping definition(1)
A model (gmfmap) describing how to map the elements from the metamodel (ecore) with the figures from the graphical definition model and the tools from the tool definition model.
20Telecom and Informatics
Mapping definition(2)
Defines a set of Top Node References Top Node = Diagram Element = The element in the metamodel
represented by the diagram (the element we wil ”be inside”) Top Node Reference = an aggregation contained in the Top Node
= set of elements contained in the Top Node May contain a Node Mapping for an element it contains = a reference to
the aggregation subpackages (fom Package) and the Node Mapping for the element Document that is contained in subpackages
21Telecom and Informatics
Mapping definition(3)
Each Top Node Reference may contain a Node Mapping Specifies the mapping between an element in the metamodel, a
Node from the graphichal model and a Tool from the tooling model e.g. That a the EClass Document from the metamodel will be
represented by the Node Document from the graphical model (which is mapped to the Rectangle Document Figure (specified in gmfgraph), and that this Node will be created by the Creation Tool Document from the tool model:
22Telecom and Informatics
Mapping definition(4)
Each Node Mapping may contain a Label Mapping Specifies the mapping between a Diagram Label from the
graphical model and an attribute contained in the ECore element of the Node Mapping
E.g. a Label Mapping contained in the Node Mapping for the ECore element Documet (containing an attibute - name) may specify that the EAttribute name will store the value of Diagram Label DocumentName from the graphical model:
23Telecom and Informatics
Mapping definition(5)
The mapping may also specify a set of Link Mappings Specifies the mapping between an element in the metamodel, a
Connection from the graphichal model and a Tool from the tooling model.
e.g. That a the EClass Association from the metamodel will be represented by the Connection Association from the graphical model (which is mapped to the Polyline Connection AssociiationFigure (specified in gmfgraph), and that this Association will be created by the Creation Tool Associaion from the tool model. We also need to specify that the EClass Association is contained by the elements aggregation of Document. And also what will be the Target feature of the link (we dont need to set the source feature because the association is contained in Document. For EntityAssociation this is not the case):
24Telecom and Informatics
Mapping definition(6)
25Telecom and Informatics
Mapping definition of our PIM4SOA metamodel
26Telecom and Informatics
The GMF Wizards
The models are only created with wizard to make the creation easier for us – we could do it manually The generated model should be viewed as a kind of suggestion to how
they should look. They do however contain errors. The names of the model are automatically generated, and may
therefore sometimes seem strange The names can be changed in any way one would like
How the models look does not matter. One may edit them in all ways possible to make them fit ones needs The important thing is that there is elements in the model describing the
graphics/tools/mappings The properties – and not the names – is what needs to be set right
The graphical definition, tooling definition and the metamodel is independent of each other. It is the mapping model that links them together.
27Telecom and Informatics
ATL Insight
Atlas Transformation Language (ATL) is a model 2 model transformation language.
Requies an ATL plugin Requires a source metamodel, a target metamodel and an
input model (instance of the source metamodel) Generates a model instance of the target metamodel from
the inputmodel, based on the mapping defined between the metamodels
28Telecom and Informatics
Model transformatios
Document
- Name : String
Doc2Schema{ from d : pim4soa!Document to s : xsd ! xsdSchema( s.name <- d.name)}
Mapping
XSDSchema
- Name : String
Order Order<Transformasjon>
<Instance of> <instance of>
<Beskrives av>
29Telecom and Informatics
ATL
The input model is created by using the generated editor Either by using the diagam editor – need to add creation tools,
Figures for ItemType and a mapping definition in this case (to be able to create ’String’ and ’Intger’)
Or by using the model editor to edit the model directly. The ItemTypes will not be shown in the diagram in this case
Also need to create the target metamodel in the same way that wecreated the PIM4SOA model, but we dont need to generate any code.
The input model, and the metamodels can be copied into the ATL project
30Telecom and Informatics
MOFScript insight
Is a Model 2 Text transformations language Plugin 2 eclipse Mofscript files may be created in any project. Can be created by creating a regular file with the
extension .m2t Ned to add the metamodel the C:\EclipseExtensions\
eclipse\plugins\org.sintef.mofscript.editor_1.1.11\repository\metamodels
The input model is specified when the transformation is run.
31Telecom and Informatics
The result of the MOFScript transformantion<?xml version="1.0" encoding="ISO-8859-1"?>
<xsdMetamodel:XSDSchema xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsdMetamodel=http:///XSDMetamodel/modeldocument="Order" targetNameSpace="http://www.w3.org/2001/XMLScema">
<xsd_simpleType name="Integer"/><xsd_simpleType name="String"/><xsd_complexType name="OrderHeader"><xsd_element name="header" type="//@xsd_complexType.0"/>
<xsd_attribute name="orderID" type="//@xsd_simpleType.1"/><xsd_attribute name="issueDate" type="//@xsd_simpleType.1"/>
</xsd_complexType><xsd_complexType name="ProductInformation">
<xsd_element name="info" type="//@xsd_complexType.1"/><xsd_element name="record" type="//@xsd_complexType.1"/>
<xsd_attribute name="name" type="//@xsd_simpleType.1"/><xsd_attribute name="code" type="//@xsd_simpleType.1"/></xsd_complexType><xsd_complexType name="ProductRecord">
<xsd_attribute name="supplierProductCode" type="//@xsd_simpleType.0"/><xsd_attribute name="buyerProductCode" type="//@xsd_simpleType.1"/>
<xsd_attribute name="quantity" type="//@xsd_simpleType.0"/> <xsd_attribute name="description" type="//@xsd_simpleType.1"/> <xsd_attribute name="model" type="//@xsd_simpleType.1"/> <xsd_attribute name="productPrice"/> <xsd_attribute name="comments" type="//@xsd_simpleType.1"/> </xsd_complexType> </xsdMetamodel:XSDSchema>
32Telecom and Informatics
Part 3 – Final notes
33Telecom and Informatics
3. Final notes
FAQ published on course website
Check the FAQ before submitting further questions and/or clarification requests
DEADline: MONDAY 05.03.2007 at 23:59! Plan your delivery! If you haven’t managed to complete, submit what you have!
The report is important Please write it yourself…
ZIP-files only Oblig1_<username>_inf5120.zip Other formats will not be accepted, so avoid tar, gzip, etc.