TAO::LocateRequest_Invocation_Adapter Class Reference

Adapter class for locate request invocations. More...

#include <LocateRequest_Invocation_Adapter.h>

Collaboration diagram for TAO::LocateRequest_Invocation_Adapter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LocateRequest_Invocation_Adapter (CORBA::Object_ptr target)
void invoke (void)
 Start the invocation on the target.

CORBA::PolicyListget_inconsistent_policies (void)
 Accessor to the inconsistent policy list.


Private Member Functions

bool get_timeout (ACE_Time_Value &val)
void object_forwarded (CORBA::Object_var &effective_target, TAO_Stub *stub, CORBA::Boolean permanent_forward)

Private Attributes

CORBA::Object_ptr target_
CORBA::PolicyList_var list_

Detailed Description

Adapter class for locate request invocations.

This class provides a look and feel similar to the TAO::Invocation_Adapter though the functionalities are different. For the record, IDL compiler doesn't know the existence of this class. This class is concerned with the creation and invocation of locate request invocations to the target object

Todo:
Need to think what happens if the target is collocated. Looks like there are no ways to utilize the opportunity that may have been presented.

Definition at line 58 of file LocateRequest_Invocation_Adapter.h.


Constructor & Destructor Documentation

TAO::LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter CORBA::Object_ptr  target  ) 
 

Definition at line 21 of file LocateRequest_Invocation_Adapter.cpp.

References CORBA::Object_ptr.

00023     : target_ (target)
00024     , list_ (0)
00025   {
00026   }


Member Function Documentation

CORBA::PolicyList * TAO::LocateRequest_Invocation_Adapter::get_inconsistent_policies void   ) 
 

Accessor to the inconsistent policy list.

Definition at line 103 of file LocateRequest_Invocation_Adapter.cpp.

Referenced by CORBA::Object::_validate_connection().

00104   {
00105     return this->list_._retn ();
00106   }

bool TAO::LocateRequest_Invocation_Adapter::get_timeout ACE_Time_Value val  )  [private]
 

Definition at line 109 of file LocateRequest_Invocation_Adapter.cpp.

References TAO_ORB_Core::call_timeout_hook(), and CORBA::Object::orb_core().

Referenced by invoke().

00110   {
00111     bool has_timeout = false;
00112     this->target_->orb_core ()->call_timeout_hook (this->target_->_stubobj (),
00113                                                    has_timeout,
00114                                                    timeout);
00115 
00116     return has_timeout;
00117   }

void TAO::LocateRequest_Invocation_Adapter::invoke void   ) 
 

Start the invocation on the target.

Definition at line 29 of file LocateRequest_Invocation_Adapter.cpp.

References CORBA::Object::_duplicate(), CORBA::Object::_stubobj(), TAO_ORB_Core::configuration(), get_timeout(), TAO_Pseudo_Var_T< T >::in(), TAO::Profile_Transport_Resolver::init_inconsistent_policies(), TAO::Invocation_Status, TAO::LocateRequest_Invocation::invoke(), TAO::Invocation_Base::is_forwarded(), object_forwarded(), CORBA::Object_var, TAO_Stub::orb_core(), TAO::Invocation_Base::reply_status(), TAO_Transport_Mux_Strategy::request_id(), TAO_Operation_Details::request_id(), TAO::Profile_Transport_Resolver::resolve(), TAO::Invocation_Base::steal_forwarded_reference(), TAO::Profile_Transport_Resolver::steal_inconsistent_policies(), TAO::Profile_Transport_Resolver::stub(), TAO_GIOP_LOCATION_FORWARD_PERM, TAO::TAO_INVOKE_RESTART, TAO::TAO_INVOKE_START, TAO_Transport::tms(), and TAO::Profile_Transport_Resolver::transport().

Referenced by CORBA::Object::_validate_connection().

00030   {
00031     CORBA::Object_var effective_target =
00032       CORBA::Object::_duplicate (this->target_);
00033 
00034     TAO_Stub * const stub =
00035       this->target_->_stubobj ();
00036     if (stub == 0)
00037       throw ::CORBA::INTERNAL (
00038                      CORBA::SystemException::_tao_minor_code (
00039                        0,
00040                          EINVAL),
00041                         CORBA::COMPLETED_NO);
00042 
00043     // The invocation has got to be within the context of the
00044     // corresponding ORB's configuration. Otherwise things like
00045     // timeout hooks, etc may not work as expected. Especially if
00046     // there are multiple ORB instances in the process, each with its
00047     // own, local configuration.
00048     ACE_Service_Config_Guard scg (stub->orb_core ()->configuration ());
00049 
00050     ACE_Time_Value tmp_wait_time;
00051     ACE_Time_Value *max_wait_time = 0;
00052 
00053     if (this->get_timeout (tmp_wait_time))
00054       max_wait_time = &tmp_wait_time;
00055 
00056     Invocation_Status s = TAO_INVOKE_START;
00057 
00058     while (s == TAO_INVOKE_START ||
00059            s == TAO_INVOKE_RESTART)
00060       {
00061         Profile_Transport_Resolver resolver (effective_target.in (), stub, true);
00062 
00063         try
00064           {
00065             resolver.init_inconsistent_policies ();
00066 
00067             resolver.resolve (max_wait_time);
00068 
00069             // Dummy operation details that is used to instantiate the
00070             // LocateRequest class.
00071             TAO_Operation_Details op (0, 0);
00072 
00073             op.request_id (resolver.transport ()->tms ()->request_id ());
00074             TAO::LocateRequest_Invocation synch (this->target_, resolver, op);
00075 
00076             s = synch.invoke (max_wait_time);
00077             if (s == TAO_INVOKE_RESTART && synch.is_forwarded ())
00078               {
00079                 effective_target = synch.steal_forwarded_reference ();
00080 
00081 #if TAO_HAS_INTERCEPTORS == 1
00082                 CORBA::Boolean const is_permanent_forward =
00083                   (synch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
00084 #else
00085                 CORBA::Boolean const is_permanent_forward = false;
00086 #endif
00087                 this->object_forwarded (effective_target,
00088                                         resolver.stub (),
00089                                         is_permanent_forward);
00090               }
00091           }
00092         catch (const ::CORBA::INV_POLICY&)
00093           {
00094             this->list_ = resolver.steal_inconsistent_policies ();
00095             throw;
00096           }
00097       }
00098 
00099     return;
00100   }

void TAO::LocateRequest_Invocation_Adapter::object_forwarded CORBA::Object_var effective_target,
TAO_Stub stub,
CORBA::Boolean  permanent_forward
[private]
 

Helper method that takes care of setting the profiles within the stub object if the target gets forwarded

Definition at line 120 of file LocateRequest_Invocation_Adapter.cpp.

References TAO_Stub::add_forward_profiles(), TAO_Stub::base_profiles(), TAO_Stub::next_profile(), CORBA::Object_var, and TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE.

Referenced by invoke().

00124   {
00125     // The object pointer has to be changed to a TAO_Stub pointer
00126     // in order to obtain the profiles.
00127     TAO_Stub *stubobj = effective_target->_stubobj ();
00128 
00129     if (stubobj == 0)
00130       throw ::CORBA::INTERNAL (
00131         CORBA::SystemException::_tao_minor_code (
00132           TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
00133           errno),
00134         CORBA::COMPLETED_NO);
00135 
00136     // Reset the profile in the stubs
00137     stub->add_forward_profiles (stubobj->base_profiles (), permanent_forward);
00138 
00139     if (stub->next_profile () == 0)
00140       throw ::CORBA::TRANSIENT (
00141         CORBA::SystemException::_tao_minor_code (
00142           TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
00143           errno),
00144         CORBA::COMPLETED_NO);
00145 
00146     return;
00147   }


Member Data Documentation

CORBA::PolicyList_var TAO::LocateRequest_Invocation_Adapter::list_ [private]
 

Definition at line 81 of file LocateRequest_Invocation_Adapter.h.

CORBA::Object_ptr TAO::LocateRequest_Invocation_Adapter::target_ [private]
 

Definition at line 80 of file LocateRequest_Invocation_Adapter.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:18:14 2008 for TAO by doxygen 1.3.6