[Enterprise Extensions only]

Initializing the CORBA server environment

One of the first things that a CORBA server application needs to do when it is started is to initialize the server environment, to perform the following actions:

  1. Getting a pointer to the implementation repository.

    The implementation repository is a persistent data store of ImplementationDef objects, each representing a logical CORBA server that has been registered in the repository. A server application typically gets a pointer to the implementation repository by using the CORBA::ImplRepository method; for example:

    ::CORBA::ImplRepository_ptr implrep = new ::CORBA::ImplRepository();
    

  2. Getting a pointer to the ImplementationDef associated with the server alias.

    The ImplementationDef, which is obtained from the Implementation Repository, describes the server; for example, it specifies a UUID that uniquely identifies the server throughout a network. Each server must retrieve its own ImplementationDef object from the Implementation Repository (using the ImplRepository class), because the ImplementationDef is a parameter required by the BOA::impl_is_ready method. A server application typically gets a pointer to its ImplementationDef by using the CORBA::ImplRepository find_impldef or find_impldef_by_alias method; for example:

    imp = implrep->find_impldef_by_alias(argv[1] );
    

    Where argv[1] is the server alias specified as a string on the command used to start the server.

  3. Initializing the communications protocol.

    This action sets the communication protocol that the server supports to SOMD_TCPIP in the ImplementationDef, using the following code extract:

    imp->set_protocols("SOMD_TCPIP");
    

  4. Initializing the ORB and BOA.

    This action is used to initialize the ORB and BOA and to return a pointer to each.

    A server application initializes the ORB by calling the CORBA::ORB_init() method, which also returns a pointer to the ORB. (If necessary, this method creates a new instance of the ORB.) For example, the following code extract initializes the ORB and return a pointers to it:

    op = ::CORBA::ORB_init(argc, argv, "DSOM");
    

    Where argc and argv refer to the properties specified on the command used to start the server. On the CORBA::ORB_init() method you must specify DSOM after the parameter argv.

    A server application initializes the BOA by calling the CORBA::BOA_init() method on the ORB. For example, the following code extract initializes the BOA and returns a pointer to it:

    bp = op->BOA_init(argc, argv, "DSOM_BOA");

    Where argc and argv refer to the properties specified on the command used to start the server. On the BOA_init() method you must specify DSOM_BOA after the parameter argv.

  5. Registering the server application as a CORBA server.

    This action calls the CORBA::BOA::impl_is_ready method to initialize the server application as a CORBA server. This method initializes the server's communications resources so that it can accept incoming request messages and export objects. For example, the following code extract registers the server (with the alias specified on the command used to start the server):

    bp->impl_is_ready(imp, 0 );
    

    Note: The zero (0) value indicates that the server should not register itself with the somorbd daemon, because CORBA servers within WebSphere only support transient objects. This parameter is an IBM extension to the CORBA specification, and should specified only for lightweight servers of transient objects.