Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_ClientRequestInfo_i Class Reference

Implementation of the PortableInterceptor::ClientRequestInfo interface. More...

#include <ClientRequestInfo_i.h>

Inheritance diagram for TAO_ClientRequestInfo_i:

Inheritance graph
[legend]
Collaboration diagram for TAO_ClientRequestInfo_i:

Collaboration graph
[legend]
List of all members.

Stub helper methods

The following methods are used in the implementation of the Stubs, they are not part of the ClientRequestInfo interface, but an extension used internally by TAO.

void response_expected (CORBA::Boolean flag)
 Set the flag that states whether or not a response is expected. For example, no response is expected in a one-way operation. More...

void reply_status (int invoke_status)
 Set the status of the received reply. More...

void forward_reference (PortableInterceptor::ForwardRequest &exc)
 Extract the forward object reference from the PortableInterceptor::ForwardRequest exception, and set the reply status flag accordingly. More...

void exception CORBA::Exceptionexception
 Change the exception status. More...


Public Methods

 TAO_ClientRequestInfo_i (TAO_GIOP_Invocation *invocation, CORBA::Object_ptr target)
 Constructor from concrete interface. More...

 TAO_ClientRequestInfo_i (TAO_GIOP_Invocation *invocation, CORBA::AbstractBase_ptr abstract_target)
 Constructor from abstract interface. More...

virtual ~TAO_ClientRequestInfo_i (void)
 Destructor. More...

CORBA::ULong request_id (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return an ID unique to the current request. This request ID may or may not be the same as the GIOP request ID. More...

char * operation (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the operation name for the current request. More...

virtual Dynamic::ParameterListarguments (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the list of arguments passed to the current operation. More...

virtual Dynamic::ExceptionListexceptions (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the list of exceptions the current operation is capable of throwing. More...

Dynamic::ContextListcontexts (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
Dynamic::RequestContextoperation_context (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
virtual CORBA::Anyresult (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the result of the current request. If there is no return value then an Any with tk_void TypeCode is returned. This is method is not valid for oneway operations. More...

CORBA::Boolean response_expected (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Returns true for a two-way operation, and false otherwise. More...

Messaging::SyncScope sync_scope (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the sync_scope policy value for the current one-way operation. If the operation is not a one-way, a CORBA::BAD_INV_ORDER exception is thrown. More...

PortableInterceptor::ReplyStatus reply_status (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the reply status for the current request. Statuses can be PortableInterceptor::SUCCESSFUL, SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD, LOCATION_FORWARD_PERMANENT, TRANSPORT_RETRY. More...

CORBA::Object_ptr forward_reference (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 If the reply status is PortableInterceptor::LOCATION_FORWARD or PortableInterceptor::LOCATION_FORWARD_PERMANENT, return the object reference to which the request was forwarded. More...

CORBA::Anyget_slot (PortableInterceptor::SlotId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
IOP::ServiceContextget_request_service_context (IOP::ServiceId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Return the IOP::ServiceContext with the given IOP::ServiceId from the request service context list. More...

IOP::ServiceContextget_reply_service_context (IOP::ServiceId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Return the IOP::ServiceContext with the given IOP::ServiceId from the reply service context list. More...

CORBA::Object_ptr target (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the (initial, non-forwarded, or permanently forwarded) object reference of the target. More...

CORBA::Object_ptr effective_target (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the object reference for the current target. The target may change in the even of a location forward. More...

IOP::TaggedProfileeffective_profile (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
CORBA::Anyreceived_exception (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return an Any containing the received exception, if any. Otherwise, throw a CORBA::BAD_INV_ORDER exception. More...

char * received_exception_id (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Return the repository ID for the received exception. More...

IOP::TaggedComponentget_effective_component (IOP::ComponentId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Return the first IOP::TaggedComponent that matches the given IOP::ComponentId in the object reference for the current target. More...

IOP::TaggedComponentSeqget_effective_components (IOP::ComponentId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Return all IOP::TaggedComponent(s) that match the given IOP::ComponentId in the object reference for the current target. More...

CORBA::Policy_ptr get_request_policy (CORBA::PolicyType type ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Return the policy of the given type in effect for the current request. More...

void add_request_service_context (const IOP::ServiceContext &service_context, CORBA::Boolean replace ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Add the IOP::ServiceContext to the request (outgoing) IOP::ServiceContextList. More...


Protected Methods

void setup_picurrent (void)
 Setup thread scope and request scope PortableInterceptor::Current objects. More...

IOP::ServiceContextget_service_context_i (TAO_Service_Context &service_context_list, IOP::ServiceId id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Helper method to get the request and response service contexts. More...


Protected Attributes

TAO_GIOP_Invocationinvocation_
 Pointer to the GIOP invocation object. More...

CORBA::Object_ptr target_
 Reference to the target object. More...

CORBA::AbstractBase_ptr abstract_target_
 Reference to the abstract interface target. More...

CORBA::Exceptioncaught_exception_
 Pointer to the caught exception. More...

CORBA::Boolean response_expected_
 True if a two-way operation, false otherwise. More...

PortableInterceptor::ReplyStatus reply_status_
 Reply status for the current request. More...

TAO_PICurrent_Impl rs_pi_current_
 The "Request Scope Current" (RSC) object, as required by Portable Interceptors. More...


Detailed Description

Implementation of the PortableInterceptor::ClientRequestInfo interface.

Definition at line 43 of file ClientRequestInfo_i.h.


Constructor & Destructor Documentation

TAO_ClientRequestInfo_i::TAO_ClientRequestInfo_i TAO_GIOP_Invocation   invocation,
CORBA::Object_ptr    target
 

Constructor from concrete interface.

Definition at line 22 of file ClientRequestInfo_i.cpp.

References CORBA::AbstractBase, and setup_picurrent.

00024   : invocation_ (inv),
00025     target_ (target), // No need to duplicate.
00026     abstract_target_ (CORBA::AbstractBase::_nil ()),
00027     caught_exception_ (0),
00028     response_expected_ (1),
00029     reply_status_ (-1),
00030     rs_pi_current_ ()
00031 {
00032   this->setup_picurrent ();
00033 }

TAO_ClientRequestInfo_i::TAO_ClientRequestInfo_i TAO_GIOP_Invocation   invocation,
CORBA::AbstractBase_ptr    abstract_target
 

Constructor from abstract interface.

Definition at line 35 of file ClientRequestInfo_i.cpp.

References CORBA::Object, and setup_picurrent.

00039   : invocation_ (inv),
00040     target_ (CORBA::Object::_nil ()),
00041     abstract_target_ (abstract_target), // No need to duplicate.
00042     caught_exception_ (0),
00043     response_expected_ (1),
00044     reply_status_ (-1),
00045     rs_pi_current_ ()
00046 {
00047   this->setup_picurrent ();
00048 }

TAO_ClientRequestInfo_i::~TAO_ClientRequestInfo_i void    [virtual]
 

Destructor.

Definition at line 50 of file ClientRequestInfo_i.cpp.

00051 {
00052 }


Member Function Documentation

void TAO_ClientRequestInfo_i::add_request_service_context const IOP::ServiceContext   service_context,
CORBA::Boolean replace    ACE_ENV_ARG_DECL
throw (CORBA::SystemException)
 

Add the IOP::ServiceContext to the request (outgoing) IOP::ServiceContextList.

Definition at line 320 of file ClientRequestInfo_i.cpp.

References ACE_ENV_ARG_DECL, ACE_THROW, and TAO_Service_Context::set_context.

00325 {
00326   // Get the service context from the list
00327   TAO_Service_Context &service_context_list =
00328     this->invocation_->request_service_context ();
00329 
00330   if (service_context_list.set_context (service_context, replace) == 0)
00331     {
00332       ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 15,
00333                                        CORBA::COMPLETED_NO));
00334     }
00335 }

Dynamic::ParameterList * TAO_ClientRequestInfo_i::arguments ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException) [virtual]
 

Return the list of arguments passed to the current operation.

Reimplemented in TAO_ClientRequestInfo_CORBA_Policy_copy.

Definition at line 430 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

00432 {
00433   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00434                                           CORBA::COMPLETED_NO),
00435                     0);
00436 }

Dynamic::ContextList * TAO_ClientRequestInfo_i::contexts ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Definition at line 448 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

00450 {
00451   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00452                                           CORBA::COMPLETED_NO),
00453                     0);
00454 }

IOP::TaggedProfile * TAO_ClientRequestInfo_i::effective_profile ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Definition at line 120 of file ClientRequestInfo_i.cpp.

References IOP::TaggedProfile_var::_retn, ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_DECL, ACE_NEW_THROW_EX, IOP::TaggedProfile::profile_data, IOP::TaggedProfile::tag, and TAO_DEFAULT_MINOR_CODE.

00122 {
00123   IOP::TaggedProfile *tagged_profile = 0;
00124   ACE_NEW_THROW_EX (tagged_profile,
00125                     IOP::TaggedProfile,
00126                     CORBA::NO_MEMORY (
00127                       CORBA::SystemException::_tao_minor_code (
00128                         TAO_DEFAULT_MINOR_CODE,
00129                         ENOMEM),
00130                       CORBA::COMPLETED_NO));
00131   ACE_CHECK_RETURN (0);
00132 
00133   IOP::TaggedProfile_var safe_tagged_profile = tagged_profile;
00134 
00135   IOP::TaggedProfile &ep =
00136     this->target_->_stubobj ()->profile_in_use ()->create_tagged_profile ();
00137 
00138   tagged_profile->tag = ep.tag;
00139   tagged_profile->profile_data = ep.profile_data;  // Deep copy
00140 
00141   return safe_tagged_profile._retn ();
00142 }

CORBA::Object_ptr TAO_ClientRequestInfo_i::effective_target ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the object reference for the current target. The target may change in the even of a location forward.

Definition at line 100 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL_NOT_USED, and CORBA::is_nil.

00102 {
00103   if (this->reply_status_ == PortableInterceptor::LOCATION_FORWARD)
00104     {
00105       // TAO_GIOP_Invocation::forward_reference() already duplicates
00106       // the reference before returning it so there is no need to
00107       // duplicate it here.
00108       return this->invocation_->forward_reference ();
00109     }
00110 
00111   if (CORBA::is_nil (this->target_))
00112     {
00113       return this->abstract_target_->_to_object ();
00114     }
00115 
00116   return CORBA::Object::_duplicate (this->target_);
00117 }

Dynamic::ExceptionList * TAO_ClientRequestInfo_i::exceptions ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException) [virtual]
 

Return the list of exceptions the current operation is capable of throwing.

Reimplemented in TAO_ClientRequestInfo_CORBA_Policy_copy.

Definition at line 439 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

00441 {
00442   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00443                                           CORBA::COMPLETED_NO),
00444                     0);
00445 }

ACE_INLINE void TAO_ClientRequestInfo_i::forward_reference PortableInterceptor::ForwardRequest   exc
 

Extract the forward object reference from the PortableInterceptor::ForwardRequest exception, and set the reply status flag accordingly.

Definition at line 25 of file ClientRequestInfo_i.inl.

References reply_status_.

00027 {
00028   // Note that we're converting the ForwardRequest exception in to a
00029   // LOCATION_FORWARD reply, so we do not set the exception status.
00030   //
00031   // The forward object reference is not handled here.  Rather, it is
00032   // handled by the TAO_GIOP_Invocation object so that its profiles
00033   // can be added to the list of forward profiles.
00034 
00035   this->reply_status_ = PortableInterceptor::LOCATION_FORWARD;
00036 }

CORBA::Object_ptr TAO_ClientRequestInfo_i::forward_reference ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

If the reply status is PortableInterceptor::LOCATION_FORWARD or PortableInterceptor::LOCATION_FORWARD_PERMANENT, return the object reference to which the request was forwarded.

Definition at line 517 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

Referenced by TAO_ClientRequestInterceptor_Adapter::process_forward_request.

00519 {
00520   if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD)
00521     ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00522                                             CORBA::COMPLETED_NO),
00523                       CORBA::Object::_nil ());
00524 
00525   // TAO_GIOP_Invocation::forward_reference() already duplicates the
00526   // reference before returning it so there is no need to duplicate it
00527   // here.
00528   return this->invocation_->forward_reference ();
00529 }

IOP::TaggedComponent * TAO_ClientRequestInfo_i::get_effective_component IOP::ComponentId id    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Return the first IOP::TaggedComponent that matches the given IOP::ComponentId in the object reference for the current target.

Definition at line 198 of file ClientRequestInfo_i.cpp.

References IOP::TaggedComponent_var::_retn, ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_NEW_THROW_EX, ACE_THROW_RETURN, TAO_Tagged_Components::components, TAO_Unbounded_Base_Sequence::length, and TAO_DEFAULT_MINOR_CODE.

00202 {
00203   TAO_Tagged_Components &ecs =
00204     this->target_->_stubobj ()->profile_in_use ()->tagged_components ();
00205 
00206   IOP::MultipleComponentProfile &components = ecs.components ();
00207 
00208   CORBA::ULong len = components.length ();
00209   for (CORBA::ULong i = 0; i < len; ++i)
00210     {
00211       if (components[i].tag == id)
00212         {
00213           IOP::TaggedComponent *tagged_component = 0;
00214 
00215           // Only allocate a sequence if we have a tagged component
00216           // that matches the given IOP::ComponentId.
00217           ACE_NEW_THROW_EX (tagged_component,
00218                             IOP::TaggedComponent,
00219                             CORBA::NO_MEMORY (
00220                               CORBA::SystemException::_tao_minor_code (
00221                                 TAO_DEFAULT_MINOR_CODE,
00222                                 ENOMEM),
00223                               CORBA::COMPLETED_NO));
00224           ACE_CHECK_RETURN (0);
00225 
00226           IOP::TaggedComponent_var safe_tagged_component =
00227             tagged_component;
00228 
00229           (*tagged_component) = components[i];  // Deep copy
00230 
00231           return safe_tagged_component._retn ();
00232         }
00233     }
00234 
00235   // No tagged component was found that matched the given
00236   // IOP::ComponentId.
00237   ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
00238                                       CORBA::COMPLETED_NO),
00239                     0);
00240 }

IOP::TaggedComponentSeq * TAO_ClientRequestInfo_i::get_effective_components IOP::ComponentId id    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Return all IOP::TaggedComponent(s) that match the given IOP::ComponentId in the object reference for the current target.

Definition at line 243 of file ClientRequestInfo_i.cpp.

References IOP::TaggedComponentSeq_var::_retn, ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_NEW_THROW_EX, ACE_THROW_RETURN, TAO_Tagged_Components::components, TAO_Unbounded_Base_Sequence::length, and TAO_DEFAULT_MINOR_CODE.

00247 {
00248   TAO_Tagged_Components &ecs =
00249     this->target_->_stubobj ()->profile_in_use ()->tagged_components ();
00250 
00251   IOP::MultipleComponentProfile &components = ecs.components ();
00252 
00253   IOP::TaggedComponentSeq *tagged_components = 0;
00254   IOP::TaggedComponentSeq_var safe_tagged_components;
00255 
00256   CORBA::ULong len = components.length ();
00257   for (CORBA::ULong i = 0; i < len; ++i)
00258     {
00259       if (components[i].tag == id)
00260         {
00261           if (tagged_components == 0)
00262             {
00263               // Only allocate a sequence if we have tagged components
00264               // to place into the sequence.
00265               ACE_NEW_THROW_EX (tagged_components,
00266                                 IOP::TaggedComponentSeq,
00267                                 CORBA::NO_MEMORY (
00268                                   CORBA::SystemException::_tao_minor_code (
00269                                     TAO_DEFAULT_MINOR_CODE,
00270                                     ENOMEM),
00271                                   CORBA::COMPLETED_NO));
00272               ACE_CHECK_RETURN (0);
00273 
00274               safe_tagged_components = tagged_components;
00275             }
00276 
00277           CORBA::ULong old_len = safe_tagged_components->length ();
00278           safe_tagged_components->length (old_len + 1);
00279 
00280           safe_tagged_components[old_len] = components[i];  // Deep copy
00281         }
00282     }
00283 
00284   if (tagged_components == 0)
00285     {
00286       // No tagged component sequence was allocated, meaning no tagged
00287       // components were found that matched the given
00288       // IOP::ComponentId.
00289       ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
00290                                           CORBA::COMPLETED_NO),
00291                         0);
00292     }
00293 
00294   return safe_tagged_components._retn ();
00295 }

IOP::ServiceContext * TAO_ClientRequestInfo_i::get_reply_service_context IOP::ServiceId id    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Return the IOP::ServiceContext with the given IOP::ServiceId from the reply service context list.

Definition at line 558 of file ClientRequestInfo_i.cpp.

References ACE_ENV_ARG_DECL, and ACE_ENV_ARG_PARAMETER.

00562 {
00563   // Get the service context from the list
00564   TAO_Service_Context &service_context_list =
00565     this->invocation_->reply_service_context ();
00566 
00567   return this->get_service_context_i (service_context_list,
00568                                       id
00569                                        ACE_ENV_ARG_PARAMETER);
00570 }

CORBA::Policy_ptr TAO_ClientRequestInfo_i::get_request_policy CORBA::PolicyType type    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Return the policy of the given type in effect for the current request.

Definition at line 298 of file ClientRequestInfo_i.cpp.

References ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, ENOTSUP, and TAO_DEFAULT_MINOR_CODE.

00301 {
00302   // @@ Do we need to look anywhere else for the request policies?
00303 
00304 #if TAO_HAS_CORBA_MESSAGING == 1
00305   return this->target_->_get_policy (type
00306                                       ACE_ENV_ARG_PARAMETER);
00307 #else
00308   ACE_UNUSED_ARG (type);
00309 
00310   ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
00311                       CORBA::SystemException::_tao_minor_code (
00312                         TAO_DEFAULT_MINOR_CODE,
00313                         ENOTSUP),
00314                       CORBA::COMPLETED_NO),
00315                     0);
00316 #endif  /* TAO_HAS_CORBA_MESSAGING == 1 */
00317 }

IOP::ServiceContext * TAO_ClientRequestInfo_i::get_request_service_context IOP::ServiceId id    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Return the IOP::ServiceContext with the given IOP::ServiceId from the request service context list.

Definition at line 542 of file ClientRequestInfo_i.cpp.

References ACE_ENV_ARG_DECL, and ACE_ENV_ARG_PARAMETER.

00546 {
00547   // Get the service context from the list
00548   TAO_Service_Context &service_context_list =
00549     this->invocation_->request_service_context ();
00550 
00551   return this->get_service_context_i (service_context_list,
00552                                       id
00553                                        ACE_ENV_ARG_PARAMETER);
00554 }

IOP::ServiceContext * TAO_ClientRequestInfo_i::get_service_context_i TAO_Service_Context   service_context_list,
IOP::ServiceId id    ACE_ENV_ARG_DECL
throw (CORBA::SystemException) [protected]
 

Helper method to get the request and response service contexts.

Definition at line 573 of file ClientRequestInfo_i.cpp.

References IOP::ServiceContext_var::_retn, ACE_ENV_ARG_DECL, ACE_THROW_RETURN, and IOP::ServiceContext_var::out.

00578 {
00579   IOP::ServiceContext_var service_context;
00580 
00581   if (service_context_list.get_context (id, service_context.out ()) != 0)
00582     {
00583       // Found.
00584       return service_context._retn ();
00585     }
00586   else
00587     {
00588       // Not found.
00589       ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 26,
00590                                           CORBA::COMPLETED_NO),
00591                         0);
00592     }
00593 }

CORBA::Any * TAO_ClientRequestInfo_i::get_slot PortableInterceptor::SlotId id    ACE_ENV_ARG_DECL throw (CORBA::SystemException, PortableInterceptor::InvalidSlot)
 

Definition at line 532 of file ClientRequestInfo_i.cpp.

References ACE_ENV_ARG_DECL, and ACE_ENV_ARG_PARAMETER.

00536 {
00537   return this->rs_pi_current_.get_slot (id
00538                                         ACE_ENV_ARG_PARAMETER);
00539 }

char * TAO_ClientRequestInfo_i::operation ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the operation name for the current request.

Definition at line 423 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL_NOT_USED, and CORBA::string_dup.

00425 {
00426   return CORBA::string_dup (this->invocation_->operation ());
00427 }

Dynamic::RequestContext * TAO_ClientRequestInfo_i::operation_context ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Definition at line 457 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

00459 {
00460   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00461                                           CORBA::COMPLETED_NO),
00462                     0);
00463 }

CORBA::Any * TAO_ClientRequestInfo_i::received_exception ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return an Any containing the received exception, if any. Otherwise, throw a CORBA::BAD_INV_ORDER exception.

Note:
There is no trivial way to extract the exception from an Any.

Definition at line 148 of file ClientRequestInfo_i.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_DECL, ACE_NEW_THROW_EX, ACE_THROW_RETURN, and TAO_DEFAULT_MINOR_CODE.

00150 {
00151   if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION
00152       && this->reply_status_ != PortableInterceptor::USER_EXCEPTION)
00153     {
00154       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00155                                               CORBA::COMPLETED_NO), 0);
00156     }
00157 
00158   // The spec says that if it is a user exception which can't be
00159   // inserted then the UNKNOWN exception needs to be thrown with minor
00160   // code 1.
00161 
00162   CORBA::Any * temp = 0;
00163 
00164   ACE_NEW_THROW_EX (temp,
00165                     CORBA::Any,
00166                     CORBA::NO_MEMORY (
00167                       CORBA::SystemException::_tao_minor_code (
00168                         TAO_DEFAULT_MINOR_CODE,
00169                         ENOMEM),
00170                       CORBA::COMPLETED_NO));
00171   ACE_CHECK_RETURN (0);
00172 
00173   CORBA::Any_var caught_exception = temp;
00174 
00175   if (this->caught_exception_ != 0)
00176     *temp <<= *(this->caught_exception_);
00177 
00178   return caught_exception._retn ();
00179 }

char * TAO_ClientRequestInfo_i::received_exception_id ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the repository ID for the received exception.

Definition at line 182 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, ACE_THROW_RETURN, and CORBA::string_dup.

00185 {
00186   if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION
00187       && this->reply_status_ != PortableInterceptor::USER_EXCEPTION)
00188     {
00189       ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00190                                               CORBA::COMPLETED_NO),
00191                         0);
00192     }
00193 
00194   return CORBA::string_dup (this->caught_exception_->_rep_id ());
00195 }

void TAO_ClientRequestInfo_i::reply_status int    invoke_status
 

Set the status of the received reply.

Definition at line 596 of file ClientRequestInfo_i.cpp.

References invocation_, TAO_GIOP_Invocation::received_location_forward, reply_status_, TAO_INVOKE_OK, and TAO_INVOKE_RESTART.

00597 {
00598   switch (invoke_status)
00599     {
00600     case TAO_INVOKE_OK:
00601       this->reply_status_ = PortableInterceptor::SUCCESSFUL;
00602       break;
00603     case TAO_INVOKE_RESTART:
00604       if (this->invocation_->received_location_forward ())
00605         this->reply_status_ = PortableInterceptor::LOCATION_FORWARD;
00606       else
00607         this->reply_status_ = PortableInterceptor::TRANSPORT_RETRY;
00608       break;
00609     default:
00610       // We should only get here if the invocation status is
00611       // TAO_INVOKE_EXCEPTION, i.e. a CORBA::SystemException, so set
00612       // the appropriate reply status.
00613       this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
00614       break;
00615     }
00616 }

PortableInterceptor::ReplyStatus TAO_ClientRequestInfo_i::reply_status ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the reply status for the current request. Statuses can be PortableInterceptor::SUCCESSFUL, SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD, LOCATION_FORWARD_PERMANENT, TRANSPORT_RETRY.

Definition at line 504 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

Referenced by CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, and CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy.

00506 {
00507   if (this->reply_status_ == -1)
00508     // A reply hasn't been received yet.
00509     ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00510                                             CORBA::COMPLETED_NO),
00511                       -1);
00512 
00513   return this->reply_status_;
00514 }

CORBA::ULong TAO_ClientRequestInfo_i::request_id ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return an ID unique to the current request. This request ID may or may not be the same as the GIOP request ID.

Definition at line 338 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, ACE_ERROR, ACE_THROW_RETURN, LM_ERROR, and ptr_arith_t.

00340 {
00341   // @todo We may have to worry about AMI once we support interceptors
00342   //       in AMI requests since the Invocation object no longer
00343   //       exists once an AMI request has been made.  In that case,
00344   //       the reply dispatcher address should be used.
00345 
00346   // The request ID must be unique across all outstanding requests.
00347   // To avoid synchronization overhead, the address of this Invocation
00348   // object is used as the request ID.  This guarantees that the
00349   // request ID is unique without being forced to acquire a lock.
00350   //
00351   // For 64-bit platforms, we right shift 8 bits and then use the
00352   // lower 32 bits of that shifted value.  Rather than losing the
00353   // upper 32 bits of significant digits by taking the lower 32 bits,
00354   // we only lose the upper 24 by doing the shift.  Basically, the
00355   // resulting request ID will comprised of bits 8 through 39.  This is
00356   // made possible by the fact that this Invocation object is large
00357   // enough to increase the likelihood that those bits (0 through 39)
00358   // are unique.  In particular, this->buffer_ is 512 bytes
00359   // (ACE_CDR::DEFAULT_BUFSIZE) long by default; implying that
00360   // dropping the lower 8 bits of the this Invocation object's 64 bit
00361   // address (i.e. 256 bytes) is not a problem.
00362 
00363   CORBA::ULong id = 0;
00364 
00365   // Note that we reinterpret_cast to an "unsigned long" instead of
00366   // CORBA::ULong since we need to first cast to an integer large
00367   // enough to hold an address to avoid compile-time warnings on some
00368   // 64-bit platforms.
00369 
00370   // 32 bit address
00371   if (sizeof (this) == 4)
00372     id = ACE_static_cast (CORBA::ULong,
00373                           ACE_reinterpret_cast (ptr_arith_t,
00374                                                 this->invocation_));
00375 
00376   // 64 bit address -- bits 8 through 39  (see notes above!)
00377   // In this case, we make sure this object is large enough to safely
00378   // do the right shift.  This is necessary since the size of the
00379   // buffer that makes this object is configurable.
00380   else if (sizeof (this) == 8
00381            && sizeof (*(this->invocation_)) > 256 /* 2 << 8 */)
00382     id =
00383       (ACE_static_cast(CORBA::ULong,
00384        ACE_reinterpret_cast (ptr_arith_t,
00385                              this->invocation_)) >> 8) & 0xFFFFFFFFu;
00386 
00387   // 64 bit address -- lower 32 bits
00388   else if (sizeof (this) == 8)
00389     id = ACE_static_cast(CORBA::ULong,
00390                          ACE_reinterpret_cast (ptr_arith_t,
00391                                                this->invocation_)) &
00392                          0xFFFFFFFFu;
00393 
00394   // @@ The following request ID generator prevents the
00395   //    PortableInterceptor::ClientRequestInterceptor::send_request()
00396   //    interception point from occuring before the call to connect,
00397   //    thus preventing us from adding an optimization that itself
00398   //    prevents a connection from being unnecessarily performed.
00399   //    Thus, the ClientRequestInfo object is forced to have its own
00400   //    request ID generator in order to make it possible to implement
00401   //    the above optimization.
00402   //
00403   //    Ideally, this request ID generator should go away, especially
00404   //    since it adds a lock to the critical path.
00405   //   else    // Fallback
00406   //     id = this->invocation_->request_id ();
00407 
00408   else
00409     {
00410       if (TAO_debug_level > 0)
00411         ACE_ERROR ((LM_ERROR,
00412                     "(%P|%t) ClientRequestInfo::request_id() failed\n"
00413                     "(%P|%t) since its request ID generator is not\n"
00414                     "(%P|%t) supported on this platform.\n"));
00415 
00416       ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
00417     }
00418 
00419   return id;
00420 }

ACE_INLINE void TAO_ClientRequestInfo_i::response_expected CORBA::Boolean    flag
 

Set the flag that states whether or not a response is expected. For example, no response is expected in a one-way operation.

Definition at line 19 of file ClientRequestInfo_i.inl.

References response_expected_.

00020 {
00021   this->response_expected_ = flag;
00022 }

CORBA::Boolean TAO_ClientRequestInfo_i::response_expected ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Returns true for a two-way operation, and false otherwise.

Definition at line 475 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL_NOT_USED.

Referenced by CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, and CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy.

00477 {
00478   return this->response_expected_;
00479 }

CORBA::Any * TAO_ClientRequestInfo_i::result ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException) [virtual]
 

Return the result of the current request. If there is no return value then an Any with tk_void TypeCode is returned. This is method is not valid for oneway operations.

Reimplemented in TAO_ClientRequestInfo_CORBA_Policy_copy.

Definition at line 466 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, and ACE_THROW_RETURN.

00468 {
00469   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00470                                           CORBA::COMPLETED_NO),
00471                     0);
00472 }

void TAO_ClientRequestInfo_i::setup_picurrent void    [protected]
 

Setup thread scope and request scope PortableInterceptor::Current objects.

Definition at line 55 of file ClientRequestInfo_i.cpp.

References TAO_PICurrent_Impl::copy, TAO_PICurrent_Impl::dirty, invocation_, TAO_GIOP_Invocation::orb_core, TAO_ORB_Core::pi_current, TAO_PICurrent_Impl::pi_peer, rs_pi_current_, TAO_PICurrent::slot_count, and TAO_PICurrent::tsc.

Referenced by TAO_ClientRequestInfo_i.

00056 {
00057   // Retrieve the thread scope current (no TSS access incurred yet).
00058   TAO_PICurrent *pi_current =
00059     this->invocation_->orb_core ()->pi_current ();
00060 
00061   // If the slot count is zero, then there is nothing to copy.
00062   // Prevent any copying (and hence TSS accesses) from occurring.
00063   if (pi_current != 0 && pi_current->slot_count () != 0)
00064     {
00065       // Retrieve the thread scope current.
00066       TAO_PICurrent_Impl *tsc = pi_current->tsc ();
00067 
00068       // Copy the TSC to the RSC.
00069       this->rs_pi_current_.copy (*tsc, 0);  // Shallow copy
00070 
00071       // PICurrent will potentially have to call back on the request
00072       // scope current so that it can deep copy the contents of the
00073       // thread scope current if the contents of the thread scope
00074       // current are about to be modified.  It is necessary to do this
00075       // deep copy once in order to completely isolate the request
00076       // scope current from the thread scope current.  This is only
00077       // necessary, if the thread scope current is modified after its
00078       // contents have been *logically* copied to the request scope
00079       // current.
00080       //
00081       // Only set the TSC's peer if a copy was actually performed.
00082       if (this->rs_pi_current_.dirty ())
00083         tsc->pi_peer (&this->rs_pi_current_);
00084     }
00085 }

Messaging::SyncScope TAO_ClientRequestInfo_i::sync_scope ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the sync_scope policy value for the current one-way operation. If the operation is not a one-way, a CORBA::BAD_INV_ORDER exception is thrown.

Definition at line 482 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL, ACE_THROW_RETURN, and TAO_GIOP_Oneway_Invocation::sync_scope.

00484 {
00485   TAO_GIOP_Oneway_Invocation *inv =
00486     ACE_dynamic_cast (TAO_GIOP_Oneway_Invocation *,
00487                       this->invocation_);
00488 
00489   // The response_expected_ check is a precautionary measure for
00490   // platforms that do not support RTTI, i.e. where the dynamic_cast
00491   // above would incorrectly work.  If the response_expected flag is
00492   // not equal to zero then it is fairly safe to assume that the
00493   // invocation is not a one-way, meaning that the sync_scope() method
00494   // is not available.
00495   if (inv != 0 && this->response_expected_ == 0)
00496     return inv->sync_scope ();
00497 
00498   ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
00499                                           CORBA::COMPLETED_NO),
00500                     -1);
00501 }

CORBA::Object_ptr TAO_ClientRequestInfo_i::target ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Return the (initial, non-forwarded, or permanently forwarded) object reference of the target.

Definition at line 88 of file ClientRequestInfo_i.cpp.

References ACE_ENV_SINGLE_ARG_DECL_NOT_USED, and CORBA::is_nil.

00090 {
00091   if (CORBA::is_nil (this->target_))
00092     {
00093       return this->abstract_target_->_to_object ();
00094     }
00095 
00096   return CORBA::Object::_duplicate (this->target_);
00097 }


Member Data Documentation

CORBA::AbstractBase_ptr TAO_ClientRequestInfo_i::abstract_target_ [protected]
 

Reference to the abstract interface target.

Definition at line 246 of file ClientRequestInfo_i.h.

CORBA::Exception* TAO_ClientRequestInfo_i::caught_exception_ [protected]
 

Pointer to the caught exception.

Definition at line 249 of file ClientRequestInfo_i.h.

ACE_INLINE void TAO_ClientRequestInfo_i::exception
 

Change the exception status.

Definition at line 6 of file ClientRequestInfo_i.inl.

Referenced by CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, and CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy.

00007 {
00008   if (CORBA::SystemException::_downcast (exception) != 0)
00009     this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
00010   else if (CORBA::UserException::_downcast (exception) != 0)
00011     this->reply_status_ = PortableInterceptor::USER_EXCEPTION;
00012 
00013   // @@ Is it possible for both of the above downcasts to fail?
00014 
00015   this->caught_exception_ = exception;
00016 }

TAO_GIOP_Invocation* TAO_ClientRequestInfo_i::invocation_ [protected]
 

Pointer to the GIOP invocation object.

Definition at line 240 of file ClientRequestInfo_i.h.

Referenced by reply_status, and setup_picurrent.

PortableInterceptor::ReplyStatus TAO_ClientRequestInfo_i::reply_status_ [protected]
 

Reply status for the current request.

Definition at line 255 of file ClientRequestInfo_i.h.

Referenced by forward_reference, and reply_status.

CORBA::Boolean TAO_ClientRequestInfo_i::response_expected_ [protected]
 

True if a two-way operation, false otherwise.

Definition at line 252 of file ClientRequestInfo_i.h.

Referenced by response_expected.

TAO_PICurrent_Impl TAO_ClientRequestInfo_i::rs_pi_current_ [protected]
 

The "Request Scope Current" (RSC) object, as required by Portable Interceptors.

Definition at line 259 of file ClientRequestInfo_i.h.

Referenced by setup_picurrent.

CORBA::Object_ptr TAO_ClientRequestInfo_i::target_ [protected]
 

Reference to the target object.

Definition at line 243 of file ClientRequestInfo_i.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:07:57 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002