1 #include "tao/PortableServer/RequestProcessingStrategyFactoryImpl.h"
2 #include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
3 #include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
4 #include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
5 #include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
6 #include "ace/Dynamic_Service.h"
7 #include "ace/Log_Msg.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 namespace Portable_Server
15 RequestProcessingStrategy
*
16 RequestProcessingStrategyFactoryImpl::create (
17 ::PortableServer::RequestProcessingPolicyValue value
,
18 ::PortableServer::ServantRetentionPolicyValue srvalue
)
20 RequestProcessingStrategy
* strategy
= 0;
21 RequestProcessingStrategyFactory
*strategy_factory
= 0;
25 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY
:
28 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyAOMOnlyFactory");
32 case ::PortableServer::USE_DEFAULT_SERVANT
:
35 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyDefaultServantFactory");
39 case ::PortableServer::USE_SERVANT_MANAGER
:
41 #if (TAO_HAS_MINIMUM_POA == 0)
44 case ::PortableServer::RETAIN
:
47 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyServantActivatorFactory");
51 case ::PortableServer::NON_RETAIN
:
54 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyServantLocatorFactory");
59 #endif /* TAO_HAS_MINIMUM_POA == 0 */
64 if (strategy_factory
!= 0)
65 strategy
= strategy_factory
->create (value
, srvalue
);
67 TAOLIB_ERROR ((LM_ERROR
,
68 ACE_TEXT ("(%P|%t) %p\n"),
69 ACE_TEXT ("ERROR, Unable to get ")
70 ACE_TEXT ("RequestProcessingStrategyFactory")));
76 RequestProcessingStrategyFactoryImpl::destroy (
77 RequestProcessingStrategy
*strategy
)
79 RequestProcessingStrategyFactory
*strategy_factory
= 0;
81 switch (strategy
->type ())
83 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY
:
86 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyAOMOnlyFactory");
90 case ::PortableServer::USE_DEFAULT_SERVANT
:
93 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyDefaultServantFactory");
97 case ::PortableServer::USE_SERVANT_MANAGER
:
99 #if (TAO_HAS_MINIMUM_POA == 0)
100 switch (strategy
->sr_type ())
102 case ::PortableServer::RETAIN
:
105 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyServantActivatorFactory");
109 case ::PortableServer::NON_RETAIN
:
112 ACE_Dynamic_Service
<RequestProcessingStrategyFactory
>::instance ("RequestProcessingStrategyServantLocatorFactory");
116 #endif /* TAO_HAS_MINIMUM_POA == 0 */
121 if (strategy_factory
!= 0)
123 strategy_factory
->destroy (strategy
);
129 ACE_STATIC_SVC_DEFINE (
130 RequestProcessingStrategyFactoryImpl
,
131 ACE_TEXT ("RequestProcessingStrategyFactory"),
133 &ACE_SVC_NAME (RequestProcessingStrategyFactoryImpl
),
134 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
137 ACE_FACTORY_NAMESPACE_DEFINE (
139 RequestProcessingStrategyFactoryImpl
,
140 TAO::Portable_Server::RequestProcessingStrategyFactoryImpl
)
141 TAO_END_VERSIONED_NAMESPACE_DECL