diff options
Diffstat (limited to 'TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp b/TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp index 743c80625aa..4b3bbec4533 100644 --- a/TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp +++ b/TAO/orbsvcs/tests/FT_App/StubBatchConsumer.cpp @@ -25,28 +25,70 @@ int StubBatchConsumer::parse_args (int argc, char * argv[]) return optionError; } + +::PortableServer::POA_ptr StubBatchConsumer::_default_POA (ACE_ENV_SINGLE_ARG_DECL) +{ + return ::PortableServer::POA::_duplicate(this->poa_ ACE_ENV_ARG_PARAMETER); +} + +PortableServer::ObjectId StubBatchConsumer::objectId()const +{ + return this->objectId_.in(); +} + + /** * register this object */ -int StubBatchConsumer::init (TAO_ORB_Manager & orbManager, - ::FT::FaultNotifier_var & notifier - ACE_ENV_ARG_DECL) +int StubBatchConsumer::init (CORBA::ORB_var & orb, ::FT::FaultNotifier_var & notifier ACE_ENV_ARG_DECL) { int result = 0; - orb_ = orbManager.orb(); + this->orb_ = orb; - notifier_ = notifier; + // Use the ROOT POA for now + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references (TAO_OBJID_ROOTPOA + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")), + -1); + + // Get the POA object. + this->poa_ = + PortableServer::POA::_narrow (poa_object.in () + ACE_ENV_ARG_PARAMETER); - // Register with the ORB. - ior_ = orbManager.activate (this - ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - identity_ = "StubBatchConsumer"; + if (CORBA::is_nil(this->poa_)) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT (" (%P|%t) Unable to narrow the POA.\n")), + -1); + } + + PortableServer::POAManager_var poa_manager = + this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Register with the POA. + + this->objectId_ = this->poa_->activate_object (this ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + this->notifier_ = notifier; + + this->identity_ = "StubBatchConsumer"; CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_nil(); - consumerId_ = notifier->connect_sequence_fault_consumer( + this->consumerId_ = notifier->connect_sequence_fault_consumer( _this(), filter); @@ -58,7 +100,7 @@ int StubBatchConsumer::init (TAO_ORB_Manager & orbManager, */ const char * StubBatchConsumer::identity () const { - return identity_.c_str(); + return this->identity_.c_str(); } /** @@ -66,14 +108,14 @@ const char * StubBatchConsumer::identity () const */ void StubBatchConsumer::fini (ACE_ENV_SINGLE_ARG_DECL) { - notifier_->disconnect_consumer(consumerId_ ACE_ENV_ARG_PARAMETER); + this->notifier_->disconnect_consumer(this->consumerId_ ACE_ENV_ARG_PARAMETER); } int StubBatchConsumer::idle(int & result) { ACE_UNUSED_ARG(result); - return quit_; + return this->quit_; } //////////////// @@ -117,7 +159,7 @@ void StubBatchConsumer::disconnect_sequence_push_consumer ( ACE_ERROR ((LM_ERROR, "StubBatchConsumer:disconnect_sequence_push_consumer interpreted as quit request.\n" )); - quit_ = 1; + this->quit_ = 1; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) |