2 #include "tao/PI_Server/PortableServer_ORBInitializer.h"
3 #include "tao/PI_Server/PortableServer_PolicyFactory.h"
5 #include "tao/ORB_Constants.h"
6 #include "tao/PortableServer/PortableServer.h"
7 #include "tao/PI/ORBInitInfo.h"
8 #include "tao/ORB_Core.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_PortableServer_ORBInitializer::pre_init (
14 PortableInterceptor::ORBInitInfo_ptr
)
19 TAO_PortableServer_ORBInitializer::post_init (
20 PortableInterceptor::ORBInitInfo_ptr info
)
22 this->register_policy_factories (info
);
26 TAO_PortableServer_ORBInitializer::register_policy_factories (
27 PortableInterceptor::ORBInitInfo_ptr info
)
29 #if !defined (CORBA_E_MICRO)
30 // Register the PortableServer policy factories.
31 PortableInterceptor::PolicyFactory_ptr tmp
;
32 ACE_NEW_THROW_EX (tmp
,
33 TAO_PortableServer_PolicyFactory
,
35 CORBA::SystemException::_tao_minor_code (
38 CORBA::COMPLETED_NO
));
40 PortableInterceptor::PolicyFactory_var policy_factory
= tmp
;
42 // Bind the same policy factory to all PortableServer related policy
43 // types since a single policy factory is used to create each of the
44 // different types of PortableServer policies.
45 static CORBA::PolicyType
const type
[] = {
46 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
47 PortableServer::THREAD_POLICY_ID
,
48 PortableServer::IMPLICIT_ACTIVATION_POLICY_ID
,
49 PortableServer::SERVANT_RETENTION_POLICY_ID
,
50 PortableServer::REQUEST_PROCESSING_POLICY_ID
,
51 #endif /* TAO_HAS_MINIMUM_POA == 0 */
52 PortableServer::LIFESPAN_POLICY_ID
,
53 PortableServer::ID_UNIQUENESS_POLICY_ID
,
54 PortableServer::ID_ASSIGNMENT_POLICY_ID
57 CORBA::PolicyType
const * end
=
58 type
+ sizeof (type
) / sizeof (type
[0]);
60 for (CORBA::PolicyType
const *i
= type
;
66 info
->register_policy_factory (*i
, policy_factory
.in ());
68 catch (const ::CORBA::BAD_INV_ORDER
& ex
)
70 if (ex
.minor () == (CORBA::OMGVMCID
| 16))
72 // The factory is already there, it happens because the
73 // magic initializer in PortableServer.cpp registers
74 // with the ORB multiple times. This is an indication
75 // that we should do no more work in this
83 ACE_UNUSED_ARG (info
);
87 TAO_END_VERSIONED_NAMESPACE_DECL