Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

OrbInit Class Reference

#include <CorbaServer.h>

Inheritance diagram for OrbInit:

SysHook List of all members.

Detailed Description

Encapsulates ORB initialization and start-up control.

ORB initialization and control during application start-up is encapsulated and generalized in this class for reuse.


Public Types

enum  InitState {
  PRE_ORB_INIT, POST_ORB_INIT, POST_POA_INIT, RUNNING,
  SHUTTING_DOWN
}

Public Member Functions

 OrbInit (int argc, char **argv)
virtual ~OrbInit ()
void addServantFactory (ServantFactory *factory) throw (BoilerPlate::IllegalStateException)
void addPreORBInitCommand (PreInitCommand *command) throw (BoilerPlate::IllegalStateException)
void addPostORBInitCommand (PostORBInitCommand *command) throw (BoilerPlate::IllegalStateException)
void addPostPOAInitCommand (PostInitCommand *command) throw (BoilerPlate::IllegalStateException)
void addPreShutdownCommand (PostInitCommand *command) throw (BoilerPlate::IllegalStateException)
void setOrbRunStrategy (OrbRunStrategy *strategy) throw (BoilerPlate::IllegalStateException)
void initialize (int argc, char **argv) throw (InitializationError)
void buildServants () throw (InitializationError, BoilerPlate::IllegalStateException, ServantFactory::ServantBuildException )
void acceptMessages () throw (CORBA::SystemException, std::runtime_error)
virtual void shutDown () throw (CORBA::SystemException)
virtual void run () throw (CORBA::SystemException)
virtual void holdRequests (bool wait) throw (PortableServer::POAManager::AdapterInactive)
virtual void activate () throw (PortableServer::POAManager::AdapterInactive)
virtual void discardRequests (bool wait) throw (PortableServer::POAManager::AdapterInactive)
SignalControllergetSignalController ()


Member Enumeration Documentation

enum OrbInit::InitState
 

The states of OrbInit.

  • PRE_ORB_INIT - The start state
  • POST_ORB_INIT - Attained when the ORB has been initialized
  • POST_POA_INIT - Attained when the RootPOA has been initialized
  • RUNNING - Attained just before orb->run is called
  • SHUTTING_DOWN - Attained immediately after orb->run exits


Constructor & Destructor Documentation

OrbInit::OrbInit int  argc,
char **  argv
 

The only ctor

virtual OrbInit::~OrbInit  )  [virtual]
 

virtual dtor Deletes all ServantFactories and Commands


Member Function Documentation

void OrbInit::acceptMessages  )  throw (CORBA::SystemException, std::runtime_error)
 

Called when the system is ready to process client messages

The operation assumes the initialize and buildServants have been called and completed successfully. If the preconditions are true then orb->run is called to begin accepting client requests. This operation does not return until the ORB is told to stop processing client requests.

Precondition:
initialize has been called and completed successfully buildServants has been called and completed successfully
Postcondition:
orb->run is called and the application begins processing requests

virtual void OrbInit::activate  )  throw (PortableServer::POAManager::AdapterInactive) [virtual]
 

Activate the POAManager

Implements SysHook.

void OrbInit::addPostORBInitCommand PostORBInitCommand command  )  throw (BoilerPlate::IllegalStateException)
 

Add a command to be called immediately after the ORB is initialized PostORBInitCommands are called after the ORB is initialized and before the RootPOA is initialized. These objects will be deleted during shutdown

Note:
We don't know what a user might do with these; maybe start a thread or something else that needs to exist for the duration of the run, therefore we don't attempt to delete them until OrbInit is shutting down.
Parameters:
command An implementation of a PostORBInitCommand
Exceptions:
IllegalStateException Raised if OrbInit state is greater than POST_ORB_INIT

void OrbInit::addPostPOAInitCommand PostInitCommand command  )  throw (BoilerPlate::IllegalStateException)
 

Add a command to be called after the RootPOA is initialized These PostInitCommands are called after the RootPOA is initialized and before ServantFactories are initialized. These objects will be deleted during shutdown

Note:
We don't know what a user might do with these; maybe start a thread or something else that needs to exist for the duration of the run, therefore we don't attempt to delete them until OrbInit is shutting down.
Parameters:
command An implementation of a PostORBInitCommand
Exceptions:
IllegalStateException Raised if OrbInit state is greater than POST_POA_INIT

void OrbInit::addPreORBInitCommand PreInitCommand command  )  throw (BoilerPlate::IllegalStateException)
 

Add a PreInitCommand to be fired before the ORB is initialized PreInitCommands are called before the ORB is initialized. You can use them to initialize other system components. Ownership is assumed by OrbInit. These objects will be deleted during shutdown.

Note:
We don't know what a user might do with these; maybe start a thread or something else that needs to exist for the duration of the run, therefore we don't attempt to delete them until OrbInit is shutting down.
Parameters:
command An implementation of a PreInitCommand
Exceptions:
IllegalStateException Raised if OrbInit state is greater than PRE_ORB_INIT

void OrbInit::addPreShutdownCommand PostInitCommand command  )  throw (BoilerPlate::IllegalStateException)
 

Add a command to be called immediately after orb->run exits These PostInitCommands are called after orb->exits but before ServantFactories and before ServantFactories are initialized. These objects will be deleted during shutdown

Note:
We don't know what a user might do with these; maybe start a thread or something else that needs to exist for the duration of the run, therefore we don't attempt to delete them until OrbInit is shutting down.
Parameters:
command An implementation of a PostORBInitCommand
Exceptions:
IllegalStateException Raised if OrbInit state is greater than RUNNING

void OrbInit::addServantFactory ServantFactory factory  )  throw (BoilerPlate::IllegalStateException)
 

Add a ServantFactory to be initialized Adds a ServantFactory to internal storage. ServantFactories are called in the order they are received. Ownership is taken by OrbInit. ServantFactories are deleted when OrbInit is shutting down.

Parameters:
factory - A pointer to a ServantFactory
Exceptions:
IllegalStateException Raised if OrbInit state is greater than POST_POA_INIT

void OrbInit::buildServants  )  throw (InitializationError, BoilerPlate::IllegalStateException, ServantFactory::ServantBuildException )
 

Called to initialize the process Servants

The operation is called after initialize is called. Users must implement the pure virtual ServantFactory contract and initialize those implementations in this operation.

Exceptions:
InitializationError 
Precondition:
initialize has been called successfully
Postcondition:
Servant framework is initialized and gaurantees that the system is ready to accept messages

virtual void OrbInit::discardRequests bool  wait  )  throw (PortableServer::POAManager::AdapterInactive) [virtual]
 

Ask the system to discard requests

The POA Manager will discard all incoming requests. The server will raise a TRANSIENT system exception.

Parameters:
wait - If true, this call will not return until all requests received before this call have completed processing

Implements SysHook.

SignalController& OrbInit::getSignalController  )  [inline]
 

Access the SignalController

The SignalController is used to register SignalHandlers

Returns:
Reference to the SignalController

virtual void OrbInit::holdRequests bool  wait  )  throw (PortableServer::POAManager::AdapterInactive) [virtual]
 

Ask the system to hold requests

A caller can ask the POAManager to hold requests until the caller uses activate

Parameters:
wait - if true, this call will not return until all requests received before this call have completed processing

Implements SysHook.

void OrbInit::initialize int  argc,
char **  argv
throw (InitializationError)
 

Called to begin the initialization method

Call this operation to kick off the initialization of the system

Parameters:
argc The same as argc in main
argv The same as argv in main
Exceptions:
InitializationError 
Precondition:
Initialize has not been called previously
Postcondition:
ORB and RootPOA are initialized

virtual void OrbInit::run  )  throw (CORBA::SystemException) [virtual]
 

Ask the system to run

Implements SysHook.

void OrbInit::setOrbRunStrategy OrbRunStrategy strategy  )  throw (BoilerPlate::IllegalStateException)
 

Set the strategy to use for ORB::run

Some applications need more than the traditional ORB::run. Some ORB implementations require the application code to supply threading model (TAO for instance). The application main instances a derivation of OrbRunStrategy and registers it using this operation.

Note:
The BasicOrbRunStrategy is used as the default
Parameters:
strategy - Pointer to an OrbRunStrategy
Exceptions:
IllegalStateException if called after ORB::run has already been called

virtual void OrbInit::shutDown  )  throw (CORBA::SystemException) [virtual]
 

Purposefully shut this server down An administrative interface to shut the server down

Implements SysHook.


The documentation for this class was generated from the following file: