02291: System Integration Components (part II) Hubert Baumeister - - PowerPoint PPT Presentation

02291 system integration
SMART_READER_LITE
LIVE PREVIEW

02291: System Integration Components (part II) Hubert Baumeister - - PowerPoint PPT Presentation

02291: System Integration Components (part II) Hubert Baumeister huba@dtu.dk DTU Compute Technical University of Denmark Spring 2020 Problem for the connection of components BankATM verifyPIN verifyPIN withdraw Clearing Bank ATM


slide-1
SLIDE 1

02291: System Integration

Components (part II) Hubert Baumeister

huba@dtu.dk

DTU Compute Technical University of Denmark

Spring 2020

slide-2
SLIDE 2

Problem for the connection of components

pinNotOK pinOk verifyPIN verifyPIN withdraw pinOk pinNotOK withdrawOK withdrawNotOk

Company Clearing− Bank ATM BC BankATM AB CB BA

Interconnecting Components: What can go wrong?

  • 1. message sent but not understood
  • 2. message sent but component is not ready to receive
  • 3. component waits for a message not sent

◮ . . .

slide-3
SLIDE 3

Solution for 1: Interfaces

Port AB Bank Clearing Company ATM Port BC Port BA Provided Interface by port AB Required Interface by port BA Provided Interface by port BA Required Interface by port AB Bank ATM <<interface>> AtmToBank pinOK pinNotOK withdrawOk withdrawNotOk <<interface>> BankToAtm verifyPIN(iban:IBAN, pin:int) withdraw(iban, amount:Money)

slide-4
SLIDE 4

Solution for 2+3: Protocol state machines

Protocol state machine ◮ Associated to provided interfaces of a port ◮ Sending messages to the required interface ◮ [post] usually [ˆm] meaning: A message m has been sent to the required interface

s2 s1 [pre] operation / [post]

Behavioural state machine

s2 s1

  • peration [guard] / action
slide-5
SLIDE 5

Solution for 2+3: Protocol state machines

Protocol for the interface BankToAtm which is the provided interface of PortBA and the required interface of PortAB

withdrawing withdraw verifying idle sm: BankToAtm {protocol} /[^pinNotOk] /[^withdrawOk] /[^withdrawNoOk] withdraw(i,a) /[^pinOk] verifyPin(p)

slide-6
SLIDE 6

Solution for 2+3: Protocol state machines

Protocol for the interface BankToAtm which is the provided interface of PortBA and the required interface of PortAB

withdrawing withdraw verifying idle sm: BankToAtm {protocol} /[^pinNotOk] /[^withdrawOk] /[^withdrawNoOk] withdraw(i,a) /[^pinOk] verifyPin(p)

Protocol for interface AtmToBank which is the provided interface of PortAB and the required interface of portBA

waiting AtmToBank {protocol} Idle pinOk pinNotOk /[^verifyPin]

slide-7
SLIDE 7

Protocol state machines

Protocol for the interface BankToAtm which is the provided interface of PortBA and the required interface of PortAB

withdrawing withdraw verifying idle sm: BankToAtm {protocol} /[^pinNotOk] /[^withdrawOk] /[^withdrawNoOk] withdraw(i,a) /[^pinOk] verifyPin(p)

Protocol for interface AtmToBank which is the provided interface of PortAB and the required interface of portBA

waiting AtmToBank {protocol} Idle Withdraw pinNotOk /[^verifyPin] pinOk/[^withdraw(i,a)] withdrawNotOk withdrawOk

slide-8
SLIDE 8

Exercise: Bank to Clearing Company

Port AB Bank Clearing Company ATM Port BC Port BA Provided Interface by port AB Required Interface by port BA Provided Interface by port BA Required Interface by port AB

«interface» CcToBank verifyPin(p) «interface» BankToCc pinOk pinNotOk

What are the two PSM’s for the two interfaces?

slide-9
SLIDE 9

PSM’s CcToBank and BankToCc

«interface» CcToBank verifyPin(p) «interface» BankToCc pinOk pinNotOk

slide-10
SLIDE 10

Implementing components by components

UML User Manual, Grady Booch

slide-11
SLIDE 11

Bank component showing Implementation by classes

Bank Bank Customer Account ClearingCompanyToBank BankToAtm

*

«delegate» «delegate» * BankToATMPort «delegate» BankToClearingCompany AtmToBank «delegate»

slide-12
SLIDE 12

Detailed Class Diagram for the Bank Component

Port BC Port BA <<interface>> BankToClearingCompany pinOK pinNotOk <<interface>> ClearingCompanyToBank verifyPIN(a,p) <<interface>> BankToAtm verifyPIN(a,p) withdraw(a,m) BankToATMPort verifyPIN(a,p) withdraw(a,m) pinOK pinNotOk Account number : IBAN balance : int withdraw(amount:int): bool ... Customer name address ... <<interface>> AtmToBank pinOK pinNotOK withdrawOk withdrawNotOk Bank name: String ... pinOK pinNotOk accountFor(a): Account ... 1 atm * 1 b * c * 1..* 1..* 1 cc

slide-13
SLIDE 13

Behaviour implementation

Lifecycle state machine BankToATMPort

withdrawing waiting for withdraw verifying idle sm: BankToATMPort withdrawOk/atm.withdrawOK withdrawNotOk/atm.withdrawNotOk widthdraw(a,m)/b.withdraw(self,a,m) pinOK/atm.pinOK pinNotOk/atm.pinNotOk verifyPin(a,p)/b.verifyPin(self,ap,p)

Lifecycle state machine Bank

waiting for withdraw withdrawing waiting for verification verifying idle sm: Bank pinOK/p.pinOK [wok]/p.widthdrawOk [else]/p.withdrawNotOk withdraw(p,a1,m)[not(a1=a)]/p.withdrawNotOk withdraw(p,a1,m)[a1=a]/acc := accountFor(a1); wok := acc.withdraw(m) pinNoOk/p.pinNotOk [else]/p.pinNotOk [c.account->exists(nbr-a)]/cc.verifyPin(a,pin) verifyPin(p,a,pin)

Account number balance withdraw .. Customer name address .. ClearingCompany verifyPin Bank verifyPin pinOk pinNotOk withdraw withdrawOk withdrawNotOk

  • accountFor

BankToAtmPort verifyPin pinOk pinNotOk withdraw withdrawOk withdrawNotOk * *

slide-14
SLIDE 14

LSM conformance with PSM

Protocol for provided interface of the port Bank to ATM

withdrawing withdraw verifying idle sm: BankToAtm {protocol} /[^pinNotOk] /[^withdrawOk] /[^withdrawNoOk] withdraw(i,a) /[^pinOk] verifyPin(p)

BankToAtmPort lifecycle state machines

withdrawing waiting for withdraw verifying idle sm: BankToATMPort withdrawOk/atm.withdrawOK withdrawNotOk/atm.withdrawNotOk widthdraw(a,m)/b.withdraw(self,a,m) pinOK/atm.pinOK pinNotOk/atm.pinNotOk verifyPin(a,p)/b.verifyPin(self,ap,p)

«interface» AtmToBank pinOk pinNotOk withdrawOk withdrawNotOk BankToAtmPort verifyPin pinOk pinNotOk withdraw withdrawOk withdrawNotOk «interface» BankToAtm verifyPin withdraw

slide-15
SLIDE 15

Summary

◮ Required and provided interfaces of a port have protocol state machines

◮ Usually there are always two matching protocol state machines for the opposite ports

◮ Classes implementing components have life cycle state machines