Delphi Clinic | C++Builder Gate | Training & Consultancy | Delphi Notes Weblog | Dr.Bob's Webshop |
|
Delphi 5 Enterprise (and Delphi 4 Client/Server) come with a number of CORBA demos. One of them, found in the demos\corba directory, is the Account demo. I've had some questions laterly about the ability to automatically load the Account server using the Object Activation Daemon, so here goes...
The Object Activation Daemon (OAD) is a deployment-time service that allows CORBA Server to be automatically started when a CORBA client makes requests. When a CORBA Server (an implementation) is registered with the OAD, the Daemon creates a Forwarder which masquerades as the actual (as yet unspawned) server. As such, it registers with the VisiBroker Smart Agent. When a client requests the object, the following actions occur "under the covers" before a reference is actually returned to the client:
Account Example
The Account project group consists of two projects: AccountClient and AccountServer.
The goal of this short example is to show how to register the AccountServer with the OAD, so it can be automatically started when the AccountClient tries to make a connection.
First, we need to start the Smart Agent (osagent.exe), so any ORB can make a connection.
Second, we need to run the OAD itself on the command-line, using the -C switch.
Third, we need to register our executable with the OAD, using the OADUTIL program, which for the AcountServer is as follows (one a single command-line, of course):
OADUTIL reg -r IDL:AccountServer/AccountFactory:1.0 -o Account -cpp "c:\program files\borland\delphi4\demos\corba\account\accountserver.exe"We can unregister the CORBA Server as follows:
OADUTIL unreg -r IDL:AccountServer/AccountFactory:1.0 -o AccountAnd we can get a list of entires in the Object Activation Daemon as follows:
OADUTIL listNow, once the AcountServer is registered, we can compile and run the AccountClient. Since both applications are CONSOLE apps, it's best to open a CONSOLE window, and start the AccountClient from there. The AccountServer won't display any output, but you can add a ShowMessage dialog to it just to make sure you can see it when it comes alive.
A final remark: don't use the OAD Service from the services manager (this may give you problems - it doesn't work (at all) for some people :). However, using the oad -c from a command-line works just fine.