TAO_RT_Stub Class Reference

#include <RT_Stub.h>

Inheritance diagram for TAO_RT_Stub:

Inheritance graph
[legend]
Collaboration diagram for TAO_RT_Stub:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_RT_Stub (const char *repository_id, const TAO_MProfile &profiles, TAO_ORB_Core *orb_core)
virtual ~TAO_RT_Stub (void)
CORBA::Policy_ptr get_policy (CORBA::PolicyType type)
CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type)
TAO_Stubset_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)

Private Member Functions

void parse_policies ()
 Helper method used to parse the policies.

void exposed_priority_model (CORBA::Policy_ptr policy)
void exposed_priority_banded_connection (CORBA::Policy_ptr policy)
void exposed_client_protocol (CORBA::Policy_ptr policy)
CORBA::Policy_ptr exposed_priority_model ()
CORBA::Policy_ptr exposed_priority_banded_connection ()
CORBA::Policy_ptr exposed_client_protocol ()
CORBA::Policyeffective_priority_banded_connection ()
CORBA::Policyeffective_client_protocol ()
 TAO_RT_Stub (const TAO_RT_Stub &)
TAO_RT_Stuboperator= (const TAO_RT_Stub &)

Private Attributes

CORBA::Policy_var priority_model_policy_
CORBA::Policy_var priority_banded_connection_policy_
CORBA::Policy_var client_protocol_policy_
CORBA::Boolean are_policies_parsed_

Detailed Description

This class represent a stub with extended functionality, which are needed for RTCORBA.

Definition at line 48 of file RT_Stub.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_RT_Stub::TAO_RT_Stub const char *  repository_id,
const TAO_MProfile profiles,
TAO_ORB_Core orb_core
 

Definition at line 20 of file RT_Stub.cpp.

00023   : TAO_Stub (repository_id,
00024               profiles,
00025               orb_core),
00026     priority_model_policy_ (0),
00027     priority_banded_connection_policy_ (0),
00028     client_protocol_policy_ (0),
00029     are_policies_parsed_ (0)
00030 {
00031 }

TAO_RT_Stub::~TAO_RT_Stub void   )  [virtual]
 

Definition at line 33 of file RT_Stub.cpp.

References client_protocol_policy_, priority_banded_connection_policy_, and priority_model_policy_.

00034 {
00035   if (this->priority_model_policy_.in ())
00036     this->priority_model_policy_->destroy ();
00037 
00038   if (this->priority_banded_connection_policy_.in ())
00039     this->priority_banded_connection_policy_->destroy ();
00040 
00041   if (this->client_protocol_policy_.in ())
00042     this->client_protocol_policy_->destroy ();
00043 }

TAO_RT_Stub::TAO_RT_Stub const TAO_RT_Stub  )  [private]
 


Member Function Documentation

CORBA::Policy * TAO_RT_Stub::effective_client_protocol  )  [private]
 

Definition at line 249 of file RT_Stub.cpp.

References RTCORBA::ClientProtocolPolicy::_narrow(), ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW_RETURN, RTCORBA::ClientProtocolPolicy_var, exposed_client_protocol(), TAO_Stub::get_cached_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), TAO::unbounded_value_sequence< Protocol >::length(), TAO_ClientProtocolPolicy::protocols_rep(), and TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL.

Referenced by get_cached_policy(), and get_policy().

00250 {
00251   // Get effective override.
00252   CORBA::Policy_var override =
00253     this->TAO_Stub::get_cached_policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL
00254                                        ACE_ENV_ARG_PARAMETER);
00255   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00256 
00257   // Get the value from the ior.
00258   CORBA::Policy_var exposed =
00259     this->exposed_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
00260   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00261 
00262   // Reconcile client-exposed and locally set values.
00263   if (CORBA::is_nil (exposed.in ()))
00264     return override._retn ();
00265 
00266   if (CORBA::is_nil (override.in ()))
00267     return exposed._retn ();
00268 
00269   RTCORBA::ClientProtocolPolicy_var override_policy_var =
00270     RTCORBA::ClientProtocolPolicy::_narrow (override.in ()
00271                                             ACE_ENV_ARG_PARAMETER);
00272   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00273 
00274   TAO_ClientProtocolPolicy *override_policy =
00275     static_cast<TAO_ClientProtocolPolicy *> (override_policy_var.in ());
00276 
00277   RTCORBA::ClientProtocolPolicy_var exposed_policy_var =
00278     RTCORBA::ClientProtocolPolicy::_narrow (exposed.in ()
00279                                             ACE_ENV_ARG_PARAMETER);
00280   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00281 
00282   TAO_ClientProtocolPolicy *exposed_policy =
00283     static_cast<TAO_ClientProtocolPolicy *> (exposed_policy_var.in ());
00284 
00285   // Both override and exposed have been set.
00286   // See if either of them has empty priority bands.
00287   RTCORBA::ProtocolList &protocols_rep_var =
00288     exposed_policy->protocols_rep ();
00289 
00290   if (protocols_rep_var.length () == 0)
00291     return override._retn ();
00292 
00293   if (override_policy->protocols_rep ().length () == 0)
00294     return exposed._retn ();
00295 
00296   // Both override and exposed have been set and neither has empty
00297   // protocols.  This is illegal (ptc/99-05-03, sec. 4.15.4).
00298   ACE_THROW_RETURN (CORBA::INV_POLICY (),
00299                     0);
00300 }

CORBA::Policy * TAO_RT_Stub::effective_priority_banded_connection  )  [private]
 

Definition at line 198 of file RT_Stub.cpp.

References RTCORBA::PriorityBandedConnectionPolicy::_narrow(), ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW_RETURN, exposed_priority_banded_connection(), TAO_Stub::get_cached_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), TAO::unbounded_value_sequence< PriorityBand >::length(), TAO_PriorityBandedConnectionPolicy::priority_bands_rep(), RTCORBA::PriorityBandedConnectionPolicy_var, and TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION.

Referenced by get_cached_policy(), and get_policy().

00199 {
00200   // Get effective override.
00201   CORBA::Policy_var override =
00202     this->TAO_Stub::get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION
00203                                        ACE_ENV_ARG_PARAMETER);
00204   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00205 
00206   // Get the value from the ior.
00207   CORBA::Policy_var exposed =
00208     this->exposed_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
00209   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00210 
00211   // Reconcile client-exposed and locally set values.
00212   if (CORBA::is_nil (exposed.in ()))
00213     return override._retn ();
00214 
00215   if (CORBA::is_nil (override.in ()))
00216     return exposed._retn ();
00217 
00218   RTCORBA::PriorityBandedConnectionPolicy_var override_policy_var =
00219     RTCORBA::PriorityBandedConnectionPolicy::_narrow (override.in ()
00220                                                       ACE_ENV_ARG_PARAMETER);
00221   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00222 
00223   TAO_PriorityBandedConnectionPolicy *override_policy =
00224     static_cast<TAO_PriorityBandedConnectionPolicy *> (override_policy_var.in ());
00225 
00226   RTCORBA::PriorityBandedConnectionPolicy_var exposed_policy_var =
00227     RTCORBA::PriorityBandedConnectionPolicy::_narrow (exposed.in ()
00228                                                       ACE_ENV_ARG_PARAMETER);
00229   ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00230 
00231   TAO_PriorityBandedConnectionPolicy *exposed_policy =
00232     static_cast<TAO_PriorityBandedConnectionPolicy *> (exposed_policy_var.in ());
00233 
00234   // Both override and exposed have been set.
00235   // See if either of them has empty priority bands.
00236   if (exposed_policy->priority_bands_rep ().length () == 0)
00237     return override._retn ();
00238 
00239   if (override_policy->priority_bands_rep ().length () == 0)
00240     return exposed._retn ();
00241 
00242   // Both override and exposed have been set and neither has empty
00243   // priority bands.  This is illegal (ptc/99-05-03, sec. 4.12.1).
00244   ACE_THROW_RETURN (CORBA::INV_POLICY (),
00245                     0);
00246 }

CORBA::Policy * TAO_RT_Stub::exposed_client_protocol  )  [private]
 

Returns the CORBA::Policy (which will be narrowed and used as RTCORBA::ClientProtocolPolicy) exported in object's IOR.

Definition at line 111 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, and parse_policies().

Referenced by effective_client_protocol(), and parse_policies().

00112 {
00113   if (!this->are_policies_parsed_)
00114     {
00115       this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00116       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00117     }
00118 
00119   return CORBA::Policy::_duplicate (this->client_protocol_policy_.in ());
00120 }

void TAO_RT_Stub::exposed_client_protocol CORBA::Policy_ptr  policy  )  [private]
 

Definition at line 123 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), and client_protocol_policy_.

00124 {
00125   this->client_protocol_policy_ = CORBA::Policy::_duplicate (policy);
00126 }

CORBA::Policy * TAO_RT_Stub::exposed_priority_banded_connection  )  [private]
 

Returns the CORBA::Policy (which will be narrowed and used as RTCORBA::PriorityBandedConnectionPolicy) exported in object's IOR.

Definition at line 92 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, and parse_policies().

Referenced by effective_priority_banded_connection(), and parse_policies().

00093 {
00094   if (!this->are_policies_parsed_)
00095     {
00096       this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00097       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00098     }
00099 
00100   return CORBA::Policy::_duplicate (this->priority_banded_connection_policy_.in ());
00101 }

void TAO_RT_Stub::exposed_priority_banded_connection CORBA::Policy_ptr  policy  )  [private]
 

Definition at line 104 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), and priority_banded_connection_policy_.

00105 {
00106   this->priority_banded_connection_policy_ =
00107     CORBA::Policy::_duplicate (policy);
00108 }

CORBA::Policy * TAO_RT_Stub::exposed_priority_model  )  [private]
 

Returns the CORBA::Policy (which will be narrowed to be used as RTCORBA::PriorityModelPolicy) exported in object's IOR.

Definition at line 74 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, and parse_policies().

Referenced by get_cached_policy(), get_policy(), and parse_policies().

00075 {
00076   if (!this->are_policies_parsed_)
00077     {
00078       this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00079       ACE_CHECK_RETURN (CORBA::Policy::_nil ());
00080     }
00081 
00082   return CORBA::Policy::_duplicate (this->priority_model_policy_.in ());
00083 }

void TAO_RT_Stub::exposed_priority_model CORBA::Policy_ptr  policy  )  [private]
 

Definition at line 86 of file RT_Stub.cpp.

References CORBA::Policy::_duplicate(), and priority_model_policy_.

00087 {
00088   this->priority_model_policy_ = CORBA::Policy::_duplicate (policy);
00089 }

CORBA::Policy_ptr TAO_RT_Stub::get_cached_policy TAO_Cached_Policy_Type  type  )  [virtual]
 

Reimplemented from TAO_Stub.

Definition at line 149 of file RT_Stub.cpp.

References ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, effective_client_protocol(), effective_priority_banded_connection(), exposed_priority_model(), TAO_Stub::get_cached_policy(), TAO_CACHED_POLICY_PRIORITY_MODEL, TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL, and TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION.

Referenced by TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile(), TAO_RT_Endpoint_Utils::policy(), and TAO_RT_Protocols_Hooks::rt_service_context().

00151 {
00152   // If we are dealing with a client exposed policy, check if any
00153   // value came in the IOR/reconcile IOR value and overrides.
00154   if (type == TAO_CACHED_POLICY_PRIORITY_MODEL)
00155     return this->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
00156 
00157   if (type == TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION)
00158     return this->effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
00159 
00160   if (type == TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL)
00161     return this->effective_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
00162 
00163   return this->TAO_Stub::get_cached_policy (type ACE_ENV_ARG_PARAMETER);
00164 }

CORBA::Policy_ptr TAO_RT_Stub::get_policy CORBA::PolicyType  type  )  [virtual]
 

Returns the effective policy if is a known client-exposed policy type. Returns the effective override for all other policy types.

Reimplemented from TAO_Stub.

Definition at line 131 of file RT_Stub.cpp.

References ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, effective_client_protocol(), effective_priority_banded_connection(), exposed_priority_model(), and TAO_Stub::get_policy().

00133 {
00134   // If we are dealing with a client exposed policy, check if any
00135   // value came in the IOR/reconcile IOR value and overrides.
00136   if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00137     return this->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
00138 
00139   if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00140     return this->effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
00141 
00142   if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00143     return this->effective_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
00144 
00145   return this->TAO_Stub::get_policy (type ACE_ENV_ARG_PARAMETER);
00146 }

TAO_RT_Stub& TAO_RT_Stub::operator= const TAO_RT_Stub  )  [private]
 

void TAO_RT_Stub::parse_policies  )  [private]
 

Helper method used to parse the policies.

Definition at line 46 of file RT_Stub.cpp.

References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, exposed_client_protocol(), exposed_priority_banded_connection(), exposed_priority_model(), and TAO_MProfile::policy_list().

Referenced by exposed_client_protocol(), exposed_priority_banded_connection(), and exposed_priority_model().

00047 {
00048   CORBA::PolicyList_var policy_list
00049     = this->base_profiles_.policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00050   ACE_CHECK;
00051 
00052   CORBA::ULong length = policy_list->length ();
00053 
00054   // Cache away the policies that we'll need later.
00055   for (CORBA::ULong i = 0; i < length; ++i)
00056     {
00057       if (policy_list[i]->policy_type () ==
00058            RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00059         this->exposed_priority_model (policy_list[i]);
00060 
00061       else if (policy_list[i]->policy_type () ==
00062                 RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00063         this->exposed_priority_banded_connection (policy_list[i]);
00064 
00065       else if (policy_list[i]->policy_type () ==
00066                 RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00067         this->exposed_client_protocol (policy_list[i]);
00068     }
00069 
00070   this->are_policies_parsed_ = 1;
00071 }

TAO_Stub * TAO_RT_Stub::set_policy_overrides const CORBA::PolicyList policies,
CORBA::SetOverrideType  set_add
[virtual]
 

Reimplemented from TAO_Stub.

Definition at line 168 of file RT_Stub.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW_RETURN, CORBA::is_nil(), TAO::unbounded_object_reference_sequence< Policy, Policy_var >::length(), and TAO_Stub::set_policy_overrides().

00171 {
00172   // Validity check.  Make sure requested policies are allowed to be
00173   // set at this scope.
00174   for (CORBA::ULong i = 0; i < policies.length ();  ++i)
00175     {
00176       CORBA::Policy_ptr policy = policies[i];
00177       if (CORBA::is_nil (policy))
00178         continue;
00179 
00180       CORBA::PolicyType type = policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
00181       ACE_CHECK_RETURN (0);
00182 
00183       if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE ||
00184           type == RTCORBA::THREADPOOL_POLICY_TYPE ||
00185           type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
00186         ACE_THROW_RETURN (CORBA::NO_PERMISSION (), 0);
00187 
00188     }
00189 
00190   // We are not required to check for consistency of <policies> with
00191   // overrides at other levels or with policies exported in the IOR.
00192   return this->TAO_Stub::set_policy_overrides(policies, set_add ACE_ENV_ARG_PARAMETER);
00193 }


Member Data Documentation

CORBA::Boolean TAO_RT_Stub::are_policies_parsed_ [private]
 

Definition at line 125 of file RT_Stub.h.

CORBA::Policy_var TAO_RT_Stub::client_protocol_policy_ [private]
 

Definition at line 123 of file RT_Stub.h.

Referenced by exposed_client_protocol(), and ~TAO_RT_Stub().

CORBA::Policy_var TAO_RT_Stub::priority_banded_connection_policy_ [private]
 

Definition at line 121 of file RT_Stub.h.

Referenced by exposed_priority_banded_connection(), and ~TAO_RT_Stub().

CORBA::Policy_var TAO_RT_Stub::priority_model_policy_ [private]
 

Definition at line 119 of file RT_Stub.h.

Referenced by exposed_priority_model(), and ~TAO_RT_Stub().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:59:44 2006 for TAO_RTCORBA by doxygen 1.3.6