Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / EndpointPolicy / EndpointPolicy_ORBInitializer.cpp
blobe7f579dd8682e424518235d0ac54fe1ae4d36b1a
1 #include "tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h"
3 #include "tao/EndpointPolicy/EndpointPolicyC.h"
4 #include "tao/EndpointPolicy/EndpointPolicy_Factory.h"
5 #include "tao/ORB_Core.h"
6 #include "tao/PI/ORBInitInfo.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 void
11 TAO_EndpointPolicy_ORBInitializer::pre_init (
12 PortableInterceptor::ORBInitInfo_ptr)
16 void
17 TAO_EndpointPolicy_ORBInitializer::post_init (
18 PortableInterceptor::ORBInitInfo_ptr info)
20 this->register_policy_factories (info);
23 void
24 TAO_EndpointPolicy_ORBInitializer::register_policy_factories (
25 PortableInterceptor::ORBInitInfo_ptr info)
27 TAO_ORBInitInfo * local_info = dynamic_cast <TAO_ORBInitInfo *> (info);
29 if (!local_info)
30 throw CORBA::INTERNAL ();
32 TAO_ORB_Core * the_orb_core = local_info->orb_core ();
34 // Register the EndpointPolicy policy factories.
35 PortableInterceptor::PolicyFactory_ptr policy_factory_ptr;
36 ACE_NEW_THROW_EX (policy_factory_ptr,
37 TAO_EndpointPolicy_Factory(the_orb_core),
38 CORBA::NO_MEMORY (
39 CORBA::SystemException::_tao_minor_code (
40 TAO::VMCID,
41 ENOMEM),
42 CORBA::COMPLETED_NO));
45 PortableInterceptor::PolicyFactory_var policy_factory =
46 policy_factory_ptr;
48 try
50 info->register_policy_factory (EndpointPolicy::ENDPOINT_POLICY_TYPE,
51 policy_factory.in ());
53 catch (const ::CORBA::BAD_INV_ORDER& ex)
55 if (ex.minor () == (CORBA::OMGVMCID | 16))
57 // The factory is already there, it happens because the
58 // magic initializer in Messaging.cpp registers with the
59 // ORB multiple times. This is an indication that we
60 // should do no more work in this ORBInitializer.
61 return;
63 throw;
67 TAO_END_VERSIONED_NAMESPACE_DECL