summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp')
-rw-r--r--TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp b/TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp
new file mode 100644
index 00000000000..42306c63e67
--- /dev/null
+++ b/TAO/orbsvcs/examples/ORT/Server_IORInterceptor_ORBInitializer.cpp
@@ -0,0 +1,49 @@
+// $Id$
+
+#include "Server_IORInterceptor_ORBInitializer.h"
+#include "Server_IORInterceptor.h"
+#include "tao/ORB_Constants.h"
+
+#include "GatewayC.h"
+
+ACE_RCSID (ORT,
+ Server_IORInterceptor_ORBInitializer,
+ "$Id: ")
+
+void
+Server_IORInterceptor_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr /* info */
+ )
+{
+}
+
+void
+Server_IORInterceptor_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info)
+{
+ CORBA::Object_var obj =
+ info->resolve_initial_references ("Gateway_Object_Factory");
+
+ /// Narrow it down correctly.
+ Gateway::Object_Factory_var gateway_object_factory =
+ Gateway::Object_Factory::_narrow (obj.in ());
+
+ /// Check for nil reference
+ if (CORBA::is_nil (gateway_object_factory.in ()))
+ ACE_ERROR ((LM_ERROR,
+ "Unable to obtain reference to Gateway::Object_Factory "
+ "object.\n"));
+
+ PortableInterceptor::IORInterceptor_ptr gateway;
+ ACE_NEW_THROW_EX (gateway,
+ Server_IORInterceptor (gateway_object_factory.in ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ PortableInterceptor::IORInterceptor_var ior_interceptor = gateway;
+
+ info->add_ior_interceptor (ior_interceptor.in ());
+}