ModelViewController Architecture Specific Model Transformation Hiroshi Kazato 1

  • Slides: 16
Download presentation
Model-View-Controller Architecture Specific Model Transformation Hiroshi Kazato 1, 2, Rafael Weiss 1, Shinpei Hayashi

Model-View-Controller Architecture Specific Model Transformation Hiroshi Kazato 1, 2, Rafael Weiss 1, Shinpei Hayashi 1, Takashi Kobayashi 3 and Motoshi Saeki 1 1 2 3 NTT DATA CORPORATION Tokyo Institute of Technology {kazato, rweiss, hayashi, saeki}@se. cs. titech. ac. jp Nagoya University tkobaya@is. nagoya-u. ac. jp October 25, 2009 DSM'09 1

Agenda n Introduction n Motivating Example n Solution: Pivot Technique n MVC-specific Model Transformation

Agenda n Introduction n Motivating Example n Solution: Pivot Technique n MVC-specific Model Transformation • PIM Profile • PIM-to-PSM Transformation • Process & Tool Chain n Case Study n Related Work n Conclusion October 25, 2009 DSM'09 2

Introduction n Various platforms (frameworks and libraries) can be used to build user-interactive application

Introduction n Various platforms (frameworks and libraries) can be used to build user-interactive application • e. g. EJB, Struts, Spring, Hibernate, JSF • Coming one after another, introducing somehow familiar concepts in brand-new names n Generative UML/MDA tools seemed promising to bring interoperability of design models • e. g. Andro. MDA, open. Architecture. Ware • UML profiles and code generators took over from platforms October 25, 2009 DSM'09 3

Motivating Example n Model migration: EJB → Spring + Hibernate (a) UML with EJB

Motivating Example n Model migration: EJB → Spring + Hibernate (a) UML with EJB profile (b) UML with Spring + Hibernate profiles October 25, 2009 DSM'09 4

Solution: Pivot Technique n Provide an intermedieate metamodel (“pivot”) and its mappings to concrete

Solution: Pivot Technique n Provide an intermedieate metamodel (“pivot”) and its mappings to concrete metamodels. n How can I define such a pivot for user-interactive applications? “pivot” metamodel mm pv concrete metamodels model-to-model transformation mm 3 mm 2 Instance of instance of mm 1 mpv Instance of m 3 m 2 Instance of m 1 October 25, 2009 DSM'09 5

Model-View-Controller n Architecture style which defines typical structure and behavior of a user-interactive application

Model-View-Controller n Architecture style which defines typical structure and behavior of a user-interactive application • «model» provides core functionalities (i. e. logic and data) • «view» shows information to a user • «controller» interprets user operations as a request to perform some functionality on the «model» Observer +update() Model -core. Data +attach(observer : Observer) +detach(observer : Observer) +notify() +get. Data() +service() View +initialize(model : Model) -my. Model +make. Controller() +activate() +display() -my. View +update() -my. Controller +initialize(model : Model, view : View) +handle. Event() +update() Buschmann et al. “Pattern-Oriented Software Architecture: A System of Patterns”, Wiley & Sons, 1996 October 25, 2009 DSM'09 6

Categorizing Platforms Design Concept Target Platform Stereotype used by Code Generator Source Code Model

Categorizing Platforms Design Concept Target Platform Stereotype used by Code Generator Source Code Model Java Object Serialization «Java. Object» POJO (implementing java. io. Serializable) EJB «Entity» CMP Entity Bean Hibernate «Entity» POJO + XML (Hibenate Mapping) Swing «Java. Object» POJO (Swing Component) Struts «Action. Form» JSP + Action. Form JSF «Managed. Bean» XHTML + Managed. Bean POJO «Java. Object» POJO EJB «Session» Stateless Session Bean Struts «Action» Action Spring «Service» POJO View Controller October 25, 2009 DSM'09 7

PIM Modeling n Restrict desgin model into Model- View-Controller architecture style n MVC Profile

PIM Modeling n Restrict desgin model into Model- View-Controller architecture style n MVC Profile (“ACCURATE “) • • «model» «view» «controller» «external» October 25, 2009 DSM'09 8

PIM-to-PSM Transformation mapping Class: : to. PSMClass() : Class { name : = self.

PIM-to-PSM Transformation mapping Class: : to. PSMClass() : Class { name : = self. name. first. To. Upper(); is. Abstract : = self. is. Abstract; visibility : = self. visibility; . . . owned. Attribute : = self. owned. Attribute->map to. Property()->as. Ordered. Set(); owned. Operation : = self. owned. Operation->map to. Operation()->as. Ordered. Set(); } Basic mapping Class: : to. Service(): Class inherits Class: : to. PSMClass when{ self. is. Stereotype. Applied(ACCURATE: : controller) }{ end { result. apply. Stereotype(Spring 2: : Service); } } October 25, 2009 DSM'09 Modify stereotype 9

Process & Tool Chain Magic. Draw M 2 M QVTo o. AW Fornax-Platform October

Process & Tool Chain Magic. Draw M 2 M QVTo o. AW Fornax-Platform October 25, 2009 DSM'09 10

Case Study n Address book • create/save/open address book • add/edit/delete entries October 25,

Case Study n Address book • create/save/open address book • add/edit/delete entries October 25, 2009 DSM'09 11

First Generation n Platform: Hibernate + Swing + POJO PIM Mark PSI Type Generated

First Generation n Platform: Hibernate + Swing + POJO PIM Mark PSI Type Generated Preserved «model» «Entity» POJO 6 0 DAO 6 0 Hibernate Settings 4 0 «view» «Java. Object» Swing 9 0 «controller» «Java. Object» POJO 6 0 October 25, 2009 DSM'09 12

Second Generation n Platform: Hibernate + Swing + Spring PIM Mark «model» PSM Mark

Second Generation n Platform: Hibernate + Swing + Spring PIM Mark «model» PSM Mark «Entity» «view» «Spring. Bean» «controller» «Service» N/A PSI Type POJO DAO Hibernate Settings Swing Spring Settings POJO Spring Settings Spring Context Helper Spring Settings October 25, 2009 DSM'09 Generated 4 4 4 6 1 4 1 2 2 Preserved 2 2 0 3 0 2 0 0 0 13

Related Work n ATL Project [7] • Pivot technique • ATLAS transformation language n

Related Work n ATL Project [7] • Pivot technique • ATLAS transformation language n Gigno. MDA [11] • Defines PIM profiles for database application • Generate Eclipse RCP based database application using Andro. MDA • Focusing on cross-layer optimizaton of database applications October 25, 2009 DSM'09 14

Conclusion n Summary • Defined a “pivot” for MVC based application using a UML

Conclusion n Summary • Defined a “pivot” for MVC based application using a UML profile and QVT transformations • Employed MVC concepts in order to categorize various platforms and find transformation mappings n Future works • Further evaluation • Platform decision model • Interoperation with coding (e. g. reverse mapping) October 25, 2009 DSM'09 15

Thank you. n Any questions? October 25, 2009 DSM'09 16

Thank you. n Any questions? October 25, 2009 DSM'09 16