1 #include "tao/ZIOP/ZIOP_ORBInitializer.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/ZIOP/ZIOP.h"
6 #include "tao/ZIOP/ZIOP_Stub_Factory.h"
7 #include "tao/ZIOP/ZIOP_PolicyFactory.h"
8 #include "tao/ZIOP/ZIOP_Service_Context_Handler.h"
9 #include "tao/ORB_Core.h"
10 #include "tao/PI/ORBInitInfo.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_ZIOP_ORBInitializer::TAO_ZIOP_ORBInitializer (TAO_ZIOP_Loader
* loader
) : loader_ (loader
)
19 TAO_ZIOP_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info
)
21 // Narrow to a TAO_ORBInitInfo object to get access to the
22 // orb_core() TAO extension.
23 TAO_ORBInitInfo_var tao_info
= TAO_ORBInitInfo::_narrow (info
);
25 if (CORBA::is_nil (tao_info
.in ()))
27 if (TAO_debug_level
> 0)
28 TAOLIB_ERROR ((LM_ERROR
,
29 "ZIOP (%P|%t) TAO_ZIOP_ORBInitializer::pre_init:\n"
30 "ZIOP (%P|%t) Unable to narrow "
31 "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
32 "ZIOP (%P|%t) \"TAO_ORBInitInfo *.\"\n"));
34 throw ::CORBA::INTERNAL ();
37 tao_info
->orb_core ()->ziop_adapter (this->loader_
);
38 // Set the name of the stub factory to be ZIOP_Stub_Factory.
39 tao_info
->orb_core ()->orb_params ()->stub_factory_name ("ZIOP_Stub_Factory");
40 ACE_Service_Config::process_directive (ace_svc_desc_TAO_ZIOP_Stub_Factory
);
42 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
43 // Bind the service context handler for ZIOP
44 TAO_ZIOP_Service_Context_Handler
* h
= 0;
46 TAO_ZIOP_Service_Context_Handler());
47 tao_info
->orb_core ()->service_context_registry ().bind (IOP::INVOCATION_POLICIES
, h
);
52 TAO_ZIOP_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info
)
54 this->register_policy_factories (info
);
58 TAO_ZIOP_ORBInitializer::register_policy_factories (
59 PortableInterceptor::ORBInitInfo_ptr info
)
61 // Register the ZIOP policy factories.
62 PortableInterceptor::PolicyFactory_ptr policy_factory_ptr
;
63 ACE_NEW_THROW_EX (policy_factory_ptr
,
64 TAO_ZIOP_PolicyFactory
,
66 CORBA::SystemException::_tao_minor_code (
69 CORBA::COMPLETED_NO
));
72 PortableInterceptor::PolicyFactory_var policy_factory
=
77 info
->register_policy_factory (ZIOP::COMPRESSION_ENABLING_POLICY_ID
,
78 policy_factory
.in ());
80 info
->register_policy_factory (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID
,
81 policy_factory
.in ());
83 info
->register_policy_factory (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID
,
84 policy_factory
.in ());
86 info
->register_policy_factory (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID
,
87 policy_factory
.in ());
89 catch (const CORBA::BAD_INV_ORDER
& ex
)
91 if (ex
.minor () == (CORBA::OMGVMCID
| 16))
93 // The factory is already there, it happens because the
94 // magic initializer in Messaging.cpp registers with the
95 // ORB multiple times. This is an indication that we
96 // should do no more work in this ORBInitializer.
103 // Rethrow any other exceptions...
108 TAO_END_VERSIONED_NAMESPACE_DECL