2 #include "tao/PortableServer/Active_Policy_Strategies.h"
3 #include "tao/PortableServer/POA_Cached_Policies.h"
5 #include "tao/PortableServer/ThreadStrategySingle.h"
6 #include "tao/PortableServer/ThreadStrategyORBControl.h"
7 #include "tao/PortableServer/IdAssignmentStrategySystem.h"
8 #include "tao/PortableServer/IdAssignmentStrategyUser.h"
9 #include "tao/PortableServer/IdUniquenessStrategyMultiple.h"
10 #include "tao/PortableServer/IdUniquenessStrategyUnique.h"
11 #include "tao/PortableServer/ImplicitActivationStrategyExplicit.h"
12 #include "tao/PortableServer/ImplicitActivationStrategyImplicit.h"
13 #include "tao/PortableServer/LifespanStrategyPersistent.h"
14 #include "tao/PortableServer/LifespanStrategyTransient.h"
15 #include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
16 #include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
17 #include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
18 #include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
19 #include "tao/PortableServer/ServantRetentionStrategyNonRetain.h"
20 #include "tao/PortableServer/ServantRetentionStrategyRetain.h"
22 #if !defined (__ACE_INLINE__)
23 # include "tao/PortableServer/Active_Policy_Strategies.inl"
24 #endif /* __ACE_INLINE__ */
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 namespace Portable_Server
33 Active_Policy_Strategies::update (Cached_Policies
&policies
,
36 this->create (policies
.thread());
37 this->create (policies
.id_assignment());
38 this->create (policies
.id_uniqueness());
39 this->create (policies
.servant_retention());
40 this->create (policies
.lifespan());
41 this->create (policies
.implicit_activation());
42 this->create (policies
.request_processing(), policies
.servant_retention());
45 if (this->lifespan_strategy_
)
47 this->lifespan_strategy_
->strategy_init (poa
);
50 if (this->request_processing_strategy_
)
52 this->request_processing_strategy_
->strategy_init (poa
);
55 if (this->id_uniqueness_strategy_
)
57 this->id_uniqueness_strategy_
->strategy_init (poa
);
60 if (this->servant_retention_strategy_
)
62 this->servant_retention_strategy_
->strategy_init (poa
);
67 Active_Policy_Strategies::cleanup ()
69 if (this->lifespan_strategy_
)
71 this->lifespan_strategy_
->strategy_cleanup ();
73 this->lifespan_strategy_
.reset (nullptr);
74 if (this->request_processing_strategy_
)
76 this->request_processing_strategy_
->strategy_cleanup ();
78 this->request_processing_strategy_
.reset (nullptr);
79 if (this->id_uniqueness_strategy_
)
81 this->id_uniqueness_strategy_
->strategy_cleanup ();
83 this->id_uniqueness_strategy_
.reset (nullptr);
84 this->implicit_activation_strategy_
.reset (nullptr);
85 this->thread_strategy_
.reset (nullptr);
86 if (this->servant_retention_strategy_
)
88 this->servant_retention_strategy_
->strategy_cleanup ();
90 this->servant_retention_strategy_
.reset (nullptr);
91 this->id_assignment_strategy_
.reset (nullptr);
95 Active_Policy_Strategies::create (::PortableServer::ThreadPolicyValue value
)
99 case ::PortableServer::SINGLE_THREAD_MODEL
:
101 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
102 this->thread_strategy_
= std::make_unique
<ThreadStrategySingle
> ();
103 #endif /* TAO_HAS_MINIMUM_POA == 0 */
106 case ::PortableServer::ORB_CTRL_MODEL
:
108 this->thread_strategy_
= std::make_unique
<ThreadStrategyORBControl
> ();
115 Active_Policy_Strategies::create (::PortableServer::IdAssignmentPolicyValue value
)
119 case ::PortableServer::SYSTEM_ID
:
121 this->id_assignment_strategy_
= std::make_unique
<IdAssignmentStrategySystem
> ();
124 case ::PortableServer::USER_ID
:
126 #if !defined (CORBA_E_MICRO)
127 this->id_assignment_strategy_
= std::make_unique
<IdAssignmentStrategyUser
> ();
128 #endif /* CORBA_E_MICRO */
135 Active_Policy_Strategies::create (::PortableServer::IdUniquenessPolicyValue value
)
139 case ::PortableServer::MULTIPLE_ID
:
141 #if !defined (CORBA_E_MICRO)
142 this->id_uniqueness_strategy_
= std::make_unique
<IdUniquenessStrategyMultiple
> ();
143 #endif /* CORBA_E_MICRO */
146 case ::PortableServer::UNIQUE_ID
:
148 this->id_uniqueness_strategy_
= std::make_unique
<IdUniquenessStrategyUnique
> ();
155 Active_Policy_Strategies::create (::PortableServer::ServantRetentionPolicyValue value
)
159 case ::PortableServer::RETAIN
:
161 this->servant_retention_strategy_
= std::make_unique
<ServantRetentionStrategyRetain
> ();
164 case ::PortableServer::NON_RETAIN
:
166 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
167 this->servant_retention_strategy_
= std::make_unique
<ServantRetentionStrategyNonRetain
> ();
168 #endif /* TAO_HAS_MINIMUM_POA == 0 */
175 Active_Policy_Strategies::create (::PortableServer::LifespanPolicyValue value
)
179 case ::PortableServer::PERSISTENT
:
181 #if !defined (CORBA_E_MICRO)
182 this->lifespan_strategy_
= std::make_unique
<LifespanStrategyPersistent
> ();
183 #endif /* CORBA_E_MICRO */
186 case ::PortableServer::TRANSIENT
:
188 this->lifespan_strategy_
= std::make_unique
<LifespanStrategyTransient
> ();
195 Active_Policy_Strategies::create (::PortableServer::ImplicitActivationPolicyValue value
)
199 case ::PortableServer::IMPLICIT_ACTIVATION
:
201 #if !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
202 this->implicit_activation_strategy_
= std::make_unique
<ImplicitActivationStrategyImplicit
> ();
203 #endif /* CORBA_E_MICRO */
206 case ::PortableServer::NO_IMPLICIT_ACTIVATION
:
208 this->implicit_activation_strategy_
= std::make_unique
<ImplicitActivationStrategyExplicit
> ();
215 Active_Policy_Strategies::create (
216 ::PortableServer::RequestProcessingPolicyValue value
,
217 ::PortableServer::ServantRetentionPolicyValue srvalue
)
221 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY
:
223 this->request_processing_strategy_
= std::make_unique
<RequestProcessingStrategyAOMOnly
> ();
226 case ::PortableServer::USE_DEFAULT_SERVANT
:
228 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
229 this->request_processing_strategy_
= std::make_unique
<RequestProcessingStrategyDefaultServant
> ();
230 #endif /* TAO_HAS_MINIMUM_POA == 0 */
233 case ::PortableServer::USE_SERVANT_MANAGER
:
237 case ::PortableServer::RETAIN
:
239 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
240 this->request_processing_strategy_
= std::make_unique
<RequestProcessingStrategyServantActivator
> ();
241 #endif /* TAO_HAS_MINIMUM_POA == 0 */
244 case ::PortableServer::NON_RETAIN
:
246 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
247 this->request_processing_strategy_
= std::make_unique
<RequestProcessingStrategyServantLocator
> ();
248 #endif /* TAO_HAS_MINIMUM_POA == 0 */
259 TAO_END_VERSIONED_NAMESPACE_DECL