00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file ClientRequestInterceptor_Adapter_Impl.h 00006 * 00007 * $Id: ClientRequestInterceptor_Adapter_Impl.h 85371 2009-05-18 13:39:38Z sma $ 00008 * 00009 * This file an adapter class to simplify the support of 00010 * interceptors. 00011 * 00012 * @author Nanbor Wang <nanbor@cs.wustl.edu> 00013 * @author Ossama Othman <ossama@uci.edu> 00014 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> 00015 * @author Johnny Willemsen <jwillemsen@remedy.nl> 00016 */ 00017 //============================================================================= 00018 00019 #ifndef TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H 00020 #define TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H 00021 00022 #include /**/ "ace/pre.h" 00023 00024 #include "tao/orbconf.h" 00025 00026 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00027 # pragma once 00028 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00029 00030 00031 #if TAO_HAS_INTERCEPTORS == 1 00032 00033 #include "tao/PI/Interceptor_List_T.h" 00034 #include "tao/PI/PI_includeC.h" 00035 #include "tao/PI/ClientRequestDetails.h" 00036 #include "tao/PI/RequestInterceptor_Adapter_Impl.h" 00037 #include "tao/ClientRequestInterceptor_Adapter.h" 00038 00039 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00040 00041 namespace TAO 00042 { 00043 typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor, 00044 ClientRequestDetails> 00045 ClientRequestInterceptor_List; 00046 } 00047 00048 class TAO_ClientRequestInfo; 00049 00050 namespace TAO 00051 { 00052 class Invocation_Base; 00053 00054 /** 00055 * @class ClientRequestInterceptor_Adapter 00056 * 00057 * @brief A convenient helper class to invoke registered client request 00058 * interceptors 00059 * 00060 * This class invokes all registered interceptors at interception 00061 * point, and enforces flow rules dictated by the Portable Interceptor 00062 * specification/chapter. 00063 */ 00064 class ClientRequestInterceptor_Adapter_Impl 00065 : public ClientRequestInterceptor_Adapter 00066 , public TAO_RequestInterceptor_Adapter_Impl 00067 { 00068 public: 00069 ClientRequestInterceptor_Adapter_Impl (void); 00070 00071 /** 00072 * @name PortableInterceptor Client Side Interception Points 00073 * 00074 * Each of these methods corresponds to a client side interception 00075 * point. There are no "intermediate" interception points on the 00076 * client side, only "starting" and "ending" interception points. 00077 * 00078 */ 00079 //@{ 00080 /// This method implements one of the "starting" client side 00081 /// interception points. 00082 virtual void send_request (Invocation_Base &invocation); 00083 00084 /// This method implements one of the "ending" client side 00085 /// interception point. 00086 virtual void receive_reply (Invocation_Base &invocation); 00087 00088 /// This method implements one of the "ending" client side 00089 /// interception point. 00090 virtual void receive_exception (Invocation_Base &invocation); 00091 00092 /// This method implements one of the "ending" client side 00093 /// interception point. 00094 virtual void receive_other (Invocation_Base &invocation); 00095 //@} 00096 00097 /// Register an interceptor. 00098 virtual void add_interceptor ( 00099 PortableInterceptor::ClientRequestInterceptor_ptr interceptor); 00100 00101 /// Register an interceptor with policies. 00102 virtual void add_interceptor ( 00103 PortableInterceptor::ClientRequestInterceptor_ptr interceptor, 00104 const CORBA::PolicyList& policies); 00105 00106 virtual void destroy_interceptors (void); 00107 00108 virtual PortableInterceptor::ReplyStatus pi_reply_status ( 00109 TAO::Invocation_Base const &invocation_base); 00110 00111 void popTSC (TAO_ORB_Core *orb_core) 00112 {TAO_RequestInterceptor_Adapter_Impl::popTSC (orb_core);} 00113 void pushTSC (TAO_ORB_Core *orb_core) 00114 {TAO_RequestInterceptor_Adapter_Impl::pushTSC (orb_core);} 00115 00116 protected: 00117 /// Process the given PortableInterceptor::ForwardRequest exception, 00118 /// i.e. invoke the receive_other() interception point, in addition 00119 /// to notifying the Invocation object of the LOCATION_FORWARD. 00120 void process_forward_request (Invocation_Base &invocation, 00121 const PortableInterceptor::ForwardRequest &exc); 00122 00123 private: 00124 /// List of registered interceptors. 00125 ClientRequestInterceptor_List interceptor_list_; 00126 }; 00127 } 00128 00129 TAO_END_VERSIONED_NAMESPACE_DECL 00130 00131 #if defined (__ACE_INLINE__) 00132 #include "tao/PI/ClientRequestInterceptor_Adapter_Impl.inl" 00133 #endif /* __ACE_INLINE__ */ 00134 00135 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00136 00137 #include /**/ "ace/post.h" 00138 00139 #endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H */