ClientRequestInfo.cpp

Go to the documentation of this file.
00001 // ClientRequestInfo.cpp,v 1.14 2006/06/26 09:24:20 sma Exp
00002 
00003 #include "tao/PI/ClientRequestInfo.h"
00004 
00005 #if TAO_HAS_INTERCEPTORS == 1
00006 
00007 ACE_RCSID (PI,
00008            ClientRequestInfo,
00009            "ClientRequestInfo.cpp,v 1.14 2006/06/26 09:24:20 sma Exp")
00010 
00011 #include "tao/AnyTypeCode/Any.h"
00012 #include "tao/AnyTypeCode/ExceptionA.h"
00013 
00014 #include "tao/PI/PICurrent.h"
00015 #include "tao/PI/RequestInfo_Util.h"
00016 
00017 #include "tao/PolicyC.h"
00018 #include "tao/PortableInterceptorC.h"
00019 #include "tao/Invocation_Base.h"
00020 #include "tao/operation_details.h"
00021 #include "tao/Stub.h"
00022 #include "tao/ORB_Core.h"
00023 #include "tao/Profile.h"
00024 #include "tao/debug.h"
00025 #include "tao/Service_Context.h"
00026 #include "tao/Exception_Data.h"
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 TAO_ClientRequestInfo::TAO_ClientRequestInfo (TAO::Invocation_Base *inv)
00031   : invocation_ (inv),
00032     rs_pi_current_ ()
00033 {
00034   this->setup_picurrent ();
00035 }
00036 
00037 void
00038 TAO_ClientRequestInfo::setup_picurrent (void)
00039 {
00040   // Retrieve the thread scope current (no TSS access incurred yet).
00041   CORBA::Object_ptr pi_current_obj =
00042     this->invocation_->orb_core ()->pi_current ();
00043 
00044   TAO::PICurrent *pi_current =
00045     dynamic_cast <TAO::PICurrent*> (pi_current_obj);
00046 
00047   // If the slot count is zero, then there is nothing to copy.
00048   // Prevent any copying (and hence TSS accesses) from occurring.
00049   if (pi_current != 0 && pi_current->slot_count () != 0)
00050     {
00051       // Retrieve the thread scope current.
00052       TAO::PICurrent_Impl *tsc = pi_current->tsc ();
00053 
00054       if (tsc != 0)
00055         {
00056           // Logically copy the TSC's slot table to the RSC.
00057           this->rs_pi_current_.take_lazy_copy (tsc);
00058        }
00059     }
00060 }
00061 
00062 IOP::ServiceContext *
00063 TAO_ClientRequestInfo::get_service_context_i (
00064     TAO_Service_Context &service_context_list,
00065     IOP::ServiceId id
00066     ACE_ENV_ARG_DECL)
00067   ACE_THROW_SPEC ((CORBA::SystemException))
00068 {
00069   IOP::ServiceContext_var service_context;
00070 
00071   if (service_context_list.get_context (id, service_context.out ()) != 0)
00072     {
00073       // Found.
00074       return service_context._retn ();
00075     }
00076   else
00077     {
00078       // Not found.
00079       ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 26,
00080                                           CORBA::COMPLETED_NO),
00081                         0);
00082     }
00083 }
00084 
00085 CORBA::Object_ptr
00086 TAO_ClientRequestInfo::target (ACE_ENV_SINGLE_ARG_DECL)
00087   ACE_THROW_SPEC ((CORBA::SystemException))
00088 {
00089   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00090   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00091 
00092   return CORBA::Object::_duplicate (this->invocation_->target ());
00093 }
00094 
00095 CORBA::Object_ptr
00096 TAO_ClientRequestInfo::effective_target (ACE_ENV_SINGLE_ARG_DECL)
00097   ACE_THROW_SPEC ((CORBA::SystemException))
00098 {
00099   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00100   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00101 
00102   return CORBA::Object::_duplicate (this->invocation_->effective_target ());
00103 }
00104 
00105 IOP::TaggedProfile *
00106 TAO_ClientRequestInfo::effective_profile (ACE_ENV_SINGLE_ARG_DECL)
00107   ACE_THROW_SPEC ((CORBA::SystemException))
00108 {
00109   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00110   ACE_CHECK_RETURN (0);
00111 
00112   IOP::TaggedProfile *tagged_profile = 0;
00113   ACE_NEW_THROW_EX (tagged_profile,
00114                     IOP::TaggedProfile,
00115                     CORBA::NO_MEMORY (
00116                       CORBA::SystemException::_tao_minor_code (
00117                         TAO::VMCID,
00118                         ENOMEM),
00119                       CORBA::COMPLETED_NO));
00120   ACE_CHECK_RETURN (0);
00121 
00122   IOP::TaggedProfile_var safe_tagged_profile = tagged_profile;
00123 
00124   TAO_Stub *stub =
00125     this->invocation_->effective_target ()->_stubobj ();
00126 
00127   IOP::TaggedProfile *ep =
00128     stub->profile_in_use ()->create_tagged_profile ();
00129 
00130   if (ep == 0)
00131     {
00132       ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
00133                                           CORBA::COMPLETED_NO),
00134                                           0);
00135     }
00136 
00137   // @@BAD_PARAM exception
00138   tagged_profile->tag = ep->tag;
00139   tagged_profile->profile_data = ep->profile_data;  // Deep copy
00140 
00141   return safe_tagged_profile._retn ();
00142 }
00143 
00144 // Use at own risk. There is no way currently of extracting an
00145 // exception from an Any. This method is in place just to be compliant
00146 // with the spec.
00147 CORBA::Any *
00148 TAO_ClientRequestInfo::received_exception (ACE_ENV_SINGLE_ARG_DECL)
00149   ACE_THROW_SPEC ((CORBA::SystemException))
00150 {
00151   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00152   ACE_CHECK_RETURN (0);
00153 
00154   if (this->invocation_->reply_status () != PortableInterceptor::SYSTEM_EXCEPTION
00155       && this->invocation_->reply_status () != PortableInterceptor::USER_EXCEPTION)
00156     {
00157       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00158                                               CORBA::COMPLETED_NO), 0);
00159     }
00160 
00161   // The spec says that if it is a user exception which can't be
00162   // inserted then the UNKNOWN exception needs to be thrown with minor
00163   // code 1.
00164 
00165   CORBA::Any * temp = 0;
00166 
00167   ACE_NEW_THROW_EX (temp,
00168                     CORBA::Any,
00169                     CORBA::NO_MEMORY (
00170                       CORBA::SystemException::_tao_minor_code (
00171                         TAO::VMCID,
00172                         ENOMEM),
00173                       CORBA::COMPLETED_NO));
00174   ACE_CHECK_RETURN (0);
00175 
00176   CORBA::Any_var caught_exception_var = temp;
00177 
00178   CORBA::Exception *caught_exception =
00179     invocation_->caught_exception ();
00180 
00181   if (caught_exception != 0)
00182     *temp <<= *(caught_exception);
00183 
00184   return caught_exception_var._retn ();
00185 }
00186 
00187 char *
00188 TAO_ClientRequestInfo::received_exception_id (
00189     ACE_ENV_SINGLE_ARG_DECL)
00190   ACE_THROW_SPEC ((CORBA::SystemException))
00191 {
00192   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00193   ACE_CHECK_RETURN (0);
00194 
00195   CORBA::Exception *caught_exception =
00196     invocation_->caught_exception ();
00197 
00198   if (caught_exception == 0)
00199     {
00200       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00201                                               CORBA::COMPLETED_NO),
00202                         0);
00203     }
00204 
00205   return CORBA::string_dup (caught_exception->_rep_id ());
00206 }
00207 
00208 IOP::TaggedComponent *
00209 TAO_ClientRequestInfo::get_effective_component (
00210     IOP::ComponentId id
00211     ACE_ENV_ARG_DECL)
00212   ACE_THROW_SPEC ((CORBA::SystemException))
00213 {
00214   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00215   ACE_CHECK_RETURN (0);
00216 
00217   TAO_Stub *stub =
00218     this->invocation_->effective_target ()->_stubobj ();
00219 
00220   TAO_Tagged_Components &ecs =
00221     stub->profile_in_use ()->tagged_components ();
00222 
00223   IOP::MultipleComponentProfile &components = ecs.components ();
00224 
00225   const CORBA::ULong len = components.length ();
00226   for (CORBA::ULong i = 0; i < len; ++i)
00227     {
00228       if (components[i].tag == id)
00229         {
00230           IOP::TaggedComponent *tagged_component = 0;
00231 
00232           // Only allocate a sequence if we have a tagged component
00233           // that matches the given IOP::ComponentId.
00234           ACE_NEW_THROW_EX (tagged_component,
00235                             IOP::TaggedComponent,
00236                             CORBA::NO_MEMORY (
00237                               CORBA::SystemException::_tao_minor_code (
00238                                 TAO::VMCID,
00239                                 ENOMEM),
00240                               CORBA::COMPLETED_NO));
00241           ACE_CHECK_RETURN (0);
00242 
00243           IOP::TaggedComponent_var safe_tagged_component =
00244             tagged_component;
00245 
00246           (*tagged_component) = components[i];  // Deep copy
00247 
00248           return safe_tagged_component._retn ();
00249         }
00250     }
00251 
00252   // No tagged component was found that matched the given
00253   // IOP::ComponentId.
00254   ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
00255                                       CORBA::COMPLETED_NO),
00256                     0);
00257 }
00258 
00259 IOP::TaggedComponentSeq *
00260 TAO_ClientRequestInfo::get_effective_components (
00261     IOP::ComponentId id
00262     ACE_ENV_ARG_DECL)
00263   ACE_THROW_SPEC ((CORBA::SystemException))
00264 {
00265   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00266   ACE_CHECK_RETURN (0);
00267 
00268   TAO_Stub *stub =
00269     this->invocation_->target ()->_stubobj ();
00270 
00271   TAO_Tagged_Components &ecs =
00272     stub->profile_in_use ()->tagged_components ();
00273 
00274   IOP::MultipleComponentProfile &components = ecs.components ();
00275 
00276   IOP::TaggedComponentSeq *tagged_components = 0;
00277   IOP::TaggedComponentSeq_var safe_tagged_components;
00278 
00279   const CORBA::ULong len = components.length ();
00280   for (CORBA::ULong i = 0; i < len; ++i)
00281     {
00282       if (components[i].tag == id)
00283         {
00284           if (tagged_components == 0)
00285             {
00286               // Only allocate a sequence if we have tagged components
00287               // to place into the sequence.
00288               ACE_NEW_THROW_EX (tagged_components,
00289                                 IOP::TaggedComponentSeq,
00290                                 CORBA::NO_MEMORY (
00291                                   CORBA::SystemException::_tao_minor_code (
00292                                     TAO::VMCID,
00293                                     ENOMEM),
00294                                   CORBA::COMPLETED_NO));
00295               ACE_CHECK_RETURN (0);
00296 
00297               safe_tagged_components = tagged_components;
00298             }
00299 
00300           const CORBA::ULong old_len = safe_tagged_components->length ();
00301           safe_tagged_components->length (old_len + 1);
00302 
00303           safe_tagged_components[old_len] = components[i];  // Deep copy
00304         }
00305     }
00306 
00307   if (tagged_components == 0)
00308     {
00309       // No tagged component sequence was allocated, meaning no tagged
00310       // components were found that matched the given
00311       // IOP::ComponentId.
00312       ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
00313                                           CORBA::COMPLETED_NO),
00314                         0);
00315     }
00316 
00317   return safe_tagged_components._retn ();
00318 }
00319 
00320 CORBA::Policy_ptr
00321 TAO_ClientRequestInfo::get_request_policy (CORBA::PolicyType type
00322                                            ACE_ENV_ARG_DECL)
00323   ACE_THROW_SPEC ((CORBA::SystemException))
00324 {
00325   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00326   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00327 
00328   // @@ Do we need to look anywhere else for the request policies?
00329 
00330 #if TAO_HAS_CORBA_MESSAGING == 1
00331   return this->invocation_->target ()->_get_policy (type
00332                                                     ACE_ENV_ARG_PARAMETER);
00333 #else
00334   ACE_UNUSED_ARG (type);
00335 
00336   ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
00337                       CORBA::SystemException::_tao_minor_code (
00338                         TAO::VMCID,
00339                         ENOTSUP),
00340                       CORBA::COMPLETED_NO),
00341                     0);
00342 #endif  /* TAO_HAS_CORBA_MESSAGING == 1 */
00343 }
00344 
00345 void
00346 TAO_ClientRequestInfo::add_request_service_context (
00347     const IOP::ServiceContext & service_context,
00348     CORBA::Boolean replace
00349     ACE_ENV_ARG_DECL)
00350   ACE_THROW_SPEC ((CORBA::SystemException))
00351 {
00352   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00353   ACE_CHECK;
00354 
00355   // Get the service context from the list
00356   TAO_Service_Context &service_context_list =
00357     this->invocation_->request_service_context ();
00358 
00359   if (service_context_list.set_context (service_context, replace) == 0)
00360     {
00361       ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 15,
00362                                        CORBA::COMPLETED_NO));
00363     }
00364 }
00365 
00366 CORBA::ULong
00367 TAO_ClientRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL)
00368   ACE_THROW_SPEC ((CORBA::SystemException))
00369 {
00370   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00371   ACE_CHECK_RETURN (0);
00372 
00373   // @todo We may have to worry about AMI once we support interceptors
00374   //       in AMI requests since the Invocation object no longer
00375   //       exists once an AMI request has been made.  In that case,
00376   //       the reply dispatcher address should be used.
00377 
00378   // The request ID must be unique across all outstanding requests.
00379   // To avoid synchronization overhead, the address of this Invocation
00380   // object is used as the request ID.  This guarantees that the
00381   // request ID is unique without being forced to acquire a lock.
00382   //
00383   // For 64-bit platforms, we right shift 8 bits and then use the
00384   // lower 32 bits of that shifted value.  Rather than losing the
00385   // upper 32 bits of significant digits by taking the lower 32 bits,
00386   // we only lose the upper 24 by doing the shift.  Basically, the
00387   // resulting request ID will comprised of bits 8 through 39.  This is
00388   // made possible by the fact that this Invocation object is large
00389   // enough to increase the likelihood that those bits (0 through 39)
00390   // are unique.  In particular, this->buffer_ is 512 bytes
00391   // (ACE_CDR::DEFAULT_BUFSIZE) long by default; implying that
00392   // dropping the lower 8 bits of the this Invocation object's 64 bit
00393   // address (i.e. 256 bytes) is not a problem.
00394 
00395   CORBA::ULong id = 0;
00396 
00397   // Note that we reinterpret_cast to an "unsigned long" instead of
00398   // CORBA::ULong since we need to first cast to an integer large
00399   // enough to hold an address to avoid compile-time warnings on some
00400   // 64-bit platforms.
00401 
00402   // 32 bit address
00403   if (sizeof (this) == 4)
00404     id =
00405       static_cast<CORBA::ULong> (
00406         reinterpret_cast<ptrdiff_t> (this->invocation_));
00407 
00408   // 64 bit address -- bits 8 through 39  (see notes above!)
00409   // In this case, we make sure this object is large enough to safely
00410   // do the right shift.  This is necessary since the size of the
00411   // buffer that makes this object is configurable.
00412   else if (sizeof (this) == 8
00413            && sizeof (*(this->invocation_)) > 256 /* 2 << 8 */)
00414     id =
00415       (static_cast<CORBA::ULong> (
00416          reinterpret_cast<ptrdiff_t> (this->invocation_)) >> 8) & 0xFFFFFFFFu;
00417 
00418   // 64 bit address -- lower 32 bits
00419   else if (sizeof (this) == 8)
00420     id =
00421       static_cast<CORBA::ULong> (
00422         reinterpret_cast<ptrdiff_t> (this->invocation_)) & 0xFFFFFFFFu;
00423 
00424   // @@ The following request ID generator prevents the
00425   //    PortableInterceptor::ClientRequestInterceptor::send_request()
00426   //    interception point from occuring before the call to connect,
00427   //    thus preventing us from adding an optimization that itself
00428   //    prevents a connection from being unnecessarily performed.
00429   //    Thus, the ClientRequestInfo object is forced to have its own
00430   //    request ID generator in order to make it possible to implement
00431   //    the above optimization.
00432   //
00433   //    Ideally, this request ID generator should go away, especially
00434   //    since it adds a lock to the critical path.
00435   //   else    // Fallback
00436   //     id = this->invocation_->request_id ();
00437 
00438   else
00439     {
00440       if (TAO_debug_level > 0)
00441         ACE_ERROR ((LM_ERROR,
00442                     "(%P|%t) ClientRequestInfo::request_id() failed\n"
00443                     "(%P|%t) since its request ID generator is not\n"
00444                     "(%P|%t) supported on this platform.\n"));
00445 
00446       ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
00447     }
00448 
00449   return id;
00450 }
00451 
00452 char *
00453 TAO_ClientRequestInfo::operation (ACE_ENV_SINGLE_ARG_DECL)
00454   ACE_THROW_SPEC ((CORBA::SystemException))
00455 {
00456   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00457   ACE_CHECK_RETURN (0);
00458 
00459   return CORBA::string_dup (
00460     this->invocation_->operation_details ().opname  ());
00461 }
00462 
00463 Dynamic::ParameterList *
00464 TAO_ClientRequestInfo::arguments (ACE_ENV_SINGLE_ARG_DECL)
00465   ACE_THROW_SPEC ((CORBA::SystemException))
00466 {
00467   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00468   ACE_CHECK_RETURN (0);
00469 
00470   // Generate the argument list on demand.
00471   Dynamic::ParameterList *parameter_list =
00472     TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00473   ACE_CHECK_RETURN (0);
00474 
00475   Dynamic::ParameterList_var safe_parameter_list = parameter_list;
00476 
00477   if (this->parameter_list (*parameter_list) == false)
00478     ACE_THROW_RETURN (CORBA::MARSHAL (),
00479                       0);
00480 
00481   return safe_parameter_list._retn ();
00482 
00483   //return this->invocation_->arguments (ACE_ENV_SINGLE_ARG_PARAMETER);
00484 }
00485 
00486 bool
00487 TAO_ClientRequestInfo::parameter_list (Dynamic::ParameterList &param_list)
00488 {
00489   // Account for the return type that could be in the argument list.
00490   param_list.length (this->invocation_->operation_details ().args_num () - 1);
00491 
00492   for (CORBA::ULong i = 1; i != this->invocation_->operation_details ().args_num (); ++i)
00493     {
00494       TAO::Argument *argument =
00495         this->invocation_->operation_details ().args ()[i];
00496       Dynamic::Parameter &p = param_list[i - 1];
00497       p.mode = argument->mode ();
00498       argument->interceptor_value (&p.argument);
00499     }
00500 
00501   return true;
00502 }
00503 
00504 Dynamic::ExceptionList *
00505 TAO_ClientRequestInfo::exceptions (ACE_ENV_SINGLE_ARG_DECL)
00506   ACE_THROW_SPEC ((CORBA::SystemException))
00507 {
00508   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00509   ACE_CHECK_RETURN (0);
00510 
00511   Dynamic::ExceptionList *exception_list =
00512     TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00513   ACE_CHECK_RETURN (0);
00514 
00515   Dynamic::ExceptionList_var safe_exception_list = exception_list;
00516 
00517   if (this->exception_list (*exception_list) == false)
00518     ACE_THROW_RETURN (CORBA::MARSHAL (),
00519                       0);
00520 
00521   return safe_exception_list._retn ();
00522 }
00523 
00524 bool
00525 TAO_ClientRequestInfo::exception_list (Dynamic::ExceptionList &exception_list)
00526 {
00527 
00528   if (this->invocation_->operation_details ().ex_count ())
00529     {
00530       exception_list.length (this->invocation_->operation_details ().ex_count ());
00531 
00532       for (CORBA::ULong i = 0;
00533            i != this->invocation_->operation_details ().ex_count ();
00534            ++i)
00535         {
00536           CORBA::TypeCode_ptr tcp =
00537             this->invocation_->operation_details ().ex_data ()[i].tc_ptr;
00538           if (!CORBA::is_nil (tcp))
00539             {
00540               exception_list[i] = tcp;
00541             }
00542         }
00543     }
00544   return true;
00545 }
00546 
00547 Dynamic::ContextList *
00548 TAO_ClientRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL)
00549   ACE_THROW_SPEC ((CORBA::SystemException))
00550 {
00551   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00552   ACE_CHECK_RETURN (0);
00553 
00554   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00555                                           CORBA::COMPLETED_NO),
00556                     0);
00557 }
00558 
00559 Dynamic::RequestContext *
00560 TAO_ClientRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL)
00561   ACE_THROW_SPEC ((CORBA::SystemException))
00562 {
00563   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00564   ACE_CHECK_RETURN (0);
00565 
00566   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00567                                           CORBA::COMPLETED_NO),
00568                     0);
00569 }
00570 
00571 CORBA::Any *
00572 TAO_ClientRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL)
00573   ACE_THROW_SPEC ((CORBA::SystemException))
00574 {
00575   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00576   ACE_CHECK_RETURN (0);
00577 
00578   // Generate the result on demand.
00579   static const CORBA::Boolean tk_void_any = 0;
00580   CORBA::Any *result_any =
00581     TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);
00582   ACE_CHECK_RETURN (0);
00583 
00584   CORBA::Any_var safe_result_any = result_any;
00585 
00586   if (this->result (result_any) == false)
00587     ACE_THROW_RETURN (CORBA::MARSHAL (),
00588                       0);
00589 
00590   return safe_result_any._retn ();
00591 }
00592 
00593 bool
00594 TAO_ClientRequestInfo::result (CORBA::Any *any)
00595 {
00596   // Result is always first element in TAO::Argument array.
00597   TAO::Argument * const r = this->invocation_->operation_details ().args ()[0];
00598 
00599   r->interceptor_value (any);
00600 
00601   return true;
00602 }
00603 
00604 CORBA::Boolean
00605 TAO_ClientRequestInfo::response_expected (ACE_ENV_SINGLE_ARG_DECL)
00606   ACE_THROW_SPEC ((CORBA::SystemException))
00607 {
00608   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00609   ACE_CHECK_RETURN (0);
00610 
00611   return this->invocation_->response_expected ();
00612 }
00613 
00614 Messaging::SyncScope
00615 TAO_ClientRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL)
00616   ACE_THROW_SPEC ((CORBA::SystemException))
00617 {
00618   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00619   ACE_CHECK_RETURN (0);
00620 
00621   return this->invocation_->operation_details ().response_flags ();
00622 }
00623 
00624 PortableInterceptor::ReplyStatus
00625 TAO_ClientRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL)
00626   ACE_THROW_SPEC ((CORBA::SystemException))
00627 {
00628   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00629   ACE_CHECK_RETURN (PortableInterceptor::SYSTEM_EXCEPTION);
00630 
00631   if (this->invocation_->reply_status() == -1)
00632     {
00633       // A reply hasn't been received yet.
00634       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00635                                               CORBA::COMPLETED_NO),
00636                         -1);
00637     }
00638 
00639   return this->invocation_->reply_status();
00640 }
00641 
00642 CORBA::Object_ptr
00643 TAO_ClientRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL)
00644   ACE_THROW_SPEC ((CORBA::SystemException))
00645 {
00646   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00647   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00648 
00649   if (this->invocation_->reply_status() != PortableInterceptor::LOCATION_FORWARD)
00650     {
00651       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00652                                               CORBA::COMPLETED_NO),
00653                         CORBA::Object::_nil ());
00654     }
00655 
00656   // TAO::Invocation_Base::forward_reference() already duplicates the
00657   // reference before returning it so there is no need to duplicate it
00658   // here.
00659   return this->invocation_->forwarded_reference ();
00660 }
00661 
00662 CORBA::Any *
00663 TAO_ClientRequestInfo::get_slot (PortableInterceptor::SlotId id
00664                                  ACE_ENV_ARG_DECL)
00665   ACE_THROW_SPEC ((CORBA::SystemException,
00666                    PortableInterceptor::InvalidSlot))
00667 {
00668   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00669   ACE_CHECK_RETURN (0);
00670 
00671   return this->rs_pi_current_.get_slot (id
00672                                         ACE_ENV_ARG_PARAMETER);
00673 }
00674 
00675 IOP::ServiceContext *
00676 TAO_ClientRequestInfo::get_request_service_context (
00677     IOP::ServiceId id
00678     ACE_ENV_ARG_DECL)
00679   ACE_THROW_SPEC ((CORBA::SystemException))
00680 {
00681   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00682   ACE_CHECK_RETURN (0);
00683 
00684   // Get the service context from the list
00685   TAO_Service_Context &service_context_list =
00686     this->invocation_->request_service_context ();
00687 
00688   return this->get_service_context_i (service_context_list,
00689                                       id
00690                                       ACE_ENV_ARG_PARAMETER);
00691 }
00692 
00693 IOP::ServiceContext *
00694 TAO_ClientRequestInfo::get_reply_service_context (
00695     IOP::ServiceId id
00696     ACE_ENV_ARG_DECL)
00697   ACE_THROW_SPEC ((CORBA::SystemException))
00698 {
00699   this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
00700   ACE_CHECK_RETURN (0);
00701 
00702   // Get the service context from the list
00703   TAO_Service_Context &service_context_list =
00704     this->invocation_->reply_service_context ();
00705 
00706   return this->get_service_context_i (service_context_list,
00707                                       id
00708                                       ACE_ENV_ARG_PARAMETER);
00709 }
00710 
00711 void
00712 TAO_ClientRequestInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL)
00713 {
00714   if (this->invocation_ == 0)
00715     ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00716                                      CORBA::COMPLETED_NO));
00717 }
00718 
00719 void
00720 TAO_ClientRequestInfo::tao_ft_expiration_time (TimeBase::TimeT time)
00721 {
00722   this->invocation_->operation_details ().ft_expiration_time (time);
00723 }
00724 
00725 TimeBase::TimeT
00726 TAO_ClientRequestInfo::tao_ft_expiration_time (void) const
00727 {
00728   return this->invocation_->operation_details ().ft_expiration_time ();
00729 }
00730 
00731 void
00732 TAO_ClientRequestInfo::tao_ft_retention_id (CORBA::Long request_id)
00733 {
00734   this->invocation_->operation_details ().ft_retention_id (request_id) ;
00735 }
00736 
00737 CORBA::Long
00738 TAO_ClientRequestInfo::tao_ft_retention_id (void) const
00739 {
00740   return this->invocation_->operation_details ().ft_retention_id ();
00741 }
00742 
00743 TAO_END_VERSIONED_NAMESPACE_DECL
00744 
00745 #endif /* TAO_HAS_INTERCEPTORS == 1 */

Generated on Thu Nov 9 12:51:39 2006 for TAO_PI by doxygen 1.3.6