EventChannelFactory.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /**
00003  *  @file EventChannelFactory.h
00004  *
00005  *  $Id: EventChannelFactory.h 79084 2007-07-30 13:13:45Z elliott_c $
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   /// Constuctor
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 <channel> from the <ec_container_>
00072   virtual void remove (TAO_Notify_EventChannel* channel);
00073 
00074   /// Accesor for the default filter factory shared by all EC's.
00075   virtual CosNotifyFilter::FilterFactory_ptr get_default_filter_factory (
00076     );
00077 
00078   /// This method is called by the Notify_Service when the event channel
00079   /// is automatically created and bound in the name service.
00080   virtual CosNotifyChannelAdmin::EventChannel_ptr create_named_channel (
00081       const CosNotification::QoSProperties& initial_qos,
00082       const CosNotification::AdminProperties& initial_admin,
00083       CosNotifyChannelAdmin::ChannelID_out id,
00084       const char* name);
00085 
00086   //////////////////////////
00087   // The following methods are for
00088   // unit testing and debugging
00089 
00090   /// Use the registered Topology_Factory to create a loader, and
00091   /// load the topology. If no Topology_Factory is registered
00092   /// then nothing will be loaded.
00093   void load_topology (void);
00094 
00095   /// Use the passed in saver factory to generate topology saver objects.
00096   /// Does not take ownership.
00097   void set_topology_factory(TAO_Notify::Topology_Factory* sf);
00098 
00099   //-- Topology_Parent
00100 
00101   virtual bool is_persistent () const;
00102 
00103   virtual void save_persistent (TAO_Notify::Topology_Saver& saver);
00104   virtual bool change_to_parent (void);
00105   virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type,
00106                                                    CORBA::Long id,
00107                                                    const TAO_Notify::NVPList& attrs);
00108   CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void);
00109   virtual void reconnect (void);
00110 
00111   /// handle change notifications
00112   bool handle_change (void);
00113 
00114   void load_event_persistence (void);
00115 
00116   virtual void save_topology (void);
00117 
00118   TAO_Notify_ProxyConsumer * find_proxy_consumer (TAO_Notify::IdVec & id_path, size_t position);
00119   TAO_Notify_ProxySupplier * find_proxy_supplier (TAO_Notify::IdVec & id_path, size_t position);
00120   TAO_Notify_Object * follow_id_path (TAO_Notify::IdVec & id_path, size_t position);
00121   virtual TAO_Notify_Object::ID get_id () const;
00122 
00123 
00124 private:
00125 
00126   /// = Data Members
00127 
00128   /// The default filter factory.
00129   CosNotifyFilter::FilterFactory_var default_filter_factory_;
00130 
00131   /// = NotifyExt methods
00132   virtual void destroy (void);
00133 
00134   /// shutdown
00135   virtual int shutdown (void);
00136 
00137   virtual
00138   NotifyExt::ReconnectionRegistry::ReconnectionID register_callback (
00139       NotifyExt::ReconnectionCallback_ptr reconnection);
00140 
00141   virtual void unregister_callback (
00142       NotifyExt::ReconnectionRegistry::ReconnectionID id);
00143 
00144   virtual CORBA::Boolean is_alive (void);
00145 
00146 protected:
00147   /// = CosNotifyChannelAdmin Methods
00148   virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel (
00149       const CosNotification::QoSProperties & initial_qos,
00150       const CosNotification::AdminProperties & initial_admin,
00151       CosNotifyChannelAdmin::ChannelID_out id
00152     );
00153 
00154   virtual ::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels (
00155     );
00156 
00157   virtual ::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel (
00158       CosNotifyChannelAdmin::ChannelID id
00159     );
00160 
00161 private:
00162   typedef TAO_Notify_Container_T<TAO_Notify_EventChannel> TAO_Notify_EventChannel_Container;
00163 
00164   TAO_Notify_EventChannel_Container& ec_container();
00165 
00166   /// Container for Event Channels.
00167   ACE_Auto_Ptr< TAO_Notify_EventChannel_Container > ec_container_;
00168 
00169   TAO_SYNCH_MUTEX topology_save_lock_;
00170 
00171   CosNotifyChannelAdmin::EventChannelFactory_var channel_factory_;
00172 
00173   /// change-in-progress detector to avoid duplicates
00174   short topology_save_seq_;
00175   TAO_Notify::Topology_Factory* topology_factory_;
00176   TAO_Notify::Reconnection_Registry reconnect_registry_;
00177   bool loading_topology_;
00178 
00179   Routing_Slip_Set routing_slip_restart_set_;
00180 
00181   /// Release this object.
00182   virtual void release (void);
00183 
00184 };
00185 
00186 TAO_END_VERSIONED_NAMESPACE_DECL
00187 
00188 #if defined(_MSC_VER)
00189 #pragma warning(pop)
00190 #endif /* _MSC_VER */
00191 
00192 #include /**/ "ace/post.h"
00193 
00194 #endif /* TAO_Notify_EVENTCHANNELFACTORY_H */

Generated on Sun Jan 27 15:39:55 2008 for TAO_CosNotification by doxygen 1.3.6