Top Banner
EGF Tutorial Generation Chain Benoît Langlois Thales/EPM EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Thales; made available under the EPL v1.0 Benoît Langlois Thales/EPM
23

EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Nov 04, 2019

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

EGF TutorialEGF TutorialGeneration Chain

Benoît Langlois – Thales/EPM

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Benoît Langlois – Thales/EPM

Page 2: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Agenda

Principles

Ser

vice

s/E

PM

Generation Customization

Cor

pora

teS

ervi

ces/

EP

M

Generation Chain Extensibility

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

2

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 3: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Agenda

Principles

Ser

vice

s/E

PM

Generation Customization

Cor

pora

teS

ervi

ces/

EP

M

Generation Chain Extensibility

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

3

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 4: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Rationale

• Objective of the Generation Chain:• Objective of the Generation Chain:� Definition, at a high level of description, of executable generations

� Abstraction: encapsulating the irrelevant technical details of

Ser

vice

s/E

PM

� Abstraction: encapsulating the irrelevant technical details of generation

� Simplicity & Efficiency: Reducing the number of “clicks” (i.e. the number of actions)

Cor

pora

teS

ervi

ces/

EP

M number of actions)

� Only providing the main generation features and next generating

• Technical principle:

Fac

torie

s–

Tha

les

Cor

pora

te

• Technical principle:� Generation features are captured in a “generation chain” file

� An EGF fcore file is produced from the generation chain: it contains

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

� An EGF fcore file is produced from the generation chain: it contains the translation of the generation chain into factory components

� Next, the factory components are transparantly executed to produce the expected artifacts

4

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

the expected artifacts

Page 5: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Levels of Generation

Generation ChainIt captures the generation steps and their featuresFile type: “generation chain”

Level 1

Ser

vice

s/E

PM

File type: “generation chain”

Factory Components

InstantiationGenerated

Level 2

Designer

Cor

pora

teS

ervi

ces/

EP

M Factory Components

They contain the logic of generationFile type: fcore

Level 2

Developer

Fac

torie

s–

Tha

les

Cor

pora

te

Result of the generationLevel 3

InstantiationExecution of the generation

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Result of the generationThe artifacts are generated

Level 3

5

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 6: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Process

1 to n ecore Models

New Generation Chain

Designer

Ser

vice

s/E

PM

Generation Chain

Cor

pora

teS

ervi

ces/

EP

M

Adjust Generation Features

Run Generation Chain

[Fast track][Update]

Fac

torie

s–

Tha

les

Cor

pora

te

Generation Result

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

6

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 7: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Process

1 to n ecore Models

New Generation Chain

Developer

Ser

vice

s/E

PM

Generation Chain

Cor

pora

teS

ervi

ces/

EP

M

Adjust Generation Features

Generate fcore file

Run Generation Chain

[Fast track][Update] [Customization track]

Fac

torie

s–

Tha

les

Cor

pora

te

Customize Factory Components

Factory Components

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Execute Factory Components

7

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Generation Result

Page 8: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Visualization 1/3Selection of ecore models Creation of Generation Chain

New Generation Chain

Creation of Generation Chain

Ser

vice

s/E

PM

New Generation Chain For each model, setting the generation features

Cor

pora

teS

ervi

ces/

EP

M

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

8

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 9: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Visualization 2/3

Modification of Generation Chain FeaturesModification of Generation Chain Features

Possibility to change the generation features and a dd new generation steps

Ser

vice

s/E

PM

C

orpo

rate

Ser

vice

s/E

PM

Generation step and values

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

9

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 10: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Visualization 3/3

Result of Generation Chain executionResult of Generation Chain execution

Ser

vice

s/E

PM

Equivalence of the generation chaininto factory components

Cor

pora

teS

ervi

ces/

EP

M

Fac

torie

s–

Tha

les

Cor

pora

te

Result of the generation

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

10

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 11: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Agenda

Principles

Ser

vice

s/E

PM

Generation Customization

Cor

pora

teS

ervi

ces/

EP

M

Generation Chain Extensibility

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

11

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 12: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Customization with Generation Chains

Generation Chain Definition

Ser

vice

s/E

PM

Instantiation

Cor

pora

teS

ervi

ces/

EP

M

Generation

Factories

Reuse

Fac

torie

s–

Tha

les

Cor

pora

te

Factories

Customization

Project Context

Portfolio

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Project Context

How to introduce customization with a generation ch ain-based development

12

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

How to introduce customization with a generation ch ain-based development while a generation chain reuses a standard generati on stored in a portfolio?

Page 13: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Principles of GC customization

• Means of customization� A customization is realized with patterns which specialize the

standard generation, for instance model / edit / editor for the Emf

Ser

vice

s/E

PM

standard generation, for instance model / edit / editor for the Emfgeneration

Cor

pora

teS

ervi

ces/

EP

M

• Incrementality� When a feature in the generation chain is changed, the fcore is

synchronized accordingly

Fac

torie

s–

Tha

les

Cor

pora

te synchronized accordingly� Ex: when the emf model editor feature is set to “true”, the model editor

generation is invoked, and in reverse is removed when this feature is set to “false”.

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

� Protected elements:� Patterns in a Pattern Viewpoint

� Pattern substitution in the “Orchestration Parameter Container” where

13

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

� Pattern substitution in the “Orchestration Parameter Container” where the patterns for customization replace the standard patterns

Page 14: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Illustration on EMF Generation

Generation Chain Definition

Ser

vice

s/E

PM

InstantiationEMF Model

Cor

pora

teS

ervi

ces/

EP

M

Generation

Factories

Reuse

EMF Edit

Fac

torie

s–

Tha

les

Cor

pora

te

Factories

Customization

Project Context

Portfolio

EMF Editor

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Project Context

EMF Edit.custo

EMF Tests

14

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 15: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Illustration on EMF Generation

Generation Chain Definition

Ser

vice

s/E

PM

InstantiationEMF Model

Cor

pora

teS

ervi

ces/

EP

M

Generation

Factories

Reuse

EMF Edit

Fac

torie

s–

Tha

les

Cor

pora

te

Factories

Customization

Project Context

Portfolio

EMF Editor

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Project Context

EMF Edit.custo

EMF Tests

Injection of the patterns in the

15

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Injection of the patterns in the standard generation by substitution

Page 16: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Example of substitutionS

ervi

ces/

EP

M

Pattern for customization

Declaration of the substitution in the orchestratio n parameters

Cor

pora

teS

ervi

ces/

EP

M Declaration of the substitution in the orchestratio n parameters

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

16

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Refer to the “org.eclipse.egf.usecase.generationchai n.uc1” example

Page 17: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Memo for a Customization with Patterns

� Open the fcore file related to the generation chain. In the Viewpoint container, create a pattern domain which will contain the pattern libraries and patterns for customization.

Ser

vice

s/E

PM

libraries and patterns for customization.

� Identify the standard patterns to extend. For their location, navigate for instance from the invoked factory component of the fcore file (e.g., EMF Edit) which contains the standard patterns.

Cor

pora

teS

ervi

ces/

EP

M (e.g., EMF Edit) which contains the standard patterns.

� Create the pattern for customization:� In order to avoid rewriting everything from scratch in the new pattern, the

pattern inherits from the standard pattern.

Fac

torie

s–

Tha

les

Cor

pora

te

pattern inherits from the standard pattern.

� Add the precondition to apply the pattern; add the “imports” defined in the pattern header method; in the method for code generation (e.g., doGenerate) add the customized code.

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

doGenerate) add the customized code.

� For pattern inheritance, in the Manifest of the plug-in which contains the fcore file, add the dependencies toward the plug-in(s) which contain(s) the standard pattern(s)

17

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

contain(s) the standard pattern(s)

Page 18: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Agenda

Principles

Ser

vice

s/E

PM

Generation Customization

Cor

pora

teS

ervi

ces/

EP

M

Generation Chain Extensibility

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

18

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 19: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Principle of Generation Chain Extension

• Objective• Objective� Ability to extend generation chains with new types of generation chain step

� Introducing new types of generations (e.g. diagram, test generation)

• Impacts

Ser

vice

s/E

PM

• Impacts� New step type in the user interface of generation chain creation

� New step type in the generation chain model

� Association of a generation to the new type of step

Cor

pora

teS

ervi

ces/

EP

M

� Association of a generation to the new type of step

Extension of the

Fac

torie

s–

Tha

les

Cor

pora

te

Extension of the creation UI

New type of step

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

19

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

New type of model element

Page 20: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Generation Chain ExtensionS

ervi

ces/

EP

M

Cor

pora

teS

ervi

ces/

EP

M

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

20

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 21: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Generation Chain ExtensionS

ervi

ces/

EP

M

Declaration of the model extending the generation c hain model

Cor

pora

teS

ervi

ces/

EP

M

Fac

torie

s–

Tha

les

Cor

pora

teE

GF

: Ecl

ipse

G

ener

atio

nF

acto

ries

21

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 22: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Generation Chain ExtensionS

ervi

ces/

EP

M

Cor

pora

teS

ervi

ces/

EP

M

Factory Component used for the extension

Fac

torie

s–

Tha

les

Cor

pora

te

- The “SampleElementPattern” Java pattern declares the behavior to be applied. It invokes the production plan here.- Production Plan = Generation BehaviorHere, it just applies a simple task implemented by a

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Here, it just applies a simple task implemented by a Java Class.

22

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Page 23: EGF Tutorial Generation Chain v0.1 - Eclipsewiki.eclipse.org/images/5/50/EGF_Tutorial_Generation_Chain_v0.1.0.pdf · Levels of Generation Generation Chain It captures the generation

Generation Chain ExtensionS

ervi

ces/

EP

M Java Class for extension

Cor

pora

teS

ervi

ces/

EP

M Java Class for extension

Id declaration of the pattern explained in the previous slide

Label for instance used in the creation user interface

Fac

torie

s–

Tha

les

Cor

pora

te

The sequence to declare that the pattern is applied over a

Label for instance used in the creation user interface

EG

F: E

clip

se

Gen

erat

ion

Fac

torie

s

Model action to be applied when a new step of this type is created

The sequence to declare that the pattern is applied over a generation chain model when the generation chain is executed

23

EG

F: E

clip

se

EGF Tutorial – Generation Chain 0.1.0 | © 2010 by Th ales; made available under the EPL v1.0

Model action to be applied when a new step of this type is created