a reflective aspect-oriented model editor based on metamodel extension

26
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan http://posl.minnie.ai.kyutech.ac.jp/ 1 A Reflective Aspect-oriented Model Editor Based on Metamodel Extension Naoyasu Ubayashi and Genya Otsubo MiSE2007 @ ICSE2007 May 20, 2007

Upload: ranger

Post on 13-Jan-2016

40 views

Category:

Documents


3 download

DESCRIPTION

MiSE2007 @ ICSE2007. A Reflective Aspect-oriented Model Editor Based on Metamodel Extension. Naoyasu Ubayashi and Genya Otsubo. May 20, 2007. Outline. AspectM. Motivation Management of Metamodel Extension Reflective Model Editor + Demonstration Related Work Conclusion. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

POSL (Principles of Software Languages) Gr.Kyushu Institute of Technology, Japan

http://posl.minnie.ai.kyutech.ac.jp/

1

A Reflective Aspect-oriented Model Editor

Based on Metamodel Extension

Naoyasu Ubayashi and Genya Otsubo

MiSE2007 @ ICSE2007

May 20, 2007

Page 2: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

2

POSLposl.minnie.ai.kyutech.ac.jp

Outline Motivation Management of Metamodel Extension Reflective Model Editor + Demonstration Related Work Conclusion

AspectM

Page 3: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

3

POSLposl.minnie.ai.kyutech.ac.jp

1. Motivation

Page 4: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

4

POSLposl.minnie.ai.kyutech.ac.jp

What is Aspect Orientation ?

Aspect-oriented programming (AOP) can separate crosscutting concerns including logging, error handling and transaction.

These concerns are modularized as aspects.

logging

Page 5: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

5

POSLposl.minnie.ai.kyutech.ac.jp

AO Mechanism -- JPM--- JPM: Join Point Mechanism

aspect Logging { pointcut publiccall (): call (public * *(..)); before() : publiccall() {logging(); }}

join point

program execution points including method calls and field access points

pointcut advice

logging codeextract a set of join points related to a specific crosscutting concern from all join points

raise effects at the join points

AspectJAspectJ

Page 6: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

6

POSLposl.minnie.ai.kyutech.ac.jp

Towards AO Modeling

Recently, aspect orientation has been proposed for coping with concerns at the early stages of the software development phases including requirements analysis, domain analysis, and architecture design phases.

We previously proposed a UML-based aspect-oriented modeling language called AspectM.

Page 7: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

7

POSLposl.minnie.ai.kyutech.ac.jp

AspectM

AspectM JPM の簡易表も載せる

JPM Join point Advice

PA (Pointcut & Advice) operation before, after, around

CM (Composition) class merge-by-name

NE (New Element) class diagram add/delete-class

OC (Open Class) class add/delete-attribute, add/delete-operation

RN (Rename) class, attribute, operation rename

RL (Rlation) class add/delete-relationship, add/delete-aggregation

IH (Inheritance) class add/delete-inheritance

Aspects at the modeling-level are typically static structures

Pointcut cname(‘Customer’) || cname(‘Invoice’)

Aspect name : Logging

Advice Join Point Type : Open Class Add “log()”method to join point

Page 8: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

8

POSLposl.minnie.ai.kyutech.ac.jp

There might be situations in which a modeler wants to introduce domain-specific notations and JPMs.

AspectM is nice, but …

pointcut-body := !DCEntityContract_UniqueId_isUserAssigned(*)advice-body := <<DCLoggerOperation>>log()

{isUserAssigned=false}

{isUserAssigned=false}

{isUserAssigned=true}

Page 9: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

9

POSLposl.minnie.ai.kyutech.ac.jpNeed to extend the AspectM

metamodel

The metamodel is too complex !It is difficult for a modeler to extend and

modify the metamodel !

However, …

MOF is not easy !

Page 10: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

10

POSLposl.minnie.ai.kyutech.ac.jp

Our Approach

Lightweight mechanism for extending the metamodel

Componentization of metamodel extension

We provide a model management method for extending the metamodel.

MMAP & Reflective Model Editor

DSL Components(Components for constructing UML-based DSL)

Page 11: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

11

POSLposl.minnie.ai.kyutech.ac.jp

2. Management of Metamodel Extension

Page 12: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

12

POSLposl.minnie.ai.kyutech.ac.jp

Concept -- MMAP, Reflective Model Editor and DSL Components

AspectM metamodel

AspectM model

introducea new kind of

domain-specificmodel element

modifythe AspectMmetamodel

reflect

reify

MMAP

extensionpoint

new modelelement

protocols

Reflective Model Editor

Base levelBase level

Meta levelMeta level

Editing-timestructuralreflection

DSLComponents

Page 13: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

13

POSLposl.minnie.ai.kyutech.ac.jp

MMAP

Extension pointsClass, Attribute, OperationPA, CM, NE, OC, RN, RL, IH

Extension operationsdefine subclassesadd attributes to

subclassescreate associations

among subclassesadd constraints using

OCLPrimitive predicatespredicates for navigating

the AspectM metamodel

AspectM metamodelClass Element

Aspect Element

extension point example of extension operations

Page 14: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

14

POSLposl.minnie.ai.kyutech.ac.jp

Metamodel navigation

DCEntityContract_UniqueId_isUserAssigned (c): meta-class-of ("DCEntityContract", c) && member-of (a, c) && meta-class-of ("UniqueId", a) && member-of ("isUserAssigned", "UniqueId") && value-of ("true", "isUserAssigned")

DCEntityContract_UniqueId_isUserAssigned (c): meta-class-of ("DCEntityContract", c) && member-of (a, c) && meta-class-of ("UniqueId", a) && member-of ("isUserAssigned", "UniqueId") && value-of ("true", "isUserAssigned")

meta-class-of

member-of

meta-class-of

member-of

value-ofBase level

Meta level

Page 15: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

15

POSLposl.minnie.ai.kyutech.ac.jp

3. Reflective Model Editor

Page 16: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

16

POSLposl.minnie.ai.kyutech.ac.jp

Overview of Reflective Model Editor

Base Editor

Meta Editor

1. Execute extension operations

2. Assign a graphic notation to a new model element

3. Regenerate the metamodel

4. Restart the base editor

Extension Procedure

Page 17: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

17

POSLposl.minnie.ai.kyutech.ac.jp

Overview of Reflective Model EditorDemonstration

Base Editor

Meta Editor

1. Execute extension operations

2. Assign a graphic notation to a new model element

3. Regenerate the metamodel

4. Restart the base editor

Extension Procedure

Base Editor

Invoke the Meta Editor

Page 18: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

18Meta Editor

Show an extension point

Create a new metaclass

Rebuild the Base Editor

Assign a graphic notation

Execute extension operations(add attribute, association, …)

Add a constraint using OCL

A class can have at most one UniqueId.

self.owner.feature ->select(oclIsTypeOf(UniqueId))->size() <= 1

Page 19: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

19

New model elements are added to the pallet

Base Editor

This violates the constraint

A class can have at most one UniqueId.

self.owner.feature ->select(oclIsTypeOf(UniqueId))->size() <= 1

Base Editor can detect this error

Page 20: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

20

Base Editor

Meta Editor

   Reusable DSL component

Page 21: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

21

POSLposl.minnie.ai.kyutech.ac.jp

Base Editor

Implementation (1) -- Reflective Model Editor

Metamodel for EMF

Map model for GMF

Tool model for GMF

Graph model for GMF

Code Generator for EMF

Code Generator for GMF

Code ofModel Editor

Code ofGraphic Editor

Eclipse Modeling Framework

Graphical Modeling Framework

Extended Metamodel

Interface

Graphic Editor Generator

Modeler

Meta Editor

Core Editor Generator

Page 22: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

22

POSLposl.minnie.ai.kyutech.ac.jp

Implementation (2) -- Model Weaver

Base Editor

ModelerProlog

Non WovenModel

Fact

write

convert

WovenModel

Weaving

Model Weaver

analyze pointcut

Model Editor

Page 23: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

23

POSLposl.minnie.ai.kyutech.ac.jp

4. Related Work

Page 24: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

24

POSLposl.minnie.ai.kyutech.ac.jp

Related Work AODM (Aspect-oriented Domain

Modeling) based on GME (Generic Modeling Environment) [J.Gray, et al. GPCE2003]

ETMOP (Edit-Time Metaobject Protocol) [A.D.Eisenberg and G.Kiczales, AOSD2007]

Page 25: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

25

POSLposl.minnie.ai.kyutech.ac.jp

5. Conclusion

Page 26: A Reflective Aspect-oriented Model Editor  Based on Metamodel Extension

26

POSLposl.minnie.ai.kyutech.ac.jp

Conclusion

We proposed the notion of MMAP, reflective model editor and DSL components.

Future work– Verification of the metamodel extension– Verification of the model weaving