TAO::ClientRequestInterceptor_Adapter_Impl Class Reference

#include <ClientRequestInterceptor_Adapter_Impl.h>

Inheritance diagram for TAO::ClientRequestInterceptor_Adapter_Impl:

Inheritance graph
[legend]
Collaboration diagram for TAO::ClientRequestInterceptor_Adapter_Impl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ClientRequestInterceptor_Adapter_Impl (void)
virtual void add_interceptor (PortableInterceptor::ClientRequestInterceptor_ptr interceptor)
 Register an interceptor.

virtual void add_interceptor (PortableInterceptor::ClientRequestInterceptor_ptr interceptor, const CORBA::PolicyList &policies)
 Register an interceptor with policies.

virtual void destroy_interceptors ()
virtual PortableInterceptor::ReplyStatus reply_status (TAO::Invocation_Base const &invocation_base)
PortableInterceptor Client Side Interception Points
Each of these methods corresponds to a client side interception point. There are no "intermediate" interception points on the client side, only "starting" and "ending" interception points.

virtual void send_request (Invocation_Base &invocation)
virtual void receive_reply (Invocation_Base &invocation)
virtual void receive_exception (Invocation_Base &invocation)
virtual void receive_other (Invocation_Base &invocation)

Protected Member Functions

void process_forward_request (Invocation_Base &invocation, PortableInterceptor::ForwardRequest &exc)

Private Attributes

ClientRequestInterceptor_List interceptor_list_
 List of registered interceptors.


Constructor & Destructor Documentation

ACE_INLINE TAO::ClientRequestInterceptor_Adapter_Impl::ClientRequestInterceptor_Adapter_Impl void   ) 
 

Definition at line 10 of file ClientRequestInterceptor_Adapter_Impl.inl.

00011   {
00012   }


Member Function Documentation

void TAO::ClientRequestInterceptor_Adapter_Impl::add_interceptor PortableInterceptor::ClientRequestInterceptor_ptr  interceptor,
const CORBA::PolicyList policies
[virtual]
 

Register an interceptor with policies.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 268 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor(), and interceptor_list_.

00272   {
00273     this->interceptor_list_.add_interceptor (interceptor,
00274                                              policies
00275                                              ACE_ENV_ARG_PARAMETER);
00276     ACE_CHECK;
00277   }

void TAO::ClientRequestInterceptor_Adapter_Impl::add_interceptor PortableInterceptor::ClientRequestInterceptor_ptr  interceptor  )  [virtual]
 

Register an interceptor.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 259 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor(), and interceptor_list_.

00262   {
00263     this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
00264     ACE_CHECK;
00265   }

void TAO::ClientRequestInterceptor_Adapter_Impl::destroy_interceptors  )  [virtual]
 

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 280 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, TAO::Interceptor_List< InterceptorType, DetailsType >::destroy_interceptors(), and interceptor_list_.

00282   {
00283     this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
00284     ACE_CHECK;
00285   }

void TAO::ClientRequestInterceptor_Adapter_Impl::process_forward_request Invocation_Base invocation,
PortableInterceptor::ForwardRequest exc
[protected]
 

Process the given PortableInterceptor::ForwardRequest exception, i.e. invoke the receive_other() interception point, in addition to notifying the Invocation object of the LOCATION_FORWARD.

Definition at line 245 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO::Invocation_Base::forwarded_reference(), and receive_other().

Referenced by receive_exception(), receive_other(), and send_request().

00249   {
00250     invocation.forwarded_reference (exc.forward.in ());
00251 
00252     // receive_other() is potentially invoked recursively.
00253     this->receive_other (invocation
00254                          ACE_ENV_ARG_PARAMETER);
00255     ACE_CHECK;
00256   }

void TAO::ClientRequestInterceptor_Adapter_Impl::receive_exception Invocation_Base invocation  )  [virtual]
 

This method implements one of the "ending" client side interception point.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 113 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_RE_THROW, ACE_TRY, ACE_TRY_CHECK, interceptor_list_, process_forward_request(), TAO::Interceptor_List< InterceptorType, DetailsType >::registered_interceptor(), and reply_status().

00116   {
00117     // This is an "ending" interception point so we only process the
00118     // interceptors pushed on to the flow stack.
00119 
00120     bool is_remote_request = invocation.is_remote_request();
00121 
00122     // Notice that the interceptors are processed in the opposite order
00123     // they were pushed onto the stack since this is an "ending"
00124     // interception point.
00125     ACE_TRY
00126       {
00127         TAO_ClientRequestInfo ri (&invocation);
00128 
00129         // Unwind the flow stack.
00130         const size_t len = invocation.stack_size ();
00131         for (size_t i = 0; i < len; ++i)
00132           {
00133             // Pop the interceptor off of the flow stack before it is
00134             // invoked.  This is necessary to prevent an interceptor
00135             // already invoked in this "ending" interception point from
00136             // being invoked in another "ending" interception point.
00137             --invocation.stack_size ();
00138 
00139             ClientRequestInterceptor_List::RegisteredInterceptor& registered =
00140               this->interceptor_list_.registered_interceptor (
00141                 invocation.stack_size ());
00142 
00143             if (registered.details_.should_be_processed (is_remote_request))
00144               {
00145                 registered.interceptor_->
00146                   receive_exception (
00147                     &ri
00148                     ACE_ENV_ARG_PARAMETER);
00149                 ACE_TRY_CHECK;
00150               }
00151           }
00152       }
00153     ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00154       {
00155         this->process_forward_request (invocation,
00156                                        exc
00157                                        ACE_ENV_ARG_PARAMETER);
00158         ACE_TRY_CHECK;
00159       }
00160     ACE_CATCHANY
00161       {
00162         // The receive_exception() interception point in the remaining
00163         // interceptors must be called so call this method (not the
00164         // interceptor's corresponding method) recursively.  The call is
00165         // made recursively since the caught exception must survive
00166         // until the remaining interceptors have been called.
00167 
00168         // Note that the recursion will stop once the flow stack size
00169         // drops to zero, i.e., once each interceptor has been invoked.
00170         // This prevents infinite recursion from occuring.
00171 
00172         invocation.exception (&ACE_ANY_EXCEPTION);
00173 
00174         this->receive_exception (invocation ACE_ENV_ARG_PARAMETER);
00175         ACE_TRY_CHECK;
00176 
00177         PortableInterceptor::ReplyStatus status =
00178           this->reply_status (invocation);
00179 
00180         // Only re-throw the exception if it hasn't been transformed by
00181         // the receive_exception() interception point (e.g. to a
00182         // LOCATION_FORWARD).
00183         if (status == PortableInterceptor::SYSTEM_EXCEPTION
00184             || status == PortableInterceptor::USER_EXCEPTION)
00185           ACE_RE_THROW;
00186       }
00187     ACE_ENDTRY;
00188     ACE_CHECK;
00189   }

void TAO::ClientRequestInterceptor_Adapter_Impl::receive_other Invocation_Base invocation  )  [virtual]
 

This method implements one of the "ending" client side interception point.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 192 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, interceptor_list_, process_forward_request(), and TAO::Interceptor_List< InterceptorType, DetailsType >::registered_interceptor().

Referenced by process_forward_request().

00195   {
00196     // This is an "ending" interception point so we only process the
00197     // interceptors pushed on to the flow stack.
00198 
00199     bool is_remote_request = invocation.is_remote_request();
00200 
00201     // Notice that the interceptors are processed in the opposite order
00202     // they were pushed onto the stack since this is an "ending"
00203     // interception point.
00204 
00205     ACE_TRY
00206       {
00207         TAO_ClientRequestInfo ri (&invocation);
00208 
00209         // Unwind the stack.
00210         const size_t len = invocation.stack_size ();
00211         for (size_t i = 0; i < len; ++i)
00212         {
00213           // Pop the interceptor off of the flow stack before it is
00214           // invoked.  This is necessary to prevent an interceptor
00215           // already invoked in this "ending" interception point from
00216           // being invoked in another "ending" interception point.
00217           --invocation.stack_size ();
00218 
00219           ClientRequestInterceptor_List::RegisteredInterceptor& registered =
00220             this->interceptor_list_.registered_interceptor (
00221               invocation.stack_size ());
00222 
00223           if (registered.details_.should_be_processed (is_remote_request))
00224             {
00225               registered.interceptor_->
00226                 receive_other (
00227                   &ri
00228                   ACE_ENV_ARG_PARAMETER);
00229               ACE_TRY_CHECK;
00230             }
00231         }
00232       }
00233     ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00234       {
00235         this->process_forward_request (invocation,
00236                                        exc
00237                                        ACE_ENV_ARG_PARAMETER);
00238         ACE_TRY_CHECK;
00239       }
00240     ACE_ENDTRY;
00241     ACE_CHECK;
00242   }

void TAO::ClientRequestInterceptor_Adapter_Impl::receive_reply Invocation_Base invocation  )  [virtual]
 

This method implements one of the "ending" client side interception point.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 68 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, interceptor_list_, and TAO::Interceptor_List< InterceptorType, DetailsType >::registered_interceptor().

00071   {
00072     // This is an "ending" interception point so we only process the
00073     // interceptors pushed on to the flow stack.
00074 
00075     bool is_remote_request = invocation.is_remote_request();
00076 
00077     // Notice that the interceptors are processed in the opposite order
00078     // they were pushed onto the stack since this is an "ending"
00079     // interception point.
00080 
00081     TAO_ClientRequestInfo ri (&invocation);
00082 
00083     // Unwind the stack.
00084     const size_t len = invocation.stack_size ();
00085     for (size_t i = 0; i < len; ++i)
00086       {
00087         // Pop the interceptor off of the flow stack before it is
00088         // invoked.  This is necessary to prevent an interceptor already
00089         // invoked in this "ending" interception point from being
00090         // invoked in another "ending" interception point.
00091         --invocation.stack_size ();
00092 
00093         ClientRequestInterceptor_List::RegisteredInterceptor& registered =
00094           this->interceptor_list_.registered_interceptor (
00095             invocation.stack_size ());
00096 
00097         if (registered.details_.should_be_processed (is_remote_request))
00098           {
00099             registered.interceptor_->
00100               receive_reply (
00101                 &ri
00102                 ACE_ENV_ARG_PARAMETER);
00103             ACE_CHECK;
00104           }
00105       }
00106 
00107     // The receive_reply() interception point does not raise a
00108     // PortableInterceptor::ForwardRequest exception so there is no need
00109     // to attempt to catch it here.
00110   }

PortableInterceptor::ReplyStatus TAO::ClientRequestInterceptor_Adapter_Impl::reply_status TAO::Invocation_Base const &  invocation_base  )  [virtual]
 

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 288 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References TAO::Invocation_Base::invoke_status(), and TAO::Invocation_Base::is_forwarded().

Referenced by receive_exception().

00290   {
00291     PortableInterceptor::ReplyStatus reply_status;
00292 
00293     switch (invocation_base.invoke_status ())
00294       {
00295       case TAO::TAO_INVOKE_SUCCESS:
00296         reply_status = PortableInterceptor::SUCCESSFUL;
00297         break;
00298       case TAO::TAO_INVOKE_RESTART:
00299         if (invocation_base.is_forwarded ())
00300           reply_status = PortableInterceptor::LOCATION_FORWARD;
00301         else
00302           reply_status = PortableInterceptor::TRANSPORT_RETRY;
00303         break;
00304       case TAO::TAO_INVOKE_USER_EXCEPTION:
00305         reply_status = PortableInterceptor::USER_EXCEPTION;
00306         break;
00307       case TAO::TAO_INVOKE_SYSTEM_EXCEPTION:
00308         reply_status = PortableInterceptor::SYSTEM_EXCEPTION;
00309         break;
00310       default:
00311         reply_status = PortableInterceptor::UNKNOWN;
00312         break;
00313       }
00314 
00315     return reply_status;
00316   }

void TAO::ClientRequestInterceptor_Adapter_Impl::send_request Invocation_Base invocation  )  [virtual]
 

This method implements one of the "starting" client side interception points.

Implements TAO::ClientRequestInterceptor_Adapter.

Definition at line 25 of file ClientRequestInterceptor_Adapter_Impl.cpp.

References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, interceptor_list_, process_forward_request(), TAO::Interceptor_List< InterceptorType, DetailsType >::registered_interceptor(), and TAO::Interceptor_List< InterceptorType, DetailsType >::size().

00028   {
00029     // This method implements one of the "starting" client side
00030     // interception point.
00031 
00032     bool is_remote_request = invocation.is_remote_request();
00033 
00034     ACE_TRY
00035       {
00036         TAO_ClientRequestInfo ri (&invocation);
00037 
00038         for (size_t i = 0 ; i < this->interceptor_list_.size (); ++i)
00039           {
00040             ClientRequestInterceptor_List::RegisteredInterceptor& registered =
00041               this->interceptor_list_.registered_interceptor (i);
00042 
00043             if (registered.details_.should_be_processed (is_remote_request))
00044               {
00045                 registered.interceptor_->
00046                   send_request (&ri
00047                                 ACE_ENV_ARG_PARAMETER);
00048                 ACE_TRY_CHECK;
00049               }
00050 
00051             // The starting interception point completed successfully.
00052             // Push  the interceptor on to the flow stack.
00053             ++invocation.stack_size ();
00054           }
00055       }
00056     ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00057       {
00058         this->process_forward_request (invocation,
00059                                        exc
00060                                        ACE_ENV_ARG_PARAMETER);
00061         ACE_TRY_CHECK;
00062       }
00063     ACE_ENDTRY;
00064     ACE_CHECK;
00065   }


Member Data Documentation

ClientRequestInterceptor_List TAO::ClientRequestInterceptor_Adapter_Impl::interceptor_list_ [private]
 

List of registered interceptors.

Definition at line 128 of file ClientRequestInterceptor_Adapter_Impl.h.

Referenced by add_interceptor(), destroy_interceptors(), receive_exception(), receive_other(), receive_reply(), and send_request().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:52:49 2006 for TAO_PI by doxygen 1.3.6