diff options
Diffstat (limited to 'TAO/tao/ClientRequestInfo.cpp')
-rw-r--r-- | TAO/tao/ClientRequestInfo.cpp | 200 |
1 files changed, 73 insertions, 127 deletions
diff --git a/TAO/tao/ClientRequestInfo.cpp b/TAO/tao/ClientRequestInfo.cpp index db257d5819c..2d9938e2a3a 100644 --- a/TAO/tao/ClientRequestInfo.cpp +++ b/TAO/tao/ClientRequestInfo.cpp @@ -7,9 +7,7 @@ #include "Stub.h" #include "Tagged_Components.h" -ACE_RCSID (TAO, - ClientRequestInfo, - "$Id$") +ACE_RCSID (tao, ClientRequestInfo, "$Id$") #if TAO_HAS_INTERCEPTORS == 1 @@ -20,7 +18,7 @@ ACE_RCSID (TAO, TAO_ClientRequestInfo::TAO_ClientRequestInfo (TAO_GIOP_Invocation *inv, CORBA::Object_ptr target) : invocation_ (inv), - target_ (target), // No need to duplicate. + target_ (CORBA::Object::_duplicate (target)), caught_exception_ (0), response_expected_ (1), reply_status_ (-1) @@ -31,14 +29,25 @@ CORBA::Object_ptr TAO_ClientRequestInfo::target (CORBA::Environment &) ACE_THROW_SPEC ((CORBA::SystemException)) { - return CORBA::Object::_duplicate (this->target_); + if (this->reply_status_ == + PortableInterceptor::LOCATION_FORWARD_PERMANENT) + { + // TAO_GIOP_Invocation::forward_reference() already duplicates + // the reference before returning it so there is no need to + // duplicate it here. + return this->invocation_->forward_reference (); + } + + return CORBA::Object::_duplicate (this->target_.in ()); } CORBA::Object_ptr TAO_ClientRequestInfo::effective_target (CORBA::Environment &) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->reply_status_ == PortableInterceptor::LOCATION_FORWARD) + if (this->reply_status_ == PortableInterceptor::LOCATION_FORWARD + || this->reply_status_ == + PortableInterceptor::LOCATION_FORWARD_PERMANENT) { // TAO_GIOP_Invocation::forward_reference() already duplicates // the reference before returning it so there is no need to @@ -46,7 +55,7 @@ TAO_ClientRequestInfo::effective_target (CORBA::Environment &) return this->invocation_->forward_reference (); } - return CORBA::Object::_duplicate (this->target_); + return CORBA::Object::_duplicate (this->target_.in ()); } IOP::TaggedProfile * @@ -84,12 +93,13 @@ TAO_ClientRequestInfo::received_exception (CORBA::Environment &ACE_TRY_ENV) if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION && this->reply_status_ != PortableInterceptor::USER_EXCEPTION) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), 0); + // @@ Need the minor code once it is available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } // The spec says that if it is a user exception which can't be // inserted then the UNKNOWN exception needs to be thrown with minor - // code 1. + // code TBD_U. CORBA::Any * temp = 0; @@ -127,9 +137,9 @@ TAO_ClientRequestInfo::received_exception_id ( if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION && this->reply_status_ != PortableInterceptor::USER_EXCEPTION) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, - CORBA::COMPLETED_NO), - 0); + // Need the minor code from the PI spec once it becomes + // available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } return CORBA::string_dup (this->caught_exception_->_id ()); @@ -141,96 +151,32 @@ TAO_ClientRequestInfo::get_effective_component ( CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO_Tagged_Components &ecs = - this->target_->_stubobj ()->profile_in_use ()->tagged_components (); - - IOP::MultipleComponentProfile &components = ecs.components (); - - CORBA::ULong len = components.length (); - for (CORBA::ULong i = 0; i < len; ++i) - { - if (components[i].tag == id) - { - IOP::TaggedComponent *tagged_component = 0; - - // Only allocate a sequence if we have a tagged component - // that matches the given IOP::ComponentId. - ACE_NEW_THROW_EX (tagged_component, - IOP::TaggedComponent, - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (0); - - IOP::TaggedComponent_var safe_tagged_component = - tagged_component; - - (*tagged_component) = components[i]; // Deep copy - - return safe_tagged_component._retn (); - } - } + IOP::TaggedComponent *tagged_component = 0; + ACE_NEW_THROW_EX (tagged_component, + IOP::TaggedComponent, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (0); - // No tagged component was found that matched the given - // IOP::ComponentId. - ACE_THROW_RETURN (CORBA::BAD_PARAM (25, CORBA::COMPLETED_NO), - 0); -} + IOP::TaggedComponent_var safe_tagged_component = tagged_component; -IOP::TaggedComponentSeq * -TAO_ClientRequestInfo::get_effective_components ( - IOP::ComponentId id, - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - TAO_Tagged_Components &ecs = + const TAO_Tagged_Components &ecs = this->target_->_stubobj ()->profile_in_use ()->tagged_components (); - IOP::MultipleComponentProfile &components = ecs.components (); + tagged_component->tag = id; - IOP::TaggedComponentSeq *tagged_components = 0; - IOP::TaggedComponentSeq_var safe_tagged_components; + if (!ecs.get_component (*tagged_component)) + ACE_THROW_RETURN (CORBA::BAD_PARAM ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + EINVAL), // @@ Need minor code from PI spec! + CORBA::COMPLETED_NO), + 0); - CORBA::ULong len = components.length (); - for (CORBA::ULong i = 0; i < len; ++i) - { - if (components[i].tag == id) - { - if (tagged_components == 0) - { - // Only allocate a sequence if we have tagged components - // to place into the sequence. - ACE_NEW_THROW_EX (tagged_components, - IOP::TaggedComponentSeq, - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (0); - - safe_tagged_components = tagged_components; - } - - CORBA::ULong old_len = safe_tagged_components->length (); - safe_tagged_components->length (old_len + 1); - - safe_tagged_components[old_len] = components[i]; // Deep copy - } - } - - if (tagged_components == 0) - { - // No tagged component sequence was allocated, meaning no tagged - // components were found that matched the given - // IOP::ComponentId. - ACE_THROW_RETURN (CORBA::BAD_PARAM (25, CORBA::COMPLETED_NO), - 0); - } - - return safe_tagged_components._retn (); + return safe_tagged_component._retn (); } CORBA::Policy_ptr @@ -239,20 +185,8 @@ TAO_ClientRequestInfo::get_request_policy (CORBA::PolicyType type, ACE_THROW_SPEC ((CORBA::SystemException)) { // @@ Do we need to look anywhere else for the request policies? - -#if TAO_HAS_CORBA_MESSAGING == 1 return this->target_->_get_policy (type, ACE_TRY_ENV); -#else - ACE_UNUSED_ARG (type); - - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOTSUP), - CORBA::COMPLETED_NO), - 0); -#endif /* TAO_HAS_CORBA_MESSAGING == 1 */ } void @@ -280,7 +214,8 @@ TAO_ClientRequestInfo::add_request_service_context ( return; } else - ACE_THROW (CORBA::BAD_INV_ORDER (11, CORBA::COMPLETED_NO)); + // @@ Need the minor code once it becomes available. + ACE_THROW (CORBA::BAD_INV_ORDER ()); } } @@ -308,40 +243,40 @@ Dynamic::ParameterList * TAO_ClientRequestInfo::arguments (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - 0); + // @@ Need the minor code once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } Dynamic::ExceptionList * TAO_ClientRequestInfo::exceptions (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - 0); + // @@ Need the minor code once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } Dynamic::ContextList * TAO_ClientRequestInfo::contexts (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - 0); + // @@ Need the minor code once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } Dynamic::RequestContext * TAO_ClientRequestInfo::operation_context (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - 0); +{ + // @@ Need the minor code once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } CORBA::Any * TAO_ClientRequestInfo::result (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - 0); + // @@ Need the minor code once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0); } CORBA::Boolean @@ -369,8 +304,8 @@ TAO_ClientRequestInfo::sync_scope (CORBA::Environment &ACE_TRY_ENV) if (inv != 0 && this->response_expected_ == 0) return inv->sync_scope (); - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), - -1); + // @@ Need the minor once it becomes available. + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), -1); } #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ @@ -380,7 +315,7 @@ TAO_ClientRequestInfo::reply_status (CORBA::Environment &ACE_TRY_ENV) { if (this->reply_status_ == -1) // A reply hasn't been received yet. - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), -1); + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), -1); return this->reply_status_; } @@ -389,8 +324,11 @@ CORBA::Object_ptr TAO_ClientRequestInfo::forward_reference (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD) - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (10, CORBA::COMPLETED_NO), + // @@ Need the minor code once it becomes available. + if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD + && this->reply_status_ != + PortableInterceptor::LOCATION_FORWARD_PERMANENT) + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), CORBA::Object::_nil ()); // TAO_GIOP_Invocation::forward_reference() already duplicates the @@ -443,7 +381,11 @@ TAO_ClientRequestInfo::get_request_service_context ( return safe_service_context._retn (); } - ACE_THROW_RETURN (CORBA::BAD_PARAM (23, CORBA::COMPLETED_NO), + ACE_THROW_RETURN (CORBA::BAD_PARAM ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + EINVAL), // @@ Need minor code from PI spec! + CORBA::COMPLETED_NO), 0); } @@ -477,7 +419,11 @@ TAO_ClientRequestInfo::get_reply_service_context ( return safe_service_context._retn (); } - ACE_THROW_RETURN (CORBA::BAD_PARAM (23, CORBA::COMPLETED_NO), + ACE_THROW_RETURN (CORBA::BAD_PARAM ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + EINVAL), // @@ Need minor code from PI spec! + CORBA::COMPLETED_NO), 0); } |