TAO::ClientRequestDetails Class Reference

The policy-driven details for a registered client request interceptor. More...

#include <ClientRequestDetails.h>

List of all members.

Public Member Functions

 ClientRequestDetails (void)
void apply_policies (const CORBA::PolicyList &policies)
bool should_be_processed (bool is_remote_request) const

Private Attributes

PortableInterceptor::ProcessingMode processing_mode_


Detailed Description

The policy-driven details for a registered client request interceptor.

Each time a client request interceptor is registered with an ORB, a ClientRequestDetails object will be created and associated with the registered client request interceptor. If the interceptor is registered with policies, the policies will be used to adjust the values in the ClientRequestDetails appropriately.

Definition at line 51 of file ClientRequestDetails.h.


Constructor & Destructor Documentation

ACE_INLINE TAO::ClientRequestDetails::ClientRequestDetails ( void   ) 

Definition at line 10 of file ClientRequestDetails.inl.

00011     : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE)
00012   {
00013   }


Member Function Documentation

void TAO::ClientRequestDetails::apply_policies ( const CORBA::PolicyList &  policies  ) 

Definition at line 19 of file ClientRequestDetails.cpp.

References CORBA::Policy::_duplicate(), CORBA::is_nil(), and processing_mode_.

00020   {
00021     // Flag to check for duplicate ProcessingModePolicy objects in the list.
00022     bool processing_mode_applied = false;
00023 
00024     const CORBA::ULong plen = policies.length ();
00025 
00026     for (CORBA::ULong i = 0; i < plen; ++i)
00027       {
00028         CORBA::Policy_var policy = CORBA::Policy::_duplicate (policies[i]);
00029 
00030         if (CORBA::is_nil (policy.in ()))
00031           {
00032             // Just ignore nil policies...
00033             continue;
00034           }
00035 
00036         // Obtain the PolicyType from the current Policy object.
00037         const CORBA::PolicyType policy_type =
00038           policy->policy_type ();
00039 
00040         if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
00041           {
00042             if (processing_mode_applied)
00043               {
00044                 // This is the second time we have run into this policy type,
00045                 // and that is not allowed.
00046                 throw ::CORBA::INV_POLICY ();
00047               }
00048 
00049             // Flip the flag to true in order to trap any dupes.
00050             processing_mode_applied = true;
00051 
00052             // Narrow the Policy to the ProcessingModePolicy interface.
00053             PortableInterceptor::ProcessingModePolicy_var pm_policy =
00054                     PortableInterceptor::ProcessingModePolicy::_narrow (
00055                                                  policy.in ());
00056 
00057             // Save the value of the ProcessingModePolicy in our data member.
00058             this->processing_mode_ = pm_policy->processing_mode ();
00059           }
00060         else
00061           {
00062             // We don't support the current policy type.
00063             throw ::CORBA::INV_POLICY ();
00064           }
00065       }
00066   }

ACE_INLINE bool TAO::ClientRequestDetails::should_be_processed ( bool  is_remote_request  )  const

Returns true if the ProcessingMode setting permits the "firing" of the associated client request interceptor based upon the remote vs. collocated nature of the current servant request that is being dispatched.

Definition at line 17 of file ClientRequestDetails.inl.

00018   {
00019     return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) ||
00020             ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) &&
00021              (is_remote_request)) ||
00022             ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) &&
00023              (!is_remote_request)));
00024   }


Member Data Documentation

PortableInterceptor::ProcessingMode TAO::ClientRequestDetails::processing_mode_ [private]

The ProcessingMode setting that can be adjusted via the PortableInterceptor::ProcessingModePolicy.

Definition at line 69 of file ClientRequestDetails.h.

Referenced by apply_policies().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:42:05 2010 for TAO_PI by  doxygen 1.4.7