Go to the documentation of this file.00001
00002
00003 #include "tao/RTCORBA/RT_Service_Context_Handler.h"
00004
00005 ACE_RCSID (RTCORBA,
00006 RT_Service_Context_Handler,
00007 "$Id: RT_Service_Context_Handler.cpp 84867 2009-03-17 11:17:15Z johnnyw $")
00008
00009 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00010
00011 #include "tao/RTCORBA/RT_Policy_i.h"
00012 #include "tao/RTCORBA/RT_Protocols_Hooks.h"
00013 #include "tao/RTCORBA/RT_Stub.h"
00014 #include "tao/CDR.h"
00015 #include "tao/TAO_Server_Request.h"
00016 #include "tao/Transport.h"
00017 #include "tao/ORB_Core.h"
00018 #include "tao/GIOP_Message_Base.h"
00019 #include "tao/operation_details.h"
00020 #include "tao/Transport_Mux_Strategy.h"
00021
00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00023
00024 int
00025 TAO_RT_Service_Context_Handler::process_service_context (
00026 TAO_Transport&,
00027 const IOP::ServiceContext&)
00028 {
00029 return 0;
00030 }
00031
00032 int
00033 TAO_RT_Service_Context_Handler::generate_service_context (
00034 TAO_Stub *stub,
00035 TAO_Transport&,
00036 TAO_Operation_Details &opdetails,
00037 TAO_Target_Specification &,
00038 TAO_OutputCDR &)
00039 {
00040 TAO_RT_Stub *rt_stub =
00041 dynamic_cast<TAO_RT_Stub *> (stub);
00042
00043 if (rt_stub)
00044 {
00045 CORBA::Policy_var priority_model_policy =
00046 rt_stub->get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);
00047
00048 RTCORBA::PriorityModelPolicy_var model_policy_ptr =
00049 RTCORBA::PriorityModelPolicy::_narrow (priority_model_policy.in ());
00050
00051 if (!CORBA::is_nil (model_policy_ptr.in ()))
00052 {
00053 TAO_PriorityModelPolicy *priority_model =
00054 static_cast<TAO_PriorityModelPolicy *> (model_policy_ptr.in ());
00055
00056 if (priority_model->get_priority_model () == RTCORBA::CLIENT_PROPAGATED)
00057 {
00058 CORBA::Short client_priority = -1;
00059 TAO_Protocols_Hooks *protocol_hooks = stub->orb_core ()->get_protocols_hooks ();
00060
00061
00062 if (protocol_hooks &&
00063 (protocol_hooks->get_thread_CORBA_priority (client_priority) != -1 ||
00064 protocol_hooks->get_thread_implicit_CORBA_priority (client_priority) != -1))
00065 {
00066
00067 }
00068 else
00069 {
00070 if (TAO_debug_level > 0)
00071 ACE_DEBUG ((LM_DEBUG, "ERROR: TAO_RT_Protocols_Hooks::rt_service_context. "
00072 "Unable to access RT CORBA Priority in client thread "
00073 "accessing object with CLIENT_PROPAGATED priority model.\n"));
00074 throw CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
00075 }
00076
00077
00078
00079 TAO_OutputCDR cdr;
00080 if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
00081 || !(cdr << client_priority))
00082 {
00083 throw CORBA::MARSHAL ();
00084 }
00085
00086 opdetails.request_service_context ().set_context (IOP::RTCorbaPriority, cdr);
00087 }
00088 }
00089 else
00090 {
00091
00092
00093 }
00094 }
00095 return 0;
00096 }
00097
00098
00099 TAO_END_VERSIONED_NAMESPACE_DECL
00100
00101 #endif