EventChannelFactory.h

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

Generated on Thu Nov 9 13:24:11 2006 for TAO_CosNotification by doxygen 1.3.6