mirror of
https://github.com/AdaCore/PolyORB.git
synced 2026-02-12 13:01:15 -08:00
This example describes a way to develop client / server applications. To provide advanced features, in this example, we had a mechanism of notification. There are three main ada units in this bank example. The "bank" that manages the client accounts, a "manager" which loads the accounts from a small database and provides some utilities and clients which modify their accounts and transfer money from their account to the account of someone else. This is always the same executable for the different clients, but of course, they don't get the same partition id in order to differentiate them. To proove this, the bank server notifies a customer when its account has been granted with money by another customer. -- To play with this example, you can do the following : % gnatdist simcity Open (at least) 3 sessions. [On session 1, starts the scenario, load "example" database and print the account status] % bank_server Menu : Create Load Print Quit Save Request : l => Load Filename : example Menu : Create Load Print Quit Save Request : p => Print Customer : poor Password : xxxx Customer : 25 Customer : middle Password : yyyy Customer : 250 Customer : rich Password : zzzz Customer : 2500 Menu : Create Load Print Quit Save [On session 2, start the poor client] % bank_client Customer : poor Password : xxxx Balance : 25 Menu : Balance Deposit Transfer Withdraw Request : [On session 3, start the rich client and transfer money from rich to poor] % bank_client Customer : rich Password : zzzz Balance : 2500 Menu : Balance Deposit Transfer Withdraw Request : t => Transfer Amount : 1000 Customer : poor Balance : 1500 Menu : Balance Deposit Transfer Withdraw [and then you will realize that on session 2, poor has been notified of the donation] => Receive 1000 from rich