Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / PortableServer / RequestProcessingStrategyFactoryImpl.cpp
blobbd18a086ce73c11aab6dec06052efbe3343e5452
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
11 namespace TAO
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;
23 switch (value)
25 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
27 strategy_factory =
28 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyAOMOnlyFactory");
30 break;
32 case ::PortableServer::USE_DEFAULT_SERVANT :
34 strategy_factory =
35 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyDefaultServantFactory");
37 break;
39 case ::PortableServer::USE_SERVANT_MANAGER :
41 #if (TAO_HAS_MINIMUM_POA == 0)
42 switch (srvalue)
44 case ::PortableServer::RETAIN :
46 strategy_factory =
47 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantActivatorFactory");
49 break;
51 case ::PortableServer::NON_RETAIN :
53 strategy_factory =
54 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantLocatorFactory");
56 break;
59 #endif /* TAO_HAS_MINIMUM_POA == 0 */
60 break;
64 if (strategy_factory != 0)
65 strategy = strategy_factory->create (value, srvalue);
66 else
67 TAOLIB_ERROR ((LM_ERROR,
68 ACE_TEXT ("(%P|%t) %p\n"),
69 ACE_TEXT ("ERROR, Unable to get ")
70 ACE_TEXT ("RequestProcessingStrategyFactory")));
72 return strategy;
75 void
76 RequestProcessingStrategyFactoryImpl::destroy (
77 RequestProcessingStrategy *strategy)
79 RequestProcessingStrategyFactory *strategy_factory = 0;
81 switch (strategy->type ())
83 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
85 strategy_factory =
86 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyAOMOnlyFactory");
88 break;
90 case ::PortableServer::USE_DEFAULT_SERVANT :
92 strategy_factory =
93 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyDefaultServantFactory");
95 break;
97 case ::PortableServer::USE_SERVANT_MANAGER :
99 #if (TAO_HAS_MINIMUM_POA == 0)
100 switch (strategy->sr_type ())
102 case ::PortableServer::RETAIN :
104 strategy_factory =
105 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantActivatorFactory");
107 break;
109 case ::PortableServer::NON_RETAIN :
111 strategy_factory =
112 ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantLocatorFactory");
113 break;
116 #endif /* TAO_HAS_MINIMUM_POA == 0 */
117 break;
121 if (strategy_factory != 0)
123 strategy_factory->destroy (strategy);
129 ACE_STATIC_SVC_DEFINE (
130 RequestProcessingStrategyFactoryImpl,
131 ACE_TEXT ("RequestProcessingStrategyFactory"),
132 ACE_SVC_OBJ_T,
133 &ACE_SVC_NAME (RequestProcessingStrategyFactoryImpl),
134 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
137 ACE_FACTORY_NAMESPACE_DEFINE (
138 ACE_Local_Service,
139 RequestProcessingStrategyFactoryImpl,
140 TAO::Portable_Server::RequestProcessingStrategyFactoryImpl)
141 TAO_END_VERSIONED_NAMESPACE_DECL