model-view-controller architecture specific model transformation october 25, 2009dsm'091...

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

Upload: nicholas-lucas

Post on 18-Dec-2015

217 views

Category:

Documents


3 download

TRANSCRIPT

Model-View-Controller Model-View-Controller Architecture SpecificArchitecture SpecificModel TransformationModel Transformation

October 25, 2009 DSM'09 1

Hiroshi Kazato1,2, Rafael Weiss1, Shinpei Hayashi1,Takashi Kobayashi3 and Motoshi Saeki1

1 NTT DATA CORPORATION2 Tokyo Institute of Technology

{kazato,rweiss,hayashi,saeki}@se.cs.titech.ac.jp3 Nagoya University

[email protected]

AgendaAgenda

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

• PIM Profile• PIM-to-PSM Transformation• Process & Tool Chain

Case Study Related Work Conclusion

October 25, 2009 DSM'09 2

IntroductionIntroduction

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 Generative UML/MDA tools seemed promising to

bring interoperability of design models• e.g. AndroMDA, openArchitectureWare• UML profiles and code generators took over from

platforms

October 25, 2009 DSM'09 3

MotivatingMotivating ExampleExample

Model migration: EJB → Spring + Hibernate

October 25, 2009 DSM'09 4

(a) UML with EJB profile (b) UML with Spring + Hibernate profiles

Solution:Solution: PivotPivot TechniqueTechnique

Provide an intermedieate metamodel (“pivot”) and its mappings to concrete metamodels.

How can I define such a pivot for user-interactive applications?

October 25, 2009 DSM'09 5

mmpvmm3

mm2

mm1

mpvm3

m2

m1

Instance of

Instance of

Instance of

instance of

“pivot”metamodel

concretemetamodels

model-to-modeltransformation

Model-View-ControllerModel-View-Controller 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»

October 25, 2009 DSM'09 6

Buschmann et al. “Pattern-Oriented Software Architecture: A System of Patterns”, Wiley & Sons, 1996

+initialize(model : Model, view : View)+handleEvent()+update()

Controller

-coreData

+attach(observer : Observer)+detach(observer : Observer)+notify()+getData()+service()

Model

+update()

Observer

+initialize(model : Model)+makeController()+activate()+display()+update()

View

-myController-myView

-myModel

CategorizingCategorizing PlatformsPlatformsDesign Concept

Target Platform

Stereotype used by Code Generator

Source Code

Model Java ObjectSerialization

«JavaObject» POJO (implementing java.io.Serializable)

EJB «Entity» CMP Entity Bean

Hibernate «Entity» POJO +XML (Hibenate Mapping)

View Swing «JavaObject» POJO (Swing Component)

Struts «ActionForm» JSP +ActionForm

JSF «ManagedBean» XHTML +ManagedBean

Controller POJO «JavaObject» POJO

EJB «Session» Stateless Session Bean

Struts «Action» Action

Spring «Service» POJO

October 25, 2009 DSM'09 7

PIMPIM ModelingModeling

Restrict desgin model into Model-View-Controller architecture style

MVC Profile (“ACCURATE “)• «model»• «view»• «controller»• «external»

October 25, 2009 DSM'09 8

PIM-to-PSMPIM-to-PSM TransformationTransformation

mapping Class::toPSMClass() : Class { name := self.name.firstToUpper(); isAbstract := self.isAbstract; visibility := self.visibility; ... ownedAttribute := self.ownedAttribute->map toProperty()->asOrderedSet(); ownedOperation := self.ownedOperation->map toOperation()->asOrderedSet();}

mapping Class::toService():Class inherits Class::toPSMClasswhen{ self.isStereotypeApplied(ACCURATE::controller)}{ end { result.applyStereotype(Spring2::Service); }}

October 25, 2009DSM'09 9

Basic mapping

Modifystereotype

ProcessProcess && ToolTool ChainChain

October 25, 2009 DSM'09 10

MagicDraw M2M QVTo

oAW

Fornax-Platform

CaseCase StudyStudy Address book

• create/save/open address book

• add/edit/delete entries

October 25, 2009 DSM'09 11

FirstFirst GenerationGeneration

October 25, 2009 DSM'09 12

PIM Mark PSM Mark PSI Type Generated Preserved

«model» «Entity» POJO 6 0

DAO 6 0

Hibernate Settings 4 0

«view» «JavaObject» Swing 9 0

«controller» «JavaObject» POJO 6 0

Platform: Hibernate + Swing + POJO

SecondSecond GenerationGeneration

October 25, 2009 DSM'09 13

PIM Mark PSM Mark PSI Type Generated Preserved«model» «Entity» POJO 4 2

DAO 4 2Hibernate Settings 4 0

«view» «SpringBean» Swing 6 3Spring Settings 1 0

«controller» «Service» POJO 4 2Spring Settings 1 0

N/A N/A Spring Context Helper 2 0Spring Settings 2 0

Platform: Hibernate + Swing + Spring

RelatedRelated WorkWork ATL Project [7]• Pivot technique• ATLAS transformation language GignoMDA [11]• Defines PIM profiles for database application• Generate Eclipse RCP based database application using

AndroMDA• Focusing on cross-layer optimizaton of database

applications

October 25, 2009 DSM'09 14

ConclusionConclusion

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 Future works

• Further evaluation• Platform decision model• Interoperation with coding (e.g. reverse mapping)

October 25, 2009 DSM'09 15

ThankThank you.you.

Any questions?

October 25, 2009 DSM'09 16