ServerInterceptorAdapter.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    ServerInterceptorAdapter.h
00006  *
00007  *  $Id: ServerInterceptorAdapter.h 79914 2007-11-01 10:51:19Z johnnyw $
00008  *
00009  *   This file contains a helper class to simplify the support of
00010  *   interceptors in TAO_IDL generated skeletons.
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  */
00016 //=============================================================================
00017 
00018 #ifndef TAO_SERVER_INTERCEPTOR_ADAPTER_H
00019 #define TAO_SERVER_INTERCEPTOR_ADAPTER_H
00020 
00021 #include /**/ "ace/pre.h"
00022 
00023 #include "tao/orbconf.h"
00024 
00025 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00026 # pragma once
00027 #endif /* ACE_LACKS_PRAGMA_ONCE */
00028 
00029 
00030 #if TAO_HAS_INTERCEPTORS == 1
00031 
00032 #include "tao/PI_Server/PI_Server_includeC.h"
00033 
00034 #include "tao/PI/Interceptor_List_T.h"
00035 #include "tao/ServerRequestInterceptor_Adapter.h"
00036 #include "tao/Basic_Types.h"
00037 #include "tao/PI_Server/ServerRequestDetails.h"
00038 
00039 
00040 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00041 
00042 namespace TAO
00043 {
00044   typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor,
00045                             ServerRequestDetails>
00046     ServerRequestInterceptor_List;
00047 }
00048 
00049 namespace CORBA
00050 {
00051   class PolicyList;
00052 }
00053 
00054 class TAO_ServerRequest;
00055 
00056 namespace TAO
00057 {
00058   class ServerRequestInfo;
00059 
00060   /**
00061    * @class ServerRequestInterceptor_Adapter_Impl
00062    *
00063    * @brief ServerRequestInterceptor_Adapter_Impl
00064    *
00065    * A convenient helper class to invoke registered server request
00066    * interceptor(s).
00067    */
00068   class ServerRequestInterceptor_Adapter_Impl
00069     : public ServerRequestInterceptor_Adapter
00070   {
00071   public:
00072 
00073     /// Constructor.
00074     ServerRequestInterceptor_Adapter_Impl (void);
00075 
00076     /**
00077      * @name PortableInterceptor Server Side Interception Points
00078      *
00079      * Each of these methods corresponds to a server side interception
00080      * point.
00081      */
00082     //@{
00083 #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
00084     /// This method implements the "starting" server side interception
00085     /// point. It will be used as the first interception point and it is
00086     /// proprietary to TAO.
00087     /// @@ Will go away once Bug 1369 is fixed
00088     void tao_ft_interception_point (
00089         TAO_ServerRequest &server_request,
00090         TAO::Argument * const args[],
00091         size_t nargs,
00092         void * servant_upcall,
00093         CORBA::TypeCode_ptr const * exceptions,
00094         CORBA::ULong nexceptions,
00095         CORBA::OctetSeq_out oc);
00096 #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
00097 
00098     /// This method implements the "intermediate" server side
00099     /// interception point if the above #ifdef is set to 1 and a
00100     /// starting intercetion point if it is not set to 1.
00101     ///
00102     /// @note This method should have been the "starting" interception
00103     ///       point according to the interceptor spec. This will be
00104     ///       fixed once Bug 1369 is completely done.
00105     void receive_request_service_contexts (
00106         TAO_ServerRequest &server_request,
00107         TAO::Argument * const args[],
00108         size_t nargs,
00109         void * servant_upcall,
00110         CORBA::TypeCode_ptr const * exceptions,
00111         CORBA::ULong nexceptions);
00112 
00113     /// This method an "intermediate" server side interception point.
00114     void receive_request (
00115         TAO_ServerRequest &server_request,
00116         TAO::Argument * const args[],
00117         size_t nargs,
00118         void * servant_upcall,
00119         CORBA::TypeCode_ptr const * exceptions,
00120         CORBA::ULong nexceptions);
00121 
00122     /// This method implements one of the "ending" server side
00123     /// interception points.
00124     void send_reply (
00125         TAO_ServerRequest &server_request,
00126         TAO::Argument * const args[],
00127         size_t nargs,
00128         void * servant_upcall,
00129         CORBA::TypeCode_ptr const * exceptions,
00130         CORBA::ULong nexceptions);
00131 
00132     /// This method implements one of the "ending" server side
00133     /// interception points.
00134     void send_exception (
00135         TAO_ServerRequest &server_request,
00136         TAO::Argument * const args[],
00137         size_t nargs,
00138         void * servant_upcall,
00139         CORBA::TypeCode_ptr const * exceptions,
00140         CORBA::ULong nexceptions);
00141 
00142     /// This method implements one of the "ending" server side
00143     /// interception points.
00144     void send_other (
00145         TAO_ServerRequest &server_request,
00146         TAO::Argument * const args[],
00147         size_t nargs,
00148         void * servant_upcall,
00149         CORBA::TypeCode_ptr const * exceptions,
00150         CORBA::ULong nexceptions);
00151     //@}
00152 
00153     /// Register an interceptor.
00154     virtual void add_interceptor (
00155       PortableInterceptor::ServerRequestInterceptor_ptr interceptor
00156      );
00157 
00158     virtual void add_interceptor (
00159       PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
00160       const CORBA::PolicyList& policies);
00161 
00162     virtual void destroy_interceptors (void);
00163 
00164     virtual TAO::PICurrent_Impl *allocate_pi_current (void);
00165 
00166     virtual void deallocate_pi_current (TAO::PICurrent_Impl *picurrent);
00167 
00168     virtual void execute_command (
00169         TAO_ServerRequest &server_request,
00170         TAO::Upcall_Command &command);
00171 
00172   private:
00173 
00174     /// List of registered interceptors.
00175     ServerRequestInterceptor_List interceptor_list_;
00176   };
00177 
00178 }  // End namespace TAO
00179 
00180 TAO_END_VERSIONED_NAMESPACE_DECL
00181 
00182 #endif  /* TAO_HAS_INTERCEPTORS */
00183 
00184 #include /**/ "ace/post.h"
00185 
00186 #endif /* TAO_SERVER_INTERCEPTOR_ADAPTER_H */

Generated on Tue Feb 2 17:42:14 2010 for TAO_PI_Server by  doxygen 1.4.7