Skip navigation.

CORBA Programming Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


Server::initialize()

Synopsis

Allows the application to perform application-specific initialization procedures, such as logging into a database, creating and registering well-known object factories, initializing global variables, and so forth.

C++ Binding

class Server {
public:
        CORBA::Boolean  initialize(int argc, char** argv);
};

Arguments

The argc and argv arguments are passed from the command line. The argc argument contains the name of the server. The argv argument contains the first command-line option that is specific to the application, if there are any.

Command-line options are specified in the UBBCONFIG file using the CLOPT parameter in the entry for the server in the SERVERS section. System-recognized options come first in the CLOPT parameter, followed by a double-hyphen (--), followed by the application-specific options. The value of argc is one greater than the number of application-specific options. For details, see ubbconfig(5) in the File Formats, Data Descriptions, MIBs, and System Processes Reference.

Exceptions

If an exception is raised in Server::initialize(), the TP Framework catches the exception. The TP Framework behavior is the same as if initialize() returned FALSE (that is, an exception is considered to be a failure). In addition, an error message is written to the user log (ULOG) file, as follows, for each exception type:

TobjS::InitializeFailed

"TPFW_CAT:1: ERROR: Exception in Server::initialize():IDL:beasys.com/TobjS/InitializeFailed:1.0. Reason = reason"

Where reason is a string supplied by application code. For example:

Throw TobjS::InitializeFailed(
"Couldn't register factory");

CORBA::Exception

"TPFW_CAT:1: ERROR: Exception in Server::initialize(): exception. Reason = unknown"

Where exception is the interface ID of the CORBA exception that was raised.

Other Exceptions

TPFW_CAT:1: ERROR: Exception in Server::initialize(): unknown exception. Reason = unknown"

Description

The initialize callback method, which is invoked as the last step in server initialization, allows the application to perform application-specific initialization.

Typically, a server application does the following tasks in Server::initialize:

It is the responsibility of the server application to open any required XA resource managers. This is done by invoking either of the following methods:

Note: You must use the TP::open_xa_rm() method if you use the INS bootstrap mechanism to obtain initial object references.

Return Value

Boolean TRUE or FALSE. TRUE indicates success. FALSE indicates failure. If an error occurs in initialize(), the application code should return FALSE. The application code should not call the system call exit(). Calling exit() does not give the TP Framework a chance to release resources allocated during startup and may cause unpredictable results.

If the return value is FALSE:

 

Skip navigation bar  Back to Top Previous Next