30
1 Metamodel Access Protocols for Extensible Aspect-Oriented Modeling Naoyasu Ubayashi (Kyushu Institute of Technology, Japan) Shinji Sano (Kyushu Institute of Technology, Japan) Yusaku Maeno (Kyushu Institute of Technology, Japan) Satoshi Murakami (Kyushu Institute of Technology, Japan) Tetsuo Tamai (University of Tokyo, Japan) SEKE 2006 Software Engineering and Knowledge Engineer

Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

  • Upload
    nico

  • View
    43

  • Download
    0

Embed Size (px)

DESCRIPTION

SEKE 2006 Software Engineering and Knowledge Engineering. Metamodel Access Protocols for Extensible Aspect-Oriented Modeling. Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Shinji Sano(Kyushu Institute of Technology, Japan) Yusaku Maeno(Kyushu Institute of Technology, Japan) - PowerPoint PPT Presentation

Citation preview

Page 1: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

1

Metamodel Access Protocolsfor ExtensibleAspect-Oriented Modeling

Naoyasu Ubayashi (Kyushu Institute of Technology, Japan)Shinji Sano (Kyushu Institute of Technology, Japan)Yusaku Maeno (Kyushu Institute of Technology, Japan)Satoshi Murakami (Kyushu Institute of Technology, Japan)Tetsuo Tamai (University of Tokyo, Japan)

5 July 2006

SEKE 2006Software Engineering and Knowledge Engineering

Page 2: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

2

Overview

1. Motivation2. Metamodel Access Protocol MMAP 3. Implementation4. Related work5. Conclusion

Page 3: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

3

1. Motivation

Page 4: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

4

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: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

5

AO Mechanism--- 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: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

6

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: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

7

AspectM

classA

attributes

operationsclassB

attributes

operationsclassC

attributes

operations

join point

(class) classA || classBpointcut classA

attributesnew attributes

operationsnew

operations

adviceadd new attributesadd new operations

Extension of JPM (Join Point Mechanism) in AOP

classB

attributesnew attributes

operationsnew

operations

join point

(class) join point

(class)

Page 8: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

8

AspectM JPMJPM Join point Pointcut Advice

PA operation

Example 1) setX || setY 2) set* 3) classA ||

classB   4) class*

before,after,around

CM class merge-by-name

NE class-diagram add-classdelete-class

OC class add-operation,delete-operation,add-attribute,delete-attribute

RN class, operation, attribute

rename

RL class add-inheritance,delete-inheritance,add-aggregation,delete-

aggregation,add-relationship,delete-relationship

PA ( pointcut & advice ), CM ( composition ), NE ( new element ), OC ( open class ), RN ( rename ),RL ( relation )

Page 9: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

9

Example of AspectM descriptions

<< OC >>addAttributeX

classeAandB : class { pointcut-body=“cname(classA) || cname(classB)” }

merge [classAandB] : add-attribute { advice-body=“attributeX” }

aspect

<aspect name=“addAttributeX” type=“ordinary” jpm=“OC" > <pointcut name=“classeAandB” type=“class”> <pointcut-body> cname(classA) || cname(classB) </pointcut-body> </pointcut> <advice name=“add-attributeX” type=“add-attribute” ref-

pointcut=“classAandB”> <advice-body> attributeX </advice-body> </advice></aspect>

classA

classB

classC

classA

newattributes

advice

add newattributes

pointcutclassA || classB

classB

newattributes

Page 10: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

10

AspectM is nice, but …

Although AspectM provides major JPMs, there might be situations in which a modeler wants to define a JPM specific to an application.

For example, a modeler wants to capture a group of methods that are targets of an application-specific logging or transaction.

However, current aspect-oriented modeling languages including AspectM do not allow a modeler to extend JPMs.

Page 11: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

11

We want to use application-specific rich vocabularies

aspect

class

Page 12: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

12

Contribution

We introduce a mechanisms called metamodel access protocol (MMAP) that allows an application modeler to access and modify the AspectM metamodel, an extension of the UML metamodel.

MMAP enables a modeler to define a new JPM that includes application-specific join points, pointcut designators, and advice.

Page 13: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

13

2. Metamodel access protocol MMAP

Page 14: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

14

Two approaches forextending model elements in UML

LightweightAn approach using UML profiles

Heavyweight

An approach that extends the UML metamodel by using MOF (Meta Object Facility), a language for modeling a metamodel

Page 15: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

15

UML profile approach

UML profiling mechanisms use stereotypes for introducing rich vocabularies.

While an application modeler can easily introduce some kinds of application-specific JPMs, there are situations in which stereotypes as a mere annotation mechanism are insufficient: the typing of tags is weak; and we cannot declare new associations among UML metamodel elements.

Page 16: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

16

Problems in UML profiles

aspect

class

Stereotypes as annotations cannot describe relations among application-specific model elements including DCEntityContract, DCControllerContract,UniqueId, and DCLogger.

Stereotypes as annotations cannot describe relations among application-specific model elements including DCEntityContract, DCControllerContract,UniqueId, and DCLogger.

Page 17: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

17

MOF approach

MOF approach is very strong because all of the metamodel elements can be extended.

However, it is not easy for an application modeler to extend the UML metamodel by using the full power of the MOF.

Page 18: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

18

Our approach -- MMAP

Our approach is a middle weight approach that restricts available extension by MOF.

MMAP (Metamodel Access Protocol) aims at introducing an application-specific JPM. An application modeler can access and modify the AspectM metamodel by using protocols exposed by MMAP.

The target of MMAP is not a tool developer that needs full access to the AspectM metamodel but an application modeler that wants to introduce rich vocabulary at small cost.

Page 19: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

19

Our concept

AspectM metamodel

AspectM model

introducea new kind of

application-specificmodel element

modifythe AspectMmetamodel

reflect

reify

MMAP

extensionpoint

new modelelement

protocols

model editor

base level(MOF L1)

base level(MOF L1)

meta level(MOF L2)

meta level(MOF L2)

Editing-timereflection

Page 20: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

20

MMAP

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

Extension operationsdefine subclassesadd attributes to

subclassescreate associations

among subclassesPrimitive predicatespredicates for navigating

the AspectM metamodel

AspectM metamodel

Page 21: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

21

MMAP: Primitive predicates

Predicate Explanation

meta-class-of (mc, c) mc is a metaclass of cmember-of (m, c) m is a member of a class cvalue-of (v, a) v is value of an attribute asuper-class-of (c1, c2) c1 is a superclass of c2related-to (c1, c2) c1 is related to c2

Page 22: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

22

Example

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 model

Meta model

Page 23: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

23

MMAP vs. MOP

The idea of MMAP originates in the mechanisms of extensible programming languages, such as metaobject protocol (MOP) and computational reflection.

MOP is useful at the modeling-level although the targets of MOP are different from those of MMAP: the former focuses on execution behavior, and the latter focuses on model structures.

Page 24: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

24

3. Implementation

Page 25: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

25

Our Prototype AspectM Tools

Prolog predicat

esUML diagrams

Aspect diagrams

Model Editor

XMI (from UML diagrams)

XSLT: Model Tranformation(from Aspect diagrams)

XMI (UML)

Java code

Model Compiler

AspectM metamodel

AspectM metamodel and application models are transformed to a set of Prolog predicates.

Model transformation accesses these model elements by MMAP predicates.

Page 26: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

26

4. Related work

Page 27: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

27

Related Work

Three-part modeling framework [ECOOP2003, H.Masuhara and G.Kiczales]

Parameterized AO interpreter [ASE2005, N.Ubayashi et al.] XAspect [OOPSLA2003, M.Shonle, K.Lieberherr, and A.Shah] Versatile kernel for multi-language AOP [GPCE2005,

E.Tanter and J.Noye]

Extensible AOP language

In AspectM, application-specific AOP features can be introduced by using MMAP.

Page 28: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

28

Related Work (Cont’d)

Domain-specific aspect-oriented modeling [GPCE2003, J.Gray]

Domain-specific aspect orientation

Reflective editorEdit-time metaobject protocol ETMOP [ODAL2006, A.D.Eisenberg and G.Kiczales

Page 29: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

29

5. Conclusion

Page 30: Metamodel Access Protocols for Extensible Aspect-Oriented Modeling

30

Conclusion

We proposed MMAP that enables a modeler to define a new JPM that represents application-specific crosscutting concerns.

Our approach is the first step towards extensible aspect-oriented modeling based on metamodel access protocols.