An Extensible Aspect-Oriented Modeling Environment

Preview:

DESCRIPTION

CAiSE 2009. An Extensible Aspect-Oriented Modeling Environment. Naoyasu Ubayashi , Kazuhide Noda, Genya Otsubo , and Jun Yoshida. June 11, 2009. Today’s Talk -- Extensible AOM Environment. AspectM (UML-based AOM language) [ Ubayashi , et al. 2005, 2006] . Key Technologies - PowerPoint PPT Presentation

Citation preview

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

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

An ExtensibleAspect-Oriented Modeling

Environment

Naoyasu Ubayashi, Kazuhide Noda, Genya Otsubo, and Jun Yoshida

CAiSE 2009

June 11, 2009

POSLposl.minnie.ai.kyutech.ac.jp

2

Today’s Talk -- Extensible AOM Environment

Base Editor

Meta Editor

Reflective Model Editor

Model Weaver(Compiler)

JavaCode

Case Study & EvaluationDSML forEmbedded Systems

AOM: Aspect-Oriented ModelingDSML: Domain-Specific Modeling Language

AspectM (UML-based AOM language) [Ubayashi, et al. 2005, 2006]

Key Technologies

Edit-time Structural ReflectionExtensible Model Weaving

POSLposl.minnie.ai.kyutech.ac.jp

3

Outline

An Overview of AspectM AspectM Support Tool Case Study & Evaluation Related Work Conclusion

POSLposl.minnie.ai.kyutech.ac.jp

4

1. An Overview of AspectM

POSLposl.minnie.ai.kyutech.ac.jp

5

AspectM: Crosscutting Concerns in Modeling

AspectM JPM の簡易表も載せる

JPM (Join Point Model) Join point Advice

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

CM (Composition) class merge-by-name

EL (Element) class diagram add/delete/modify-class

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

RN (Rename) class, attribute, operation rename

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

IH (Inheritance) class add/delete/modify-inheritance

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

Aspect name : Logging

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

[JPM: AO Mechanisms]

ModelWeaving

POSLposl.minnie.ai.kyutech.ac.jp

6

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

But, …

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

{isUserAssigned=false}

{isUserAssigned=false}

{isUserAssigned=true}

POSLposl.minnie.ai.kyutech.ac.jp

7

AspectM Extension Mechanism

AspectM metamodel

AspectM model

introducea new kind of

domain-specificmodel element

modifythe AspectMmetamodel

reflect

reify

MMAP

extensionpoint

new modelelement

protocols

Reflective Model Editor

Base level

Meta level

Editing-timestructuralreflection

DSLComponents

POSLposl.minnie.ai.kyutech.ac.jp

8

MMAP Extension PointsClass, Attribute,

OperationPA, CM, EL, OC, RN, RL,

IHExtension 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

POSLposl.minnie.ai.kyutech.ac.jp

9

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")

meta-class-of

member-of

meta-class-of

member-of

value-ofBase level

Meta level

POSLposl.minnie.ai.kyutech.ac.jp

10

2. AspectM Support Tool

POSLposl.minnie.ai.kyutech.ac.jp

11

An Overview of AspectM Support Tool

Base Editor

Meta Editor

Reflective Model Editor

Model Weaver(Compiler)

JavaCode

POSLposl.minnie.ai.kyutech.ac.jp

12

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

Implemented usingEclipse EMF/GMF

POSLposl.minnie.ai.kyutech.ac.jp

13

Overview of Reflective Model EditorDemonstration

Base Editor

Meta Editor 1. Execute extension

operations2. 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

14Meta Editor

Show an extension point

Create a new metaclassRebuild the Base Editor

Assign a graphic notation

Execute extension operations(add attribute, association, …)

Add a constraint using OCLA class can have at most one UniqueId.

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

15

New model elements are added to the pallet

Base Editor

This violates the constraintA class can have at most one UniqueId.

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

Base Editor can detect this error

16

Base Editor

Meta Editor

   Reusable DSML component

POSLposl.minnie.ai.kyutech.ac.jp

17

Extensible Model Weaver

Modeler Prolog

Non WovenModel

Fact

write

convert

WovenModel

Weaving

Model Weaver

analyze pointcut

Model Editor

define pointcut 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')

-- from Invoice class meta-class-of('DCEntityContract', 'Invoice'), member-of('number', 'Invoice'), meta-class-of('UniqueId', 'number'), value-of('false', 'isUserAssigned').

-- from AspectM metamodel member-of('isUserAssigned', 'UniqueId').

!DCEntityContract_UniqueId_isUserAssigned selects a set of join points (classes) that satisfy the above facts (model) ‘Invoice’

POSLposl.minnie.ai.kyutech.ac.jp

18

-- Constructing a DSML for Embedded Systems

3. Case Study & Evaluation

POSLposl.minnie.ai.kyutech.ac.jp

19

Contexts in Embedded Systems Many embedded systems not only affect

their contexts through actuators but also are affected by their contexts through sensors.

However, requirements analysis is mainly conducted from the viewpoint of system functions, and contexts are only roughly analyzed.

EmbeddedSystem

Actuator

SensorContexts

Boundary ?Association ?

Unexpected behavior might emerge in a system if a developer does not recognize any possible conflicting combinations between the system and contexts.

It is difficult to decide the boundary of contexts that should be taken into account: which contexts should be included as the targets of requirements analysis.

CAMEmb

POSLposl.minnie.ai.kyutech.ac.jp

20

Model Editor for CAMEmb

Context model of a line trace car

DSML (Domain-Specific Modeling Language) <<Context>><<Hardware>><<Sensor>><<Actuator>><<Observe>><<Control>><<Transfer>><<Noise>><<Affect>>

LEGO

POSLposl.minnie.ai.kyutech.ac.jp

21

Metamodel Extension + OCL

Hardware should observe

xor control contexts.

POSLposl.minnie.ai.kyutech.ac.jp

22

Model Weaver for CAMEmb

Total code size: 223 LOCAutomatic generated code size: 174 LOC

78 %

Context Model

SystemModel

Java

Analysis Model Design Model CodeEvaluation (Tasks for constructing DSL tool)

(Task) (Number)[Editor] 1.Extend the metamodel 8[Editor] 2.Define meta-level OCLs 8[Weaver] 3.Define aspects commonly reused in CAMEmb 3[Weaver] 4.Define aspects specific to a line trace car 11[Weaver] 5.Reuse LEGO OS components 4

Coded by hand

POSLposl.minnie.ai.kyutech.ac.jp

23

4. Related Work

POSLposl.minnie.ai.kyutech.ac.jp

24

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]

POSLposl.minnie.ai.kyutech.ac.jp

25

5. Conclusion

POSLposl.minnie.ai.kyutech.ac.jp

26

Conclusion We proposed an implementation method

for extensible AOM environments. Key technologies:

– Edit-time structural reflection– Extensible model weaving

POSLposl.minnie.ai.kyutech.ac.jp

27

Appendix

POSLposl.minnie.ai.kyutech.ac.jp

28

Problems in Extensible AOM Languages

Extensible AOM LanguageA modeler can extend metamodel.A modeler can add new aspects that include user-definedAO mechanisms (user-defined pointcuts, etc).

Does a pointcut

select join points

correctly ?

Does a base

model conform to metamodel

?

Does a woven model include cyclic

inheritances?

It is not necessarily easy to check model consistency and aspect interference.

Verification Mechanism

POSLposl.minnie.ai.kyutech.ac.jp

Model Verifyer (Assertion Checker) Assertions for checking (un)favorable

properties

29

Woven model

checkassertions

Assertionssuper_class_of (c1, c2)attribute_of (a, c)operation_of (o, c)advice_of (a, o)class_exist (c)related_to (c1, c2)aggregate(c1, c2)composed_of (c1, c2)

specifiedby predicates

base and meta modelscan be navigated using predicates

A model represented in XML<ownedElement name="TransOp" xsi:type="asm:TransactionOperation" />

Prolog factsmodelElement( [property('tagName', 'ownedElement'), property('name', 'TransOp'), property('xsi:type', 'asm:TransactionOperation')])

Assertionoperation_of ('TransOp', 'C')

Translate

Check

Recommended