ImR_Locator_i.h

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

Generated on Sun Jan 27 15:54:50 2008 for TAO_Implementation_Repository by doxygen 1.3.6