#include <ProxyConsumer.h>
Inheritance diagram for TAO_Notify_ProxyConsumer:
Public Types | |
typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_ProxyConsumer > | Ptr |
Public Member Functions | |
TAO_Notify_ProxyConsumer (void) | |
Constuctor. | |
virtual | ~TAO_Notify_ProxyConsumer () |
Destructor. | |
virtual void | init (TAO_Notify::Topology_Parent *topology_parent) |
init: overrides Topology_Object method | |
void | connect (TAO_Notify_Supplier *supplier) |
Connect. | |
void | disconnect (void) |
Disconnect. | |
virtual int | shutdown (void) |
Shutdown (TAO_Notify_Container_T method). | |
virtual void | destroy (void) |
Destroy this object. | |
bool | is_connected (void) const |
Return 1 if connected. | |
TAO_Notify_SupplierAdmin & | supplier_admin (void) |
The SA parent. | |
Protected Member Functions | |
TAO_Notify_Supplier * | supplier (void) |
Access the Supplier. | |
void | push_i (TAO_Notify_Event *event) |
Accept an event from the Supplier. | |
Private Member Functions | |
bool | supports_reliable_events () const |
Is this part of a reliable channel. | |
virtual TAO_Notify_Peer * | peer (void) |
Access our Peer. | |
Private Attributes | |
TAO_Notify_SupplierAdmin::Ptr | supplier_admin_ |
ACE_Auto_Ptr< TAO_Notify_Supplier > | supplier_ |
The Supplier that we're connect to. |
Definition at line 39 of file ProxyConsumer.h.
|
Reimplemented from TAO_Notify_Proxy. Definition at line 43 of file ProxyConsumer.h. |
|
Constuctor.
Definition at line 32 of file ProxyConsumer.cpp.
00033 : supplier_admin_ (0) 00034 { 00035 } |
|
Destructor.
Definition at line 37 of file ProxyConsumer.cpp.
00038 { 00039 } |
|
Connect.
Definition at line 68 of file ProxyConsumer.cpp. References ACE_ASSERT, ACE_GUARD_THROW_EX, TAO_Notify_Object::admin_properties(), TAO_Notify_Properties::allow_reconnect(), TAO_Notify_Event_Manager::connect(), TAO_Notify_Object::event_manager(), TAO_Notify_Properties::instance(), is_connected(), TAO_Notify_AdminProperties::max_suppliers(), TAO_Notify_Event_Manager::offer_change(), TAO_Notify_AdminProperties::suppliers(), TAO_Notify_Atomic_Property_Long, TAO_Notify_Property_Long, TAO_SYNCH_MUTEX, and TAO_Notify_PropertyBase_T< TYPE >::value(). Referenced by TAO_Notify_ProxyPushConsumer::connect_any_push_supplier(), TAO_Notify_CosEC_ProxyPushConsumer::connect_push_supplier(), TAO_Notify_SequenceProxyPushConsumer::connect_sequence_push_supplier(), and TAO_Notify_StructuredProxyPushConsumer::connect_structured_push_supplier().
00069 { 00070 // Adopt the supplier 00071 ACE_Auto_Ptr< TAO_Notify_Supplier > auto_supplier (supplier); 00072 00073 TAO_Notify_Atomic_Property_Long& supplier_count = this->admin_properties().suppliers (); 00074 const TAO_Notify_Property_Long& max_suppliers = this->admin_properties().max_suppliers (); 00075 00076 if (max_suppliers != 0 && supplier_count >= max_suppliers.value ()) 00077 { 00078 throw CORBA::IMP_LIMIT ( 00079 ); // we've reached the limit of suppliers connected. 00080 } 00081 00082 { 00083 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 00084 CORBA::INTERNAL ()); 00085 00086 // if supplier is set and reconnect not allowed we get out. 00087 if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false) 00088 { 00089 throw CosEventChannelAdmin::AlreadyConnected (); 00090 } 00091 00092 // Adopt the supplier 00093 this->supplier_ = auto_supplier; 00094 00095 this->supplier_admin_->subscribed_types (this->subscribed_types_); // get the parents subscribed types. 00096 } 00097 00098 // Inform QoS values. 00099 ACE_ASSERT (this->supplier_.get() != 0); 00100 this->supplier_->qos_changed (this->qos_properties_); 00101 00102 TAO_Notify_EventTypeSeq removed; 00103 00104 this->event_manager().offer_change (this, this->subscribed_types_, removed); 00105 00106 this->event_manager().connect (this); 00107 00108 // Increment the global supplier count 00109 ++supplier_count; 00110 } |
|
Destroy this object.
Implements TAO_Notify_Proxy. Definition at line 177 of file ProxyConsumer.cpp. References shutdown(). Referenced by TAO_Notify_ProxyPushConsumer::disconnect_push_consumer(), TAO_Notify_CosEC_ProxyPushConsumer::disconnect_push_consumer(), TAO_Notify_SequenceProxyPushConsumer::disconnect_sequence_push_consumer(), and TAO_Notify_StructuredProxyPushConsumer::disconnect_structured_push_consumer().
00178 { 00179 this->shutdown (); 00180 this->supplier_admin_->remove (this); 00181 00182 // Do not reset this->supplier_. 00183 // It is not safe to delete the non-refcounted supplier here. 00184 } |
|
Disconnect.
Definition at line 148 of file ProxyConsumer.cpp. References TAO_Notify_Object::admin_properties(), TAO_Notify_Event_Manager::disconnect(), TAO_Notify_Object::event_manager(), TAO_Notify_Event_Manager::offer_change(), and TAO_Notify_AdminProperties::suppliers(). Referenced by shutdown().
00149 { 00150 TAO_Notify_EventTypeSeq added; 00151 00152 event_manager().offer_change (this, added, this->subscribed_types_); 00153 00154 this->event_manager().disconnect (this); 00155 00156 // Decrement the global supplier count 00157 this->admin_properties().suppliers ()--; 00158 } |
|
init: overrides Topology_Object method
Definition at line 48 of file ProxyConsumer.cpp. References ACE_ASSERT, ACE_GUARD_THROW_EX, TAO_Notify_Properties::default_proxy_consumer_qos_properties(), TAO_Notify::Topology_Object::initialize(), TAO_Notify_Properties::instance(), CosNotification::QoSProperties, TAO_Notify_Object::set_qos(), and TAO_SYNCH_MUTEX.
00049 { 00050 ACE_ASSERT( this->supplier_admin_.get() == 0 ); 00051 00052 TAO_Notify_Proxy::initialize (topology_parent); 00053 00054 this->supplier_admin_.reset (dynamic_cast<TAO_Notify_SupplierAdmin *>(topology_parent)); 00055 ACE_ASSERT (this->supplier_admin_.get() != 0); 00056 00057 const CosNotification::QoSProperties &default_ps_qos = 00058 TAO_Notify_PROPERTIES::instance ()->default_proxy_consumer_qos_properties (); 00059 00060 { 00061 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 00062 CORBA::INTERNAL ()); 00063 this->TAO_Notify_Object::set_qos (default_ps_qos); 00064 } 00065 } |
|
Return 1 if connected.
Definition at line 8 of file ProxyConsumer.inl. References ACE_Auto_Basic_Ptr< X >::get(). Referenced by connect(), TAO_Notify_ProxyPushConsumer::push(), TAO_Notify_CosEC_ProxyPushConsumer::push(), TAO_Notify_StructuredProxyPushConsumer::push_structured_event(), and TAO_Notify_SequenceProxyPushConsumer::push_structured_events().
|
|
Access our Peer.
Implements TAO_Notify_Proxy. Definition at line 42 of file ProxyConsumer.cpp. References supplier().
00043 { 00044 return this->supplier (); 00045 } |
|
|
Shutdown (TAO_Notify_Container_T method).
Reimplemented from TAO_Notify_Object. Definition at line 161 of file ProxyConsumer.cpp. References disconnect(), ACE_Auto_Basic_Ptr< X >::get(), and TAO_Notify_Object::shutdown(). Referenced by destroy().
00162 { 00163 if (this->TAO_Notify_Object::shutdown () == 1) 00164 return 1; 00165 00166 00167 this->disconnect (); 00168 00169 if (this->supplier_.get() != 0) 00170 { 00171 this->supplier_->shutdown (); 00172 } 00173 return 0; 00174 } |
|
Access the Supplier.
Definition at line 14 of file ProxyConsumer.inl. References ACE_Auto_Basic_Ptr< X >::get(). Referenced by peer().
|
|
The SA parent.
Definition at line 20 of file ProxyConsumer.inl. References ACE_ASSERT. Referenced by TAO_Notify_Method_Request_Lookup::execute_i(), and TAO_Notify_ProxyConsumer_T< SERVANT_TYPE >::MyAdmin().
00021 { 00022 ACE_ASSERT( this->supplier_admin_.get() != 0 ); 00023 return *this->supplier_admin_; 00024 } |
|
Is this part of a reliable channel.
Definition at line 132 of file ProxyConsumer.cpp. References TAO_Notify_Object::find_qos_property_value(), and CosNotification::PropertyValue. Referenced by push_i().
00133 { 00134 bool reliable = false; 00135 CosNotification::PropertyValue value; 00136 if (this->find_qos_property_value (CosNotification::EventReliability, value)) 00137 { 00138 CORBA::Short setting; 00139 if (value >>= setting) 00140 { 00141 reliable = (setting == CosNotification::Persistent); 00142 } 00143 } 00144 return reliable; 00145 } |
|
The Supplier that we're connect to.
Definition at line 88 of file ProxyConsumer.h. |
|
= Data Members. The SA parent. Definition at line 85 of file ProxyConsumer.h. |