00001
00002
00003 #include "tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h"
00004 #include "ace/Dynamic_Service.h"
00005 #include "tao/PortableServer/LifespanStrategyPersistent.h"
00006
00007 ACE_RCSID (PortableServer,
00008 LifespanStrategyFactoryImpl,
00009 "$Id: LifespanStrategyPersistentFactoryImpl.cpp 76898 2007-02-04 18:58:07Z johnnyw $")
00010
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012
00013 namespace TAO
00014 {
00015 namespace Portable_Server
00016 {
00017 LifespanStrategy*
00018 LifespanStrategyPersistentFactoryImpl::create (
00019 ::PortableServer::LifespanPolicyValue value)
00020 {
00021 LifespanStrategy* strategy = 0;
00022
00023 switch (value)
00024 {
00025 case ::PortableServer::PERSISTENT :
00026 {
00027 ACE_NEW_RETURN (strategy, LifespanStrategyPersistent, 0);
00028 break;
00029 }
00030 case ::PortableServer::TRANSIENT :
00031 {
00032 ACE_ERROR ((LM_ERROR, "Incorrect type in LifespanStrategyPersistentFactoryImpl"));
00033 break;
00034 }
00035 }
00036
00037 return strategy;
00038 }
00039
00040 void
00041 LifespanStrategyPersistentFactoryImpl::destroy (LifespanStrategy *strategy)
00042 {
00043 strategy->strategy_cleanup ();
00044
00045 delete strategy;
00046 }
00047 }
00048 }
00049
00050 TAO_END_VERSIONED_NAMESPACE_DECL
00051
00052 ACE_STATIC_SVC_DEFINE (
00053 LifespanStrategyPersistentFactoryImpl,
00054 ACE_TEXT ("LifespanStrategyPersistentFactory"),
00055 ACE_SVC_OBJ_T,
00056 &ACE_SVC_NAME (LifespanStrategyPersistentFactoryImpl),
00057 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00058 0)
00059
00060 ACE_FACTORY_NAMESPACE_DEFINE (
00061 ACE_Local_Service,
00062 LifespanStrategyPersistentFactoryImpl,
00063 TAO::Portable_Server::LifespanStrategyPersistentFactoryImpl)
00064