Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / examples / ORT / Server_IORInterceptor_ORBInitializer.cpp
blobdd9dbd2940d2e6cedf4840739274cee56c483647
1 #include "Server_IORInterceptor_ORBInitializer.h"
2 #include "Server_IORInterceptor.h"
3 #include "tao/ORB_Constants.h"
5 #include "GatewayC.h"
7 void
8 Server_IORInterceptor_ORBInitializer::pre_init (
9 PortableInterceptor::ORBInitInfo_ptr /* info */
14 void
15 Server_IORInterceptor_ORBInitializer::post_init (
16 PortableInterceptor::ORBInitInfo_ptr info)
18 CORBA::Object_var obj =
19 info->resolve_initial_references ("Gateway_Object_Factory");
21 /// Narrow it down correctly.
22 Gateway::Object_Factory_var gateway_object_factory =
23 Gateway::Object_Factory::_narrow (obj.in ());
25 /// Check for nil reference
26 if (CORBA::is_nil (gateway_object_factory.in ()))
27 ACE_ERROR ((LM_ERROR,
28 "Unable to obtain reference to Gateway::Object_Factory "
29 "object.\n"));
31 PortableInterceptor::IORInterceptor_ptr gateway;
32 ACE_NEW_THROW_EX (gateway,
33 Server_IORInterceptor (gateway_object_factory.in ()),
34 CORBA::NO_MEMORY (
35 CORBA::SystemException::_tao_minor_code (
36 TAO::VMCID,
37 ENOMEM),
38 CORBA::COMPLETED_NO));
40 PortableInterceptor::IORInterceptor_var ior_interceptor = gateway;
42 info->add_ior_interceptor (ior_interceptor.in ());