00001
00002
00003 #include "tao/PI_Server/PortableServer_ORBInitializer.h"
00004 #include "tao/PI_Server/PortableServer_PolicyFactory.h"
00005 #include "tao/debug.h"
00006 #include "tao/ORB_Constants.h"
00007 #include "tao/PortableServer/PortableServer.h"
00008 #include "tao/PI/ORBInitInfo.h"
00009 #include "tao/ORB_Core.h"
00010
00011 ACE_RCSID (PI_Server,
00012 PortableServer_ORBInitializer,
00013 "PortableServer_ORBInitializer.cpp,v 1.4 2006/03/10 07:19:12 jtc Exp")
00014
00015
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 void
00019 TAO_PortableServer_ORBInitializer::pre_init (
00020 PortableInterceptor::ORBInitInfo_ptr
00021 ACE_ENV_ARG_DECL_NOT_USED)
00022 ACE_THROW_SPEC ((CORBA::SystemException))
00023 {
00024 }
00025
00026 void
00027 TAO_PortableServer_ORBInitializer::post_init (
00028 PortableInterceptor::ORBInitInfo_ptr info
00029 ACE_ENV_ARG_DECL)
00030 ACE_THROW_SPEC ((CORBA::SystemException))
00031 {
00032 this->register_policy_factories (info
00033 ACE_ENV_ARG_PARAMETER);
00034 ACE_CHECK;
00035 }
00036
00037 void
00038 TAO_PortableServer_ORBInitializer::register_policy_factories (
00039 PortableInterceptor::ORBInitInfo_ptr info
00040 ACE_ENV_ARG_DECL)
00041 {
00042
00043 PortableInterceptor::PolicyFactory_ptr tmp;
00044 ACE_NEW_THROW_EX (tmp,
00045 TAO_PortableServer_PolicyFactory,
00046 CORBA::NO_MEMORY (
00047 CORBA::SystemException::_tao_minor_code (
00048 TAO::VMCID,
00049 ENOMEM),
00050 CORBA::COMPLETED_NO));
00051 ACE_CHECK;
00052
00053 PortableInterceptor::PolicyFactory_var policy_factory = tmp;
00054
00055
00056
00057
00058 static CORBA::PolicyType const type[] = {
00059 #if (TAO_HAS_MINIMUM_POA == 0)
00060 PortableServer::THREAD_POLICY_ID,
00061 PortableServer::IMPLICIT_ACTIVATION_POLICY_ID,
00062 PortableServer::SERVANT_RETENTION_POLICY_ID,
00063 PortableServer::REQUEST_PROCESSING_POLICY_ID,
00064 #endif
00065 PortableServer::LIFESPAN_POLICY_ID,
00066 PortableServer::ID_UNIQUENESS_POLICY_ID,
00067 PortableServer::ID_ASSIGNMENT_POLICY_ID
00068 };
00069
00070 CORBA::PolicyType const * end =
00071 type + sizeof (type) / sizeof (type[0]);
00072
00073 for (CORBA::PolicyType const *i = type;
00074 i != end;
00075 ++i)
00076 {
00077 ACE_TRY
00078 {
00079 info->register_policy_factory (*i,
00080 policy_factory.in ()
00081 ACE_ENV_ARG_PARAMETER);
00082 ACE_TRY_CHECK;
00083 }
00084 ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
00085 {
00086 if (ex.minor () == (CORBA::OMGVMCID | 16))
00087 {
00088
00089
00090
00091
00092
00093 return;
00094 }
00095 ACE_RE_THROW;
00096 }
00097 ACE_CATCHANY
00098 {
00099
00100 ACE_RE_THROW;
00101 }
00102 ACE_ENDTRY;
00103 ACE_CHECK;
00104 }
00105 }
00106
00107 TAO_END_VERSIONED_NAMESPACE_DECL