Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / RTCORBA / Bug_3382_Regression / interceptors.cpp
blob3e5e24aa0d47d053172b2ea53454ac2d4cce4796
1 #include "interceptors.h"
2 #include "tao/OctetSeqC.h"
3 #include "ace/Log_Msg.h"
5 Client_Request_Interceptor::
6 Client_Request_Interceptor (const char *id)
7 : myname_ ("Client_Request_Interceptor"),
8 orb_id_ (CORBA::string_dup (id))
12 Client_Request_Interceptor::~Client_Request_Interceptor (void)
16 char *
17 Client_Request_Interceptor::name (void)
19 return CORBA::string_dup (this->myname_);
22 void
23 Client_Request_Interceptor::destroy (void)
27 void
28 Client_Request_Interceptor::send_poll (
29 PortableInterceptor::ClientRequestInfo_ptr)
31 // Do Nothing
34 void
35 Client_Request_Interceptor::send_request (
36 PortableInterceptor::ClientRequestInfo_ptr)
38 // Do Nothing
41 void
42 Client_Request_Interceptor::receive_reply (
43 PortableInterceptor::ClientRequestInfo_ptr ri)
46 try
48 // Try to get the RTCorbaPriority context. If its not there,
49 // report the fact via an exception.
50 IOP::ServiceContext_var sc =
51 ri->get_reply_service_context (IOP::RTCorbaPriority);
53 catch (const CORBA::Exception& ex)
55 ex._tao_print_exception ("Caught exception:");
57 ACE_DEBUG ((LM_DEBUG, "EXCEPTION was most likely caused by the lack "
58 "of an IOP::RTCorbaPriority context in the reply.\n"));
59 throw;
64 void
65 Client_Request_Interceptor::receive_other (
66 PortableInterceptor::ClientRequestInfo_ptr)
70 void
71 Client_Request_Interceptor::receive_exception (
72 PortableInterceptor::ClientRequestInfo_ptr ri)
75 if (CORBA::is_nil (this->orb_.in ()))
77 int argc = 0;
78 ACE_TCHAR **argv = 0;
79 this->orb_ = CORBA::ORB_init (argc, argv,
80 this->orb_id_.in ());
83 CORBA::String_var operation = ri->operation ();
85 CORBA::Object_var target = ri->target ();
87 CORBA::String_var ior =
88 this->orb_->object_to_string (target.in ());
90 ACE_DEBUG ((LM_DEBUG,
91 "%s.received_exception "
92 "from \"%s\" on object: %s\n",
93 this->myname_,
94 operation.in (),
95 ior.in ()));
97 // Try to get the RTCorbaPriority context. If its not there,
98 // report the fact via an exception.
99 IOP::ServiceContext_var sc =
100 ri->get_reply_service_context (IOP::RTCorbaPriority);