00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef IMR_ACTIVATOR_I_H
00014 #define IMR_ACTIVATOR_I_H
00015
00016 #include "activator_export.h"
00017
00018 #include "ImR_ActivatorS.h"
00019 #include "ImR_LocatorC.h"
00020
00021 #include "ace/Process_Manager.h"
00022 #include "ace/Hash_Map_Manager.h"
00023 #include "ace/Null_Mutex.h"
00024 #include "ace/SString.h"
00025
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif
00029
00030 class Activator_Options;
00031
00032
00033
00034 struct ACE_Hash_pid_t
00035 {
00036 unsigned long operator () (pid_t t) const
00037 {
00038 return t;
00039 }
00040 };
00041
00042 struct ACE_Equal_To_pid_t
00043 {
00044 int operator () (const pid_t lhs, const pid_t rhs) const
00045 {
00046 return lhs == rhs;
00047 }
00048 };
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 class Activator_Export ImR_Activator_i : public POA_ImplementationRepository::Activator,
00061 public ACE_Event_Handler
00062 {
00063 public:
00064 ImR_Activator_i (void);
00065
00066 void start_server (
00067 const char* name,
00068 const char* cmdline,
00069 const char* dir,
00070 const ImplementationRepository::EnvironmentList & env ACE_ENV_ARG_DECL)
00071 ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::CannotActivate));
00072
00073 void shutdown(ACE_ENV_SINGLE_ARG_DECL)
00074 ACE_THROW_SPEC ((CORBA::SystemException));
00075
00076
00077 int init (Activator_Options& opts ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00078
00079
00080 int fini (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
00081
00082
00083 int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
00084
00085
00086 void shutdown (bool wait_for_completion ACE_ENV_ARG_DECL);
00087
00088 private:
00089
00090 int init_with_orb (CORBA::ORB_ptr orb, const Activator_Options& opts ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00091
00092 void register_with_imr(ImplementationRepository::Activator_ptr activator);
00093
00094
00095
00096 int handle_exit (ACE_Process * process);
00097
00098 private:
00099
00100 typedef ACE_Hash_Map_Manager_Ex<pid_t,
00101 ACE_CString,
00102 ACE_Hash_pid_t,
00103 ACE_Equal_To_pid_t,
00104 ACE_Null_Mutex> ProcessMap;
00105
00106 ACE_Process_Manager process_mgr_;
00107
00108 PortableServer::POA_var root_poa_;
00109 PortableServer::POA_var imr_poa_;
00110
00111 ImplementationRepository::Locator_var locator_;
00112
00113
00114
00115 CORBA::Long registration_token_;
00116
00117 CORBA::ORB_var orb_;
00118
00119 unsigned int debug_;
00120
00121 bool notify_imr_;
00122
00123 ACE_CString name_;
00124
00125 ProcessMap process_map_;
00126 };
00127
00128 #endif