TAO_Notify_Proxy Class Reference

Base class proxy for all proxys in NS. More...

#include <Proxy.h>

Inheritance diagram for TAO_Notify_Proxy:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_Proxy:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_Proxy
Ptr
typedef CosNotifyChannelAdmin::ProxyIDSeq SEQ
typedef CosNotifyChannelAdmin::ProxyIDSeq_var SEQ_VAR

Public Member Functions

 TAO_Notify_Proxy (void)
 Constuctor.

virtual ~TAO_Notify_Proxy ()
 Destructor.

virtual CORBA::Object_ptr activate (PortableServer::Servant servant)
 Activate.

virtual CORBA::Object_ptr activate (PortableServer::Servant servant, CORBA::Long id)
 Activate with a given ID.

void deactivate (void)
 Deactivate.

void subscribed_types (TAO_Notify_EventTypeSeq &subscribed_types)
 Obtain the Proxy's subscribed types.

CORBA::Boolean check_filters (const TAO_Notify_Event *event, TAO_Notify_FilterAdmin &parent_filter_admin, CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator)
 Check if this event passes the admin and proxy filters.

void types_changed (const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
 Inform this proxy that the following types are being advertised.

CORBA::Boolean updates_off (void)
 Have updates been turned off.

virtual void destroy (void)=0
 Destroy this object.

virtual TAO_Notify_Peerpeer (void)=0
 Access our Peer.

virtual CosNotification::EventTypeSeqobtain_types (CosNotifyChannelAdmin::ObtainInfoMode mode, const TAO_Notify_EventTypeSeq &types)
 Implement the Obtain Types.

virtual void admin_types_changed (const CosNotification::EventTypeSeq &added, const CosNotification::EventTypeSeq &removed)=0
 Notification of subscriptions/offers set at the admin.

virtual void qos_changed (const TAO_Notify_QoSProperties &qos_properties)
 Override, TAO_Notify_Object::qos_changed.

virtual void save_persistent (TAO_Notify::Topology_Saver &saver)
virtual void save_attrs (TAO_Notify::NVPList &attrs)
virtual const char * get_proxy_type_name (void) const=0
virtual TAO_Notify::Topology_Objectload_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs)

Protected Attributes

TAO_Notify_FilterAdmin filter_admin_
 Filter Administration.

TAO_Notify_EventTypeSeq subscribed_types_
 The types that we're subscribed with the event manager.

CORBA::Boolean updates_off_
 True if updates have been turned off.


Friends

class TAO_Notify_Peer

Detailed Description

Base class proxy for all proxys in NS.

Definition at line 38 of file Proxy.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T<TAO_Notify_Proxy> TAO_Notify_Proxy::Ptr
 

Reimplemented from TAO_Notify_Refcountable.

Reimplemented in TAO_Notify_ProxyConsumer, and TAO_Notify_ProxySupplier.

Definition at line 44 of file Proxy.h.

typedef CosNotifyChannelAdmin::ProxyIDSeq TAO_Notify_Proxy::SEQ
 

Definition at line 45 of file Proxy.h.

typedef CosNotifyChannelAdmin::ProxyIDSeq_var TAO_Notify_Proxy::SEQ_VAR
 

Definition at line 46 of file Proxy.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_Proxy::TAO_Notify_Proxy void   ) 
 

Constuctor.

Definition at line 21 of file Proxy.cpp.

00022   : updates_off_ (0)
00023 {
00024 }

TAO_Notify_Proxy::~TAO_Notify_Proxy  )  [virtual]
 

Destructor.

Definition at line 26 of file Proxy.cpp.

00027 {
00028 }


Member Function Documentation

CORBA::Object_ptr TAO_Notify_Proxy::activate PortableServer::Servant  servant,
CORBA::Long  id
[virtual]
 

Activate with a given ID.

Reimplemented from TAO_Notify_Object.

Reimplemented in TAO_Notify_RT_StructuredProxyPushSupplier.

Definition at line 39 of file Proxy.cpp.

References TAO_Notify_Object::activate(), and TAO_Notify_Object::set_primary_as_proxy_poa().

00041 {
00042   // Set the POA that we use to return our <ref>
00043   this->set_primary_as_proxy_poa();
00044   return TAO_Notify_Object::activate (servant, id);
00045 }

CORBA::Object_ptr TAO_Notify_Proxy::activate PortableServer::Servant  servant  )  [virtual]
 

Activate.

Reimplemented from TAO_Notify_Object.

Reimplemented in TAO_Notify_RT_StructuredProxyPushSupplier.

Definition at line 31 of file Proxy.cpp.

References TAO_Notify_Object::activate(), and TAO_Notify_Object::set_primary_as_proxy_poa().

Referenced by TAO_Notify_RT_StructuredProxyPushSupplier::activate().

00032 {
00033   // Set the POA that we use to return our <ref>
00034   this->set_primary_as_proxy_poa();
00035   return TAO_Notify_Object::activate (servant);
00036 }

virtual void TAO_Notify_Proxy::admin_types_changed const CosNotification::EventTypeSeq added,
const CosNotification::EventTypeSeq removed
[pure virtual]
 

Notification of subscriptions/offers set at the admin.

Implemented in TAO_Notify_ProxyConsumer_T< SERVANT_TYPE >, TAO_Notify_ProxySupplier_T< SERVANT_TYPE >, TAO_Notify_ProxyConsumer_T< POA_CosNotifyChannelAdmin::ProxyPushConsumer >, TAO_Notify_ProxyConsumer_T< POA_CosNotifyChannelAdmin::SequenceProxyPushConsumer >, TAO_Notify_ProxyConsumer_T< POA_CosEventChannelAdmin::ProxyPushConsumer >, TAO_Notify_ProxyConsumer_T< POA_CosNotifyChannelAdmin::StructuredProxyPushConsumer >, TAO_Notify_ProxySupplier_T< POA_Event_Forwarder::ProxyPushSupplier >, TAO_Notify_ProxySupplier_T< POA_CosNotifyChannelAdmin::SequenceProxyPushSupplier >, TAO_Notify_ProxySupplier_T< POA_Event_Forwarder::StructuredProxyPushSupplier >, and TAO_Notify_ProxySupplier_T< POA_CosEventChannelAdmin::ProxyPushSupplier >.

Referenced by TAO_Notify_Subscription_Change_Worker::work().

ACE_INLINE CORBA::Boolean TAO_Notify_Proxy::check_filters const TAO_Notify_Event event,
TAO_Notify_FilterAdmin parent_filter_admin,
CosNotifyChannelAdmin::InterFilterGroupOperator  filter_operator
 

Check if this event passes the admin and proxy filters.

Definition at line 14 of file Proxy.inl.

References TAO_Notify_FilterAdmin::match().

Referenced by TAO_Notify_Method_Request_Lookup::execute_i().

00017 {
00018   // check if it passes the parent filter.
00019   CORBA::Boolean parent_val =
00020     parent_filter_admin.match (event);
00021 
00022   CORBA::Boolean val = 0;
00023 
00024   if (filter_operator == CosNotifyChannelAdmin::AND_OP)
00025     {
00026       val = parent_val && this->filter_admin_.match (event);
00027     }
00028   else
00029     {
00030       val = parent_val || this->filter_admin_.match (event);
00031     }
00032 
00033   return val;
00034 }

void TAO_Notify_Proxy::deactivate void   ) 
 

Deactivate.

Reimplemented from TAO_Notify_Object.

Definition at line 48 of file Proxy.cpp.

References ACE_ASSERT, TAO_Notify_POA_Helper::deactivate(), and TAO_Notify_Object::proxy_poa().

00049 {
00050   ACE_ASSERT (this->proxy_poa() != 0 );
00051   this->proxy_poa()->deactivate (this->id());
00052 }

virtual void TAO_Notify_Proxy::destroy void   )  [pure virtual]
 

Destroy this object.

Implemented in TAO_Notify_ProxyConsumer, and TAO_Notify_ProxySupplier.

Referenced by TAO_Notify_Peer::handle_dispatch_exception().

virtual const char* TAO_Notify_Proxy::get_proxy_type_name void   )  const [pure virtual]
 

Implemented in TAO_Notify_CosEC_ProxyPushConsumer, TAO_Notify_CosEC_ProxyPushSupplier, TAO_Notify_ProxyPushConsumer, TAO_Notify_ProxyPushSupplier, TAO_Notify_SequenceProxyPushConsumer, TAO_Notify_SequenceProxyPushSupplier, TAO_Notify_StructuredProxyPushConsumer, and TAO_Notify_StructuredProxyPushSupplier.

Referenced by save_persistent().

TAO_Notify::Topology_Object * TAO_Notify_Proxy::load_child const ACE_CString type,
CORBA::Long  id,
const TAO_Notify::NVPList attrs
[virtual]
 

Definition at line 167 of file Proxy.cpp.

References ACE_Unbounded_Set< TAO_Notify_EventType >::reset().

00169 {
00170   ACE_UNUSED_ARG (id);
00171   ACE_UNUSED_ARG (attrs);
00172   TAO_Notify::Topology_Object* result = this;
00173   if (type == "subscriptions")
00174   {
00175     // since we initialized our subscribed types to everything
00176     // in the constructor. we have to clear it out first.
00177     this->subscribed_types_.reset();
00178     result = &this->subscribed_types_;
00179   }
00180   else if (type == "filter_admin")
00181   {
00182     result = & this->filter_admin_;
00183   }
00184   return result;
00185 }

CosNotification::EventTypeSeq * TAO_Notify_Proxy::obtain_types CosNotifyChannelAdmin::ObtainInfoMode  mode,
const TAO_Notify_EventTypeSeq types
[virtual]
 

Implement the Obtain Types.

Definition at line 85 of file Proxy.cpp.

References ACE_GUARD_THROW_EX, ACE_NEW_THROW_EX, CosNotification::EventTypeSeq, TAO_Notify_EventTypeSeq::populate(), TAO_SYNCH_MUTEX, and updates_off_.

Referenced by TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::obtain_offered_types(), and TAO_Notify_ProxyConsumer_T< SERVANT_TYPE >::obtain_subscription_types().

00086 {
00087   CosNotification::EventTypeSeq_var event_type_seq;
00088 
00089   ACE_NEW_THROW_EX (event_type_seq,
00090                     CosNotification::EventTypeSeq (),
00091                     CORBA::NO_MEMORY ());
00092 
00093   ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ());
00094 
00095   if (mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_OFF ||
00096       mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON)
00097     {
00098       types.populate (event_type_seq);
00099     }
00100 
00101   if (mode == CosNotifyChannelAdmin::NONE_NOW_UPDATES_ON ||
00102       mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON)
00103     {
00104       this->updates_off_ = 0;
00105     }
00106   else
00107     {
00108       this->updates_off_ = 1;
00109     }
00110 
00111   return event_type_seq._retn ();
00112 }

virtual TAO_Notify_Peer* TAO_Notify_Proxy::peer void   )  [pure virtual]
 

Access our Peer.

Implemented in TAO_Notify_ProxyConsumer, and TAO_Notify_ProxySupplier.

Referenced by qos_changed(), and save_attrs().

void TAO_Notify_Proxy::qos_changed const TAO_Notify_QoSProperties qos_properties  )  [virtual]
 

Override, TAO_Notify_Object::qos_changed.

Reimplemented from TAO_Notify_Object.

Reimplemented in TAO_Notify_ProxySupplier.

Definition at line 115 of file Proxy.cpp.

References peer(), and TAO_Notify_Peer::qos_changed().

Referenced by TAO_Notify_ProxySupplier::qos_changed().

00116 {
00117   //Inform Peers of qos changes.
00118   TAO_Notify_Peer* peer = this->peer ();
00119 
00120   if (peer != 0)
00121     peer->qos_changed (qos_properties);
00122 }

void TAO_Notify_Proxy::save_attrs TAO_Notify::NVPList attrs  )  [virtual]
 

Called by derived types to save their attributes. Each derived type should call its superclass version before saving its own attrs.

Reimplemented from TAO_Notify_Object.

Definition at line 156 of file Proxy.cpp.

References TAO_Notify_Peer::get_ior(), peer(), TAO_Notify::NVPList::push_back(), and TAO_Notify_Object::save_attrs().

Referenced by save_persistent().

00157 {
00158   TAO_Notify_Object::save_attrs(attrs);
00159   TAO_Notify_Peer * peer = this->peer();
00160   if (peer != 0)
00161   {
00162     attrs.push_back (TAO_Notify::NVP("PeerIOR", peer->get_ior()));
00163   }
00164 }

void TAO_Notify_Proxy::save_persistent TAO_Notify::Topology_Saver saver  )  [virtual]
 

Save our state to a Topology_Saver.

Use the methods of a Topology_Saver to store all information we want persisted. This function is called by our parent, which gives us a saver to use. In turn, we must call this function on all of our children. The implementation should look like: bool change = this->self_changed_; this->self_changed_ = false; this->children_changed_ = false; if (is_persistent ()) { bool want_all_children = saver.begin_object( this->id(), type, attrs, change); for all children { if (want_all_children || child.is_changed()) { child.save_persistent(saver); } } for all deleted children { saver.delete_child(child_type, child_id); } saver.end_object(this->id(), type); )

Implements TAO_Notify::Topology_Savable.

Definition at line 125 of file Proxy.cpp.

References TAO_Notify::Topology_Saver::begin_object(), TAO_Notify::Topology_Saver::end_object(), get_proxy_type_name(), TAO_Notify::Topology_Object::is_changed(), TAO_Notify::Topology_Object::is_persistent(), save_attrs(), TAO_Notify_EventTypeSeq::save_persistent(), and TAO_Notify_FilterAdmin::save_persistent().

00126 {
00127   bool changed = this->children_changed_;
00128   this->children_changed_ = false;
00129   this->self_changed_ = false;
00130 
00131   if (is_persistent ())
00132   {
00133     TAO_Notify::NVPList attrs;
00134     this->save_attrs(attrs);
00135 
00136     const char * type_name = this->get_proxy_type_name ();
00137     bool want_all_children = saver.begin_object(this->id(), type_name, attrs, changed);
00138 
00139     if (want_all_children || this->filter_admin_.is_changed ())
00140     {
00141       this->filter_admin_.save_persistent(saver);
00142     }
00143 
00144     if (want_all_children || this->subscribed_types_.is_changed ())
00145     {
00146       this->subscribed_types_.save_persistent(saver);
00147     }
00148 
00149     // todo: handle removed children
00150 
00151     saver.end_object(this->id(), type_name);
00152   }
00153 }

void TAO_Notify_Proxy::subscribed_types TAO_Notify_EventTypeSeq subscribed_types  ) 
 

Obtain the Proxy's subscribed types.

Definition at line 55 of file Proxy.cpp.

References ACE_GUARD_THROW_EX, and TAO_SYNCH_MUTEX.

Referenced by TAO_Notify_Peer::dispatch_updates().

00056 {
00057   ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00058                         CORBA::INTERNAL ());
00059 
00060   // copy
00061   subscribed_types = this->subscribed_types_;
00062 }

void TAO_Notify_Proxy::types_changed const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed
 

Inform this proxy that the following types are being advertised.

Definition at line 65 of file Proxy.cpp.

References TAO_Notify_Properties::asynch_updates(), TAO_Notify_Method_Request_Updates_No_Copy::execute(), TAO_Notify_Object::execute_task(), TAO_Notify_Properties::instance(), TAO_Notify_Properties::updates(), and updates_off_.

Referenced by TAO_Notify_Event_Manager::connect(), TAO_Notify_ProxySupplier_Update_Worker::work(), and TAO_Notify_ProxyConsumer_Update_Worker::work().

00066 {
00067   // return if the updates for this proxy are turned off or
00068   // if all the updates in the channel are switched off.
00069   if (this->updates_off_ == 1 || TAO_Notify_PROPERTIES::instance()->updates () == 0)
00070     return;
00071 
00072   TAO_Notify_Method_Request_Updates_No_Copy request (added, removed, this);
00073 
00074   if (TAO_Notify_PROPERTIES::instance()->asynch_updates () == 1) // if we should send the updates synchronously.
00075     {
00076       this->execute_task (request);
00077     }
00078   else // execute in the current thread context.
00079     {
00080       request.execute ();
00081     }
00082 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Boolean TAO_Notify_Proxy::updates_off void   ) 
 

Have updates been turned off.

Definition at line 8 of file Proxy.inl.

References updates_off_.

00009 {
00010   return this->updates_off_;
00011 }


Friends And Related Function Documentation

friend class TAO_Notify_Peer [friend]
 

Definition at line 41 of file Proxy.h.


Member Data Documentation

TAO_Notify_FilterAdmin TAO_Notify_Proxy::filter_admin_ [protected]
 

Filter Administration.

Definition at line 114 of file Proxy.h.

TAO_Notify_EventTypeSeq TAO_Notify_Proxy::subscribed_types_ [protected]
 

The types that we're subscribed with the event manager.

Definition at line 117 of file Proxy.h.

CORBA::Boolean TAO_Notify_Proxy::updates_off_ [protected]
 

True if updates have been turned off.

Definition at line 120 of file Proxy.h.

Referenced by obtain_types(), types_changed(), and updates_off().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 15:49:56 2008 for TAO_CosNotification by doxygen 1.3.6