diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp new file mode 100644 index 00000000000..5092f791477 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp @@ -0,0 +1,78 @@ +/* -*- C++ -*- $Id$ */ + +#include "orbsvcs/Log/LogNotification.h" +#include "orbsvcs/Log/NotifyLogNotification.h" +#include "orbsvcs/Time_Utilities.h" +#include "tao/debug.h" + +NotifyLogNotification::NotifyLogNotification (CosNotifyChannelAdmin::EventChannel_ptr ec) +: LogNotification (), event_channel_ (CosNotifyChannelAdmin::EventChannel::_duplicate (ec)) +{ + + CosNotifyComm::PushSupplier_var objref = + this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + ACE_ASSERT (!CORBA::is_nil (objref.in ())); + + CosNotifyChannelAdmin::AdminID adminID; + CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = + this->event_channel_->new_for_suppliers (CosNotifyChannelAdmin::OR_OP, adminID); + + ACE_ASSERT (!CORBA::is_nil (supplier_admin.in ())); + + CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer = + supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::ANY_EVENT, proxy_consumer_id_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_ASSERT (!CORBA::is_nil (proxyconsumer.in ())); + + // narrow + this->proxy_consumer_ = + CosNotifyChannelAdmin::ProxyPushConsumer::_narrow (proxyconsumer.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ())); + + proxy_consumer_->connect_any_push_supplier (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +NotifyLogNotification::~NotifyLogNotification (void) +{ + // No-Op. +} + +void +NotifyLogNotification::send_notification (const CORBA::Any& any) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->proxy_consumer_->push (any); +} + +void +NotifyLogNotification::subscription_change + (const CosNotification::EventTypeSeq & /*added*/, + const CosNotification::EventTypeSeq & /*removed */ + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType + )) +{ + //No-Op. +} + +void +NotifyLogNotification::disconnect_push_supplier + (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ())); + + this->proxy_consumer_->disconnect_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER); +} |