TAO_Notify_PushConsumer Class Reference

Wrapper for the PushConsumer that connect to the EventChannel. More...

#include <PushConsumer.h>

Inheritance diagram for TAO_Notify_PushConsumer:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_PushConsumer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Notify_PushConsumer (TAO_Notify_ProxySupplier *proxy)
 Constructor.
virtual ~TAO_Notify_PushConsumer ()
 Destructor.
void init (CosEventComm::PushConsumer_ptr push_consumer)
 Init.
virtual void push (const CORBA::Any &event)
 Push <event> to this consumer.
virtual void push (const CosNotification::StructuredEvent &event)
 Push <event> to this consumer.
virtual void push (const CosNotification::EventBatch &event)
 Push a batch of events to this consumer.
virtual ACE_CString get_ior (void) const
 Retrieve the ior of this peer.
virtual void reconnect_from_consumer (TAO_Notify_Consumer *old_consumer)

Protected Attributes

CosEventComm::PushConsumer_var push_consumer_
 The Consumer.

Private Member Functions

virtual void release (void)
 TAO_Notify_Destroy_Callback methods.

Detailed Description

Wrapper for the PushConsumer that connect to the EventChannel.

Definition at line 33 of file PushConsumer.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_PushConsumer::TAO_Notify_PushConsumer ( TAO_Notify_ProxySupplier proxy  ) 

Constructor.

Definition at line 18 of file PushConsumer.cpp.

00019   :TAO_Notify_Consumer (proxy)
00020 {
00021 }

TAO_Notify_PushConsumer::~TAO_Notify_PushConsumer (  )  [virtual]

Destructor.

Definition at line 23 of file PushConsumer.cpp.

00024 {
00025 }


Member Function Documentation

ACE_CString TAO_Notify_PushConsumer::get_ior ( void   )  const [virtual]

Retrieve the ior of this peer.

Implements TAO_Notify_Peer.

Definition at line 136 of file PushConsumer.cpp.

References ACE_String_Base< CHAR >::fast_clear(), TAO_Notify_Properties::instance(), and TAO_Notify_Properties::orb().

00137 {
00138   ACE_CString result;
00139   CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00140   try
00141     {
00142       CORBA::String_var ior = orb->object_to_string(this->push_consumer_.in());
00143       result = static_cast<const char*> (ior.in ());
00144     }
00145   catch (const CORBA::Exception&)
00146     {
00147       result.fast_clear();
00148     }
00149   return result;
00150 }

void TAO_Notify_PushConsumer::init ( CosEventComm::PushConsumer_ptr  push_consumer  ) 

Init.

Definition at line 28 of file PushConsumer.cpp.

References ACE_ASSERT, ACE_DEBUG, TAO_Notify_Properties::dispatching_orb(), TAO_Pseudo_Var_T< T >::in(), TAO_Notify_Properties::instance(), CORBA::is_nil(), LM_DEBUG, CORBA::ORB::object_to_string(), TAO_Notify_Properties::orb(), TAO_Notify_Consumer::publish_, push_consumer_, CORBA::ORB::string_to_object(), and TAO_debug_level.

Referenced by reconnect_from_consumer().

00029 {
00030   // Initialize only once
00031   ACE_ASSERT( CORBA::is_nil (this->push_consumer_.in()) );
00032 
00033   // push_consumer not optional
00034   if (CORBA::is_nil (push_consumer))
00035   {
00036     throw CORBA::BAD_PARAM();
00037   }
00038 
00039   try
00040   {
00041     if (!TAO_Notify_PROPERTIES::instance()->separate_dispatching_orb ())
00042       {
00043         this->push_consumer_ = CosEventComm::PushConsumer::_duplicate (push_consumer);
00044 
00045         this->publish_ =
00046           CosNotifyComm::NotifyPublish::_narrow (push_consumer);
00047       }
00048     else
00049       {
00050         // "Port" consumer's object reference from receiving ORB to dispatching ORB.
00051         CORBA::String_var temp =
00052           TAO_Notify_PROPERTIES::instance()->orb()->object_to_string(push_consumer);
00053 
00054         CORBA::Object_var obj =
00055           TAO_Notify_PROPERTIES::instance()->dispatching_orb()->string_to_object(temp.in());
00056 
00057         CosEventComm::PushConsumer_var new_cos_comm_pc =
00058           CosEventComm::PushConsumer::_unchecked_narrow(obj.in());
00059 
00060         this->push_consumer_ =
00061           CosEventComm::PushConsumer::_duplicate (new_cos_comm_pc.in());
00062 
00063         //
00064         // Note that here we do an _unchecked_narrow() in order to avoid
00065         // making a call on the consumer b/c the consumer may not have activated
00066         // its POA just yet.  That means that before we use this reference the first
00067         // time, we'll actually need to call _is_a() on it, i.e., the equivalent
00068         // of an _narrow().  At the time of this writing, the only use of
00069         // this->publish_ is in TAO_NS_Consumer::dispatch_updates_i (the superclass).
00070         // If any other use is made of this data member, then the code to validate
00071         // the actual type of the target object must be refactored.
00072         this->publish_ =
00073           CosNotifyComm::NotifyPublish::_unchecked_narrow (obj.in());
00074 
00075 
00076         //--cj verify dispatching ORB
00077         if (TAO_debug_level >= 10)
00078           {
00079             ACE_DEBUG ((LM_DEBUG, "(%P|%t) Any push init dispatching ORB id is %s.\n",
00080                         obj->_stubobj()->orb_core()->orbid()));
00081           }
00082         //--cj end
00083       }
00084   }
00085   catch (const CORBA::TRANSIENT& ex)
00086     {
00087       ex._tao_print_exception ("Got a TRANSIENT in NS_PushConsumer::init");
00088       ACE_DEBUG ((LM_DEBUG, "(%P|%t) got it for NS_PushConsumer %@\n", this));
00089     }
00090   catch (const CORBA::Exception&)
00091     {
00092       // _narrow failed which probably means the interface is CosEventComm type.
00093     }
00094 }

void TAO_Notify_PushConsumer::push ( const CosNotification::EventBatch event  )  [virtual]

Push a batch of events to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 128 of file PushConsumer.cpp.

References ACE_ASSERT.

00129 {
00130   ACE_ASSERT(false);
00131   ACE_UNUSED_ARG (event);
00132   // TODO exception?
00133 }

void TAO_Notify_PushConsumer::push ( const CosNotification::StructuredEvent event  )  [virtual]

Push <event> to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 117 of file PushConsumer.cpp.

References push_consumer_, and TAO_Notify_Event::translate().

00118 {
00119   CORBA::Any any;
00120 
00121   TAO_Notify_Event::translate (event, any);
00122 
00123   this->push_consumer_->push (any);
00124 }

void TAO_Notify_PushConsumer::push ( const CORBA::Any &  event  )  [virtual]

Push <event> to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 104 of file PushConsumer.cpp.

References ACE_DEBUG, LM_DEBUG, push_consumer_, and TAO_debug_level.

00105 {
00106   //--cj verify dispatching ORB
00107   if (TAO_debug_level >= 10) {
00108     ACE_DEBUG ((LM_DEBUG, "(%P|%t) Any push dispatching ORB id is %s.\n",
00109                 this->push_consumer_->_stubobj()->orb_core()->orbid()));
00110   }
00111   //--cj end
00112 
00113   this->push_consumer_->push (payload);
00114 }

void TAO_Notify_PushConsumer::reconnect_from_consumer ( TAO_Notify_Consumer old_consumer  )  [virtual]

on reconnect we need to move events from the old consumer to the new one

Implements TAO_Notify_Consumer.

Definition at line 153 of file PushConsumer.cpp.

References ACE_ASSERT, init(), push_consumer_, and TAO_Notify_Consumer::schedule_timer().

00154 {
00155   TAO_Notify_PushConsumer* tmp =
00156     dynamic_cast<TAO_Notify_PushConsumer*> (old_consumer);
00157   ACE_ASSERT(tmp != 0);
00158   this->init(tmp->push_consumer_.in());
00159   this->schedule_timer(false);
00160 }

void TAO_Notify_PushConsumer::release ( void   )  [private, virtual]

TAO_Notify_Destroy_Callback methods.

Implements TAO_Notify_Peer.

Definition at line 97 of file PushConsumer.cpp.

00098 {
00099   delete this;
00100   //@@ inform factory
00101 }


Member Data Documentation

CosEventComm::PushConsumer_var TAO_Notify_PushConsumer::push_consumer_ [protected]

The Consumer.

Definition at line 67 of file PushConsumer.h.

Referenced by init(), push(), and reconnect_from_consumer().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:28 2010 for TAO_CosNotification by  doxygen 1.4.7