diff options
author | fields_t <fields_t@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-24 20:19:09 +0000 |
---|---|---|
committer | fields_t <fields_t@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-24 20:19:09 +0000 |
commit | 0848317866091b02f40ea62d8db7d580efd1a561 (patch) | |
tree | c4f33b43453b6e5cc15558ab3da655e36fba99e8 /TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | |
parent | 6a271e6178c4016b0a15578f553833125ef146de (diff) | |
download | ATCD-0848317866091b02f40ea62d8db7d580efd1a561.tar.gz |
ChangeLogTag:Fri Sep 24 13:16:44 MST 2004 Trevor Fields <fields_t@ociweb.com>
Diffstat (limited to 'TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h')
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | 282 |
1 files changed, 124 insertions, 158 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index 5f7ea07d604..61eeb883c33 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -4,212 +4,178 @@ #define IMR_LOCATOR_I_H #include /**/ "ace/pre.h" -#include "tao/PortableServer/ImR_LocatorS.h" -#include "tao/IORTable/IORTable.h" +#include "locator_export.h" -#include "ace/Hash_Map_Manager.h" -#include "ace/Null_Mutex.h" -#include "ace/SString.h" +#include "Adapter_Activator.h" +#include "Forwarder.h" +#include "INS_Locator.h" +#include "Locator_Options.h" +#include "Locator_Repository.h" -class ACE_Reactor; - -struct ActivatorInfo { - CORBA::Long token; // A unique token is assigned at registration - ImplementationRepository::Administration_var admin; -}; +#include "orbsvcs/orbsvcs/IOR_Multicast.h" -// Look up activator information by activator name. -typedef ACE_Hash_Map_Manager_Ex <ACE_CString, - ActivatorInfo, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> ActivatorMap; +#include "ImR_LocatorS.h" -// Look up activator name by server name. (where the server name is the name of a poa -// registered in the call to server_is_running().) -typedef ACE_Hash_Map_Manager_Ex <ACE_CString, - ACE_CString, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> ServerMap; - -class ImR_Adapter_Activator; -class ImR_Forwarder; +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +class ACE_Reactor; // Gets a request from a client and depending on the POA name, // requests an activator to take care of activating the // corresponding server and raises a forward exception to the // client pointing to the correct server. -class ImR_Locator_i : public virtual POA_ImplementationRepository::Locator +class Locator_Export ImR_Locator_i : public virtual POA_ImplementationRepository::Locator { +public: + ImR_Locator_i(); - public: + /// Initialize the service, creating its own orb, poa, etc. + int init (Options& opts ACE_ENV_ARG_DECL); - ImR_Locator_i (); + /// Same as above, but use the given orb + int init_with_orb (CORBA::ORB_ptr orb, Options& opts ACE_ENV_ARG_DECL); - // Initialize and gets the ImR_Locator running and ready to accept - // requests. - int init (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + /// Cleans up any state created by init*. + int fini (ACE_ENV_SINGLE_ARG_DECL); - // Register an activator with the locator. - // Returns a token that must be used when unregistering. - virtual CORBA::Long register_activator (const char *activator, - ImplementationRepository::Administration_ptr admin, - const ImplementationRepository::Locator::ServerNameList & servers - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); + /// Run using the orb reference created during init() + int run (ACE_ENV_SINGLE_ARG_DECL); + + // Note : See the IDL for descriptions of the operations. + + // Activator->Locator - // UnRegister an activator with the locator. - virtual void unregister_activator (const char *activator, - CORBA::Long token ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual CORBA::Long register_activator (const char* name, + ImplementationRepository::Activator_ptr admin + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void unregister_activator (const char* name, + CORBA::Long token ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); - // Starts up the server <server> if not already running. - virtual void activate_server (const char *server - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - ImplementationRepository::NotFound, - ImplementationRepository::CannotActivate)); + // tao_imr->Locator - // Starts up the server <server> if not already running. - virtual void activate_server_in_activator (const char *server, - const char *activator - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void activate_server (const char * name + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, - ImplementationRepository::NotFound, - ImplementationRepository::CannotActivate)); - - // Adds the server to the repository and registers the startup information - // about the server <server>. - virtual void register_server (const char *server, - const ImplementationRepository::StartupOptions &options - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - ImplementationRepository::AlreadyRegistered, - ImplementationRepository::NotFound)); - - // Updates the startup information about the server <server>. - virtual void reregister_server (const char *server, - const ImplementationRepository::StartupOptions &options - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException,ImplementationRepository::NotFound )); - - // Removes the server <server> from the repository. - virtual void remove_server (const char *server - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - - // Removes the server <server> from the repository. - virtual void remove_server_in_activator (const char *server, - const char *activator - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ImplementationRepository::NotFound, + ImplementationRepository::CannotActivate)); + virtual void register_server (const char * name, + const ImplementationRepository::StartupOptions &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::AlreadyRegistered, + ImplementationRepository::NotFound)); + virtual void reregister_server (const char * name, + const ImplementationRepository::StartupOptions &options + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::AlreadyRegistered, + ImplementationRepository::NotFound )); + virtual void remove_server (const char * name + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - - // Attempts to gracefully shut down the server, - virtual void shutdown_server (const char *server - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void shutdown_server (const char * name + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - - // Attempts to gracefully shut down the server <server> in activator - // <activator> - virtual void shutdown_server_in_activator (const char *server, - const char *activator - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void find (const char * name, + ImplementationRepository::ServerInformation_out info + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - - // Shuts down the repository. - virtual void shutdown_repo (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual void list ( + CORBA::ULong how_many, + ImplementationRepository::ServerInformationList_out server_list, + ImplementationRepository::ServerInformationIterator_out server_iterator + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); - // Invoked by the server to update transient information such as current - // activator of the <server> and its ServerObject. - virtual void server_is_running_in_activator (const char *server, - const char* activator, - const char* partial_ior, - ImplementationRepository::ServerObject_ptr server_object - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); + // Server->Locator - // This version should only be used by the activator. - virtual void server_is_running (const char* server, - const char* partial_ior, - ImplementationRepository::ServerObject_ptr server_object - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void server_is_running (const char* name, + const char* partial_ior, + ImplementationRepository::ServerObject_ptr server_object + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - - // Only used by activator. - virtual void server_is_shutting_down (const char *server ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void server_is_shutting_down (const char * name ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); - // What the server <server> should call before it shuts down from - // activator <activator> - virtual void server_is_shutting_down_in_activator (const char *server, - const char *activator - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); + // Used by the INS_Locator to start a sever given an object name + char* activate_server_by_object (const char* object_name ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::NotFound, + ImplementationRepository::CannotActivate)); - /// IOR_LookupTable_Callback method helper. Will return an IOR - char *find_ior (const char* object_name ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); + char* activate_server_by_name (const char * name, bool manual_start ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::NotFound, + ImplementationRepository::CannotActivate)); - virtual void find (const char *server, - ImplementationRepository::ServerInformation_out info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); + void server_status_changed(Server_Info& info); - // Returns the startup information for a server - virtual void find_in_activator (const char *server, - const char* activator, - ImplementationRepository::ServerInformation_out info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound)); +private: - // Used to access the list of servers registered. May also return an - // iterator which can be used to access more than <how_many> of them. - virtual void list ( - CORBA::ULong how_many, - ImplementationRepository::ServerInformationList_out server_list, - ImplementationRepository::ServerInformationIterator_out server_iterator - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); + char* activate_server_i (Server_Info& info, bool manual_start ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::NotFound, + ImplementationRepository::CannotActivate)); + + void start_server(Server_Info& info, bool manual_start ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ImplementationRepository::NotFound, + ImplementationRepository::CannotActivate)); - // Starts up the server <server> on one or more activators. - // Returns a partial ior for the server that is missing only the ObjectKey. - char *activate_server_with_startup (const char *server, - int check_startup - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + void register_server_i (const char * name, + const ImplementationRepository::StartupOptions &options, + bool allow_updates + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, - ImplementationRepository::NotFound, - ImplementationRepository::CannotActivate)); - private: + ImplementationRepository::AlreadyRegistered, + ImplementationRepository::NotFound )); + + bool is_alive(Server_Info& info); + int is_alive_i(Server_Info& info); // Set up the multicast related if 'm' is passed on the command // line. int setup_multicast (ACE_Reactor *reactor, const char *ior); - // As the name suggests, this methods helps choose the activator - // based on the activator passed. - ImplementationRepository::Administration_ptr - choose_activator(const char *activator ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((ImplementationRepository::NotFound, CORBA::SystemException)); + void unregister_activator_i(const char* activator); + + Activator_Info_Ptr get_activator (const ACE_CString& name); + void connect_activator (Activator_Info& info); + + void auto_start_servers(ACE_ENV_SINGLE_ARG_DECL); + + void set_timeout_policy(CORBA::Object_ptr obj, const ACE_Time_Value& to); - // Table that maintains the activator to Object Reference of the - // Activator running in that activator. - ActivatorMap activator_map_; - ServerMap server_map_; + void connect_server(Server_Info& info); + +private: // The class that handles the forwarding. - ImR_Forwarder *forwarder_impl_; + ImR_Forwarder forwarder_; // Used for the forwarding of any type of POA. - ImR_Adapter_Activator *activator_; + ImR_Adapter adapter_; /// The locator interface for the IORTable - IORTable::Locator_var ins_locator_; + INS_Locator ins_locator_; + + CORBA::ORB_var orb_; + PortableServer::POA_var root_poa_; + PortableServer::POA_var imr_poa_; + + int debug_; + + TAO_IOR_Multicast ior_multicast_; + + Locator_Repository repository_; - // The ORB. - CORBA::ORB_var orb_ ; + bool read_only_; + ACE_Time_Value startup_timeout_; + ACE_Time_Value ping_interval_; }; #include /**/ "ace/post.h" |