Public Member Functions | Private Attributes

TAO::ServerRequestDetails Class Reference

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

#include <ServerRequestDetails.h>

List of all members.

Public Member Functions

 ServerRequestDetails (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 server request interceptor.

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

Definition at line 51 of file ServerRequestDetails.h.


Constructor & Destructor Documentation

TAO::ServerRequestDetails::ServerRequestDetails ( void   ) 

Definition at line 10 of file ServerRequestDetails.inl.

    : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE)
  {
  }


Member Function Documentation

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

Definition at line 20 of file ServerRequestDetails.cpp.

  {
    // Flag to check for duplicate ProcessingModePolicy objects in the list.
    bool processing_mode_applied = false;

    CORBA::ULong const plen = policies.length ();

    for (CORBA::ULong i = 0; i < plen; ++i)
      {
        CORBA::Policy_var policy = CORBA::Policy::_duplicate (policies[i]);

        if (CORBA::is_nil (policy.in ()))
          {
            // Just ignore nil policies...
            continue;
          }

        // Obtain the PolicyType from the current Policy object.
        CORBA::PolicyType const policy_type = policy->policy_type ();

        if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
          {
            if (processing_mode_applied)
              {
                // This is the second time we have run into this policy type,
                // and that is not allowed.
                throw ::CORBA::INV_POLICY ();
              }

            // Flip the flag to true in order to trap any dupes.
            processing_mode_applied = true;

            // Narrow the Policy to the ProcessingModePolicy interface.
            PortableInterceptor::ProcessingModePolicy_var pm_policy =
                    PortableInterceptor::ProcessingModePolicy::_narrow (
                                                 policy.in ());

            // Save the value of the ProcessingModePolicy in our data member.
            this->processing_mode_ = pm_policy->processing_mode ();
          }
        else
          {
            // We don't support the current policy type.
            throw ::CORBA::INV_POLICY ();
          }
      }
  }

bool TAO::ServerRequestDetails::should_be_processed ( bool  is_remote_request  )  const

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

Definition at line 17 of file ServerRequestDetails.inl.

  {
    return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) ||
            ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) &&
             (is_remote_request)) ||
            ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) &&
             (!is_remote_request)));
  }


Member Data Documentation

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

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

Definition at line 68 of file ServerRequestDetails.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines