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)
 Constuctor.

virtual ~TAO_Notify_PushConsumer ()
 Destructor.

void init (CosEventComm::PushConsumer_ptr push_consumer)
 Init.

virtual void push (const CORBA::Any &event)
 Push to this consumer.

virtual void push (const CosNotification::StructuredEvent &event)
 Push 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  ) 
 

Constuctor.

Definition at line 16 of file PushConsumer.cpp.

00017   :TAO_Notify_Consumer (proxy)
00018 {
00019 }

TAO_Notify_PushConsumer::~TAO_Notify_PushConsumer  )  [virtual]
 

Destructor.

Definition at line 21 of file PushConsumer.cpp.

00022 {
00023 }


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 87 of file PushConsumer.cpp.

References ACE_CATCHANY, ACE_CString, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, and TAO_Singleton< TYPE, ACE_LOCK >::instance().

00088 {
00089   ACE_CString result;
00090   CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
00091   ACE_DECLARE_NEW_CORBA_ENV;
00092   ACE_TRY
00093     {
00094       CORBA::String_var ior = orb->object_to_string(this->push_consumer_.in() ACE_ENV_ARG_PARAMETER);
00095       ACE_TRY_CHECK;
00096       result = static_cast<const char*> (ior.in ());
00097     }
00098   ACE_CATCHANY
00099     {
00100       result.fast_clear();
00101     }
00102   ACE_ENDTRY;
00103   return result;
00104 }

void TAO_Notify_PushConsumer::init CosEventComm::PushConsumer_ptr  push_consumer  ) 
 

Init.

Definition at line 26 of file PushConsumer.cpp.

References ACE_ASSERT, ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), and push_consumer_.

Referenced by TAO_Notify_ProxyPushSupplier::connect_any_push_consumer(), TAO_Notify_CosEC_ProxyPushSupplier::connect_push_consumer(), and reconnect_from_consumer().

00028 {
00029   // Initialize only once
00030   ACE_ASSERT( CORBA::is_nil (this->push_consumer_.in()) );
00031 
00032   // push_consumer not optional
00033   if (CORBA::is_nil (push_consumer))
00034   {
00035     ACE_THROW (CORBA::BAD_PARAM());
00036   }
00037 
00038   this->push_consumer_ = CosEventComm::PushConsumer::_duplicate (push_consumer);
00039 
00040   ACE_TRY
00041     {
00042       this->publish_ =
00043         CosNotifyComm::NotifyPublish::_narrow (push_consumer
00044                                                ACE_ENV_ARG_PARAMETER);
00045       ACE_TRY_CHECK;
00046     }
00047   ACE_CATCHANY
00048     {
00049       // _narrow failed which probably means the interface is CosEventComm type.
00050     }
00051   ACE_ENDTRY;
00052 }

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 79 of file PushConsumer.cpp.

References ACE_ASSERT, and CosNotification::EventBatch.

00080 {
00081   ACE_ASSERT(false);
00082   ACE_UNUSED_ARG (event);
00083   // TODO exception?
00084 }

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

Push to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 68 of file PushConsumer.cpp.

References ACE_ENV_ARG_PARAMETER, push_consumer_, and TAO_Notify_Event::translate().

00069 {
00070   CORBA::Any any;
00071 
00072   TAO_Notify_Event::translate (event, any);
00073 
00074   this->push_consumer_->push (any ACE_ENV_ARG_PARAMETER);
00075 }

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

Push to this consumer.

Implements TAO_Notify_Consumer.

Definition at line 62 of file PushConsumer.cpp.

References ACE_ENV_ARG_PARAMETER, and push_consumer_.

00063 {
00064   this->push_consumer_->push (payload ACE_ENV_ARG_PARAMETER);
00065 }

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 107 of file PushConsumer.cpp.

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

00109 {
00110   TAO_Notify_PushConsumer* tmp =
00111     dynamic_cast<TAO_Notify_PushConsumer*> (old_consumer);
00112   ACE_ASSERT(tmp != 0);
00113   this->init(tmp->push_consumer_.in() ACE_ENV_ARG_PARAMETER);
00114   ACE_CHECK;
00115   this->schedule_timer(false);
00116 }

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

TAO_Notify_Destroy_Callback methods.

Implements TAO_Notify_Peer.

Definition at line 55 of file PushConsumer.cpp.

00056 {
00057   delete this;
00058   //@@ inform factory
00059 }


Member Data Documentation

CosEventComm::PushConsumer_var TAO_Notify_PushConsumer::push_consumer_ [protected]
 

The Consumer.

Definition at line 68 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 Thu Nov 9 13:32:57 2006 for TAO_CosNotification by doxygen 1.3.6