Active_Policy_Strategies.cpp

Go to the documentation of this file.
00001 // Active_Policy_Strategies.cpp,v 1.6 2006/03/10 07:19:13 jtc Exp
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 /* __ACE_INLINE__ */
00035 
00036 ACE_RCSID(PortableServer,
00037           Active_Policy_Strategies,
00038           "Active_Policy_Strategies.cpp,v 1.6 2006/03/10 07:19:13 jtc Exp")
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                                       ACE_ENV_ARG_DECL)
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 // @todo, check if all pointers are != 0
00134 
00135       if (this->lifespan_strategy_ != 0)
00136         {
00137           this->lifespan_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00138           ACE_CHECK;
00139         }
00140 
00141       if (this->request_processing_strategy_ != 0)
00142         {
00143           this->request_processing_strategy_->strategy_init (poa, policies.servant_retention() ACE_ENV_ARG_PARAMETER);
00144           ACE_CHECK;
00145         }
00146 
00147       if (this->id_uniqueness_strategy_ != 0)
00148         {
00149           this->id_uniqueness_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00150           ACE_CHECK;
00151         }
00152 
00153       if (this->implicit_activation_strategy_ != 0)
00154         {
00155           this->implicit_activation_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00156           ACE_CHECK;
00157         }
00158 
00159       if (this->thread_strategy_ != 0)
00160         {
00161           this->thread_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00162           ACE_CHECK;
00163         }
00164 
00165       if (this->servant_retention_strategy_ != 0)
00166         {
00167           this->servant_retention_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00168           ACE_CHECK;
00169         }
00170 
00171       if (this->id_assignment_strategy_ != 0)
00172         {
00173           this->id_assignment_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
00174           ACE_CHECK;
00175         }
00176     }
00177 
00178     void
00179     Active_Policy_Strategies::cleanup (ACE_ENV_SINGLE_ARG_DECL)
00180     {
00181 
00182       if (this->lifespan_strategy_ != 0)
00183         {
00184           this->lifespan_strategy_factory_->destroy (lifespan_strategy_ ACE_ENV_ARG_PARAMETER);
00185           ACE_CHECK;
00186 
00187           this->lifespan_strategy_ = 0;
00188         }
00189 
00190       if (this->request_processing_strategy_ != 0)
00191         {
00192           this->request_processing_strategy_factory_->destroy (request_processing_strategy_ ACE_ENV_ARG_PARAMETER);
00193           ACE_CHECK;
00194 
00195           this->request_processing_strategy_ = 0;
00196         }
00197 
00198       if (this->id_uniqueness_strategy_ != 0)
00199         {
00200           this->id_uniqueness_strategy_factory_->destroy (id_uniqueness_strategy_ ACE_ENV_ARG_PARAMETER);
00201           ACE_CHECK;
00202 
00203           this->id_uniqueness_strategy_ = 0;
00204         }
00205 
00206       if (this->implicit_activation_strategy_ != 0)
00207         {
00208           this->implicit_activation_strategy_factory_->destroy (implicit_activation_strategy_ ACE_ENV_ARG_PARAMETER);
00209           ACE_CHECK;
00210 
00211           this->implicit_activation_strategy_ = 0;
00212         }
00213 
00214       if (this->thread_strategy_ != 0)
00215         {
00216           this->thread_strategy_factory_->destroy (thread_strategy_ ACE_ENV_ARG_PARAMETER);
00217           ACE_CHECK;
00218 
00219           this->thread_strategy_ = 0;
00220         }
00221 
00222       if (this->servant_retention_strategy_ != 0)
00223         {
00224           this->servant_retention_strategy_factory_->destroy (servant_retention_strategy_ ACE_ENV_ARG_PARAMETER);
00225           ACE_CHECK;
00226 
00227           this->servant_retention_strategy_ = 0;
00228         }
00229 
00230       if (this->id_assignment_strategy_ != 0)
00231         {
00232           this->id_assignment_strategy_factory_->destroy (id_assignment_strategy_ ACE_ENV_ARG_PARAMETER);
00233           ACE_CHECK;
00234 
00235           this->id_assignment_strategy_ = 0;
00236         }
00237     }
00238   }
00239 }
00240 
00241 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 12:40:37 2006 for TAO_PortableServer by doxygen 1.3.6