Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / ORT / ServerRequestInterceptor.cpp
blob8b08aa66ef153791d9366d735bfc80eeffc4a4b5
1 // -*- C++ -*-
2 #include "ServerRequestInterceptor.h"
4 #include "ace/Log_Msg.h"
5 #include "ace/OS_NS_string.h"
7 ServerRequestInterceptor::ServerRequestInterceptor (
8 const char * orb_id,
9 PortableServer::Current_ptr poa_current)
10 : orb_id_ (orb_id),
11 poa_current_ (PortableServer::Current::_duplicate (poa_current))
15 char *
16 ServerRequestInterceptor::name ()
18 return CORBA::string_dup ("ServerRequestInterceptor");
21 void
22 ServerRequestInterceptor::destroy ()
26 void
27 ServerRequestInterceptor::receive_request_service_contexts (
28 PortableInterceptor::ServerRequestInfo_ptr)
32 void
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
38 // time.
39 CORBA::Boolean response_expected =
40 ri->response_expected ();
42 if (!response_expected)
43 return;
45 PortableServer::POA_var poa;
47 try
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 =
59 poa->the_parent ();
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
63 // RootPOA.
64 ACE_ASSERT (!CORBA::is_nil (parent_poa.in ()));
66 PortableInterceptor::AdapterName_var name =
67 ri->adapter_name ();
70 ACE_DEBUG ((LM_INFO,
71 "POA Hierarchy:\n"
72 "==============\n"));
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.
79 ACE_ASSERT (len > 1);
81 for (CORBA::ULong i = 0; i < len; ++i)
83 for (CORBA::ULong j = 0; j < i; ++j)
84 ACE_DEBUG ((LM_INFO, "\t"));
86 ACE_DEBUG ((LM_INFO,
87 "%C\n",
88 static_cast<char const*>(name[i])));
91 ACE_DEBUG ((LM_INFO,
92 "\n"
93 "==============\n"));
95 // Make sure the name of the RootPOA is the first in the AdapterName
96 // sequence.
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);
108 void
109 ServerRequestInterceptor::send_reply (
110 PortableInterceptor::ServerRequestInfo_ptr)
114 void
115 ServerRequestInterceptor::send_exception (
116 PortableInterceptor::ServerRequestInfo_ptr)
120 void
121 ServerRequestInterceptor::send_other (
122 PortableInterceptor::ServerRequestInfo_ptr)