00001 #include "tao/RTCORBA/RT_Endpoint_Utils.h" 00002 #include "tao/Profile_Transport_Resolver.h" 00003 00004 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 00005 00006 #include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h" 00007 #include "tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h" 00008 00009 #include "tao/RTCORBA/RT_Stub.h" 00010 00011 #include "tao/SystemException.h" 00012 00013 ACE_RCSID (RTCORBA, 00014 RT_Endpoint_Utils, 00015 "$Id: RT_Endpoint_Utils.cpp 82354 2008-07-22 11:34:18Z johnnyw $") 00016 00017 // **************************************************************** 00018 00019 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00020 00021 CORBA::Policy_ptr 00022 TAO_RT_Endpoint_Utils::policy (TAO_Cached_Policy_Type type, 00023 TAO::Profile_Transport_Resolver &r) 00024 { 00025 CORBA::Policy_ptr policy = CORBA::Policy::_nil (); 00026 00027 TAO_RT_Stub * const rt_stub = 00028 dynamic_cast<TAO_RT_Stub *> (r.stub ()); 00029 00030 if (!rt_stub) 00031 throw CORBA::INTERNAL (); 00032 00033 try 00034 { 00035 policy = rt_stub->get_cached_policy (type); 00036 } 00037 catch (const ::CORBA::INV_POLICY&) 00038 { 00039 if (r.inconsistent_policies ()) 00040 { 00041 CORBA::PolicyList *p = r.inconsistent_policies (); 00042 p->length (1); 00043 (*p)[0u] = rt_stub->TAO_Stub::get_cached_policy (type); 00044 } 00045 00046 throw; 00047 } 00048 00049 return policy; 00050 } 00051 00052 TAO_END_VERSIONED_NAMESPACE_DECL 00053 00054 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */