00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_Strategy_Proxy.h 00006 * 00007 * $Id: CSD_Strategy_Proxy.h 81882 2008-06-10 14:59:20Z johnc $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H 00014 #define TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_Framework/CSD_FW_Export.h" 00019 00020 #include "tao/PortableServer/PortableServer.h" 00021 #include "tao/PortableServer/Servant_Upcall.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "tao/CSD_Framework/CSD_Strategy_Base.h" 00028 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 class TAO_ServerRequest; 00033 00034 namespace TAO 00035 { 00036 namespace CSD 00037 { 00038 /** 00039 * @class Strategy_Proxy 00040 * 00041 * @brief Proxy class for the Custom Servant Dispatching Strategy. 00042 * 00043 * If no custom servant dispatching strategy is provided to the proxy, 00044 * then the "default servant dispatching strategy" logic is used. 00045 */ 00046 class TAO_CSD_FW_Export Strategy_Proxy 00047 { 00048 public: 00049 00050 /// Default Constructor. 00051 Strategy_Proxy(); 00052 00053 /// Destructor. 00054 ~Strategy_Proxy(); 00055 00056 /// Mutator to provide the proxy with a CSD Strategy object. 00057 /// A return value of true indicates success, and false indicates 00058 /// failure to set the custom strategy on the proxy object. 00059 bool custom_strategy(CSD_Framework::Strategy_ptr strategy); 00060 00061 /// Invoked by the Object_Adapter using an ORB thread. 00062 /// 00063 /// If the proxy object holds a custom strategy object, then this method 00064 /// will simply delegate to the custom strategy object. Otherwise, 00065 /// this method will perform the "default servant dispatching strategy" 00066 /// logic, preserving the original logic path as it was prior to the 00067 /// introduction of the Custom Servant Dispatching feature. 00068 /// 00069 /// This method will be inlined (if inlining is turned on during the build). 00070 /// 00071 /// The added cost to the original logic path will be this method 00072 /// invocation + one conditional (an is_nil() call/comparison for truth on 00073 /// the smart pointer to the custom dispatching strategy object). 00074 void dispatch_request(TAO_ServerRequest& server_request, 00075 TAO::Portable_Server::Servant_Upcall& upcall); 00076 00077 00078 /// Event - The POA has been (or is being) activated. 00079 bool poa_activated_event(TAO_ORB_Core& orb_core); 00080 00081 /// Event - The POA has been deactivated. 00082 void poa_deactivated_event(); 00083 00084 /// Event - A servant has been activated. 00085 void servant_activated_event(PortableServer::Servant servant, 00086 const PortableServer::ObjectId& oid); 00087 00088 /// Event - A servant has been deactivated. 00089 void servant_deactivated_event(PortableServer::Servant servant, 00090 const PortableServer::ObjectId& oid); 00091 00092 private: 00093 00094 /// Smart Pointer to a custom servant dispatching strategy object. 00095 /// This smart pointer will be in the "nil" state when the "default" 00096 /// strategy is to be applied. 00097 CSD_Framework::Strategy_var strategy_; 00098 TAO::CSD::Strategy_Base *strategy_impl_; 00099 }; 00100 } 00101 } 00102 00103 TAO_END_VERSIONED_NAMESPACE_DECL 00104 00105 #if defined (__ACE_INLINE__) 00106 # include "tao/CSD_Framework/CSD_Strategy_Proxy.inl" 00107 #endif /* __ACE_INLINE__ */ 00108 00109 #include /**/ "ace/post.h" 00110 00111 #endif