Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
www.thalesgroup.com
Benoît Langlois / Thales Global Services
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
Start Up
2 /2 /
� Introduction
� EGF Architecture
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
3 /3 /
� IntroductionIntroductionIntroductionIntroduction
� EGF Architecture
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
4 /4 / Generative Software
What target-platform?
Generation reusability?
Generation orchestration?
Generation data, which ones, where?
One-click generation solution?
Combining [model|text|dsl]-to-
How to develop & test?
Generation customization?
Generation scope?
Best practices, guidance?
Generation workflow?
Executability? Distribution?
Performance, scalability?
Variability? Product lines?
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Update strategy of the produced artifacts?
Combining [model|text|dsl]-to-[Model|text|dsl]?
Merging Generation?
Integration of a new language?
Dealing with generation complexityIssue
An integrated and extensible software factory frameworkProposedsolution
Software IndustrializationPurpose
Multiplicity of languages and engines?
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
5 /5 / What is EGF?
� EGF (Eclipse Generation Factories) is an Eclipse op en source component project in incubation under the EMFT pro ject
� Purpose: providing a model-based generation framewo rk
� Objectives:
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
�Supporting complex, large-scale and customizable generations
�Promoting generation portfolios in order to capitalize on generation solutions
�Providing an extensible generation structure
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
6 /6 / General info about EGF
Project page: http://www.eclipse.org/egfWiki: http://wiki.eclipse.org/EGF
Download: by update site from Indigo
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
Download: by update site from Indigoor by update site from Amalgam
7 /7 /
Top
&
Su
b
Pro
ject
s
Ho
st:
Infr
ast
ruct
ure
,
Po
lici
es,
Pro
cess
Project Organization
EGFCore ProjectEPL License
Additional PortfoliosNot EPL License
Project Project
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Co
mm
un
ity
Ho
st:
Infr
ast
ruct
ure
,
Po
lici
es,
Pro
cess
Contributor
Project Project
Committer ContributorOwnerCommitter
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
8 /8 /
� Introduction
� EGF ArchitectureEGF ArchitectureEGF ArchitectureEGF Architecture
� Architecture
� Some issues addressed by EGF
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Concepts & Practice
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
9 /9 / EGF Architecture
EGF
EGF Portfolio
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EGF
Engine Extensions
EGF Engine
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
10 /10 / EGF Architecture
EGF
EGF Portfolio
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EGF
Engine Extensions
EGF EngineProvides basic metamodels and behaviors
to automate software production
EGF Metamodel
Basic behaviors,
dynamic execution
Factory component, task
Pattern
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
11 /11 / EGF Architecture
EGF
EGF Portfolio
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EGF
Engine Extensions
EGF Engine
Meets specific software production needs
Language & tools interoperability
New types of generation formalisms
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
12 /12 / EGF Architecture
EGF
EGF Portfolio
Use cases to understand
production issues
Examples to mimic and start up
Practice
(EGF Wiki) Utilities
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EGF
Engine Extensions
EGF Engine
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
Meets specific software production needs
Provides basic metamodels and behaviors
to automate software production
13 /13 / EGF Architecture
EGF
EGF Portfolio
Portfolio
Simple to off-the-shelf software
factories
Portfolio = generation topic
Meeting specific generation topics
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EGF
Engine Extensions
EGF Engine
Enhancement of the EMF Generation
Build modeler and generator
Examples of Portfolios provided with EGF
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
14 /14 /
� Introduction
� EGF ArchitectureEGF ArchitectureEGF ArchitectureEGF Architecture
� Architecture
� Some issues addressed by EGF
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Concepts & Practice
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
15 /15 / Generation Composition, Language and Tool Interoperability
Language Task
0 1 0 1
Factory Component Production Plan(Activity workflow)
Data exchange between heterogeneous activities
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Factory Component
Tool Task
0 1 0 1 ATLJet
Composite Activity Invocation
heterogeneous activities
Activity Workflow with Java and Ruby: http://vimeo.com/15705526Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
16 /16 / Code Generation Families
Enterprise Portfolio
Example
Code/textual generationfor my organization
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Several levels of Customization
Team Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
Specific generationfor my project
extends
17 /17 / Code Generation Families
Standard Portfolio
customization
Example
EMF Generation
EMF Generation
extends
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Several levels of Customization
Enterprise Portfolio
Team Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
EMF Generationfor my organization
EMF Generationfor my application
extends
18 /18 / Generation Development in Multi-User Mode
Factories DevelopmentFactories Development
Build Deployment
Architecture & DesignAnalysis
Needs Validation
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
0 1 0 1
Project MemberCore Team Member
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
19 /19 /
De
ve
lop
me
nt
Generation Activity Development
Software Factory Engineering
Factory Component Pattern
Assembly & Orchestration
0 1 0 1
Language Task
0 1 0 1
Tool Task
0 1 0 1
Use
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Off-The-Shelf Factories Customization
Factories
Packaging
Project Adaptation
Re
use
Portfolio
Reuse
Management
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
20 /20 / Software Factory Engineering
General Architecture of EGF
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Example of EGF Factory
Development & Reuse Process with EGF
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
21 /21 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
22 /22 / Installation of EGF
Installation by update site
� Eclipse Update site
� Update site from Amalgam
� [Eclipse] Help / Install Modeling Components / EGF
Download EGF materials
� Download EGF update site, dropins, examples
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Download EGF update site, dropins, examples
� Location: http://wiki.eclipse.org/EGF_Installation
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
23 /23 / Examples and Portfolio
Installation of the Examples
� Install the examples File/New/Example…/EGF
Presentation of the EGF Portfolios
� http://wiki.eclipse.org/EGF/Portfolio
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
24 /24 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
25 /25 / Types of Generation Units in EGF
Factory Component
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Portfolio
Capitalization on a
specific generation topic
Factory Component
Composite generation unit
with an activity workflow
Task
Leaf generation unit
written in a language (e.g.,
Java, Ruby)
EGF Pattern
- Description of
systematic behavior
- For definition of
code generation
families
Generation Chain
High generation view to
organize complex
generations
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
26 /26 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
27 /27 / Generation Chain - Objectives
Objectives:
� Definition, at a high level of description, of exec utable generations
� Abstraction: encapsulating the irrelevant technical details of generation
� Simplicity & Efficiency: Reducing the number of “cli cks” (i.e. the number of actions)
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Only providing the main generation features and next generating
28 /28 / Generation Chain - Principles
Technical principles:
� Generation features are captured in a “generation ch ain” file
� An EGF fcore file is produced from the generation c hain: it contains the translation of the generation chain in to factory components
� Next, the factory components are transparently exec uted to produce the expected artifacts
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� It is possible to add customization later a generati on with generation chains at the factory component level
29 /29 / Instantiation & Customization of Generation Chains
Generation
Generation Chain Definition
Instantiation
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Factories
Customization
Project Context
Portfolio
Reuse
30 /30 / [Practice] Hands On…
Links:
Video: http://vimeo.com/29472598
For more explanations:
Generation Chain Tutorial http://wiki.eclipse.org/EGF_Tutorial_and_Use_Cases
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Exercice:1. Select ecore models
2. File/New/Other…/[EGF] Generation Chain Model
3. Set the generation parameters
4. Right click on the first Generation Chain node / Run Generation Chain
5. After execution, open the fcore file in a created plug-in in order to understand how the generation is realized
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
31 /31 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
32 /32 / Activity – Definition
An activity is the abstract class of executable EGF generation units
� Factory component and Task are activities
Activity storage
� Activities are stored in fcore files
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activities are stored in fcore files
� The same fcore file contains one to several activit ies
Activity properties
� Contract declaration
� Ability to be invoked and to execute a generation a ction
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
33 /33 / Concepts
0-1 containerContract Container
Contractname
mode (in,out,InOut)mandatory
0-* contract
TaskFactory Component
Activity
execute()
name0-* activity
fcore filename
location
execute()
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
mandatory
Type Instancevalue
0-1 value
Type
1 type
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
34 /34 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
35 /35 / Factory Component
� Unit of generation with a clear objective of genera tion
� Unit of generation with a clear contract
� Assembly of factory components
� Delegation to other activities
� Creation of heterogeneous and complex generations
� Generation workflow located in a production plan
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Generation workflow located in a production plan
� Explicit declaration of generation data organised b y viewpoints
� A Factory Component can be edited and executed in t he same Eclipse session
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
36 /36 / Factory Component Structure
Factory Component
Viewpoint container
== Contract container
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Production Plan
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
37 /37 / Factory Component Structure
Factory Component
Viewpoint container
== Contract container
= Contract
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Viewpoint container
Production Plan
� Contract: Factory component parameter
� A contract has a type, a passing mode (In/Out/In_Out), a default value or not, is mandatory or optional
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
38 /38 / Factory Component Structure
Factory Component
Viewpoint container
== Contract container
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Production Plan
� Viewpoint: area to declare concerns of generation data
� Examples of viewpoint:
� Available today: domain declaration, pattern
� Candidates: licensing, feature modelEclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
39 /39 / Factory Component Structure
Factory Component
Viewpoint container
== Contract container
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Production Plan
� Production Plan : workflow to describe generation steps – Sequential today
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
40 /40 / Activity and Production Plan
Activity
Factory Component
Task
invocation * ContractContainer
Contract
*
0-1
contract
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Production Plan
0-1
Activity Invocation
*
Invocation Contract*
contract
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
41 /41 / In/Output relationships – Example
Quantity’s Properties
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Amount’s Properties
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
42 /42 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
43 /43 / Task – Definition
A task is an atomic generation unit
� A task enables to execute code in a language
� Examples of Tasks: Java Task, Ruby Task, Ant Task
Task implementation:
� An implementation is associated to a task
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Example: a JavaTask is implemented by a Java class ( which implements ITaskProduction)
Java Task Java Class1
implementation
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
44 /44 / [Practice] Hands On…
Links:
[Video] Video: Activity Creation: http://vimeo.com/15639796
Examples:
[Eclipse] Help Contents! / EGF / Tutorials / Factory Component –First Steps
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Exercices:
EGF Example – [Plug-in] org.eclipse.egf.usecase.fc.uc1 plugin, for definition of Factory Component & Task
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
45 /45 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
46 /46 / Pattern – Definition
Definition
� A pattern is a solution to a recurrent generation p roblem
Purpose
� Applying a systematic behavior onto a resource
� Clearly dissociating the specification (external vi ew) from the implementation (internal view) of the behavior
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
implementation (internal view) of the behavior
� Reusing and customizing a pattern in different conte xts
� Supporting multilingual patterns in order to apply the best programming language to a situation, and then suppo rting multi-paradigm (M2T, M2M, T2M, T2T)
� Java and Jet are the two first languages supported today
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
47 /47 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� Pattern Structure
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
48 /48 / Pattern Structure – Specification Elements
Super-Pattern
delegation
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Pattern PatternTypedelegation
Language
0..n parameter
1 nature
� Parameter : Object type of a query record from a query applied over a resource (e.g., a class from an ecore model, a file of a file directory)
� Nature: Language used for the pattern implementation (e.g., Java, Jet for model-to-text)
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
49 /49 / Pattern Structure – Specification Elements
EClassifierGen
EStructural delegation
Example
ECoreResource
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
EClass GenEStructural
Feature Gen
EClassdelegation
Jet
parameter
nature
� The EClassGen pattern is applied onto a Ecore resource
� Objects selected on the ecore resource: EClass instances
� It specializes the EClassifierGen pattern
� It applies a model-to-text generation in Jet
� Its also applies a generation on its features by delegation to the EStructuralFeatureGen pattern
50 /50 / Pattern Structure – Specification Elements
Super-Pattern
delegation
Type 0..n variable
Constraint0..1 preCondition
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Pattern PatternTypedelegation
Language
0..n parameter
1 nature
� preCondition/Constraint: constraint to be verified before application
� variable/Type: local variable declaration for the pattern implementation
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
51 /51 / Pattern Structure – Specification View
Super-pattern
Pattern Language
Query Parameter
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
52 /52 / Pattern Structure – Implementation View
Methods which implement the patternThey conform to the pattern language Order to execute the methods
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� header: typically used for the Jet header
� init : method for pattern initialization (e.g., variable initialization)
� A method editor allows editing pattern methods
53 /53 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� Pattern Structure
� Pattern Execution
� EGF Portfolios
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
54 /54 / Pattern Execution – Big Picture
For each pattern, query over a resource, e.g. Model
PatternStrategy
Control
ResourceProcessing
List of patterns to be appliedFor pattern execution, use of the
Way to apply patterns and a resource together
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
over a resource, e.g. Model
Optional - Pattern reporter for the final rendering
For pattern execution, use of the language engine matching the pattern language, e.g. Jet, Java
View
Result
Result
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
55 /55 / Pattern Execution – Big Picture
For each pattern, query over a resource, e.g. Model
PatternStrategy
Control
ResourceProcessing
Way to apply patterns and a resource together
Example of strategy:
Strategy name: Model-driven StrategyResource type: ecore modelAlgorithm: for each model element (in-depth navigation), apply patterns matching the query parameters
List of patterns to be appliedFor pattern execution, use of the
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
over a resource, e.g. Model
Optional - Pattern reporter for the final rendering
View
Result
Result
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
For pattern execution, use of the language engine matching the pattern language, e.g. Jet, Java
56 /56 / Pattern Strategy
Definition: Way to apply patterns against a resource
Examples of strategies:
� Model-driven pattern strategy : in-depth navigation over a model, and for each model element, applying a set of patterns
� Pattern-driven strategy : for each pattern, applying the pattern for each model element
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
each model element
� [Data type]-driven strategy : generalization of the approach; instead of model, it could be any type of resource (e.g., file directory)
Strategy parameters:
� Resource visitor : When navigating over a resource, the visitor function specifies how to continue this navigation. Example: considering the sub-classes of the current resource instance.
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
57 /57 /
� Introduction
� EGF Architecture
� Concepts & Concepts & Concepts & Concepts & PracticePracticePracticePractice
� Generation Chain
Activity
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� Activity
� Factory Component
� Task
� Pattern
� Pattern Structure
� Pattern Execution
� Pattern Relationships
� EGF PortfoliosEclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
58 /58 / Pattern Relationships – Introduction
Patterns can be related together (e.g., pattern inheritance, pattern call)
The next slides present the different kinds of pattern relationships
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
59 /59 / Pattern Relationships
Pattern Inheritance
Pattern Delegation Pattern Injection Pattern Callback
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Pattern Delegation Pattern Injection Pattern Callback
Pattern Substitution
substitutes
delegates injects
Pattern Merge
merges
Pattern Comparison
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
60 /60 / Pattern Inheritance
Pattern inheritance Case 1. Reuse of super-pattern methods
Same mechanism than Class inheritanceSelection of methods from the super-pattern hierarchy
Hello
- sayHello- finish
Example
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Hello World
- body
Orchestration of HelloWorld
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
61 /61 / Pattern Inheritance
Case 2. Reuse of super-pattern orchestration
Reuse of method and orchestration defined in the super-patternThis abstracts the super-pattern orchestrationThis avoids rewriting pattern orchestrationJust adding the methods of the current pattern
Pattern inheritance
Example
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
62 /62 / Pattern Delegation
Case. For Problem decomposition & Reuse of pattern
- The same pattern is reused in different pattern contexts- The orchestration of the called pattern is applied- The Pattern caller provides parameter values to the called pattern- The parameter values are statically declared at the pattern definition
Hello
WorldHello
FriendsExample 1
Pattern delegation
delegates
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Display EAttribute
Display Annotations
Display EClass
Example 2
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
63 /63 / Multilingual Call
Case. Pattern delegation when implementation langua ges are different
This corresponds to a Pattern Delegation where Pattern natures are different. For instance, a Pattern with a Jet nature calls a Pattern with a Java nature in order to differently process the same resource.It is impossible to have different natures in the same Pattern inheritance hierarchy.
EClass Example
Pattern delegation
delegates
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Measure EClass Quality
EClass Report
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
64 /64 / Pattern Injection
Case. Reuse of pattern with a dynamic resolution of the injected context
- A Pattern injection corresponds to a Pattern Delegation, but- The parameter values are dynamically set at pattern execution
Example
Pattern injection
injects
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
In this example, the “setupVariable” method sets the injection context
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
65 /65 / Pattern Callback
Case 1. Applying a Java call
The callback indicates where the callback on a Java Class is applied
Pattern orchestration
Example
Pattern Callback
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Specification of the Java Class in the production plan
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
66 /66 / Pattern Callback
Case 2. Combination with the Pattern Strategy
A strategy determines how to apply patterns and how to navigate over a resource. In an orchestration, a callback is the moment before and after a cycle of pattern application, and allows to discriminate the methods to apply before and after it.
Scenario:The following generation result can be realized with a callback.- The model-driven strategy navigates over the model
Example
Pattern Callback
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
- The model-driven strategy navigates over the model- There is a pattern for each kind of model element with the following pattern orchestrationA generation action is realized before (open) and after (close) the callback.
<EPackage name=“P”><EClass name=“C1”>
<EAttribute = “A1”>…
</EAttribute = “A1”></EClass name=“C1”>
</EPackage name=“P”>
Generation result
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
67 /67 / Pattern Substitution
Case. Customization of a pattern-based generation
- A substitution replaces a pattern by a list of patterns- This list can be empty (for annihilating a pattern), another pattern, or a list of other patterns (for replacing one pattern by several)- This mechanism enables to adapt a generation to a specific context- It is used for definition of families of code generation with patterns
Pattern substitution
substitutes
For deeper understanding
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
For deeper understanding
[Tutorial] http://wiki.eclipse.org/EGF_Tutorial_and_Use_Cases#EGF_Patterns
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
68 /68 / Pattern Merge
Case. Combination of pattern lists
- Two patterns lists are merged into one list- Examples: for customization, merging a local substitution with a pattern list in parameter of factory component
For deeper understanding
Pattern Merge
merges
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
For deeper understanding
EGF Example – [Plug-in] org.eclipse.egf.usecase.emf.uc3
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
69 /69 / Pattern Comparison
Case. Used during pattern edition – Face pattern evo lution when pattern-based generation scales up
- Comparison of patterns in a hierarchy or of cousin patterns
Scenario:Comparison of super- and child-patterns in the same or different pattern libraries. Below, comparison of “body” methods of a ChildPattern and its SuperPattern.Possibility of live edition when editing pattern comparison.
Pattern Comparison
Example
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Possibility of live edition when editing pattern comparison.
70 /70 / [Practice] Hands On…
Links:
[Video] Pattern Creation: http://vimeo.com/15664081
Examples:
[Eclipse] Help Contents! / EGF / Tutorials / Pattern – First Steps
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Exercices:
EGF Example – [Plug-in] org.eclipse.egf.usecase.pattern.uc1 and org.eclipse.egf.usecase.pattern.uc2
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
71 /71 /
� Introduction
� EGF Architecture
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF EGF EGF EGF PortfoliosPortfoliosPortfoliosPortfolios
� Enhancement of the EMF Generation
� Build Chain Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
72 /72 /
� Introduction
� EGF Architecture
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF EGF EGF EGF PortfoliosPortfoliosPortfoliosPortfolios
� Enhancement of the EMF Generation
� Build Chain Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
73 /73 / EMF Generation – Levels of Maturity
Generation as-is
Customization
Reusability
Product Lines
EMF GenerationStandard
EMF GenerationGeneration Chain
Dimension
EMF GenerationFactory Component
EMF GenerationPatterns
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Silo
Level 1
Integration
Level 2
Component
Level 3
Capability
Level 4
CompositeCapability
Level 5
Maturity Level
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
74 /74 / Portfolio #1 – EMF Generations Layers
Generation Chain
Graphical
Representation
Textual
Representation
Abstract Syntax
Concrete Syntax[Other Form of]
Representation
Includes the related concerns to the EMF
Generation (e.g., Java Doc)
DSL
De
sig
n
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0Factories
Abstraction of
GenModel
Projection
CustomizationGenerated
EMF Code
Execution
Imp
lem
en
tati
on
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
75 /75 / Portfolio #1 – EMF Generations Layers
Generation Chain
Graphical
Representation
Textual
Representation
Abstract Syntax
Concrete Syntax[Other Form of]
Representation
Includes the related concerns to the EMF
Generation (e.g., Java Doc)
DSL
De
sig
n
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0Factories
Abstraction of
GenModel
Projection
CustomizationGenerated
EMF Code
Execution
Imp
lem
en
tati
on
In E
clip
se
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
76 /76 / Portfolio #1 – Enhancement of EMF Generation
EMF
GenerationReverse
EMF Generation Factories
into patterns
Standard Portfolio
customization
Several levels of Customization
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Generation
EMF
GenerationTeam Working
into patterns
Enterprise Portfolio
Team Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
77 /77 / [Practice] Hands On…
Exercices:
EGF Example – org.eclipse.egf.usecase.emf.uc1, org.eclipse.egf.usecase.emf.uc2 and org.eclipse.egf.usecase.emf.uc3
Download access: http://wiki.eclipse.org/EGF_Tutorial_and_Use_Cases#Enhanced_EMF_
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
http://wiki.eclipse.org/EGF_Tutorial_and_Use_Cases#Enhanced_EMF_Generation
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
78 /78 /
� Introduction
� EGF Architecture
� Concepts & Practice
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
� EGF EGF EGF EGF PortfoliosPortfoliosPortfoliosPortfolios
� Enhancement of the EMF Generation
� Build Chain Portfolio
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
79 /79 / Portfolio #2 – Build Chain Editor & Generator
Objective of the Build Portfolio provided by EGF:
� Facilitating the definition of build chain:
1. A build editor describes a build chain
2. A generator targets a build platform, here Hudson and
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
2. A generator targets a build platform, here Hudson and Buckminster
3. Use of the build chain
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
80 /80 / Portfolio #2 – Build Chain Editor & Generator
Build Model Definition
Build Script Generation
BuildAutomation
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
81 /81 / Portfolio #2 – Build Chain Editor & Generator – Nomenclature
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
82 /82 / [Practice] Hands On…
Links:
[Video] Build Chain Creation: http://vimeo.com/22033124
Examples:
[Eclipse] http://wiki.eclipse.org/EGF_Build_Portfolio
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Exercices:
EGF Example – [Plug-in] org.eclipse.egf.portfolio.eclipse.build.examples
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
83 /83 / General info about EGF
Project page: http://www.eclipse.org/egfWiki: http://wiki.eclipse.org/EGFBlog: http://blanglois.blogspot.com/
Mod
èle
pres
enta
tion_
epm
ver
sion
1.0
Eclipse (EMFT) EGF | © 2011 by Thales; made availab le under the EPL v1.0
Blog: http://blanglois.blogspot.com/Twitter: @LangloisBenoit