00001 // -*- C++ -*- 00002 00003 /** 00004 * @file Reconnection_Registry.h 00005 * 00006 * Reconnection_Registry.h,v 1.7 2006/03/14 06:14:34 jtc Exp 00007 * 00008 * @author Dale Wilson <wilson_d@ociweb.com> 00009 */ 00010 00011 #ifndef TAO_NOTIFY_RECONNECTION_REGISTRY_H 00012 #define TAO_NOTIFY_RECONNECTION_REGISTRY_H 00013 #include /**/ <ace/pre.h> 00014 #include /**/ <ace/config-all.h> 00015 00016 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00017 # pragma once 00018 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00019 00020 #include "orbsvcs/Notify/Topology_Object.h" 00021 00022 #include "orbsvcs/NotifyExtS.h" 00023 00024 #include "ace/Hash_Map_Manager_T.h" 00025 #include "ace/Null_Mutex.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 namespace TAO_Notify 00030 { 00031 extern const char REGISTRY_TYPE[]; 00032 extern const char RECONNECT_ID[]; 00033 extern const char RECONNECT_IOR[]; 00034 extern const char REGISTRY_CALLBACK_TYPE[]; 00035 00036 /** 00037 * @class Reconnection_Registry 00038 * 00039 * @brief Implementation of ReconnectionRegistry 00040 * 00041 */ 00042 class TAO_Notify_Serv_Export Reconnection_Registry 00043 : public Topology_Object 00044 { 00045 /// The registry consists of a map from ReconnectionID to stringified IOR 00046 typedef ACE_Hash_Map_Manager_Ex<NotifyExt::ReconnectionRegistry::ReconnectionID, 00047 ACE_CString, 00048 ACE_Hash<NotifyExt::ReconnectionRegistry::ReconnectionID>, 00049 ACE_Equal_To<NotifyExt::ReconnectionRegistry::ReconnectionID>, 00050 ACE_SYNCH_NULL_MUTEX> Reconnection_Registry_Type; 00051 00052 public: 00053 00054 /// Constructor 00055 Reconnection_Registry (Topology_Parent & parent); 00056 00057 /// Destructor 00058 virtual ~Reconnection_Registry (); 00059 00060 ////////////////////////// 00061 // During normal operation 00062 00063 /// add a new callback to the registry 00064 ::NotifyExt::ReconnectionRegistry::ReconnectionID register_callback ( 00065 ::NotifyExt::ReconnectionCallback_ptr callback 00066 ACE_ENV_ARG_DECL); 00067 00068 /// 00069 void unregister_callback (::NotifyExt::ReconnectionRegistry::ReconnectionID id 00070 ACE_ENV_ARG_DECL); 00071 00072 CORBA::Boolean is_alive (ACE_ENV_SINGLE_ARG_DECL); 00073 00074 ////////////////////// 00075 // During topology save 00076 virtual void save_persistent (Topology_Saver& saver ACE_ENV_ARG_DECL); 00077 00078 /////////////////////////////////////// 00079 // During reload of persistent topology 00080 00081 virtual Topology_Object* load_child (const ACE_CString & type, 00082 CORBA::Long id, 00083 const NVPList& attrs 00084 ACE_ENV_ARG_DECL); 00085 00086 void send_reconnect (CosNotifyChannelAdmin::EventChannelFactory_ptr dest_factory 00087 ACE_ENV_ARG_DECL); 00088 00089 private: 00090 void release (void); 00091 00092 Reconnection_Registry_Type reconnection_registry_; 00093 ::NotifyExt::ReconnectionRegistry::ReconnectionID highest_id_; 00094 }; 00095 } // namespace TAO_Notify 00096 00097 TAO_END_VERSIONED_NAMESPACE_DECL 00098 00099 #include /**/ <ace/post.h> 00100 #endif /* TAO_NOTIFY_RECONNECTION_REGISTRY_H */