summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp54
1 files changed, 33 insertions, 21 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp
index a912b7f5706..8048c1dcaa5 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "PushConsumer.h"
+#include "orbsvcs/Notify/Any/PushConsumer.h"
ACE_RCSID (Notify,
TAO_Notify_PushConsumer,
@@ -8,8 +8,10 @@ ACE_RCSID (Notify,
#include "ace/Bound_Ptr.h"
#include "orbsvcs/CosEventCommC.h"
-#include "../Event.h"
-#include "../Properties.h"
+#include "orbsvcs/Notify/Event.h"
+#include "orbsvcs/Notify/Properties.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Notify_PushConsumer::TAO_Notify_PushConsumer (TAO_Notify_ProxySupplier* proxy)
:TAO_Notify_Consumer (proxy)
@@ -21,15 +23,25 @@ TAO_Notify_PushConsumer::~TAO_Notify_PushConsumer ()
}
void
-TAO_Notify_PushConsumer::init (CosEventComm::PushConsumer_ptr push_consumer ACE_ENV_ARG_DECL)
+TAO_Notify_PushConsumer::init (CosEventComm::PushConsumer_ptr push_consumer
+ ACE_ENV_ARG_DECL)
{
- ACE_ASSERT ( push_consumer != 0 && this->push_consumer_.in() == 0 );
+ // Initialize only once
+ ACE_ASSERT( CORBA::is_nil (this->push_consumer_.in()) );
+
+ // push_consumer not optional
+ if (CORBA::is_nil (push_consumer))
+ {
+ ACE_THROW (CORBA::BAD_PARAM());
+ }
this->push_consumer_ = CosEventComm::PushConsumer::_duplicate (push_consumer);
ACE_TRY
{
- this->publish_ = CosNotifyComm::NotifyPublish::_narrow (push_consumer ACE_ENV_ARG_PARAMETER);
+ this->publish_ =
+ CosNotifyComm::NotifyPublish::_narrow (push_consumer
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
@@ -71,25 +83,22 @@ TAO_Notify_PushConsumer::push (const CosNotification::EventBatch& event ACE_ENV_
// TODO exception?
}
-
-
-bool
-TAO_Notify_PushConsumer::get_ior (ACE_CString & iorstr) const
+ACE_CString
+TAO_Notify_PushConsumer::get_ior (void) const
{
- bool result = false;
+ ACE_CString result;
CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
- {
- CORBA::String_var ior = orb->object_to_string(this->push_consumer_.in() ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- iorstr = static_cast<const char *> (ior.in ());
- result = true;
- }
+ {
+ CORBA::String_var ior = orb->object_to_string(this->push_consumer_.in() ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ result = static_cast<const char*> (ior.in ());
+ }
ACE_CATCHANY
- {
- ACE_ASSERT(0);
- }
+ {
+ result.fast_clear();
+ }
ACE_ENDTRY;
return result;
}
@@ -98,9 +107,12 @@ void
TAO_Notify_PushConsumer::reconnect_from_consumer (TAO_Notify_Consumer* old_consumer
ACE_ENV_ARG_DECL)
{
- TAO_Notify_PushConsumer* tmp = dynamic_cast<TAO_Notify_PushConsumer*> (old_consumer);
+ TAO_Notify_PushConsumer* tmp =
+ dynamic_cast<TAO_Notify_PushConsumer*> (old_consumer);
ACE_ASSERT(tmp != 0);
this->init(tmp->push_consumer_.in() ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
this->schedule_timer(false);
}
+
+TAO_END_VERSIONED_NAMESPACE_DECL