ACE+TAO-7_0_8
[ACE_TAO.git] / TAO / tests / ORT / ServerORBInitializer.cpp
blob9840a5ded3221d21dc644a490c6c6f6c50dafa78
1 #include "ServerORBInitializer.h"
2 #include "ServerRequestInterceptor.h"
3 #include "ORT_test_IORInterceptor.h"
5 #include "tao/ORB_Constants.h"
6 #include "tao/PortableServer/PortableServer.h"
8 void
9 ServerORBInitializer::pre_init (
10 PortableInterceptor::ORBInitInfo_ptr /* info */)
14 void
15 ServerORBInitializer::post_init (
16 PortableInterceptor::ORBInitInfo_ptr info)
19 CORBA::Object_var obj =
20 info->resolve_initial_references ("POACurrent");
22 PortableServer::Current_var poa_current =
23 PortableServer::Current::_narrow (obj.in ());
25 ACE_ASSERT (!CORBA::is_nil (poa_current.in ()));
28 CORBA::String_var orb_id = info->orb_id ();
30 // Create and register the test's ServerRequestInterceptor
32 PortableInterceptor::ServerRequestInterceptor_ptr tmp;
33 ACE_NEW_THROW_EX (tmp,
34 ServerRequestInterceptor (orb_id.in (),
35 poa_current.in ()),
36 CORBA::NO_MEMORY (
37 CORBA::SystemException::_tao_minor_code (
38 TAO::VMCID,
39 ENOMEM),
40 CORBA::COMPLETED_NO));
42 PortableInterceptor::ServerRequestInterceptor_var server_interceptor = tmp;
44 info->add_server_request_interceptor (server_interceptor.in ());
47 // Create and register the test's IORInterceptor
49 PortableInterceptor::IORInterceptor_ptr ort_test_interceptor;
50 ACE_NEW_THROW_EX (ort_test_interceptor,
51 ORT_test_IORInterceptor,
52 CORBA::NO_MEMORY (
53 CORBA::SystemException::_tao_minor_code (
54 TAO::VMCID,
55 ENOMEM),
56 CORBA::COMPLETED_NO));
58 PortableInterceptor::IORInterceptor_var ior_interceptor =
59 ort_test_interceptor;
61 info->add_ior_interceptor (ior_interceptor.in ());