00001 // -*- C++ -*- 00002 00003 /** 00004 * @file Reconnection_Registry.h 00005 * 00006 * $Id: Reconnection_Registry.h 81419 2008-04-24 11:35:22Z johnnyw $ 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 00067 /// 00068 void unregister_callback (::NotifyExt::ReconnectionRegistry::ReconnectionID id); 00069 00070 CORBA::Boolean is_alive (void); 00071 00072 ////////////////////// 00073 // During topology save 00074 virtual void save_persistent (Topology_Saver& saver); 00075 00076 /////////////////////////////////////// 00077 // During reload of persistent topology 00078 00079 virtual Topology_Object* load_child (const ACE_CString & type, 00080 CORBA::Long id, 00081 const NVPList& attrs); 00082 00083 void send_reconnect (CosNotifyChannelAdmin::EventChannelFactory_ptr dest_factory); 00084 00085 private: 00086 void release (void); 00087 00088 Reconnection_Registry_Type reconnection_registry_; 00089 ::NotifyExt::ReconnectionRegistry::ReconnectionID highest_id_; 00090 }; 00091 } // namespace TAO_Notify 00092 00093 TAO_END_VERSIONED_NAMESPACE_DECL 00094 00095 #include /**/ <ace/post.h> 00096 #endif /* TAO_NOTIFY_RECONNECTION_REGISTRY_H */