Overview | Initializes and returns a pointer to the Basic Object Adapter (BOA) in a server. |
Original class | CORBA::ORB |
Exceptions | CORBA::SystemException |
Intended Usage
This method is intended to be used by all server applications to both initialize the BOA and obtain a pointer to it. This method can be called multiple times without adverse effect (the BOA is only initialized once, regardless of how many times BOA_init is called). The return value should be released using CORBA::release(BOA_ptr).
Syntax
CORBA::BOA_ptr BOA_init (int& argc, char** argv, const CORBA::ORB::OAid boa_identifier);
Input parameters
An array of strings, whose size is indicated by the argc parameter. This is typically the argv parameter passed in to the server's main() function.
Note: For workstation Implementation, if one of the strings in argv matches -OAid "DSOM_BOA", then BOA initialization is performed, the matching string is consumed, and argc is decremented. (The remaining strings in argv may be reordered as part of consuming the -OAid "DSOM_BOA" string.) If argv is NULL or contains no string that matches -OAid "DSOM_BOA", then the BOA is initialized only if the boa_identifier parameter is "DSOM_BOA".
A string that indicates which BOA to initialize.
Note: For workstation Implementation, if no string in the argv parameter matches -OAid "DSOM_BOA", then the BOA is initialized only if the boa_identifier parameter is "DSOM_BOA".
Return values
Example
/* This is a minimal, dummy server program. It does not create any object to export. It assumes that the server with the name "dummyServer" is already registered in the implementation repository. */ #include #include "corba.h" void main(int argc, char* argv[]) { try { /* Initialize the server's ImplementationDef, ORB, and BOA */ CORBA::ImplRepository_ptr implrep = new CORBA::ImplRepository; CORBA::ImplementationDef_ptr imp = implrep->find_impldef_by_alias ("dummyServer"); /* Assume op-parm is initialized. For workstation initialize to "DSOM" */ char * op_parm; /* Assume bp_parm is initialized. For workstation initialize to "DSOM_BOA" */ char * bp-parm; static CORBA::ORB_ptr op = CORBA::ORB_init(argc, argv, op_parm); static CORBA::BOA_ptr bp = op->BOA_init(argc, argv, bp_parm); bp->impl_is_ready(imp); /* To customize, fill in : create objects to export, and so on */ cout << "server listening ...." << endl; cout.flush(); bp->execute_request_loop(CORBA::BOA::SOMD_WAIT); } catch (CORBA::SystemException &sysex) { cout << "caught a system exception, terminating." << endl; cout.flush(); } }