Typing make(vbmake on Windows) in the object_wrapped_bank subdirectory will build the following classes for the examples described above:
prompt> vbj TypedServer & (start vbj TypedServer on Windows) // make the Server run in the backgroundWait for the "AccountManager:BankManager is ready" message and query the balance in a user's account using the command
prompt> vbj TypedClient Johnor
prompt> vbj TypedClient // Uses a default nameWith the default name, the output you should see for the server is:
AccountManager:BankManager is ready. + SecureAccountManagerObjectWrapper: Verifying Name + SecureAccountManagerObjectWrapper: Access Granted + CachingAccountManager: Before Call Created Jack B. Quick's account: + SecureAccountManagerObjectWrapper: Verifying Name + SecureAccountManagerObjectWrapper: Access Deniedand the output you should see for the client is (Note that you may get a different balance as that is a random number):
+ CachingAccountObjectWrapper: Before calling balance: + CachingAccountObjectWrapper: After calling balance: The balance in Jack B. Quick's account is $195.8 Pass two + CachingAccountObjectWrapper: Before calling balance: + CachingAccountObjectWrapper: Returning Cached value + CachingAccountObjectWrapper: After calling balance: The balance in Jack B. Quick's account is $195.8 Trying Unauthorized Account No permission to open this accountUntyped Object Wrappers
prompt> vbj UntypedServer & (start vbj UntypedServer on Windows) // make the Server run in the backgroundWait for the "AccountManager:BankManager is ready" message and query the balance in a user's account using the command
prompt> vbj UntypedClient Johnor
prompt> vbj UntypedClient // Uses a default nameWith the default name, the output you should see for the server is(Note that the null->balance() is correct output, since the account object is transient and does not have a name):
AccountManager:BankManager is ready. Tracing: Before Call to BankManager->open() Created Jack B. Quick's account: Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=null]] Tracing: Before Call to null->balance() Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Tracing: Before Call to null->balance() Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Tracing: Before Call to BankManager->open() Created Unauthorized Account's account: Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=null]]and the output you should see for the client is (Note that you may get a different balance as that is a random number):
Timing: BankManager->open() Tracing: Before Call to BankManager->open() Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call BankManager->open() = 120 ms. Timing: null->balance() Tracing: Before Call to null->balance() Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call null->balance() = 38 ms. The balance in Jack B. Quick's account is $11.53 Pass two Timing: null->balance() Tracing: Before Call to null->balance() Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call null->balance() = 50 ms. The balance in Jack B. Quick's account is $11.53 Trying Unauthorized Account Timing: BankManager->open() Tracing: Before Call to BankManager->open() Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=null]] pTiming: Time for call BankManager->open() = 52 ms.
Play with the different combinations of typed and untyped to see behaviour in different configuration.
For your convenience, both the typed and untyped object wrappers have service initializers that allow you to install the object wrappers in different configurations at runtime. Services in this example are:
prompt>vbj -DORBservices=BankWrappers,UtilityObjectWrappers -DCachingAccount=client -DSecureAccountManager=server \
-DTiming -DTracing=client Server -runCoLocated Client &
AccountManager:BankManager is ready. Timing: BankManager->open() Tracing: Before Call to BankManager->open() Timing: BankManager->open() + SecureAccountManagerObjectWrapper: Verifying Name + SecureAccountManagerObjectWrapper: Access Granted Created Jack B. Quick's account: Timing: Time for call BankManager->open() = 118 ms. Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call BankManager->open() = 303 ms. Timing: null->balance() Tracing: Before Call to null->balance() Timing: null->balance() Timing: Time for call null->balance() = 0 ms. Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call null->balance() = 80 ms. The balance in Jack B. Quick's account is $353.3 Pass two Timing: null->balance() Tracing: Before Call to null->balance() Timing: null->balance() Timing: Time for call null->balance() = 0 ms. Tracing: After call to null->balance() env:[org.omg.CORBA.Environment[exception=null]] Timing: Time for call null->balance() = 6 ms. The balance in Jack B. Quick's account is $353.3 Trying Unauthorized Account Timing: BankManager->open() Tracing: Before Call to BankManager->open() Timing: BankManager->open() + SecureAccountManagerObjectWrapper: Verifying Name + SecureAccountManagerObjectWrapper: Access Denied Timing: Time for call BankManager->open() = 23 ms. Tracing: After call to BankManager->open() env:[org.omg.CORBA.Environment[exception=org.omg.CORBA.NO_PERMISSION[completed=MAYBE]]] Timing: Time for call BankManager->open() = 100 ms. No permission to open this account