ImR_Locator_i.h

Go to the documentation of this file.
00001 // ImR_Locator_i.h,v 1.15 2005/11/29 14:45:53 ossama Exp
00002 
00003 #ifndef IMR_LOCATOR_I_H
00004 #define IMR_LOCATOR_I_H
00005 #include /**/ "ace/pre.h"
00006 
00007 #include "locator_export.h"
00008 
00009 #include "Adapter_Activator.h"
00010 #include "Forwarder.h"
00011 #include "Locator_Options.h"
00012 #include "Locator_Repository.h"
00013 #include "AsyncStartupWaiter_i.h"
00014 #include "tao/IORTable/IORTable.h"
00015 
00016 #include "orbsvcs/IOR_Multicast.h"
00017 
00018 #include "ImR_LocatorS.h"
00019 #include "AsyncStartupWaiterS.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00026 class ACE_Reactor;
00027 ACE_END_VERSIONED_NAMESPACE_DECL
00028 
00029 class INS_Locator;
00030 
00031 // Gets a request from a client and depending on the POA name,
00032 // requests an activator to take care of activating the
00033 // corresponding server and raises a forward exception to the
00034 // client pointing to the correct server.
00035 class Locator_Export ImR_Locator_i
00036   : public virtual POA_ImplementationRepository::Locator
00037 {
00038 public:
00039   ImR_Locator_i();
00040 
00041   ~ImR_Locator_i (void);
00042 
00043   /// Initialize the service, creating its own orb, poa, etc.
00044   int init (Options& opts ACE_ENV_ARG_DECL);
00045 
00046   /// Same as above, but use the given orb
00047   int init_with_orb (CORBA::ORB_ptr orb, Options& opts ACE_ENV_ARG_DECL);
00048 
00049   /// Cleans up any state created by init*.
00050   int fini (ACE_ENV_SINGLE_ARG_DECL);
00051 
00052   /// Run using the orb reference created during init()
00053   int run (ACE_ENV_SINGLE_ARG_DECL);
00054 
00055   /// Shutdown the orb.
00056   void shutdown (bool wait_for_completion ACE_ENV_ARG_DECL);
00057 
00058   int debug() const;
00059   // Note : See the IDL for descriptions of the operations.
00060 
00061   // Activator->Locator
00062 
00063   virtual CORBA::Long register_activator (const char* name,
00064     ImplementationRepository::Activator_ptr admin
00065     ACE_ENV_ARG_DECL)
00066     ACE_THROW_SPEC ((CORBA::SystemException));
00067   virtual void unregister_activator (const char* name,
00068     CORBA::Long token ACE_ENV_ARG_DECL)
00069     ACE_THROW_SPEC ((CORBA::SystemException));
00070   virtual void notify_child_death (const char* name ACE_ENV_ARG_DECL)
00071     ACE_THROW_SPEC ((CORBA::SystemException));
00072 
00073   // tao_imr->Locator
00074 
00075   virtual void activate_server (const char * name
00076     ACE_ENV_ARG_DECL)
00077     ACE_THROW_SPEC ((CORBA::SystemException,
00078     ImplementationRepository::NotFound,
00079     ImplementationRepository::CannotActivate));
00080   virtual void add_or_update_server (const char * name,
00081     const ImplementationRepository::StartupOptions &options ACE_ENV_ARG_DECL)
00082     ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound));
00083   virtual void remove_server (const char * name ACE_ENV_ARG_DECL)
00084     ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound));
00085   virtual void shutdown_server (const char * name ACE_ENV_ARG_DECL)
00086     ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound));
00087   virtual void find (const char * name,
00088     ImplementationRepository::ServerInformation_out info ACE_ENV_ARG_DECL)
00089     ACE_THROW_SPEC ((CORBA::SystemException));
00090   virtual void list (
00091     CORBA::ULong how_many,
00092     ImplementationRepository::ServerInformationList_out server_list,
00093     ImplementationRepository::ServerInformationIterator_out server_iterator ACE_ENV_ARG_DECL)
00094     ACE_THROW_SPEC ((CORBA::SystemException));
00095   virtual void shutdown(CORBA::Boolean activators, CORBA::Boolean servers ACE_ENV_ARG_DECL)
00096     ACE_THROW_SPEC ((CORBA::SystemException));
00097 
00098   // Server->Locator
00099 
00100   virtual void server_is_running (const char* name,
00101     const char* partial_ior,
00102     ImplementationRepository::ServerObject_ptr server_object
00103     ACE_ENV_ARG_DECL)
00104     ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound));
00105   virtual void server_is_shutting_down (const char * name ACE_ENV_ARG_DECL)
00106     ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound));
00107 
00108   // Used by the INS_Locator to start a sever given an object name
00109   char* activate_server_by_object (const char* object_name ACE_ENV_ARG_DECL)
00110     ACE_THROW_SPEC ((CORBA::SystemException,
00111     ImplementationRepository::NotFound,
00112     ImplementationRepository::CannotActivate));
00113 
00114   char* activate_server_by_name (const char * name, bool manual_start ACE_ENV_ARG_DECL)
00115     ACE_THROW_SPEC ((CORBA::SystemException,
00116     ImplementationRepository::NotFound,
00117     ImplementationRepository::CannotActivate));
00118 
00119 private:
00120 
00121   char* activate_server_i (Server_Info& info, bool manual_start ACE_ENV_ARG_DECL)
00122     ACE_THROW_SPEC ((CORBA::SystemException,
00123     ImplementationRepository::NotFound,
00124     ImplementationRepository::CannotActivate));
00125 
00126   char* activate_perclient_server_i (Server_Info info, bool manual_start ACE_ENV_ARG_DECL)
00127     ACE_THROW_SPEC ((CORBA::SystemException,
00128     ImplementationRepository::NotFound,
00129     ImplementationRepository::CannotActivate));
00130 
00131   ImplementationRepository::StartupInfo*
00132     start_server(Server_Info& info, bool manual_start ACE_ENV_ARG_DECL)
00133     ACE_THROW_SPEC ((CORBA::SystemException,
00134     ImplementationRepository::NotFound,
00135     ImplementationRepository::CannotActivate));
00136 
00137   bool is_alive(Server_Info& info);
00138   int is_alive_i(Server_Info& info);
00139 
00140   // Set up the multicast related if 'm' is passed on the command
00141   // line.
00142   int setup_multicast (ACE_Reactor *reactor, const char *ior);
00143   void teardown_multicast();
00144 
00145   void unregister_activator_i(const char* activator);
00146 
00147   Activator_Info_Ptr get_activator (const ACE_CString& name);
00148   void connect_activator (Activator_Info& info);
00149 
00150   void auto_start_servers(ACE_ENV_SINGLE_ARG_DECL);
00151 
00152   CORBA::Object_ptr set_timeout_policy(CORBA::Object_ptr obj, const ACE_Time_Value& to);
00153 
00154   void connect_server(Server_Info& info);
00155 
00156   PortableServer::POA_ptr findPOA(const char* name);
00157 private:
00158 
00159   // The class that handles the forwarding.
00160   ImR_Forwarder forwarder_;
00161 
00162   // Used for the forwarding of any type of POA.
00163   ImR_Adapter adapter_;
00164 
00165   /// The locator interface for the IORTable
00166   IORTable::Locator_var ins_locator_;
00167 
00168   CORBA::ORB_var orb_;
00169   PortableServer::POA_var root_poa_;
00170   PortableServer::POA_var imr_poa_;
00171 
00172   int debug_;
00173 
00174   TAO_IOR_Multicast ior_multicast_;
00175 
00176   Locator_Repository repository_;
00177 
00178   AsyncStartupWaiter_i waiter_svt_;
00179   ImplementationRepository::AsyncStartupWaiter_var waiter_;
00180 
00181   bool read_only_;
00182   ACE_Time_Value startup_timeout_;
00183   ACE_Time_Value ping_interval_;
00184 };
00185 
00186 #include /**/ "ace/post.h"
00187 #endif /* IMR_LOCATOR_I_H */

Generated on Thu Nov 9 13:36:19 2006 for TAO_Implementation_Repository by doxygen 1.3.6