Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tao / PI_Server / ServerInterceptorAdapter.h
blob15630621c6ad35d9df78b3215cc72d8693da490f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file ServerInterceptorAdapter.h
7 * This file contains a helper class to simplify the support of
8 * interceptors in TAO_IDL generated skeletons.
10 * @author Nanbor Wang <nanbor@cs.wustl.edu>
11 * @author Ossama Othman <ossama@uci.edu>
12 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
14 //=============================================================================
16 #ifndef TAO_SERVER_INTERCEPTOR_ADAPTER_H
17 #define TAO_SERVER_INTERCEPTOR_ADAPTER_H
19 #include /**/ "ace/pre.h"
21 #include "tao/orbconf.h"
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # pragma once
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #if TAO_HAS_INTERCEPTORS == 1
29 #include "tao/PI_Server/PI_Server_includeC.h"
31 #include "tao/PI/Interceptor_List_T.h"
32 #include "tao/ServerRequestInterceptor_Adapter.h"
33 #include "tao/PI/RequestInterceptor_Adapter_Impl.h"
34 #include "tao/Basic_Types.h"
35 #include "tao/PI_Server/ServerRequestDetails.h"
37 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
39 namespace TAO
41 typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor,
42 ServerRequestDetails>
43 ServerRequestInterceptor_List;
46 namespace CORBA
48 class PolicyList;
51 class TAO_ServerRequest;
53 namespace TAO
55 class ServerRequestInfo;
57 /**
58 * @class ServerRequestInterceptor_Adapter_Impl
60 * @brief ServerRequestInterceptor_Adapter_Impl
62 * A convenient helper class to invoke registered server request
63 * interceptor(s).
65 class ServerRequestInterceptor_Adapter_Impl
66 : public ServerRequestInterceptor_Adapter
67 , public TAO_RequestInterceptor_Adapter_Impl
69 public:
70 /// Constructor.
71 ServerRequestInterceptor_Adapter_Impl ();
73 /**
74 * @name PortableInterceptor Server Side Interception Points
76 * Each of these methods corresponds to a server side interception
77 * point.
79 //@{
80 #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
81 /// This method implements the "starting" server side interception
82 /// point. It will be used as the first interception point and it is
83 /// proprietary to TAO.
84 void tao_ft_interception_point (
85 TAO_ServerRequest &server_request,
86 TAO::Argument * const args[],
87 size_t nargs,
88 TAO::Portable_Server::Servant_Upcall *servant_upcall,
89 CORBA::TypeCode_ptr const * exceptions,
90 CORBA::ULong nexceptions,
91 CORBA::OctetSeq_out oc);
92 #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
94 /// This method implements the "intermediate" server side
95 /// interception point if the above #ifdef is set to 1 and a
96 /// starting interception point if it is not set to 1.
97 ///
98 /// @note This method should have been the "starting" interception
99 /// point according to the interceptor spec. This will be
100 /// fixed once Bug 1369 is completely done.
101 void receive_request_service_contexts (
102 TAO_ServerRequest &server_request,
103 TAO::Argument * const args[],
104 size_t nargs,
105 TAO::Portable_Server::Servant_Upcall *servant_upcall,
106 CORBA::TypeCode_ptr const * exceptions,
107 CORBA::ULong nexceptions);
109 /// This method an "intermediate" server side interception point.
110 void receive_request (
111 TAO_ServerRequest &server_request,
112 TAO::Argument * const args[],
113 size_t nargs,
114 TAO::Portable_Server::Servant_Upcall *servant_upcall,
115 CORBA::TypeCode_ptr const * exceptions,
116 CORBA::ULong nexceptions);
118 /// This method implements one of the "ending" server side
119 /// interception points.
120 void send_reply (
121 TAO_ServerRequest &server_request,
122 TAO::Argument * const args[],
123 size_t nargs,
124 TAO::Portable_Server::Servant_Upcall *servant_upcall,
125 CORBA::TypeCode_ptr const * exceptions,
126 CORBA::ULong nexceptions);
128 /// This method implements one of the "ending" server side
129 /// interception points.
130 void send_exception (
131 TAO_ServerRequest &server_request,
132 TAO::Argument * const args[],
133 size_t nargs,
134 TAO::Portable_Server::Servant_Upcall *servant_upcall,
135 CORBA::TypeCode_ptr const * exceptions,
136 CORBA::ULong nexceptions);
138 /// This method implements one of the "ending" server side
139 /// interception points.
140 void send_other (
141 TAO_ServerRequest &server_request,
142 TAO::Argument * const args[],
143 size_t nargs,
144 TAO::Portable_Server::Servant_Upcall *servant_upcall,
145 CORBA::TypeCode_ptr const * exceptions,
146 CORBA::ULong nexceptions);
147 //@}
149 /// Register an interceptor.
150 virtual void add_interceptor (
151 PortableInterceptor::ServerRequestInterceptor_ptr interceptor);
153 virtual void add_interceptor (
154 PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
155 const CORBA::PolicyList& policies);
157 virtual void destroy_interceptors ();
159 virtual TAO::PICurrent_Impl *allocate_pi_current ();
161 virtual void deallocate_pi_current (TAO::PICurrent_Impl *picurrent);
163 virtual void execute_command (
164 TAO_ServerRequest &server_request,
165 TAO::Upcall_Command &command);
167 void popTSC (TAO_ORB_Core *orb_core)
168 {TAO_RequestInterceptor_Adapter_Impl::popTSC (orb_core);}
169 void pushTSC (TAO_ORB_Core *orb_core)
170 {TAO_RequestInterceptor_Adapter_Impl::pushTSC (orb_core);}
172 private:
173 /// List of registered interceptors.
174 ServerRequestInterceptor_List interceptor_list_;
176 } // End namespace TAO
178 TAO_END_VERSIONED_NAMESPACE_DECL
180 #endif /* TAO_HAS_INTERCEPTORS */
182 #include /**/ "ace/post.h"
184 #endif /* TAO_SERVER_INTERCEPTOR_ADAPTER_H */