Synthesis State-machines from a communication diagram

Its procedure is as follows:

  1. draw class diagram
  2. draw communication diagram
  3. synthesis state-machine

Example

purchaseordercol.png

The example choreography is shown right. The figure is a collaboration diagram of UML1.x. *1

The example is a modified version of a collaboration by T. Bultan and X. Fu, which is taken from BPEL-WS 2.0 specification.

This example is composed of five services: Customer, Vendor, Shipping, Invoicing, and Scheduling. When Vendor receives an order from Customer, it sends requests to Shipping, Invoicing and Scheduling. Finally, Vendor returns orderReply to Customer.

The request to Shipping is shipReq, and the reply from Shipping is shipInfo.

The requests to Invoicing are productInfo and shipType; the reply from Invoicing is invoice. Vendor sends productInfo after receiving order; it sends shipType after receiving shipInfo. Invoicing does internal process to make an invoice after receiving productInfo and shipType; then it sends invoice as a reply.

The request to Scheduling are productSchedule and shipSchedule. Vendor sends productSchedule after receiving order; it sends shipSchedule after receiving shipInfo.

Vendor sends orderReply to Customer after receiving shipInfo and invoice and sending shipSchedule.

Draw Class Diagram

Create an UML project in RSA.

Add new class diagram; create classes for the services: Customer, Vendor, Shipping, Invoicing, and Scheduling.

classDiagram.png

Draw Communication Diagram

Add new communication diagram; place all classes as lifelines.

Draw message pathways between lifelines that communicates.

communicationDiagram1.png

Add messages.

RSA has three message types:

  • Asynchronous Call
  • Asynchronous Signal
  • Synchronous Call

CSCB Tools supports two of them: Asynchronous and Synchronous Calls. In this example, we assume that all messages are asynchronous calls. The communication diagram added messages is shown below.

communicationDiagram2.png

Define ordering relation among messages.

  • Communication diagrams does not have predecessors, which collaboration diagrams have.
  • The ordering relation of the example cannot be represented by the sequence number.

In CSCB Tools, we specify the preceding messages in the "Documentation". For example, because shipInfo, invoice, and shipSchedule precede orderReply, we add them in the Documentation of orderReply as below.

communicationDiagram3.png

Now, it is ready to synthesize state machines.

synthesis state-machine

Right click the package in Project Explorer and select "Create StateMachine?" -> "create State Machine all by CSCB" from the menu; then a state machine for each service is synthesized.

By the way, if "create State Machine by CSCB" is selected, one can select a service to be synthesized. If "... by projection" is selected, state machines are synthesized by the projection method.

stateMachine1.png

When there is no problem, state machines are synthesized and added to the model. The Blank Package of PurchaseOrder?; project in the above diagram has only Class Diagrams and Communication Diagrams; now it has State Machine Diagrams as shown below.

stateMachine2.png

Results

  • Customer state machine

Customer executes the effect "send order to vendor", i.e. sends message order to vendor, at the transition from initial pseudo state to V1; it transitions to final state by the occurrence of the event orderReply_receive, i.e. receives message orderReply.

stateMachine_customer.png
  • Vendor state machine

When vendor receives order, three processes run concurrently; these processes are represented the state machines in the three regions of the composite state V2.

In the first region, vendor sends shipReq to shipping, and receives shipInfo. Then, the process forks into two processes. In the first process, vendor sends shipSchedule to scheduling; in the another process, it sends shipType to invoicing and receives invoice. Vendor sends &color(blue){orderReply} to customer when two processes terminate.

In the second region, vendor sends productSchedule to scheduling.

In the third region, vendor sends productInfo to invoicing.

When all processes in the three regions terminate, vendor transitions to the final state.

stateMachine_vendor.png
  • Shipping state machine

Shipping received shipReq, and then sends shipInfo to vendor.

stateMachine_shipping.png
  • Invoicing state machine

Invoicing receives shipType and productInfo concurrently; then it sends invoice to vendor after receiving shipType. *2

stateMachine_invoicing.png
  • Scheduling state machine

Scheduling receives shipSchedule and productSchedule.

stateMachine_scheduling.png
  • Class diagram

The class diagram is updated as below, where references to communicating partners and called methods are added.

classDiagram2.png

*1 Collaboration diagrams are called communication diagrams in UML2.x. In collaboration diagrams, we can define partial order on messages using the predecessor of each message. For example, 1/ in front of A1 shipReq is the predecessor. The predecessor indicates that message 1 must precede message A1. Therefore, Vendor must send shipReq after it receives order.
*2 In this example, because invoice does not precedes productInfo, invoicing may issue invoice before receiving productInfo. This problem is solved by adding preceding relation among invoice and productInfo in the choreography.

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2014-06-11 (水) 12:14:35 (3610d)