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 80572 2008-02-05 20:02:46Z johnnyw $")
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 this->thread_strategy_factory_ =
00070 ACE_Dynamic_Service<ThreadStrategyFactory>::instance ("ThreadStrategyFactory");
00071
00072 if (this->thread_strategy_factory_ != 0)
00073 this->thread_strategy_ =
00074 this->thread_strategy_factory_->create (policies.thread());
00075
00076
00077
00078 this->id_assignment_strategy_factory_ =
00079 ACE_Dynamic_Service<IdAssignmentStrategyFactory>::instance ("IdAssignmentStrategyFactory");
00080
00081 if (this->id_assignment_strategy_factory_ != 0)
00082 this->id_assignment_strategy_ =
00083 this->id_assignment_strategy_factory_->create (policies.id_assignment());
00084
00085
00086
00087 this->id_uniqueness_strategy_factory_ =
00088 ACE_Dynamic_Service<IdUniquenessStrategyFactory>::instance ("IdUniquenessStrategyFactory");
00089
00090 if (this->id_uniqueness_strategy_factory_ != 0)
00091 this->id_uniqueness_strategy_ =
00092 this->id_uniqueness_strategy_factory_->create (policies.id_uniqueness());
00093
00094
00095
00096 this->servant_retention_strategy_factory_ =
00097 ACE_Dynamic_Service<ServantRetentionStrategyFactory>::instance ("ServantRetentionStrategyFactory");
00098
00099 if (this->servant_retention_strategy_factory_ != 0)
00100 this->servant_retention_strategy_ =
00101 this->servant_retention_strategy_factory_->create (policies.servant_retention());
00102
00103
00104
00105 this->request_processing_strategy_factory_ =
00106 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyFactory");
00107
00108 if (this->request_processing_strategy_factory_ != 0)
00109 this->request_processing_strategy_ =
00110 this->request_processing_strategy_factory_->create (policies.request_processing(), policies.servant_retention());
00111
00112
00113
00114 this->lifespan_strategy_factory_ =
00115 ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyFactory");
00116
00117 if (this->lifespan_strategy_factory_ != 0)
00118 this->lifespan_strategy_ =
00119 this->lifespan_strategy_factory_->create (policies.lifespan());
00120
00121
00122
00123 this->implicit_activation_strategy_factory_ =
00124 ACE_Dynamic_Service<ImplicitActivationStrategyFactory>::instance ("ImplicitActivationStrategyFactory");
00125
00126 if (this->implicit_activation_strategy_factory_ != 0)
00127 this->implicit_activation_strategy_ =
00128 this->implicit_activation_strategy_factory_->create (policies.implicit_activation());
00129
00130
00131
00132
00133
00134 if (this->lifespan_strategy_ != 0)
00135 {
00136 this->lifespan_strategy_->strategy_init (poa);
00137 }
00138
00139 if (this->request_processing_strategy_ != 0)
00140 {
00141 this->request_processing_strategy_->strategy_init (poa, policies.servant_retention());
00142 }
00143
00144 if (this->id_uniqueness_strategy_ != 0)
00145 {
00146 this->id_uniqueness_strategy_->strategy_init (poa);
00147 }
00148
00149 if (this->implicit_activation_strategy_ != 0)
00150 {
00151 this->implicit_activation_strategy_->strategy_init (poa);
00152 }
00153
00154 if (this->thread_strategy_ != 0)
00155 {
00156 this->thread_strategy_->strategy_init (poa);
00157 }
00158
00159 if (this->servant_retention_strategy_ != 0)
00160 {
00161 this->servant_retention_strategy_->strategy_init (poa);
00162 }
00163
00164 if (this->id_assignment_strategy_ != 0)
00165 {
00166 this->id_assignment_strategy_->strategy_init (poa);
00167 }
00168 }
00169
00170 void
00171 Active_Policy_Strategies::cleanup (void)
00172 {
00173
00174 if (this->lifespan_strategy_ != 0)
00175 {
00176 this->lifespan_strategy_factory_->destroy (lifespan_strategy_);
00177
00178 this->lifespan_strategy_ = 0;
00179 }
00180
00181 if (this->request_processing_strategy_ != 0)
00182 {
00183 this->request_processing_strategy_factory_->destroy (request_processing_strategy_);
00184
00185 this->request_processing_strategy_ = 0;
00186 }
00187
00188 if (this->id_uniqueness_strategy_ != 0)
00189 {
00190 this->id_uniqueness_strategy_factory_->destroy (id_uniqueness_strategy_);
00191
00192 this->id_uniqueness_strategy_ = 0;
00193 }
00194
00195 if (this->implicit_activation_strategy_ != 0)
00196 {
00197 this->implicit_activation_strategy_factory_->destroy (implicit_activation_strategy_);
00198
00199 this->implicit_activation_strategy_ = 0;
00200 }
00201
00202 if (this->thread_strategy_ != 0)
00203 {
00204 this->thread_strategy_factory_->destroy (thread_strategy_);
00205
00206 this->thread_strategy_ = 0;
00207 }
00208
00209 if (this->servant_retention_strategy_ != 0)
00210 {
00211 this->servant_retention_strategy_factory_->destroy (servant_retention_strategy_);
00212
00213 this->servant_retention_strategy_ = 0;
00214 }
00215
00216 if (this->id_assignment_strategy_ != 0)
00217 {
00218 this->id_assignment_strategy_factory_->destroy (id_assignment_strategy_);
00219
00220 this->id_assignment_strategy_ = 0;
00221 }
00222 }
00223 }
00224 }
00225
00226 TAO_END_VERSIONED_NAMESPACE_DECL