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 (void)
 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 (void)
CORBA::Policy_ptr exposed_priority_banded_connection (void)
CORBA::Policy_ptr exposed_client_protocol (void)
CORBA::Policyeffective_priority_banded_connection (void)
CORBA::Policyeffective_client_protocol (void)
 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_ (false)
00030 {
00031 }

TAO_RT_Stub::~TAO_RT_Stub ( void   )  [virtual]

Definition at line 33 of file RT_Stub.cpp.

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 ( void   )  [private]

Definition at line 231 of file RT_Stub.cpp.

References TAO_Objref_Var_T< T >::_retn(), exposed_client_protocol(), TAO_Stub::get_cached_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), and TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL.

Referenced by get_cached_policy(), and get_policy().

00232 {
00233   // Get effective override.
00234   CORBA::Policy_var override =
00235     this->TAO_Stub::get_cached_policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL);
00236 
00237   // Get the value from the ior.
00238   CORBA::Policy_var exposed =
00239     this->exposed_client_protocol ();
00240 
00241   // Reconcile client-exposed and locally set values.
00242   if (CORBA::is_nil (exposed.in ()))
00243     return override._retn ();
00244 
00245   if (CORBA::is_nil (override.in ()))
00246     return exposed._retn ();
00247 
00248   RTCORBA::ClientProtocolPolicy_var override_policy_var =
00249     RTCORBA::ClientProtocolPolicy::_narrow (override.in ());
00250 
00251   TAO_ClientProtocolPolicy *override_policy =
00252     static_cast<TAO_ClientProtocolPolicy *> (override_policy_var.in ());
00253 
00254   RTCORBA::ClientProtocolPolicy_var exposed_policy_var =
00255     RTCORBA::ClientProtocolPolicy::_narrow (exposed.in ());
00256 
00257   TAO_ClientProtocolPolicy *exposed_policy =
00258     static_cast<TAO_ClientProtocolPolicy *> (exposed_policy_var.in ());
00259 
00260   // Both override and exposed have been set.
00261   // See if either of them has empty priority bands.
00262   RTCORBA::ProtocolList &protocols_rep_var =
00263     exposed_policy->protocols_rep ();
00264 
00265   if (protocols_rep_var.length () == 0)
00266     return override._retn ();
00267 
00268   if (override_policy->protocols_rep ().length () == 0)
00269     return exposed._retn ();
00270 
00271   // Both override and exposed have been set and neither has empty
00272   // protocols.  This is illegal (ptc/99-05-03, sec. 4.15.4).
00273   throw ::CORBA::INV_POLICY ();
00274 }

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

Definition at line 188 of file RT_Stub.cpp.

References TAO_Objref_Var_T< T >::_retn(), exposed_priority_banded_connection(), TAO_Stub::get_cached_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), and TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION.

Referenced by get_cached_policy(), and get_policy().

00189 {
00190   // Get effective override.
00191   CORBA::Policy_var override =
00192     this->TAO_Stub::get_cached_policy (
00193       TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION);
00194 
00195   // Get the value from the ior.
00196   CORBA::Policy_var exposed = this->exposed_priority_banded_connection ();
00197 
00198   // Reconcile client-exposed and locally set values.
00199   if (CORBA::is_nil (exposed.in ()))
00200     return override._retn ();
00201 
00202   if (CORBA::is_nil (override.in ()))
00203     return exposed._retn ();
00204 
00205   RTCORBA::PriorityBandedConnectionPolicy_var override_policy_var =
00206     RTCORBA::PriorityBandedConnectionPolicy::_narrow (override.in ());
00207 
00208   TAO_PriorityBandedConnectionPolicy *override_policy =
00209     static_cast<TAO_PriorityBandedConnectionPolicy *> (override_policy_var.in ());
00210 
00211   RTCORBA::PriorityBandedConnectionPolicy_var exposed_policy_var =
00212     RTCORBA::PriorityBandedConnectionPolicy::_narrow (exposed.in ());
00213 
00214   TAO_PriorityBandedConnectionPolicy *exposed_policy =
00215     static_cast<TAO_PriorityBandedConnectionPolicy *> (exposed_policy_var.in ());
00216 
00217   // Both override and exposed have been set.
00218   // See if either of them has empty priority bands.
00219   if (exposed_policy->priority_bands_rep ().length () == 0)
00220     return override._retn ();
00221 
00222   if (override_policy->priority_bands_rep ().length () == 0)
00223     return exposed._retn ();
00224 
00225   // Both override and exposed have been set and neither has empty
00226   // priority bands.  This is illegal (ptc/99-05-03, sec. 4.12.1).
00227   throw ::CORBA::INV_POLICY ();
00228 }

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

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

Definition at line 107 of file RT_Stub.cpp.

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

Referenced by effective_client_protocol(), and parse_policies().

00108 {
00109   if (!this->are_policies_parsed_)
00110     {
00111       this->parse_policies ();
00112     }
00113 
00114   return CORBA::Policy::_duplicate (this->client_protocol_policy_.in ());
00115 }

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

Definition at line 118 of file RT_Stub.cpp.

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

00119 {
00120   this->client_protocol_policy_ = CORBA::Policy::_duplicate (policy);
00121 }

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

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

Definition at line 90 of file RT_Stub.cpp.

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

Referenced by effective_priority_banded_connection(), and parse_policies().

00091 {
00092   if (!this->are_policies_parsed_)
00093     {
00094       this->parse_policies ();
00095     }
00096 
00097   return CORBA::Policy::_duplicate (this->priority_banded_connection_policy_.in ());
00098 }

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

Definition at line 101 of file RT_Stub.cpp.

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

00102 {
00103   this->priority_banded_connection_policy_ = CORBA::Policy::_duplicate (policy);
00104 }

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

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

Definition at line 73 of file RT_Stub.cpp.

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

Referenced by get_cached_policy(), and get_policy().

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

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

Definition at line 84 of file RT_Stub.cpp.

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

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

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

Reimplemented from TAO_Stub.

Definition at line 143 of file RT_Stub.cpp.

References 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().

00144 {
00145   // If we are dealing with a client exposed policy, check if any
00146   // value came in the IOR/reconcile IOR value and overrides.
00147   if (type == TAO_CACHED_POLICY_PRIORITY_MODEL)
00148     return this->exposed_priority_model ();
00149 
00150   if (type == TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION)
00151     return this->effective_priority_banded_connection ();
00152 
00153   if (type == TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL)
00154     return this->effective_client_protocol ();
00155 
00156   return this->TAO_Stub::get_cached_policy (type);
00157 }

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

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

Reimplemented from TAO_Stub.

Definition at line 126 of file RT_Stub.cpp.

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

00127 {
00128   // If we are dealing with a client exposed policy, check if any
00129   // value came in the IOR/reconcile IOR value and overrides.
00130   if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00131     return this->exposed_priority_model ();
00132 
00133   if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00134     return this->effective_priority_banded_connection ();
00135 
00136   if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00137     return this->effective_client_protocol ();
00138 
00139   return this->TAO_Stub::get_policy (type);
00140 }

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

void TAO_RT_Stub::parse_policies ( void   )  [private]

Helper method used to parse the policies.

Definition at line 46 of file RT_Stub.cpp.

References are_policies_parsed_, TAO_Stub::base_profiles_, exposed_client_protocol(), exposed_priority_banded_connection(), 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 ();
00050 
00051   CORBA::ULong const length = policy_list->length ();
00052 
00053   // Cache away the policies that we'll need later.
00054   for (CORBA::ULong i = 0; i < length; ++i)
00055     {
00056       if (policy_list[i]->policy_type () ==
00057            RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
00058         this->exposed_priority_model (policy_list[i]);
00059 
00060       else if (policy_list[i]->policy_type () ==
00061                 RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
00062         this->exposed_priority_banded_connection (policy_list[i]);
00063 
00064       else if (policy_list[i]->policy_type () ==
00065                 RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
00066         this->exposed_client_protocol (policy_list[i]);
00067     }
00068 
00069   this->are_policies_parsed_ = true;
00070 }

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

Reimplemented from TAO_Stub.

Definition at line 161 of file RT_Stub.cpp.

References CORBA::is_nil(), and TAO_Stub::set_policy_overrides().

00163 {
00164   // Validity check.  Make sure requested policies are allowed to be
00165   // set at this scope.
00166   for (CORBA::ULong i = 0; i < policies.length ();  ++i)
00167     {
00168       CORBA::Policy_ptr policy = policies[i];
00169       if (!CORBA::is_nil (policy))
00170         {
00171           CORBA::PolicyType const type = policy->policy_type ();
00172 
00173           if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE ||
00174               type == RTCORBA::THREADPOOL_POLICY_TYPE ||
00175               type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
00176             throw ::CORBA::NO_PERMISSION ();
00177         }
00178     }
00179 
00180   // We are not required to check for consistency of <policies> with
00181   // overrides at other levels or with policies exported in the IOR.
00182   return this->TAO_Stub::set_policy_overrides(policies, set_add);
00183 }


Member Data Documentation

CORBA::Boolean TAO_RT_Stub::are_policies_parsed_ [private]

Definition at line 122 of file RT_Stub.h.

Referenced by parse_policies().

CORBA::Policy_var TAO_RT_Stub::client_protocol_policy_ [private]

Definition at line 120 of file RT_Stub.h.

Referenced by exposed_client_protocol().

CORBA::Policy_var TAO_RT_Stub::priority_banded_connection_policy_ [private]

Definition at line 118 of file RT_Stub.h.

Referenced by exposed_priority_banded_connection().

CORBA::Policy_var TAO_RT_Stub::priority_model_policy_ [private]

Definition at line 116 of file RT_Stub.h.

Referenced by exposed_priority_model().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:43:01 2010 for TAO_RTCORBA by  doxygen 1.4.7