00001
00002
00003 #include "tao/PortableServer/Active_Policy_Strategies.h"
00004 #include "tao/PortableServer/POA_Cached_Policies.h"
00005
00006 #include "tao/PortableServer/ThreadStrategy.h"
00007 #include "tao/PortableServer/ThreadStrategyFactory.h"
00008 #include "tao/PortableServer/RequestProcessingStrategy.h"
00009 #include "tao/PortableServer/RequestProcessingStrategyFactory.h"
00010 #include "tao/PortableServer/IdAssignmentStrategy.h"
00011 #include "tao/PortableServer/IdAssignmentStrategyFactory.h"
00012 #include "tao/PortableServer/LifespanStrategy.h"
00013 #include "tao/PortableServer/LifespanStrategyFactory.h"
00014 #include "tao/PortableServer/IdUniquenessStrategy.h"
00015 #include "tao/PortableServer/IdUniquenessStrategyFactory.h"
00016 #include "tao/PortableServer/ImplicitActivationStrategy.h"
00017 #include "tao/PortableServer/ImplicitActivationStrategyFactory.h"
00018 #include "tao/PortableServer/ServantRetentionStrategy.h"
00019 #include "tao/PortableServer/ServantRetentionStrategyFactory.h"
00020
00021 #include "tao/PortableServer/IdAssignmentPolicyC.h"
00022 #include "tao/PortableServer/IdUniquenessPolicyC.h"
00023 #include "tao/PortableServer/ImplicitActivationPolicyC.h"
00024 #include "tao/PortableServer/LifespanPolicyC.h"
00025 #include "tao/PortableServer/RequestProcessingPolicyC.h"
00026 #include "tao/PortableServer/ServantRetentionPolicyC.h"
00027 #include "tao/PortableServer/ThreadPolicyC.h"
00028 #include "tao/PortableServer/ServantRetentionPolicyC.h"
00029
00030 #include "ace/Dynamic_Service.h"
00031
00032 #if !defined (__ACE_INLINE__)
00033 # include "tao/PortableServer/Active_Policy_Strategies.inl"
00034 #endif
00035
00036 ACE_RCSID(PortableServer,
00037 Active_Policy_Strategies,
00038 "$Id: Active_Policy_Strategies.cpp 79339 2007-08-14 17:49:17Z sowayaa $")
00039
00040
00041 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00042
00043 namespace TAO
00044 {
00045 namespace Portable_Server
00046 {
00047 Active_Policy_Strategies::Active_Policy_Strategies (void)
00048 : thread_strategy_ (0),
00049 request_processing_strategy_ (0),
00050 id_assignment_strategy_ (0),
00051 lifespan_strategy_ (0),
00052 id_uniqueness_strategy_ (0),
00053 implicit_activation_strategy_ (0),
00054 servant_retention_strategy_ (0),
00055 thread_strategy_factory_ (0),
00056 servant_retention_strategy_factory_ (0),
00057 request_processing_strategy_factory_ (0),
00058 lifespan_strategy_factory_ (0),
00059 implicit_activation_strategy_factory_ (0),
00060 id_uniqueness_strategy_factory_ (0),
00061 id_assignment_strategy_factory_ (0)
00062 {
00063 }
00064
00065 void
00066 Active_Policy_Strategies::update (Cached_Policies &policies,
00067 ::TAO_Root_POA *poa
00068 )
00069 {
00070 this->thread_strategy_factory_ =
00071 ACE_Dynamic_Service<ThreadStrategyFactory>::instance ("ThreadStrategyFactory");
00072
00073 if (this->thread_strategy_factory_ != 0)
00074 this->thread_strategy_ =
00075 this->thread_strategy_factory_->create (policies.thread());
00076
00077
00078
00079 this->id_assignment_strategy_factory_ =
00080 ACE_Dynamic_Service<IdAssignmentStrategyFactory>::instance ("IdAssignmentStrategyFactory");
00081
00082 if (this->id_assignment_strategy_factory_ != 0)
00083 this->id_assignment_strategy_ =
00084 this->id_assignment_strategy_factory_->create (policies.id_assignment());
00085
00086
00087
00088 this->id_uniqueness_strategy_factory_ =
00089 ACE_Dynamic_Service<IdUniquenessStrategyFactory>::instance ("IdUniquenessStrategyFactory");
00090
00091 if (this->id_uniqueness_strategy_factory_ != 0)
00092 this->id_uniqueness_strategy_ =
00093 this->id_uniqueness_strategy_factory_->create (policies.id_uniqueness());
00094
00095
00096
00097 this->servant_retention_strategy_factory_ =
00098 ACE_Dynamic_Service<ServantRetentionStrategyFactory>::instance ("ServantRetentionStrategyFactory");
00099
00100 if (this->servant_retention_strategy_factory_ != 0)
00101 this->servant_retention_strategy_ =
00102 this->servant_retention_strategy_factory_->create (policies.servant_retention());
00103
00104
00105
00106 this->request_processing_strategy_factory_ =
00107 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyFactory");
00108
00109 if (this->request_processing_strategy_factory_ != 0)
00110 this->request_processing_strategy_ =
00111 this->request_processing_strategy_factory_->create (policies.request_processing(), policies.servant_retention());
00112
00113
00114
00115 this->lifespan_strategy_factory_ =
00116 ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyFactory");
00117
00118 if (this->lifespan_strategy_factory_ != 0)
00119 this->lifespan_strategy_ =
00120 this->lifespan_strategy_factory_->create (policies.lifespan());
00121
00122
00123
00124 this->implicit_activation_strategy_factory_ =
00125 ACE_Dynamic_Service<ImplicitActivationStrategyFactory>::instance ("ImplicitActivationStrategyFactory");
00126
00127 if (this->implicit_activation_strategy_factory_ != 0)
00128 this->implicit_activation_strategy_ =
00129 this->implicit_activation_strategy_factory_->create (policies.implicit_activation());
00130
00131
00132
00133
00134
00135 if (this->lifespan_strategy_ != 0)
00136 {
00137 this->lifespan_strategy_->strategy_init (poa);
00138 }
00139
00140 if (this->request_processing_strategy_ != 0)
00141 {
00142 this->request_processing_strategy_->strategy_init (poa, policies.servant_retention());
00143 }
00144
00145 if (this->id_uniqueness_strategy_ != 0)
00146 {
00147 this->id_uniqueness_strategy_->strategy_init (poa);
00148 }
00149
00150 if (this->implicit_activation_strategy_ != 0)
00151 {
00152 this->implicit_activation_strategy_->strategy_init (poa);
00153 }
00154
00155 if (this->thread_strategy_ != 0)
00156 {
00157 this->thread_strategy_->strategy_init (poa);
00158 }
00159
00160 if (this->servant_retention_strategy_ != 0)
00161 {
00162 this->servant_retention_strategy_->strategy_init (poa);
00163 }
00164
00165 if (this->id_assignment_strategy_ != 0)
00166 {
00167 this->id_assignment_strategy_->strategy_init (poa);
00168 }
00169 }
00170
00171 void
00172 Active_Policy_Strategies::cleanup (void)
00173 {
00174
00175 if (this->lifespan_strategy_ != 0)
00176 {
00177 this->lifespan_strategy_factory_->destroy (lifespan_strategy_);
00178
00179 this->lifespan_strategy_ = 0;
00180 }
00181
00182 if (this->request_processing_strategy_ != 0)
00183 {
00184 this->request_processing_strategy_factory_->destroy (request_processing_strategy_);
00185
00186 this->request_processing_strategy_ = 0;
00187 }
00188
00189 if (this->id_uniqueness_strategy_ != 0)
00190 {
00191 this->id_uniqueness_strategy_factory_->destroy (id_uniqueness_strategy_);
00192
00193 this->id_uniqueness_strategy_ = 0;
00194 }
00195
00196 if (this->implicit_activation_strategy_ != 0)
00197 {
00198 this->implicit_activation_strategy_factory_->destroy (implicit_activation_strategy_);
00199
00200 this->implicit_activation_strategy_ = 0;
00201 }
00202
00203 if (this->thread_strategy_ != 0)
00204 {
00205 this->thread_strategy_factory_->destroy (thread_strategy_);
00206
00207 this->thread_strategy_ = 0;
00208 }
00209
00210 if (this->servant_retention_strategy_ != 0)
00211 {
00212 this->servant_retention_strategy_factory_->destroy (servant_retention_strategy_);
00213
00214 this->servant_retention_strategy_ = 0;
00215 }
00216
00217 if (this->id_assignment_strategy_ != 0)
00218 {
00219 this->id_assignment_strategy_factory_->destroy (id_assignment_strategy_);
00220
00221 this->id_assignment_strategy_ = 0;
00222 }
00223 }
00224 }
00225 }
00226
00227 TAO_END_VERSIONED_NAMESPACE_DECL