EventChannelFactory.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /**
00003  *  @file EventChannelFactory.h
00004  *
00005  *  $Id: EventChannelFactory.h 81418 2008-04-24 11:11:22Z johnnyw $
00006  *
00007  *  @author Pradeep Gore <pradeep@oomworks.com>
00008  *
00009  *
00010  */
00011 
00012 #ifndef TAO_Notify_EVENTCHANNELFACTORY_H
00013 #define TAO_Notify_EVENTCHANNELFACTORY_H
00014 
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "orbsvcs/Notify/notify_serv_export.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "orbsvcs/Notify/Topology_Object.h"
00024 #include "orbsvcs/Notify/Topology_Factory.h"
00025 #include "orbsvcs/Notify/Reconnection_Registry.h"
00026 #include "orbsvcs/Notify/Routing_Slip.h"
00027 
00028 #include "orbsvcs/CosNotifyChannelAdminS.h"
00029 #include "orbsvcs/NotifyExtS.h"
00030 
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 #if defined(_MSC_VER)
00034 #pragma warning(push)
00035 #pragma warning(disable:4250)
00036 #endif /* _MSC_VER */
00037 
00038 class TAO_Notify_EventChannel;
00039 template <class TYPE> class TAO_Notify_Container_T;
00040 
00041 /**
00042  * @class TAO_Notify_EventChannelFactory
00043  *
00044  * @brief Implementation of CosNotifyChannelAdmin::EventChannelFactory
00045  *
00046  */
00047 class TAO_Notify_Serv_Export TAO_Notify_EventChannelFactory
00048   : public virtual POA_NotifyExt::EventChannelFactory
00049   , public TAO_Notify::Topology_Parent
00050 
00051 {
00052   friend class TAO_Notify_Builder;
00053   typedef ACE_Unbounded_Set <TAO_Notify::Routing_Slip_Ptr> Routing_Slip_Set;
00054 
00055 public:
00056   typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_EventChannelFactory > Ptr;
00057 
00058   /// Constructor
00059   TAO_Notify_EventChannelFactory (void);
00060 
00061   /// Init the factory
00062   void init (PortableServer::POA_ptr poa);
00063 
00064   /// Destructor
00065   virtual ~TAO_Notify_EventChannelFactory ();
00066 
00067   /// = ServantBase  Methods
00068   virtual void _add_ref (void);
00069   virtual void _remove_ref (void);
00070 
00071   /// Remove @a channel from the <ec_container_>
00072   virtual void remove (TAO_Notify_EventChannel* channel);
00073 
00074   /// This method is called by the Notify_Service when the event channel
00075   /// is automatically created and bound in the name service.
00076   virtual CosNotifyChannelAdmin::EventChannel_ptr create_named_channel (
00077       const CosNotification::QoSProperties& initial_qos,
00078       const CosNotification::AdminProperties& initial_admin,
00079       CosNotifyChannelAdmin::ChannelID_out id,
00080       const char* name);
00081 
00082   //////////////////////////
00083   // The following methods are for
00084   // unit testing and debugging
00085 
00086   /// Use the registered Topology_Factory to create a loader, and
00087   /// load the topology. If no Topology_Factory is registered
00088   /// then nothing will be loaded.
00089   void load_topology (void);
00090 
00091   /// Use the passed in saver factory to generate topology saver objects.
00092   /// Does not take ownership.
00093   void set_topology_factory(TAO_Notify::Topology_Factory* sf);
00094 
00095   //-- Topology_Parent
00096 
00097   virtual bool is_persistent (void) const;
00098 
00099   virtual void save_persistent (TAO_Notify::Topology_Saver& saver);
00100   virtual bool change_to_parent (void);
00101   virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type,
00102                                                    CORBA::Long id,
00103                                                    const TAO_Notify::NVPList& attrs);
00104   CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void);
00105   virtual void reconnect (void);
00106 
00107   /// Handle change notifications
00108   bool handle_change (void);
00109 
00110   void load_event_persistence (void);
00111 
00112   virtual void save_topology (void);
00113 
00114   TAO_Notify_ProxyConsumer * find_proxy_consumer (TAO_Notify::IdVec & id_path, size_t position);
00115   TAO_Notify_ProxySupplier * find_proxy_supplier (TAO_Notify::IdVec & id_path, size_t position);
00116   TAO_Notify_Object * follow_id_path (TAO_Notify::IdVec & id_path, size_t position);
00117   virtual TAO_Notify_Object::ID get_id (void) const;
00118 
00119 private:
00120 
00121   /// = Data Members
00122 
00123   /// = NotifyExt methods
00124   virtual void destroy (void);
00125 
00126   /// shutdown
00127   virtual int shutdown (void);
00128 
00129   virtual
00130   NotifyExt::ReconnectionRegistry::ReconnectionID register_callback (
00131       NotifyExt::ReconnectionCallback_ptr reconnection);
00132 
00133   virtual void unregister_callback (
00134       NotifyExt::ReconnectionRegistry::ReconnectionID id);
00135 
00136   virtual CORBA::Boolean is_alive (void);
00137 
00138 protected:
00139   /// = CosNotifyChannelAdmin Methods
00140   virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel (
00141       const CosNotification::QoSProperties & initial_qos,
00142       const CosNotification::AdminProperties & initial_admin,
00143       CosNotifyChannelAdmin::ChannelID_out id);
00144 
00145   virtual ::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels (void);
00146 
00147   virtual ::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel (
00148       CosNotifyChannelAdmin::ChannelID id);
00149 
00150 private:
00151   typedef TAO_Notify_Container_T<TAO_Notify_EventChannel> TAO_Notify_EventChannel_Container;
00152 
00153   TAO_Notify_EventChannel_Container& ec_container();
00154 
00155   /// Container for Event Channels.
00156   ACE_Auto_Ptr< TAO_Notify_EventChannel_Container > ec_container_;
00157 
00158   TAO_SYNCH_MUTEX topology_save_lock_;
00159 
00160   CosNotifyChannelAdmin::EventChannelFactory_var channel_factory_;
00161 
00162   /// Change-in-progress detector to avoid duplicates
00163   short topology_save_seq_;
00164   TAO_Notify::Topology_Factory* topology_factory_;
00165   TAO_Notify::Reconnection_Registry reconnect_registry_;
00166   bool loading_topology_;
00167 
00168   Routing_Slip_Set routing_slip_restart_set_;
00169 
00170   /// Release this object.
00171   virtual void release (void);
00172 
00173 };
00174 
00175 TAO_END_VERSIONED_NAMESPACE_DECL
00176 
00177 #if defined(_MSC_VER)
00178 #pragma warning(pop)
00179 #endif /* _MSC_VER */
00180 
00181 #include /**/ "ace/post.h"
00182 
00183 #endif /* TAO_Notify_EVENTCHANNELFACTORY_H */

Generated on Tue Feb 2 17:45:29 2010 for TAO_CosNotification by  doxygen 1.4.7