Its procedure is as follows:
#ref(): File not found: "purchaseordercol.png" at page "コミュニケーション図から状態機械の合成"
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.
Create an UML project in RSA.
Add new class diagram; create classes for the services: Customer, Vendor, Shipping, Invoicing, and Scheduling.
#ref(): File not found: "classDiagram.png" at page "コミュニケーション図から状態機械の合成"
Add new communication diagram; place all classes as lifelines.
Draw message pathways between lifelines that communicates.
#ref(): File not found: "communicationDiagram1.png" at page "コミュニケーション図から状態機械の合成"
Add messages.
RSA has three message types:
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.
#ref(): File not found: "communicationDiagram2.png" at page "コミュニケーション図から状態機械の合成"
Define ordering relation among messages.
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 Document of orderReply as below.
#ref(): File not found: "communicationDiagram3.png" at page "コミュニケーション図から状態機械の合成"
Now, it is ready to synthesize state machines.
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.
#ref(): File not found: "stateMachine1.png" at page "コミュニケーション図から状態機械の合成"
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.
#ref(): File not found: "stateMachine2.png" at page "コミュニケーション図から状態機械の合成"
以下に,合成された状態機械を示します.
初期疑似状態から状態V1への遷移において,操作"send order to vendor"(vendorにメッセージorderを送信する)を実行し,事象orderReply_receiveの生起により終了状態に遷移しています.
#ref(): File not found: "stateMachine_customer.png" at page "コミュニケーション図から状態機械の合成"
Vendorはメッセージorderの受信事象order_receiveが生起すると,3つのプロセスを並行して実行します.これらは状態V2の3つの領域にある状態機械で表現されます.
最初の領域では,shippingにshipReqを送信し,shipInfoを受信すると,さらに2つのプロセスに分かれます.一つ目のプロセスではschedulingにshipScheduleを送信します.もう一つのプロセスではinvoicingにshipTypeを送信し,invoiceを受信します.これら2つのプロセスが終了するとcustomerにorderReplyを送信します.
2つめの領域では,schedulingにproductScheduleを送信します.
3つめの領域では,invoicingにproductInfoを送信します.
3つの領域の実行が終了すると,終了状態に遷移します.
#ref(): File not found: "stateMachine_vendor.png" at page "コミュニケーション図から状態機械の合成"
ShippingはshipReqを受信すると,shipInfoをvendorに返信します.
#ref(): File not found: "stateMachine_shipping.png" at page "コミュニケーション図から状態機械の合成"
InvoicingはshipTypeとproductInfoを並行して受信します.そして,shipTypeを受信するとvendorにinvoiceを送信します. *2
#ref(): File not found: "stateMachine_invoicing.png" at page "コミュニケーション図から状態機械の合成"
SchedulingはshipScheduleとproductScheduleを受信します.
#ref(): File not found: "stateMachine_scheduling.png" at page "コミュニケーション図から状態機械の合成"
実行後のクラス図は下図のようになります.
通信先への参照と,呼び出されるメソッドが追加されています.
#ref(): File not found: "classDiagram2.png" at page "コミュニケーション図から状態機械の合成"