mirror of
https://github.com/AdaCore/PolyORB.git
synced 2026-02-12 13:01:15 -08:00
142 lines
1.8 KiB
Plaintext
142 lines
1.8 KiB
Plaintext
This example describes a way to develop client / server
|
|
applications.
|
|
|
|
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 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
|
|
Withdraw
|
|
|
|
Request : d
|
|
|
|
=> Deposit
|
|
|
|
Amount : 1000
|
|
|
|
Balance : 1025
|
|
|
|
Menu :
|
|
|
|
[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
|
|
Withdraw
|
|
|
|
Request : w
|
|
|
|
=> Withdraw
|
|
|
|
Amount : 1000
|
|
|
|
Balance : 1500
|
|
|
|
Menu :
|
|
|
|
Balance
|
|
Deposit
|
|
Withdraw
|
|
|
|
[On session 1, ask for the balances]
|
|
|
|
Request : p
|
|
|
|
=> Print
|
|
|
|
Customer : poor
|
|
Password : xxxx
|
|
Customer : 1025
|
|
|
|
Customer : middle
|
|
Password : yyyy
|
|
Customer : 250
|
|
|
|
Customer : rich
|
|
Password : zzzz
|
|
Customer : 1500
|
|
|
|
|