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 ACE_ENV_ARG_DECL)
00034 {
00035 this->subscription_change (added, removed ACE_ENV_ARG_PARAMETER);
00036 }
00037
00038 template <class SERVANT_TYPE> void
00039 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_structured (const CosNotification::StructuredEvent& notification ACE_ENV_ARG_DECL)
00040 ACE_THROW_SPEC ((
00041 CORBA::SystemException
00042 ))
00043 {
00044 TAO_Notify_StructuredEvent_No_Copy event (notification);
00045
00046 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 1);
00047
00048 this->execute_task (request ACE_ENV_ARG_PARAMETER);
00049 }
00050
00051 template <class SERVANT_TYPE> void
00052 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_structured_no_filtering (const CosNotification::StructuredEvent& notification ACE_ENV_ARG_DECL)
00053 ACE_THROW_SPEC ((
00054 CORBA::SystemException
00055 ))
00056 {
00057 TAO_Notify_StructuredEvent_No_Copy event(notification);
00058
00059 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 0);
00060
00061 this->execute_task (request ACE_ENV_ARG_PARAMETER);
00062 }
00063
00064 template <class SERVANT_TYPE> void
00065 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_any (const CORBA::Any & any ACE_ENV_ARG_DECL)
00066 ACE_THROW_SPEC ((
00067 CORBA::SystemException
00068 ))
00069 {
00070 TAO_Notify_AnyEvent_No_Copy event (any);
00071
00072 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 1);
00073
00074 this->execute_task (request ACE_ENV_ARG_PARAMETER);
00075 }
00076
00077 template <class SERVANT_TYPE> void
00078 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::forward_any_no_filtering (const CORBA::Any& any ACE_ENV_ARG_DECL)
00079 ACE_THROW_SPEC ((
00080 CORBA::SystemException
00081 ))
00082 {
00083 TAO_Notify_AnyEvent_No_Copy event(any);
00084
00085 TAO_Notify_Method_Request_Dispatch_No_Copy request (&event, this, 0);
00086
00087 this->execute_task (request ACE_ENV_ARG_PARAMETER);
00088 }
00089
00090 template <class SERVANT_TYPE> CosNotification::EventTypeSeq*
00091 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::obtain_offered_types (CosNotifyChannelAdmin::ObtainInfoMode mode ACE_ENV_ARG_DECL)
00092 ACE_THROW_SPEC ((
00093 CORBA::SystemException
00094 ))
00095 {
00096 return this->obtain_types (mode, this->event_manager().offered_types () ACE_ENV_ARG_PARAMETER);
00097 }
00098
00099 template <class SERVANT_TYPE> void
00100 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::subscription_change (const CosNotification::EventTypeSeq & added,
00101 const CosNotification::EventTypeSeq & removed
00102 ACE_ENV_ARG_DECL)
00103 ACE_THROW_SPEC ((CORBA::SystemException,
00104 CosNotifyComm::InvalidEventType))
00105 {
00106 TAO_Notify_EventTypeSeq seq_added (added);
00107 TAO_Notify_EventTypeSeq seq_removed (removed);
00108
00109 {
00110 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00111 CORBA::INTERNAL ());
00112 ACE_CHECK;
00113
00114 this->subscribed_types_.add_and_remove (seq_added, seq_removed);
00115 }
00116
00117 this->event_manager().subscription_change (this, seq_added, seq_removed ACE_ENV_ARG_PARAMETER);
00118 }
00119
00120 template <class SERVANT_TYPE> void
00121 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::suspend_connection (ACE_ENV_SINGLE_ARG_DECL)
00122 ACE_THROW_SPEC ((
00123 CORBA::SystemException,
00124 CosNotifyChannelAdmin::ConnectionAlreadyInactive,
00125 CosNotifyChannelAdmin::NotConnected
00126 ))
00127 {
00128 {
00129 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
00130
00131 if (this->is_connected () == 0)
00132 ACE_THROW (CosNotifyChannelAdmin::NotConnected ());
00133
00134 if (this->consumer()->is_suspended () == 1)
00135 ACE_THROW (CosNotifyChannelAdmin::ConnectionAlreadyInactive ());
00136 }
00137
00138 this->consumer()->suspend (ACE_ENV_SINGLE_ARG_PARAMETER);
00139 ACE_CHECK;
00140 this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00141 ACE_CHECK;
00142 }
00143
00144 template <class SERVANT_TYPE> void
00145 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::resume_connection (ACE_ENV_SINGLE_ARG_DECL)
00146 ACE_THROW_SPEC ((
00147 CORBA::SystemException,
00148 CosNotifyChannelAdmin::ConnectionAlreadyActive,
00149 CosNotifyChannelAdmin::NotConnected
00150 ))
00151 {
00152 {
00153 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
00154
00155 if (this->is_connected () == 0)
00156 ACE_THROW (CosNotifyChannelAdmin::NotConnected ());
00157
00158 if (this->consumer()->is_suspended () == 0)
00159 ACE_THROW (CosNotifyChannelAdmin::ConnectionAlreadyActive ());
00160 }
00161
00162 this->consumer()->resume (ACE_ENV_SINGLE_ARG_PARAMETER);
00163 }
00164
00165 template <class SERVANT_TYPE> CosNotifyChannelAdmin::ConsumerAdmin_ptr
00166 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::MyAdmin (ACE_ENV_SINGLE_ARG_DECL)
00167 ACE_THROW_SPEC ((
00168 CORBA::SystemException
00169 ))
00170 {
00171 CosNotifyChannelAdmin::ConsumerAdmin_var ret;
00172
00173 CORBA::Object_var object = this->consumer_admin().ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00174 ACE_CHECK_RETURN (ret._retn ());
00175
00176 ret = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
00177
00178 return ret._retn ();
00179 }
00180
00181
00182
00183 template <class SERVANT_TYPE> CosNotifyFilter::MappingFilter_ptr
00184 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::priority_filter (ACE_ENV_SINGLE_ARG_DECL)
00185 ACE_THROW_SPEC ((
00186 CORBA::SystemException
00187 ))
00188 {
00189 ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
00190 CosNotifyFilter::MappingFilter::_nil ());
00191
00192 return CosNotifyFilter::MappingFilter::_nil ();
00193 }
00194
00195 template <class SERVANT_TYPE> void
00196 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::priority_filter (CosNotifyFilter::MappingFilter_ptr ACE_ENV_ARG_DECL)
00197 ACE_THROW_SPEC ((
00198 CORBA::SystemException
00199 ))
00200 {
00201 ACE_THROW (CORBA::NO_IMPLEMENT ());
00202 }
00203
00204 template <class SERVANT_TYPE> CosNotifyFilter::MappingFilter_ptr
00205 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::lifetime_filter (ACE_ENV_SINGLE_ARG_DECL)
00206 ACE_THROW_SPEC ((
00207 CORBA::SystemException
00208 ))
00209 {
00210 ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
00211 CosNotifyFilter::MappingFilter::_nil ());
00212
00213 return CosNotifyFilter::MappingFilter::_nil ();
00214 }
00215
00216 template <class SERVANT_TYPE> void
00217 TAO_Notify_ProxySupplier_T<SERVANT_TYPE>::lifetime_filter (CosNotifyFilter::MappingFilter_ptr ACE_ENV_ARG_DECL)
00218 ACE_THROW_SPEC ((
00219 CORBA::SystemException
00220 ))
00221 {
00222 ACE_THROW (CORBA::NO_IMPLEMENT ());
00223 }
00224
00225 TAO_END_VERSIONED_NAMESPACE_DECL
00226
00227 #endif