2 #include "ServerRequestInterceptor.h"
4 #include "ace/Log_Msg.h"
5 #include "ace/OS_NS_string.h"
7 ServerRequestInterceptor::ServerRequestInterceptor (
9 PortableServer::Current_ptr poa_current
)
11 poa_current_ (PortableServer::Current::_duplicate (poa_current
))
16 ServerRequestInterceptor::name ()
18 return CORBA::string_dup ("ServerRequestInterceptor");
22 ServerRequestInterceptor::destroy ()
27 ServerRequestInterceptor::receive_request_service_contexts (
28 PortableInterceptor::ServerRequestInfo_ptr
)
33 ServerRequestInterceptor::receive_request (
34 PortableInterceptor::ServerRequestInfo_ptr ri
)
36 // If no response is expected, then we're invoking the oneway
37 // shutdown operation. Don't bother displaying output a second
39 CORBA::Boolean response_expected
=
40 ri
->response_expected ();
42 if (!response_expected
)
45 PortableServer::POA_var poa
;
49 poa
= this->poa_current_
->get_POA ();
51 catch (const PortableServer::Current::NoContext
& ex
)
53 ex
._tao_print_exception ("ServerRequestInterceptor::receive_request");
55 throw CORBA::INTERNAL ();
58 PortableServer::POA_var parent_poa
=
61 // Make sure there is more than one POA in the POA hierarchy since
62 // the servant should have been registered with a child POA, not the
64 ACE_ASSERT (!CORBA::is_nil (parent_poa
.in ()));
66 PortableInterceptor::AdapterName_var name
=
74 const CORBA::ULong len
= name
->length ();
76 // Make sure there is more than one AdapterName in the AdapterName
77 // sequence since the servant should have been registered with a
78 // child POA, not the RootPOA.
81 for (CORBA::ULong i
= 0; i
< len
; ++i
)
83 for (CORBA::ULong j
= 0; j
< i
; ++j
)
84 ACE_DEBUG ((LM_INFO
, "\t"));
88 static_cast<char const*>(name
[i
])));
95 // Make sure the name of the RootPOA is the first in the AdapterName
97 ACE_ASSERT (ACE_OS::strcmp ("RootPOA", name
[(CORBA::ULong
) 0]) == 0);
99 CORBA::String_var orb_id
= ri
->orb_id ();
101 ACE_ASSERT (ACE_OS::strcmp (this->orb_id_
.in (), orb_id
.in ()) == 0);
103 CORBA::String_var server_id
= ri
->server_id ();
105 ACE_ASSERT (ACE_OS::strcmp (server_id
.in (), "ORT_test_server") == 0);
109 ServerRequestInterceptor::send_reply (
110 PortableInterceptor::ServerRequestInfo_ptr
)
115 ServerRequestInterceptor::send_exception (
116 PortableInterceptor::ServerRequestInfo_ptr
)
121 ServerRequestInterceptor::send_other (
122 PortableInterceptor::ServerRequestInfo_ptr
)