00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file ClientRequestInterceptor_Adapter_Impl.h 00006 * 00007 * $Id: ClientRequestInterceptor_Adapter_Impl.h 81145 2008-03-28 15:32:58Z vzykov $ 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/ClientRequestInterceptor_Adapter.h" 00037 00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00039 00040 namespace TAO 00041 { 00042 typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor, 00043 ClientRequestDetails> 00044 ClientRequestInterceptor_List; 00045 } 00046 00047 class TAO_ClientRequestInfo; 00048 00049 namespace TAO 00050 { 00051 class Invocation_Base; 00052 00053 /** 00054 * @class ClientRequestInterceptor_Adapter 00055 * 00056 * @brief A convenient helper class to invoke registered client request 00057 * interceptors 00058 * 00059 * This class invokes all registered interceptors at interception 00060 * point, and enforces flow rules dictated by the Portable Interceptor 00061 * specification/chapter. 00062 */ 00063 class ClientRequestInterceptor_Adapter_Impl 00064 : public ClientRequestInterceptor_Adapter 00065 { 00066 public: 00067 00068 ClientRequestInterceptor_Adapter_Impl (void); 00069 00070 /** 00071 * @name PortableInterceptor Client Side Interception Points 00072 * 00073 * Each of these methods corresponds to a client side interception 00074 * point. There are no "intermediate" interception points on the 00075 * client side, only "starting" and "ending" interception points. 00076 * 00077 */ 00078 //@{ 00079 /// This method implements one of the "starting" client side 00080 /// interception points. 00081 virtual void send_request (Invocation_Base &invocation); 00082 00083 /// This method implements one of the "ending" client side 00084 /// interception point. 00085 virtual void receive_reply (Invocation_Base &invocation); 00086 00087 /// This method implements one of the "ending" client side 00088 /// interception point. 00089 virtual void receive_exception (Invocation_Base &invocation); 00090 00091 /// This method implements one of the "ending" client side 00092 /// interception point. 00093 virtual void receive_other (Invocation_Base &invocation); 00094 //@} 00095 00096 /// Register an interceptor. 00097 virtual void add_interceptor ( 00098 PortableInterceptor::ClientRequestInterceptor_ptr interceptor); 00099 00100 /// Register an interceptor with policies. 00101 virtual void add_interceptor ( 00102 PortableInterceptor::ClientRequestInterceptor_ptr interceptor, 00103 const CORBA::PolicyList& policies); 00104 00105 virtual void destroy_interceptors (void); 00106 00107 virtual PortableInterceptor::ReplyStatus pi_reply_status ( 00108 TAO::Invocation_Base const &invocation_base); 00109 00110 protected: 00111 00112 /// Process the given PortableInterceptor::ForwardRequest exception, 00113 /// i.e. invoke the receive_other() interception point, in addition 00114 /// to notifying the Invocation object of the LOCATION_FORWARD. 00115 void process_forward_request (Invocation_Base &invocation, 00116 const PortableInterceptor::ForwardRequest &exc); 00117 00118 private: 00119 00120 /// List of registered interceptors. 00121 ClientRequestInterceptor_List interceptor_list_; 00122 }; 00123 } 00124 00125 TAO_END_VERSIONED_NAMESPACE_DECL 00126 00127 #if defined (__ACE_INLINE__) 00128 #include "tao/PI/ClientRequestInterceptor_Adapter_Impl.inl" 00129 #endif /* __ACE_INLINE__ */ 00130 00131 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00132 00133 #include /**/ "ace/post.h" 00134 00135 #endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H */