00001 // $Id: CSD_Strategy_Proxy.cpp 71473 2006-03-10 07:19:20Z jtc $ 00002 00003 #include "tao/CSD_Framework/CSD_Strategy_Proxy.h" 00004 #include "tao/TAO_Server_Request.h" 00005 #include "tao/debug.h" 00006 00007 ACE_RCSID (CSD_Framework, 00008 CSD_Strategy_Base, 00009 "$Id: CSD_Strategy_Proxy.cpp 71473 2006-03-10 07:19:20Z jtc $") 00010 00011 00012 #if !defined (__ACE_INLINE__) 00013 # include "tao/CSD_Framework/CSD_Strategy_Proxy.inl" 00014 #endif /* ! __ACE_INLINE__ */ 00015 00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 bool 00019 TAO::CSD::Strategy_Proxy::custom_strategy 00020 (CSD_Framework::Strategy_ptr strategy) 00021 { 00022 if (this->strategy_impl_) 00023 { 00024 if (TAO_debug_level > 0) 00025 ACE_ERROR((LM_ERROR, 00026 ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") 00027 ACE_TEXT("object already has a custom strategy.\n"))); 00028 00029 return false; 00030 } 00031 00032 if (CORBA::is_nil(strategy)) 00033 { 00034 if (TAO_debug_level > 0) 00035 ACE_ERROR((LM_ERROR, 00036 ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") 00037 ACE_TEXT("supplied with a NIL custom strategy.\n"))); 00038 00039 return false; 00040 } 00041 00042 // We need to bump up the reference count of the strategy before saving 00043 // it off into our handle (smart pointer) data member. 00044 this->strategy_ = CSD_Framework::Strategy::_duplicate(strategy); 00045 this->strategy_impl_ = dynamic_cast <TAO::CSD::Strategy_Base*> (strategy); 00046 00047 return true; 00048 } 00049 00050 TAO_END_VERSIONED_NAMESPACE_DECL