Go to the documentation of this file.00001
00002
00003 #ifndef TAO_Notify_PROXYSUPPLIER_T_CPP
00004 #define TAO_Notify_PROXYSUPPLIER_T_CPP
00005
00006 #include "orbsvcs/Notify/ProxySupplier_T.h"
00007
00008 #include "orbsvcs/Notify/Consumer.h"
00009 #include "orbsvcs/Notify/Structured/StructuredEvent.h"
00010 #include "orbsvcs/Notify/Any/AnyEvent.h"
00011
00012 #include "orbsvcs/Notify/Method_Request_Dispatch.h"
00013 #include "orbsvcs/Notify/Worker_Task.h"
00014 #include "orbsvcs/Notify/Event_Manager.h"
00015 #include "orbsvcs/Notify/ConsumerAdmin.h"
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 template <class SERVANT_TYPE>
00020 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::TAO_Notify_ProxySupplier_T (void)
00021 : is_suspended_ (0)
00022 {
00023 }
00024
00025 template <class SERVANT_TYPE>
00026 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::~TAO_Notify_ProxySupplier_T ()
00027 {
00028 }
00029
00030 template <class SERVANT_TYPE> void
00031 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::admin_types_changed (const CosNotification::EventTypeSeq & added,
00032 const CosNotification::EventTypeSeq & removed)
00033 {
00034 this->subscription_change (added, removed);
00035 }
00036
00037 template <class SERVANT_TYPE> void
00038 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_structured (const CosNotification::StructuredEvent& notification)
00039 {
00040 TAO_Notify_StructuredEvent_No_Copy event (notification);
00041
00042 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 1);
00043
00044 this->execute_task (request);
00045 }
00046
00047 template <class SERVANT_TYPE> void
00048 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_structured_no_filtering (const CosNotification::StructuredEvent& notification)
00049 {
00050 TAO_Notify_StructuredEvent_No_Copy event(notification);
00051
00052 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 0);
00053
00054 this->execute_task (request);
00055 }
00056
00057 template <class SERVANT_TYPE> void
00058 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_any (const CORBA::Any & any)
00059 {
00060 TAO_Notify_AnyEvent_No_Copy event (any);
00061
00062 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 1);
00063
00064 this->execute_task (request);
00065 }
00066
00067 template <class SERVANT_TYPE> void
00068 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_any_no_filtering (const CORBA::Any& any)
00069 {
00070 TAO_Notify_AnyEvent_No_Copy event(any);
00071
00072 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 0);
00073
00074 this->execute_task (request);
00075 }
00076
00077 template <class SERVANT_TYPE> CosNotification::EventTypeSeq*
00078 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::obtain_offered_types (CosNotifyChannelAdmin::ObtainInfoMode mode)
00079 {
00080 return this->obtain_types (mode, this->event_manager().offered_types ());
00081 }
00082
00083 template <class SERVANT_TYPE> void
00084 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::subscription_change (const CosNotification::EventTypeSeq & added,
00085 const CosNotification::EventTypeSeq & removed)
00086 {
00087 TAO_Notify_EventTypeSeq seq_added (added);
00088 TAO_Notify_EventTypeSeq seq_removed (removed);
00089
00090 {
00091 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00092 CORBA::INTERNAL ());
00093
00094 this->subscribed_types_.add_and_remove (seq_added, seq_removed);
00095 }
00096
00097 this->event_manager().subscription_change (this, seq_added, seq_removed);
00098 }
00099
00100 template <class SERVANT_TYPE> void
00101 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::suspend_connection (void)
00102 {
00103 {
00104 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
00105
00106 if (this->is_connected () == 0)
00107 throw CosNotifyChannelAdmin::NotConnected ();
00108
00109 if (this->consumer()->is_suspended () == 1)
00110 throw CosNotifyChannelAdmin::ConnectionAlreadyInactive ();
00111 }
00112
00113 this->consumer()->suspend ();
00114 this->self_change ();
00115 }
00116
00117 template <class SERVANT_TYPE> void
00118 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::resume_connection (void)
00119 {
00120 {
00121 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
00122
00123 if (this->is_connected () == 0)
00124 throw CosNotifyChannelAdmin::NotConnected ();
00125
00126 if (this->consumer()->is_suspended () == 0)
00127 throw CosNotifyChannelAdmin::ConnectionAlreadyActive ();
00128 }
00129
00130 this->consumer()->resume ();
00131 }
00132
00133 template <class SERVANT_TYPE> CosNotifyChannelAdmin::ConsumerAdmin_ptr
00134 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::MyAdmin (void)
00135 {
00136 CosNotifyChannelAdmin::ConsumerAdmin_var ret;
00137
00138 CORBA::Object_var object = this->consumer_admin().ref ();
00139
00140 ret = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (object.in ());
00141
00142 return ret._retn ();
00143 }
00144
00145
00146
00147 template <class SERVANT_TYPE> CosNotifyFilter::MappingFilter_ptr
00148 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::priority_filter (void)
00149 {
00150 throw CORBA::NO_IMPLEMENT ();
00151 }
00152
00153 template <class SERVANT_TYPE> void
00154 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::priority_filter (CosNotifyFilter::MappingFilter_ptr )
00155 {
00156 throw CORBA::NO_IMPLEMENT ();
00157 }
00158
00159 template <class SERVANT_TYPE> CosNotifyFilter::MappingFilter_ptr
00160 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::lifetime_filter (void)
00161 {
00162 throw CORBA::NO_IMPLEMENT ();
00163 }
00164
00165 template <class SERVANT_TYPE> void
00166 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::lifetime_filter (CosNotifyFilter::MappingFilter_ptr )
00167 {
00168 throw CORBA::NO_IMPLEMENT ();
00169 }
00170
00171 TAO_END_VERSIONED_NAMESPACE_DECL
00172
00173 #endif