00001
00002
00003 #include "tao/PortableServer/POA_Cached_Policies.h"
00004 #include "tao/PortableServer/POA_Policy_Set.h"
00005 #include "tao/PortableServer/IdAssignmentPolicyC.h"
00006 #include "tao/PortableServer/IdUniquenessPolicyC.h"
00007 #include "tao/PortableServer/ImplicitActivationPolicyC.h"
00008 #include "tao/PortableServer/LifespanPolicyC.h"
00009 #include "tao/PortableServer/RequestProcessingPolicyC.h"
00010 #include "tao/PortableServer/ServantRetentionPolicyC.h"
00011 #include "tao/PortableServer/ThreadPolicyC.h"
00012
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/PortableServer/POA_Cached_Policies.i"
00015 #endif
00016
00017 ACE_RCSID(PortableServer,
00018 POA_Cached_Policies,
00019 "POA_Cached_Policies.cpp,v 1.10 2006/06/20 06:26:14 jwillemsen Exp")
00020
00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00022
00023 namespace TAO
00024 {
00025 namespace Portable_Server
00026 {
00027 Cached_Policies::Cached_Policies () :
00028 thread_ (::PortableServer::ORB_CTRL_MODEL),
00029 lifespan_ (::PortableServer::TRANSIENT),
00030 id_uniqueness_ (::PortableServer::UNIQUE_ID),
00031 id_assignment_ (::PortableServer::SYSTEM_ID),
00032 implicit_activation_ (::PortableServer::NO_IMPLICIT_ACTIVATION),
00033 servant_retention_ (::PortableServer::RETAIN),
00034 request_processing_ (::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
00035 priority_model_ (Cached_Policies::NOT_SPECIFIED),
00036 server_priority_ (TAO_INVALID_PRIORITY)
00037 {
00038 }
00039
00040
00041 Cached_Policies::~Cached_Policies (void)
00042 {
00043 }
00044
00045 void
00046 Cached_Policies::update (TAO_POA_Policy_Set &policy_set
00047 ACE_ENV_ARG_DECL)
00048 {
00049 for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
00050 {
00051 CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
00052
00053 this->update_policy (policy.in ()
00054 ACE_ENV_ARG_PARAMETER);
00055 ACE_CHECK;
00056 }
00057 }
00058
00059 void
00060 Cached_Policies::update_policy (const CORBA::Policy_ptr policy
00061 ACE_ENV_ARG_DECL)
00062 {
00063
00064 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00065 ::PortableServer::ThreadPolicy_var thread
00066 = ::PortableServer::ThreadPolicy::_narrow (policy
00067 ACE_ENV_ARG_PARAMETER);
00068 ACE_CHECK;
00069
00070 if (!CORBA::is_nil (thread.in ()))
00071 {
00072 this->thread_ = thread->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00073 ACE_CHECK;
00074
00075 return;
00076 }
00077 #endif
00078
00079 #if !defined (CORBA_E_MICRO)
00080 ::PortableServer::LifespanPolicy_var lifespan
00081 = ::PortableServer::LifespanPolicy::_narrow (policy
00082 ACE_ENV_ARG_PARAMETER);
00083 ACE_CHECK;
00084
00085 if (!CORBA::is_nil (lifespan.in ()))
00086 {
00087 this->lifespan_ = lifespan->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00088 ACE_CHECK;
00089
00090 return;
00091 }
00092 #endif
00093
00094 #if !defined (CORBA_E_MICRO)
00095 ::PortableServer::IdUniquenessPolicy_var id_uniqueness
00096 = ::PortableServer::IdUniquenessPolicy::_narrow (policy
00097 ACE_ENV_ARG_PARAMETER);
00098 ACE_CHECK;
00099
00100 if (!CORBA::is_nil (id_uniqueness.in ()))
00101 {
00102 this->id_uniqueness_ = id_uniqueness->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00103 ACE_CHECK;
00104
00105 return;
00106 }
00107 #endif
00108
00109 #if !defined (CORBA_E_MICRO)
00110 ::PortableServer::IdAssignmentPolicy_var id_assignment
00111 = ::PortableServer::IdAssignmentPolicy::_narrow (policy
00112 ACE_ENV_ARG_PARAMETER);
00113 ACE_CHECK;
00114
00115 if (!CORBA::is_nil (id_assignment.in ()))
00116 {
00117 this->id_assignment_ = id_assignment->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00118 ACE_CHECK;
00119
00120 return;
00121 }
00122 #endif
00123
00124 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00125
00126 ::PortableServer::ImplicitActivationPolicy_var implicit_activation
00127 = ::PortableServer::ImplicitActivationPolicy::_narrow (policy
00128 ACE_ENV_ARG_PARAMETER);
00129 ACE_CHECK;
00130
00131 if (!CORBA::is_nil (implicit_activation.in ()))
00132 {
00133 this->implicit_activation_ = implicit_activation->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00134 ACE_CHECK;
00135
00136 return;
00137 }
00138
00139 ::PortableServer::ServantRetentionPolicy_var servant_retention
00140 = ::PortableServer::ServantRetentionPolicy::_narrow (policy
00141 ACE_ENV_ARG_PARAMETER);
00142 ACE_CHECK;
00143
00144 if (!CORBA::is_nil (servant_retention.in ()))
00145 {
00146 this->servant_retention_ = servant_retention->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00147 ACE_CHECK;
00148
00149 return;
00150 }
00151
00152 ::PortableServer::RequestProcessingPolicy_var request_processing
00153 = ::PortableServer::RequestProcessingPolicy::_narrow (policy
00154 ACE_ENV_ARG_PARAMETER);
00155 ACE_CHECK;
00156
00157 if (!CORBA::is_nil (request_processing.in ()))
00158 {
00159 this->request_processing_ = request_processing->value (ACE_ENV_SINGLE_ARG_PARAMETER);
00160 ACE_CHECK;
00161
00162 return;
00163 }
00164
00165 #endif
00166
00167 #if defined (CORBA_E_MICRO)
00168 ACE_UNUSED_ARG (policy);
00169 #endif
00170 }
00171 }
00172 }
00173
00174 TAO_END_VERSIONED_NAMESPACE_DECL