a verification mechanism for weaving in extensible aom languages

27
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan http://posl.minnie.ai.kyutech.ac.jp/ 1 A Verification Mechanism for Weaving in Extensible AOM Languages Naoyasu Ubayashi , Yusaku Maeno, Kazuhide Noda and Genya Otsubo ADI2007 @ ECOOP2007 July 30, 2007

Upload: anana

Post on 13-Jan-2016

42 views

Category:

Documents


0 download

DESCRIPTION

ADI2007 @ ECOOP2007. A Verification Mechanism for Weaving in Extensible AOM Languages. Naoyasu Ubayashi , Yusaku Maeno, Kazuhide Noda and Genya Otsubo. July 30, 2007. Outline. Motivation AspectM: an extensible AOM language Verification mechanism Conclusion. 1. Motivation. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A Verification Mechanism for Weaving in Extensible AOM Languages

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

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

1

A Verification Mechanismfor Weaving in Extensible AOM

Languages

Naoyasu Ubayashi, Yusaku Maeno, Kazuhide Noda and Genya Otsubo

ADI2007 @ ECOOP2007

July 30, 2007

Page 2: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

2

Outline Motivation AspectM: an extensible AOM language Verification mechanism Conclusion

Page 3: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

3

1. Motivation

Page 4: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

Extensible AOM language AOM (Aspect-oriented Modeling)

languages can cope with concerns at the early stages of the software development phases.

We previously proposed a UML-based AOM language called AspectM.

AspectM is an extensible AOML based on MMAP (Metamodel Access Protocol).

The extension mechanism in AspectM is effective for constructing domain-specific modeling languages.

4

Page 5: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

Problems in extensible AOM languages

5

Extensible AOM LanguageA modeler can extend metamodel.A modeler can add new aspects that include user-defined JPMs.(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

Page 6: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

6

2. AspectM: an extensible AOM language

Page 7: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

7

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

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

Aspect name : Logging

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

Page 8: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

8

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 Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

9

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 levelBase level

Meta levelMeta level

Editing-timestructuralreflection

DSLComponents

Page 10: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

10

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 11: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

11

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 12: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

13

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 13: A Verification Mechanism for Weaving in Extensible AOM Languages

14Meta 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 14: A Verification Mechanism for Weaving in Extensible AOM Languages

15

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 15: A Verification Mechanism for Weaving in Extensible AOM Languages

16

Base Editor

Meta Editor

   Reusable DSL component

Page 16: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

17

3. Verification mechanism

Page 17: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

What should be checked ? Structural correctness (Syntax check) Intention of a modeler (Semantic check)

18

Page 18: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

[Syntax Check] Structural correctness Consistency between base models and

metamodel– Base models might not conform to metamodel if it evolves

(metamodel can be modified by a modeler).– A woven model might not conform to metamodel even if

each base model before weaving conforms to metamodel (aspects can be added by a modeler).

– A woven model might include inference including name conflicts, multiple inheritance and cyclic inheritance.

19

ExtendedMetamodel

V1

checkconformance

ExtendedMetamodel

V2

Base model

Woven model

ExtendedMetamodel

evolution(introduce

new elements)

weaving

checkconformance

&inference

Page 19: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

Model structure checker

1. Generate a default schema from the original metamodel.

2. Check whether the metamodel is extended.3. Redefine the schema if extended.4. Check whether a base model conforms to the

extended metamodel.

20

1 :<xsd:complexType name="ClassType"> 2 : <xsd:choice maxOccurs="unbounded" minOccurs="0"> 3 : <xsd:element name="Attribute" type="AttributeType"/> 4 : <xsd:element name="Operation" type="OperationType"/> 5 : <xsd:element name=“TransactionOperation" type=" TransactionOperationType"/> 6 : </xsd:choice> 7 : <xsd:attribute name="name" type="Name" use="required"/> 8 : <xsd:attribute name="isAbstract" type="Boolean" use="optional"/> 9 : </xsd:complexType>10 :11 : <xsd:complexType name=" TransactionOperationType ">12 : <xsd:complexContent>13 : <xsd:extension base=“OperationType“/>14 : </xsd:complexContent>15 : </xsd:complexType>

Page 20: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp[Semantic Check] Intention of a

modeler Assertions for checking (un)favorable

properties– Captured join points might not be the points intended

by a modeler.– Intended results might not be obtained when a modeler

makes a mistake in specifying the precedence.– The mixture of illegal pointcut designators and illegal

aspect precedence might cause an unexpected weaving.

21

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

Page 21: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

Assertion checker1. Translate base and meta models into Prolog facts.2. Generate Prolog queries from assertions.3. Check the satisfiability.

22

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

Assertion for checking the effect of a single aspect can be automatically generated.

Page 22: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

23

4. Conclusion

Page 23: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

24

Conclusion & Future work

We clarified how the metamodel extension affects the verification of the weaving.

We proposed a verification mechanism for weaving in extensible AOM languages.

Currently, only simple cases are shown. We must prepare verification mechanisms corresponding to the

purpose of AO modeling (Behavior modification, Refinement (MDA) …)

Constraints specified in metamodel can be useful for verifying a weaving.

Page 24: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

Constraint preservation In AspectM, pre-/post-conditions and invariants

can be specified for rigorous modeling. However, a weaving might break the constraint

specified in a model before weaving.

25

What kind of weaving should be allowed ?

For example, behavior subtyping ( MDA, … ), and so on.

A first step towards verifying model weaver

Page 25: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

26

Appendix

Page 26: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

27

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 27: A Verification Mechanism for Weaving in Extensible AOM Languages

POSLposl.minnie.ai.kyutech.ac.jp

28

Implementation (2) -- Model weaver

Base Editor

ModelerProlog

Non WovenModel

Fact

write

convert

WovenModel

Weaving

Model Weaver

analyze pointcut

Model Editor