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);
00071
00072 void shutdown(void);
00073
00074
00075 int init (Activator_Options& opts);
00076
00077
00078 int fini (void);
00079
00080
00081 int run (void);
00082
00083
00084 void shutdown (bool wait_for_completion);
00085
00086 private:
00087
00088 int init_with_orb (CORBA::ORB_ptr orb, const Activator_Options& opts);
00089
00090 void register_with_imr(ImplementationRepository::Activator_ptr activator);
00091
00092
00093
00094 int handle_exit (ACE_Process * process);
00095
00096 private:
00097
00098 typedef ACE_Hash_Map_Manager_Ex<pid_t,
00099 ACE_CString,
00100 ACE_Hash_pid_t,
00101 ACE_Equal_To_pid_t,
00102 ACE_Null_Mutex> ProcessMap;
00103
00104 ACE_Process_Manager process_mgr_;
00105
00106 PortableServer::POA_var root_poa_;
00107 PortableServer::POA_var imr_poa_;
00108
00109 ImplementationRepository::Locator_var locator_;
00110
00111
00112
00113 CORBA::Long registration_token_;
00114
00115 CORBA::ORB_var orb_;
00116
00117 unsigned int debug_;
00118
00119 bool notify_imr_;
00120
00121 ACE_CString name_;
00122
00123 ProcessMap process_map_;
00124
00125
00126 int env_buf_len_;
00127 };
00128
00129 #endif