ImR_Activator_i Class Reference

IMR Activator Interface. More...

#include <ImR_Activator_i.h>

Inheritance diagram for ImR_Activator_i:

Inheritance graph
[legend]
Collaboration diagram for ImR_Activator_i:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ImR_Activator_i (void)
void start_server (const char *name, const char *cmdline, const char *dir, const ImplementationRepository::EnvironmentList &env ACE_ENV_ARG_DECL) throw (CORBA::SystemException, ImplementationRepository::CannotActivate)
void shutdown (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
int init (Activator_Options &opts ACE_ENV_ARG_DECL_WITH_DEFAULTS)
 Initialize the Server state - parsing arguments and waiting.

int fini (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
 Cleans up any state created by init*.

int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
 Runs the orb.

void shutdown (bool wait_for_completion ACE_ENV_ARG_DECL)
 Shutdown the orb.


Private Types

typedef ACE_Hash_Map_Manager_Ex<
pid_t, ACE_CString, ACE_Hash_pid_t,
ACE_Equal_To_pid_t, ACE_Null_Mutex
ProcessMap

Private Member Functions

int init_with_orb (CORBA::ORB_ptr orb, const Activator_Options &opts ACE_ENV_ARG_DECL_WITH_DEFAULTS)
void register_with_imr (ImplementationRepository::Activator_ptr activator)
int handle_exit (ACE_Process *process)

Private Attributes

ACE_Process_Manager process_mgr_
PortableServer::POA_var root_poa_
PortableServer::POA_var imr_poa_
ImplementationRepository::Locator_var locator_
CORBA::Long registration_token_
CORBA::ORB_var orb_
unsigned int debug_
bool notify_imr_
ACE_CString name_
ProcessMap process_map_

Detailed Description

IMR Activator Interface.

This class provides the interface for the various activities that can be done by the ImR_Activator.

Definition at line 60 of file ImR_Activator_i.h.


Member Typedef Documentation

typedef ACE_Hash_Map_Manager_Ex<pid_t, ACE_CString, ACE_Hash_pid_t, ACE_Equal_To_pid_t, ACE_Null_Mutex> ImR_Activator_i::ProcessMap [private]
 

Definition at line 104 of file ImR_Activator_i.h.


Constructor & Destructor Documentation

ImR_Activator_i::ImR_Activator_i void   ) 
 

Definition at line 22 of file ImR_Activator_i.cpp.

References getHostName().

00023 : registration_token_(0)
00024 , debug_(0)
00025 , notify_imr_ (false)
00026 , name_ (getHostName ())
00027 {
00028 }


Member Function Documentation

int ImR_Activator_i::fini ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   ) 
 

Cleans up any state created by init*.

Referenced by ImR_Activator_Loader::fini(), run_standalone(), and Activator_NT_Service::svc().

int ImR_Activator_i::handle_exit ACE_Process process  )  [private, virtual]
 

Reimplemented from ACE_Event_Handler.

Definition at line 363 of file ImR_Activator_i.cpp.

References ACE_CString, ACE_DEBUG, ACE_TEXT, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), ACE_Process::getpid(), CORBA::is_nil(), LM_DEBUG, process_map_, ACE_Process::return_value(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind().

00364 {
00365   // We use the process_manager so that we're notified when
00366   // any of our launched processes die. We notify the locator
00367   // when this happens.
00368 
00369   if (debug_ > 0)
00370     {
00371       ACE_DEBUG
00372         ((LM_DEBUG,
00373         ACE_TEXT ("Process %d exited with exit code %d\n"),
00374         process->getpid (), process->return_value ()));
00375     }
00376 
00377   ACE_CString name;
00378   if (this->process_map_.find (process->getpid (), name) == 0)
00379     {
00380       this->process_map_.unbind (process->getpid ());
00381 
00382       if (!CORBA::is_nil (this->locator_.in ()))
00383         {
00384           if (debug_ > 1)
00385             {
00386               ACE_DEBUG ((LM_DEBUG,
00387                 ACE_TEXT ("ImR Activator: Notifying ImR that %s has exited.\n"),
00388                 name.c_str()));
00389             }
00390           this->locator_->notify_child_death (name.c_str());
00391         }
00392     }
00393 
00394   return 0;
00395 }

int ImR_Activator_i::init Activator_Options &opts  ACE_ENV_ARG_DECL_WITH_DEFAULTS  ) 
 

Initialize the Server state - parsing arguments and waiting.

Referenced by ImR_Activator_Loader::init(), run_standalone(), and Activator_NT_Service::svc().

int ImR_Activator_i::init_with_orb CORBA::ORB_ptr  orb,
const Activator_Options &opts  ACE_ENV_ARG_DECL_WITH_DEFAULTS
[private]
 

void ImR_Activator_i::register_with_imr ImplementationRepository::Activator_ptr  activator  )  [private]
 

Definition at line 63 of file ImR_Activator_i.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, CORBA::is_nil(), LM_DEBUG, ACE_Process_Manager::open(), process_mgr_, and registration_token_.

00064 {
00065   ACE_TRY_NEW_ENV
00066     {
00067       if (this->debug_ > 1)
00068         ACE_DEBUG( (LM_DEBUG, "ImR Activator: Contacting ImplRepoService...\n"));
00069 
00070       // First, resolve the ImR, without this we can go no further
00071       CORBA::Object_var obj =
00072         orb_->resolve_initial_references ("ImplRepoService" ACE_ENV_ARG_PARAMETER);
00073       ACE_TRY_CHECK;
00074 
00075       this->process_mgr_.open (ACE_Process_Manager::DEFAULT_SIZE,
00076         this->orb_->orb_core ()->reactor ());
00077 
00078       locator_ = ImplementationRepository::Locator::_narrow (obj.in () ACE_ENV_ARG_PARAMETER);
00079       ACE_TRY_CHECK;
00080 
00081       if (!CORBA::is_nil (locator_.in ()))
00082         {
00083           this->registration_token_ =
00084             locator_->register_activator (name_.c_str (), activator ACE_ENV_ARG_PARAMETER);
00085           ACE_TRY_CHECK;
00086 
00087           if (debug_ > 0)
00088             ACE_DEBUG((LM_DEBUG, "ImR Activator: Registered with ImR.\n"));
00089 
00090           return;
00091         }
00092     }
00093   ACE_CATCHANY
00094     {
00095       if (debug_ > 1)
00096         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "ImR Activator: Can't register with ImR.");
00097     }
00098   ACE_ENDTRY;
00099 
00100   if (debug_ > 0)
00101     ACE_DEBUG ((LM_DEBUG, "ImR Activator: Not registered with ImR.\n"));
00102 }

int ImR_Activator_i::run ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   ) 
 

Runs the orb.

Referenced by ImR_Activator_Loader::run(), run_standalone(), and Activator_NT_Service::svc().

void ImR_Activator_i::shutdown bool wait_for_completion  ACE_ENV_ARG_DECL  ) 
 

Shutdown the orb.

Definition at line 292 of file ImR_Activator_i.cpp.

References ACE_ENV_ARG_PARAMETER.

00293 {
00294   this->orb_->shutdown (wait_for_completion ACE_ENV_ARG_PARAMETER);
00295 }

void ImR_Activator_i::shutdown ACE_ENV_SINGLE_ARG_DECL   )  throw (CORBA::SystemException)
 

Referenced by ImR_Activator_Shutdown::operator()().

void ImR_Activator_i::start_server const char *  name,
const char *  cmdline,
const char *  dir,
const ImplementationRepository::EnvironmentList &env  ACE_ENV_ARG_DECL
throw (CORBA::SystemException, ImplementationRepository::CannotActivate)
 


Member Data Documentation

unsigned int ImR_Activator_i::debug_ [private]
 

Definition at line 119 of file ImR_Activator_i.h.

PortableServer::POA_var ImR_Activator_i::imr_poa_ [private]
 

Definition at line 109 of file ImR_Activator_i.h.

ImplementationRepository::Locator_var ImR_Activator_i::locator_ [private]
 

Definition at line 111 of file ImR_Activator_i.h.

ACE_CString ImR_Activator_i::name_ [private]
 

Definition at line 123 of file ImR_Activator_i.h.

bool ImR_Activator_i::notify_imr_ [private]
 

Definition at line 121 of file ImR_Activator_i.h.

CORBA::ORB_var ImR_Activator_i::orb_ [private]
 

Definition at line 117 of file ImR_Activator_i.h.

ProcessMap ImR_Activator_i::process_map_ [private]
 

Definition at line 125 of file ImR_Activator_i.h.

Referenced by handle_exit().

ACE_Process_Manager ImR_Activator_i::process_mgr_ [private]
 

Definition at line 106 of file ImR_Activator_i.h.

Referenced by register_with_imr().

CORBA::Long ImR_Activator_i::registration_token_ [private]
 

We're given a token when registering with the locator, which we must use when unregistering.

Definition at line 115 of file ImR_Activator_i.h.

Referenced by register_with_imr().

PortableServer::POA_var ImR_Activator_i::root_poa_ [private]
 

Definition at line 108 of file ImR_Activator_i.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:37:01 2006 for TAO_Implementation_Repository by doxygen 1.3.6