TAO_Notify_StructuredPushConsumer Class Reference

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

#include <StructuredPushConsumer.h>

Inheritance diagram for TAO_Notify_StructuredPushConsumer:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_StructuredPushConsumer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Notify_StructuredPushConsumer (TAO_Notify_ProxySupplier *proxy)
 Constructor.
void init (CosNotifyComm::StructuredPushConsumer_ptr push_consumer)
 Init the Consumer.
virtual ~TAO_Notify_StructuredPushConsumer ()
 Destructor.
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

CosNotifyComm::StructuredPushConsumer_var push_consumer_
 The Consumer.

Private Member Functions

virtual void release (void)
 Release.

Detailed Description

Wrapper for the StructuredPushConsumer that connect to the EventChannel.

Definition at line 35 of file StructuredPushConsumer.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_StructuredPushConsumer::TAO_Notify_StructuredPushConsumer ( TAO_Notify_ProxySupplier proxy  ) 

Constructor.

Definition at line 14 of file StructuredPushConsumer.cpp.

00015   :TAO_Notify_Consumer (proxy)
00016 {
00017 }

TAO_Notify_StructuredPushConsumer::~TAO_Notify_StructuredPushConsumer (  )  [virtual]

Destructor.

Definition at line 19 of file StructuredPushConsumer.cpp.

00020 {
00021 }


Member Function Documentation

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

Retrieve the ior of this peer.

Implements TAO_Notify_Peer.

Definition at line 126 of file StructuredPushConsumer.cpp.

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

00127 {
00128   ACE_CString result;
00129   CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00130   try
00131   {
00132     CORBA::String_var ior = orb->object_to_string(this->push_consumer_.in());
00133     result = static_cast<const char*> (ior.in ());
00134   }
00135   catch (const CORBA::Exception&)
00136   {
00137     result.fast_clear();
00138   }
00139   return result;
00140 }

void TAO_Notify_StructuredPushConsumer::init ( CosNotifyComm::StructuredPushConsumer_ptr  push_consumer  ) 

Init the Consumer.

Definition at line 24 of file StructuredPushConsumer.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().

00025 {
00026   // Initialize only once
00027   ACE_ASSERT( CORBA::is_nil (this->push_consumer_.in()) );
00028 
00029   if (CORBA::is_nil (push_consumer))
00030   {
00031     throw CORBA::BAD_PARAM();
00032   }
00033 
00034   if (!TAO_Notify_PROPERTIES::instance()->separate_dispatching_orb ())
00035     {
00036       this->push_consumer_ = CosNotifyComm::StructuredPushConsumer::_duplicate (push_consumer);
00037       this->publish_ = CosNotifyComm::NotifyPublish::_duplicate (push_consumer);
00038     }
00039   else
00040     {
00041       // "Port" consumer's object reference from receiving ORB to dispatching ORB.
00042       CORBA::String_var temp =
00043         TAO_Notify_PROPERTIES::instance()->orb()->object_to_string(push_consumer);
00044 
00045       CORBA::Object_var obj =
00046         TAO_Notify_PROPERTIES::instance()->dispatching_orb()->string_to_object(temp.in());
00047 
00048       try
00049         {
00050           CosNotifyComm::StructuredPushConsumer_var new_push_consumer =
00051             CosNotifyComm::StructuredPushConsumer::_unchecked_narrow(obj.in());
00052 
00053           this->push_consumer_ = CosNotifyComm::StructuredPushConsumer::_duplicate (new_push_consumer.in());
00054           this->publish_ = CosNotifyComm::NotifyPublish::_duplicate (new_push_consumer.in());
00055           //--cj verify dispatching ORB
00056           if (TAO_debug_level >= 10)
00057             {
00058               ACE_DEBUG ((LM_DEBUG,
00059                           "(%P|%t) Structured push init dispatching ORB id is %s.\n",
00060                           obj->_stubobj()->orb_core()->orbid()));
00061           }
00062           //--cj end
00063         }
00064       catch (const CORBA::TRANSIENT& ex)
00065         {
00066           ex._tao_print_exception (
00067             "Got a TRANSIENT in NS_StructuredPushConsumer::init");
00068           ACE_DEBUG ((LM_DEBUG, "(%P|%t) got it for NS_StructuredPushConsumer %@\n", this));
00069         }
00070       catch (const CORBA::Exception&)
00071         {
00072           // _narrow failed
00073         }
00074     }
00075 }

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

Push a batch of events to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 109 of file StructuredPushConsumer.cpp.

References ACE_ASSERT.

00110 {
00111   ACE_ASSERT(false);
00112   ACE_UNUSED_ARG (event);
00113   // TODO exception?
00114 }

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

Push <event> to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 95 of file StructuredPushConsumer.cpp.

References ACE_DEBUG, LM_DEBUG, push_consumer_, and TAO_debug_level.

00096 {
00097   //--cj verify dispatching ORB
00098   if (TAO_debug_level >= 10) {
00099     ACE_DEBUG ((LM_DEBUG, "(%P|%t) Structured push dispatching ORB id is %s.\n",
00100                 this->push_consumer_->_stubobj()->orb_core()->orbid()));
00101   }
00102   //--cj end
00103 
00104   this->push_consumer_->push_structured_event (event);
00105 }

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

Push <event> to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 85 of file StructuredPushConsumer.cpp.

References push_consumer_, and TAO_Notify_Event::translate().

00086 {
00087   CosNotification::StructuredEvent notification;
00088 
00089   TAO_Notify_Event::translate (event, notification);
00090 
00091   this->push_consumer_->push_structured_event (notification);
00092 }

void TAO_Notify_StructuredPushConsumer::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 117 of file StructuredPushConsumer.cpp.

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

00118 {
00119   TAO_Notify_StructuredPushConsumer* tmp = dynamic_cast<TAO_Notify_StructuredPushConsumer *> (old_consumer);
00120   ACE_ASSERT(tmp != 0);
00121   this->init(tmp->push_consumer_.in());
00122   this->schedule_timer(false);
00123 }

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

Release.

Implements TAO_Notify_Peer.

Definition at line 78 of file StructuredPushConsumer.cpp.

00079 {
00080   delete this;
00081   //@@ inform factory
00082 }


Member Data Documentation

CosNotifyComm::StructuredPushConsumer_var TAO_Notify_StructuredPushConsumer::push_consumer_ [protected]

The Consumer.

Definition at line 70 of file StructuredPushConsumer.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:32 2010 for TAO_CosNotification by  doxygen 1.4.7