towards executable aspect-oriented uml models 10th int. workshop on aspect-oriented modeling (aom),...
Post on 11-Jan-2016
216 Views
Preview:
TRANSCRIPT
Towards Executable Aspect-Oriented UML Models
10th Int. Workshop on Aspect-Oriented Modeling (AOM),6th Int. Conf. on Aspect-Oriented Software Development (AOSD)
March 12th, 2007. Vancouver British Columbia (Canada)
Lidia Fuentes and Pablo SánchezDpto. Lenguajes y Ciencias de la Computación
Universidad de Málaga, (Spain){lff,pablo}@lcc.uma.es
AOSD for improving modularization
I would like to separate my crosscutting concerns
AOSD for improving modularization
I would like to separate my crosscutting concerns
AOSD !!
!!
Reasoning about AO Models
Base ModelsBase Models
Reasoning about AO Models
Base ModelsBase Models
Aspect ModelsAspect Models
Reasoning about AO Models
Base ModelsBase Models
Aspect ModelsAspect Models
Pointcut ModelsPointcut Models
{hook=BEFORE_SEND}
*:* Bank
pay(..)
Reasoning about AO Models
Base ModelsBase Models
Aspect ModelsAspect Models
Pointcut ModelsPointcut Models
{hook=BEFORE_SEND}
*:* Bank
pay(..)
?
Simple solution
• If I want to know what my model does, the quickest way is to execute it.
• UML models can be executed (UML Action Semantics).
• There are tools that execute UML models (e.g. Telelogic Rhapsody, KC iUML).
Simple solution
• If I want to know what my model does, the quickest way is to execute it.
• UML models can be executed (UML Action Semantics).
• There are tools that execute UML models (e.g. Telelogic Rhapsody, KC iUML).
XMI
Simple solution
• If I want to know what my model does, the quickest way is to execute it.
• UML models can be executed (UML Action Semantics).
• There are tools that execute UML models (e.g. Telelogic Rhapsody, KC iUML).
XMI
Base ModelsBase Models Aspect Models
Aspect ModelsPointcut Models
Pointcut Models
{hook=BEFORE_SEND}
*:* Bankpay(..)
XMI
WeaverWeaver
Woven ModelsWoven Models
The Online Book Store System
• The Online Book Store has to provide a way for customers to place orders for books.
• A customer will start a new order by selecting a book and specifying the required quantity.
• The customer can continue adding more books to the order.• Once the customer is satisfied with his/her selections, the order goes to the
check out stage. • Each time a new book is added to the order, the order must be persisted. • Persistence is a crosscutting concern !! => AO modeling
Base model (plain Executable UML)
OBS System<< component >> Delivery
<< component >>
CreditCard<< component >>
Network
(1) Decompose the system into a set of interconnected components
Base model (plain Executable UML)
(2) Model internals of each component (OBS System in the figure)
ShoppingCart
+addItem( book : Book, quantity : int )+removeItem( book : Book )+checkOut()
Customer
-name : String-creditCard : String
+getCreditCard() : String
Book
-author : String-title : StringClerk
+packOrder()
System
+register()+unregister()
1..*
0..*
1..*
SelectedProduct
-quantity : Integer
-books
Base model (plain Executable UML)
(3) Construct a state machine by each class (ShoppingCart in the figure)
ItemsAdded
addItem( book : Book, quantity : int ) / UpdateItems
WaitingForCreditConfirmation
Empty
WaitingForDeliveryConfirmation
addItem( book : Book, quantity : int ) / UpdateItems
[else] / notifyProblem [creditOk=true & deliveryOk=true] / sendOk
checkOut() / doCheckOut
Behaviors are associated to transition events => modeled as activity diagrams
Base model (plain Executable UML)
(3) Specify each behavior (UpdateItems in the diagram) using activity diagrams and actions
This does not have Persistence.
<<WriteStructuralFeature>>
Quantity
valuebook
<<ReadSelf>>
ThisShoppingCart
SelectedProduct<<CreateLinkObject>>
book
cart
quantity : intbook : BookShoppingCart
+addItem( book : Book, quantity : int )+removeItem( book : Book )+checkOut()
Customer
-name : String-creditCard : String
+getCreditCard() : String
Book
-author : String-title : StringClerk
+packOrder()
System
+register()+unregister()
1..*
0..*
1..*
SelectedProduct
-quantity : Integer
-books
Aspect model (AOEM Profile)
Joinpoint model
(1) Object creation and destruction; (2) The sending and reception of a message/method; (3) The throwing of an event; (4) The raising of an exception.
Suitable for being used with black-box components, services or legacy systems
Aspect model (AOEM Profile)
Persistence<<aspect>>
<<advice>>+persist()
<<component>>
PersistentIPersistence
(1) We create the Persistence aspect.
Aspect model (AOEM Profile)
(2) We specify the advice behaviour.
<<GetTarget>>
GetSettedComp
<<Literal>>
"Persistent"
<<CallBehavior>>
GetReference<<CallBehavior>>
persist
object
target
GetSource Returns a reference to the source of the intercepted message
GetTarget Returns a reference to the target of the intercepted message
Proceed Executes the intercepted behavior
GetArg(n) Returns the n-argument of the intercepted message
GetMessName Returns the name of the intercepted message
Aspect model (AOEM Profile)
(3) We model the pointcuts.
add*(..)
<<pointcut>>sd ShoppingCartUpdate
:ShoppingCart
<<joinpoint>>
{point = RECEIVE, time = AFTER}
{advice = Persistence.persist()}
Aspect weaving
• As the final behavior of base classes and aspects is expressed by means of activity diagrams, the weaving problem can be reduced to weaving activity diagrams.
• Two phases: joinpoint selection and aspect injection.
Joinpoint selection
• Pointcuts are processed to generate XPath expressions that are used to search selected joinpoints (UML models are serialized into XMI).
• Information required by the weaver is added to each selected joinpoint (e.g., advice to be injected).
Aspect weaving
CallOperation
arg1 arg2
target
result
O2 O3
O4
O1
arg1
arg2
result
Action1
Source Object Target Object
Action N
...
O5
O6
1
2
3
4
5
6
Advice injection(1) Select the place where the advice must be injected.(2) Translate special AO actions into UML plain actions.(3) Reroute control and object flows to ensure correctness of the composition
BEFORE AFTER AROUND
SEND 1 2 3
RECEIVE 4 5 6
Aspect weaving
Advice injection(1) Select the place where the advice must be injected.(2) Translate special AO actions into UML plain actions.(3) Reroute control and object flows to ensure correctness of the composition
<<structured>>
<<ReadSelf>>
ThisShoppingCart
target <<CallOperation>>
persist
argument
<<CallBehavior>>
GetReference
result
<<Literal>>
Persistence
<<WriteStructuralFeature>>
WriteQuantity
value
argument
<<ReadSelf>>
ThisShoppingCart
SelectedProduct<<CreateLinkObject>>newBook
bookcart
quantity : intbook : Book
C1
C2
Aspect weaving
Advice injection(1) Select the place where the advice must be injected.(2) Translate special AO actions into UML plain actions.(3) Reroute control and object flows to ensure correctness of the composition
<<structured>>
<<ReadSelf>>
ThisShoppingCart
target <<CallOperation>>
persist
argument
<<CallBehavior>>
GetReference
result
<<Literal>>
Persistence
<<WriteStructuralFeature>>
WriteQuantity
value
argument
<<ReadSelf>>
ThisShoppingCart
SelectedProduct<<CreateLinkObject>>newBook
bookcart
quantity : intbook : Book
C1
C2
Experiments and Future Work
• Lack of UML tools that – Execute models– Export/Import to XMI, including actions, adequately.
• UML2 de Eclipse for UML modeling• Telelogic Rhapsody for UML execution• Solution: Use UML2 and import manually the woven in
Rhapsody for validating the results.• As future work:
– Develop an academic UML execution engine for our own experimentation.
– Replace the current pointcut model by JPDD’s or similar.
Questions ?
Have I explained it clearly ?
Any question or suggestion ?
Thanks for your attention
top related