260 likes | 422 Views
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.
E N D
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
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
AO Mechanism -- JPM--- JPM: Join Point Mechanism advice join point pointcut logging code program execution points including method calls and field access points extract a set of join points related to a specific crosscutting concern from all join points raise effects at the join points AspectJ aspect Logging { pointcut publiccall (): call (public * *(..)); before() : publiccall() {logging(); } }
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.
Advice Join Point Type : Open Class Add “log()”method to join point Aspects at the modeling-level are typically static structures AspectM Aspect name : Logging Pointcut cname(‘Customer’) || cname(‘Invoice’) AspectM JPMの簡易表も載せる ・DC におけるLogging の例(AspectMエディタで作成)。ただし、ここではモデル拡張していない版。 ・モデルweavingがわかるようにアニメーションにする
AspectM is nice, but … {isUserAssigned=false} {isUserAssigned=true} {isUserAssigned=false} pointcut-body:= !DCEntityContract_UniqueId_isUserAssigned(*) advice-body := <<DCLoggerOperation>>log() There might be situations in which a modeler wants to introduce domain-specific notations and JPMs. ・同じくDC におけるLogging 例。ただし、こちらはモデル拡張した版。 ・こちらもアニメーションにする
Need to extend the AspectM metamodel MOF is not easy ! However, … • The metamodel is too complex ! • It is difficult for a modeler to extend and modify the metamodel !
Our Approach We provide a model management method for extending the metamodel. MMAP & Reflective Model Editor DSL Components (Components for constructing UML-based DSL) Lightweight mechanism for extending the metamodel Componentization of metamodel extension
2. Management of Metamodel Extension
AspectM metamodel AspectM model Concept -- MMAP, Reflective Model Editor and DSL Components Meta level reify modify the AspectM metamodel protocols extension point DSL Components MMAP Editing-time structural reflection Base level reflect introduce a new kind of domain-specific model element new model element Reflective Model Editor
MMAP AspectM metamodel Extension points Class Element • Class, Attribute, Operation • PA, CM, NE, OC, RN, RL, IH Extension operations • define subclasses • add attributes to subclasses • create associations among subclasses • add constraints using OCL Aspect Element Primitive predicates • predicates for navigating the AspectM metamodel extension point example of extension operations 分かりやすい図に 置き換え!
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") member-of meta-class-of meta-class-of Meta level member-of Base level value-of
Overview of Reflective Model Editor Base Editor Extension Procedure Meta Editor Execute extension operations Assign a graphic notation to a new model element Regenerate the metamodel Restart the base editor
Demonstration Invoke the Meta Editor Overview of Reflective Model Editor Base Editor Extension Procedure Meta Editor Execute extension operations Assign a graphic notation to a new model element Regenerate the metamodel Restart the base editor Base Editor
Add a constraint using OCL A class can have at most one UniqueId. self.owner.feature ->select(oclIsTypeOf(UniqueId))->size() <= 1 Show an extension point Rebuild the Base Editor Create a new metaclass Execute extension operations (add attribute, association, …) Assign a graphic notation Meta 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 New model elements are added to the pallet Base Editor
Reusable DSL component Meta Editor Base Editor
Implementation (1) -- Reflective Model Editor Core Editor Generator Modeler Eclipse Modeling Framework Code Generator for EMF Metamodel for EMF Code of Model Editor Meta Editor Map model for GMF Extended Metamodel Graphical Modeling Framework Tool model for GMF Base Editor Code Generator for GMF Code of Graphic Editor Graph model for GMF Graphic Editor Generator Interface 英語版に置き換え!
Implementation (2) -- Model Weaver Model Weaver Model Editor Weaving write Non Woven Model Woven Model Base Editor analyze pointcut convert Fact Modeler Prolog 追加
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]
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