3 This is a simple CORBA example that has a module Bank with two
4 interfaces Account and AccountManager. The Account interface has
5 operations for balance, deposit and withdraw. It has a readonly
6 attribute for the Account Holder's name. It also has a user defined
7 exception which is raised for withdrawing more moneythen the current
8 balance. The AccountManager interface has methods to create and close
9 Accounts. It also has a method to shutdown the server.
11 run_test.pl : This is a perl script to run the server and client as :
16 Passing the Server IOR to Clients:
17 ---------------------------------
19 To keep this example simple, the server advertises its IOR in the
20 following manner - The server program writes its server object's IOR
21 to a ior_file. Later on, the client reads this IOR from the specified
22 ior_file and uses the <string_to_object> method to obtain a reference
25 For this mechanism to work, the file must be readable and writable. If
26 it doesn't exist, a new file is created by the server. Moreover, the
27 file path must be accessible to both the client and server.
29 If the client and server are on different machine, then there must be
30 a shared directory accessible by both. On UNIX system's this is
31 typically done via the NFS mount command. On Windows, the 'explorer'
32 application provides an option to share drives.
34 In general if no such file sharing option is available, then using the
35 the Naming Service mechanism is the only alternative, as described by
36 the -n option below. There are other command line options available
37 for the server and client which are also explained below.
42 server [-d] [-o IOR_file_name] [-n]
46 -d Debug flag (It is additive more -d flags will give debugging).
48 When the server is started, you should see as the first line of output
49 something that looks like
50 iiop:1.0//danzon.cs.wustl.edu:10015/P35ad159600081a38/child_poa/server
53 IOR:000000000000001649444c3a43756269745...
56 Using -d turns on debugging messages. This option is additive, i.e.,
57 the more -d options provided, the more debugging you can get. At the
58 moment, only 2 levels of debugging are implemented, and more than 2 -d
61 -o This option creates an ior file for the server with the name ior_filename.
64 The file can be used by clients who wish to access the server directly
65 using this ior file. This obviates the need for the client to use the
66 naming service for getting the server ior. The client can use the -f
67 option to specify the file which contains the ior of the server (the
68 same file that was written by the server using the -o option).
73 client [-d] [-x] [-n iterations] [-b initial_balance] [-o Name_of_account_holder]
74 [-f IOR_file_name ] [-k IOR]
80 -x Tells the server to shutdown at the end of the test.
86 -o Name of the Account Holder
88 -k Read IOR from the command line. If this option is specified the client does not use
89 the Naming Service for locating the server. It just uses the ior file supplied with
92 -f Read IOR from the specified file. If this option is specified the client does not use
93 the Naming Service for locating the server. It just uses the ior file supplied with
96 The client executes the following tests :
98 1. Creating accounts with the same name to make sure the Account is
99 created only once and he gets back the same object reference each
100 time. This is confirmed by the server printing the message for
101 Creation of an account only once.
103 2. Creating accounts with different name to make sure a different
104 Account is created and a different IOR returned each time.
106 3. Creating an Account with some initial balance and then withdrawing
107 more than the current balance. The server throws an exception which is
108 passed to the client and the client displays the reason for the