#include <ServerInterceptorAdapter.h>
Inheritance diagram for TAO::ServerRequestInterceptor_Adapter_Impl:


Public Member Functions | |
| ServerRequestInterceptor_Adapter_Impl (void) | |
| Constructor. | |
| virtual void | add_interceptor (PortableInterceptor::ServerRequestInterceptor_ptr interceptor) |
| Register an interceptor. | |
| virtual void | add_interceptor (PortableInterceptor::ServerRequestInterceptor_ptr interceptor, const CORBA::PolicyList &policies) |
| virtual void | destroy_interceptors () |
| virtual TAO::PICurrent_Impl * | allocate_pi_current (void) |
| virtual void | deallocate_pi_current (TAO::PICurrent_Impl *picurrent) |
| virtual void | execute_command (TAO_ServerRequest &server_request, TAO::Upcall_Command &command) |
PortableInterceptor Server Side Interception Points | |
Each of these methods corresponds to a server side interception point. | |
| void | receive_request_service_contexts (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs, void *servant_upcall, CORBA::TypeCode_ptr const *exceptions, CORBA::ULong nexceptions) |
| void | receive_request (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs, void *servant_upcall, CORBA::TypeCode_ptr const *exceptions, CORBA::ULong nexceptions) |
| This method an "intermediate" server side interception point. | |
| void | send_reply (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs, void *servant_upcall, CORBA::TypeCode_ptr const *exceptions, CORBA::ULong nexceptions) |
| void | send_exception (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs, void *servant_upcall, CORBA::TypeCode_ptr const *exceptions, CORBA::ULong nexceptions) |
| void | send_other (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs, void *servant_upcall, CORBA::TypeCode_ptr const *exceptions, CORBA::ULong nexceptions) |
Private Attributes | |
| ServerRequestInterceptor_List | interceptor_list_ |
| List of registered interceptors. | |
A convenient helper class to invoke registered server request interceptor(s).
Definition at line 68 of file ServerInterceptorAdapter.h.
|
|
Constructor.
Definition at line 23 of file ServerInterceptorAdapter.cpp.
00024 {
00025 }
|
|
||||||||||||
|
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 557 of file ServerInterceptorAdapter.cpp. References ACE_ENV_ARG_PARAMETER, and interceptor_list_.
00561 {
00562 this->interceptor_list_.add_interceptor (interceptor,
00563 policies
00564 ACE_ENV_ARG_PARAMETER);
00565 }
|
|
|
Register an interceptor.
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 549 of file ServerInterceptorAdapter.cpp. References ACE_ENV_ARG_PARAMETER, and interceptor_list_.
00552 {
00553 this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
00554 }
|
|
|
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 575 of file ServerInterceptorAdapter.cpp. References ACE_NEW_RETURN.
00576 {
00577 TAO::PICurrent_Impl *pi = 0;
00578 ACE_NEW_RETURN (pi,
00579 TAO::PICurrent_Impl,
00580 pi);
00581 return pi;
00582 }
|
|
|
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 585 of file ServerInterceptorAdapter.cpp.
00587 {
00588 delete picurrent;
00589 }
|
|
|
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 568 of file ServerInterceptorAdapter.cpp. References ACE_ENV_SINGLE_ARG_PARAMETER, and interceptor_list_.
00570 {
00571 this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
00572 }
|
|
||||||||||||
|
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 592 of file ServerInterceptorAdapter.cpp. References ACE_CHECK, and ACE_ENV_SINGLE_ARG_PARAMETER.
00596 {
00597 TAO::PICurrent_Guard const pi_guard (server_request,
00598 true /* Copy TSC to RSC */);
00599
00600 // The actual upcall.
00601 command.execute (ACE_ENV_SINGLE_ARG_PARAMETER);
00602 ACE_CHECK;
00603 }
|
|
||||||||||||||||||||||||||||
|
This method an "intermediate" server side interception point.
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 252 of file ServerInterceptorAdapter.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, TAO_ServerRequest::collocated(), TAO_ServerRequest::forward_location(), TAO_ServerRequest::interceptor_count(), interceptor_list_, TAO_ServerRequest::reply_status(), and send_other().
00260 {
00261 // This method implements an "intermediate" server side interception
00262 // point. Interceptors are invoked in the same order they were
00263 // pushed on to the flow stack.
00264
00265 if (this->interceptor_list_.size() != server_request.interceptor_count ())
00266 {
00267 // This method (i.e. the receive_request() interception point)
00268 // should only be invoked if all of the interceptors registered
00269 // with the ORB were pushed on to the flow stack by one of the
00270 // starting endpoints (such as
00271 // receive_request_service_contexts()). If the above condition
00272 // evaluates to "true," then it is likely that a starting
00273 // interception point was never invoked. This is of course, an
00274 // internal error that must be corrected.
00275 ACE_THROW (CORBA::INTERNAL ());
00276 }
00277
00278 TAO::ServerRequestInfo request_info (server_request,
00279 args,
00280 nargs,
00281 servant_upcall,
00282 exceptions,
00283 nexceptions);
00284
00285 ACE_TRY
00286 {
00287 bool is_remote_request = !server_request.collocated ();
00288
00289 for (size_t i = 0; i < server_request.interceptor_count (); ++i)
00290 {
00291 ServerRequestInterceptor_List::RegisteredInterceptor& registered =
00292 this->interceptor_list_.registered_interceptor (i);
00293
00294 if (registered.details_.should_be_processed (is_remote_request))
00295 {
00296 registered.interceptor_->
00297 receive_request (&request_info
00298 ACE_ENV_ARG_PARAMETER);
00299 ACE_TRY_CHECK;
00300 }
00301
00302 // Note that no interceptors are pushed on to or popped off
00303 // of the flow stack in this interception point since it is
00304 // an intermediate interception point.
00305 }
00306 }
00307 ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00308 {
00309 server_request.forward_location (exc.forward.in ());
00310 server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
00311 this->send_other (server_request,
00312 args,
00313 nargs,
00314 servant_upcall,
00315 exceptions,
00316 nexceptions
00317 ACE_ENV_ARG_PARAMETER);
00318 ACE_TRY_CHECK;
00319 }
00320 ACE_ENDTRY;
00321 ACE_CHECK;
00322
00323 }
|
|
||||||||||||||||||||||||||||
|
This method implements the "intermediate" server side interception point if the above #ifdef is set to 1 and a starting intercetion point if it is not set to 1.
Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 184 of file ServerInterceptorAdapter.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, TAO_ServerRequest::collocated(), TAO_ServerRequest::forward_location(), TAO_ServerRequest::interceptor_count(), interceptor_list_, TAO_ServerRequest::reply_status(), and send_other().
00192 {
00193 // This method implements one of the "starting" server side
00194 // interception point if extended interceptors are not in place.
00195
00196 ACE_TRY
00197 {
00198 // Copy the request scope current (RSC) to the thread scope
00199 // current (TSC) upon leaving this scope, i.e. just after the
00200 // receive_request_service_contexts() completes. A "guard" is
00201 // used to make the copy also occur if an exception is thrown.
00202 TAO::PICurrent_Guard const pi_guard (server_request,
00203 false /* Copy RSC to TSC */);
00204
00205 bool is_remote_request = !server_request.collocated ();
00206
00207 TAO::ServerRequestInfo request_info (server_request,
00208 args,
00209 nargs,
00210 servant_upcall,
00211 exceptions,
00212 nexceptions);
00213
00214 for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i)
00215 {
00216 ServerRequestInterceptor_List::RegisteredInterceptor& registered =
00217 this->interceptor_list_.registered_interceptor (i);
00218
00219 if (registered.details_.should_be_processed (is_remote_request))
00220 {
00221 registered.interceptor_->
00222 receive_request_service_contexts (&request_info
00223 ACE_ENV_ARG_PARAMETER);
00224 ACE_TRY_CHECK;
00225 }
00226
00227 // The starting interception point completed successfully.
00228 // Push the interceptor on to the flow stack.
00229 ++server_request.interceptor_count ();
00230 }
00231 }
00232 ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00233 {
00234 server_request.forward_location (exc.forward.in ());
00235 server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
00236 (void) this->send_other (server_request,
00237 args,
00238 nargs,
00239 servant_upcall,
00240 exceptions,
00241 nexceptions
00242 ACE_ENV_ARG_PARAMETER);
00243 ACE_TRY_CHECK;
00244 }
00245 ACE_ENDTRY;
00246 ACE_CHECK;
00247 }
|
|
||||||||||||||||||||||||||||
|
This method implements one of the "ending" server side interception points. Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 380 of file ServerInterceptorAdapter.cpp. References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_RE_THROW, ACE_TRY, ACE_TRY_CHECK, TAO_ServerRequest::caught_exception(), TAO_ServerRequest::collocated(), TAO_ServerRequest::forward_location(), TAO_ServerRequest::interceptor_count(), interceptor_list_, TAO_ServerRequest::reply_status(), and send_other().
00388 {
00389 // This is an "ending" server side interception point so we only
00390 // process the interceptors pushed on to the flow stack.
00391
00392 bool is_remote_request = !server_request.collocated ();
00393
00394 // Notice that the interceptors are processed in the opposite order
00395 // they were pushed onto the stack since this is an "ending" server
00396 // side interception point.
00397
00398 TAO::ServerRequestInfo request_info (server_request,
00399 args,
00400 nargs,
00401 servant_upcall,
00402 exceptions,
00403 nexceptions);
00404
00405 ACE_TRY
00406 {
00407 // Unwind the flow stack.
00408 size_t const len = server_request.interceptor_count ();
00409 for (size_t i = 0; i < len; ++i)
00410 {
00411 // Pop the interceptor off of the flow stack before it is
00412 // invoked. This is necessary to prevent an interceptor
00413 // already invoked in this "ending" interception point from
00414 // being invoked in another "ending" interception point.
00415 --server_request.interceptor_count ();
00416
00417 ServerRequestInterceptor_List::RegisteredInterceptor& registered =
00418 this->interceptor_list_.registered_interceptor (
00419 server_request.interceptor_count ());
00420
00421 if (registered.details_.should_be_processed (is_remote_request))
00422 {
00423 registered.interceptor_->
00424 send_exception (&request_info
00425 ACE_ENV_ARG_PARAMETER);
00426 ACE_TRY_CHECK;
00427 }
00428 }
00429 }
00430 ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00431 {
00432 server_request.forward_location (exc.forward.in ());
00433 server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
00434 this->send_other (server_request,
00435 args,
00436 nargs,
00437 servant_upcall,
00438 exceptions,
00439 nexceptions
00440 ACE_ENV_ARG_PARAMETER);
00441 ACE_TRY_CHECK;
00442 }
00443 ACE_CATCHANY
00444 {
00445 // The send_exception() interception point in the remaining
00446 // interceptors must be called so call this method (not the
00447 // interceptor's corresponding method) recursively. The call is
00448 // made recursively since the caught exception must survive
00449 // until the remaining interceptors have been called.
00450 //
00451 // Note that the recursion will stop once the flow stack size
00452 // drops to zero, i.e., once each interceptor has been invoked.
00453 // This prevents infinite recursion from occuring.
00454
00455 server_request.caught_exception (&ACE_ANY_EXCEPTION);
00456
00457 this->send_exception (server_request,
00458 args,
00459 nargs,
00460 servant_upcall,
00461 exceptions,
00462 nexceptions
00463 ACE_ENV_ARG_PARAMETER);
00464 ACE_TRY_CHECK;
00465
00466 PortableInterceptor::ReplyStatus status =
00467 server_request.reply_status ();
00468
00469 // Only re-throw the exception if it hasn't been transformed by
00470 // the send_exception() interception point (e.g. to a
00471 // LOCATION_FORWARD).
00472 if (status == PortableInterceptor::SYSTEM_EXCEPTION
00473 || status == PortableInterceptor::USER_EXCEPTION)
00474 ACE_RE_THROW;
00475 }
00476 ACE_ENDTRY;
00477 ACE_CHECK;
00478 }
|
|
||||||||||||||||||||||||||||
|
This method implements one of the "ending" server side interception points. Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 481 of file ServerInterceptorAdapter.cpp. References ACE_CATCH, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, TAO_ServerRequest::collocated(), TAO_ServerRequest::forward_location(), TAO_ServerRequest::interceptor_count(), interceptor_list_, and TAO_ServerRequest::reply_status(). Referenced by receive_request(), receive_request_service_contexts(), and send_exception().
00489 {
00490 // This is an "ending" server side interception point so we only
00491 // process the interceptors pushed on to the flow stack.
00492
00493 bool is_remote_request = !server_request.collocated ();
00494
00495 TAO::ServerRequestInfo request_info (server_request,
00496 args,
00497 nargs,
00498 servant_upcall,
00499 exceptions,
00500 nexceptions);
00501
00502 // Notice that the interceptors are processed in the opposite order
00503 // they were pushed onto the stack since this is an "ending" server
00504 // side interception point.
00505
00506 ACE_TRY
00507 {
00508 // Unwind the flow stack.
00509 size_t const len = server_request.interceptor_count ();
00510 for (size_t i = 0; i < len; ++i)
00511 {
00512 // Pop the interceptor off of the flow stack before it is
00513 // invoked. This is necessary to prevent an interceptor
00514 // already invoked in this "ending" interception point from
00515 // being invoked in another "ending" interception point.
00516 --server_request.interceptor_count ();
00517
00518 ServerRequestInterceptor_List::RegisteredInterceptor& registered =
00519 this->interceptor_list_.registered_interceptor (
00520 server_request.interceptor_count ());
00521
00522 if (registered.details_.should_be_processed (is_remote_request))
00523 {
00524 registered.interceptor_->
00525 send_other (&request_info
00526 ACE_ENV_ARG_PARAMETER);
00527 ACE_TRY_CHECK;
00528 }
00529 }
00530 }
00531 ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
00532 {
00533 server_request.forward_location (exc.forward.in ());
00534 server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
00535 this->send_other (server_request,
00536 args,
00537 nargs,
00538 servant_upcall,
00539 exceptions,
00540 nexceptions
00541 ACE_ENV_ARG_PARAMETER);
00542 ACE_TRY_CHECK;
00543 }
00544 ACE_ENDTRY;
00545 ACE_CHECK;
00546 }
|
|
||||||||||||||||||||||||||||
|
This method implements one of the "ending" server side interception points. Implements TAO::ServerRequestInterceptor_Adapter. Definition at line 326 of file ServerInterceptorAdapter.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_ServerRequest::collocated(), TAO_ServerRequest::interceptor_count(), and interceptor_list_.
00334 {
00335 // This is an "ending" interception point so we only process the
00336 // interceptors pushed on to the flow stack.
00337
00338 bool is_remote_request = !server_request.collocated ();
00339
00340 // Notice that the interceptors are processed in the opposite order
00341 // they were pushed onto the stack since this is an "ending"
00342 // interception point.
00343
00344 TAO::ServerRequestInfo request_info (server_request,
00345 args,
00346 nargs,
00347 servant_upcall,
00348 exceptions,
00349 nexceptions);
00350
00351 // Unwind the stack.
00352 size_t const len = server_request.interceptor_count ();
00353 for (size_t i = 0; i < len; ++i)
00354 {
00355 // Pop the interceptor off of the flow stack before it is
00356 // invoked. This is necessary to prevent an interceptor already
00357 // invoked in this "ending" interception point from being
00358 // invoked in another "ending" interception point.
00359 --server_request.interceptor_count ();
00360
00361 ServerRequestInterceptor_List::RegisteredInterceptor& registered =
00362 this->interceptor_list_.registered_interceptor (
00363 server_request.interceptor_count ());
00364
00365 if (registered.details_.should_be_processed (is_remote_request))
00366 {
00367 registered.interceptor_->
00368 send_reply (&request_info
00369 ACE_ENV_ARG_PARAMETER);
00370 ACE_CHECK;
00371 }
00372 }
00373
00374 // The send_reply() interception point does not raise a
00375 // PortableInterceptor::ForwardRequest exception so there is no need
00376 // to attempt to catch it here.
00377 }
|
|
|
List of registered interceptors.
Definition at line 184 of file ServerInterceptorAdapter.h. Referenced by add_interceptor(), destroy_interceptors(), receive_request(), receive_request_service_contexts(), send_exception(), send_other(), and send_reply(). |
1.3.6