diff options
161 files changed, 3473 insertions, 2527 deletions
diff --git a/ChangeLog b/ChangeLog index ea6d4f734d4..18255522aaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Fri Jul 1 11:25:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/MakeProjectCreator/config/interceptors.mpb + Don't use pi as base lib. + + * bin/MakeProjectCreator/config/iorinterceptor.mpb + * bin/MakeProjectCreator/config/loadbalancing.mpb + * bin/MakeProjectCreator/config/rtscheduling.mpb: + * bin/MakeProjectCreator/config/fault_tolerance.mpb + * bin/MakeProjectCreator/config/ftclientorb.mpb + Added pi and pi_server as base projects when needed + Fri Jul 1 10:05:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> * bin/MakeProjectCreator/templates/bor.mpd: diff --git a/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/ReplicaController.h b/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/ReplicaController.h index 07ae5071b8b..fe159ae328d 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/ReplicaController.h +++ b/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/ReplicaController.h @@ -8,6 +8,7 @@ #include "ace/TMCast/GroupFwd.hpp" #include "tao/corba.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableServer/PortableServer.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/RolyPoly.mpc b/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/RolyPoly.mpc index 4b7dece36d4..d1cf05d0d2c 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/RolyPoly.mpc +++ b/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/RolyPoly.mpc @@ -1,5 +1,5 @@ // $Id$ -project(*Server): orbsvcsexe, fault_tolerance, tmcast, interceptors { +project(*Server): orbsvcsexe, fault_tolerance, tmcast, pi_server, interceptors { Source_Files { RolyPoly_i.cpp ORB_Initializer.cpp diff --git a/TAO/orbsvcs/examples/LoadBalancing/LoadBalancing.mpc b/TAO/orbsvcs/examples/LoadBalancing/LoadBalancing.mpc index 9b53614a46f..704dd916769 100644 --- a/TAO/orbsvcs/examples/LoadBalancing/LoadBalancing.mpc +++ b/TAO/orbsvcs/examples/LoadBalancing/LoadBalancing.mpc @@ -1,6 +1,5 @@ // $Id$ -project(*Server): taoexe, loadbalancing, exceptions { - includes += $(TAO_ROOT)/orbsvcs +project(*Server): taoexe, loadbalancing, pi_server, exceptions { Source_Files { ServerRequestInterceptor.cpp ORBInitializer.cpp @@ -11,7 +10,7 @@ project(*Server): taoexe, loadbalancing, exceptions { } } -project(*Client): taoexe, strategies { +project(*Client): taoclient, strategies { Source_Files { TestC.cpp client.cpp diff --git a/TAO/orbsvcs/examples/LoadBalancing/ServerRequestInterceptor.h b/TAO/orbsvcs/examples/LoadBalancing/ServerRequestInterceptor.h index 015a3bb61a7..189a1cad016 100644 --- a/TAO/orbsvcs/examples/LoadBalancing/ServerRequestInterceptor.h +++ b/TAO/orbsvcs/examples/LoadBalancing/ServerRequestInterceptor.h @@ -20,6 +20,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.mpc b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.mpc index 8081c8487ca..88c5793a5a5 100644 --- a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.mpc +++ b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project : orbsvcslib, core, naming, iormanip, portablegroup, ami, minimum_corba, iorinterceptor { +project : orbsvcslib, core, naming, iormanip, portablegroup, ami, minimum_corba, pi, pi_server, iorinterceptor { sharedname = TAO_CosLoadBalancing idlflags += -Wb,export_macro=TAO_LoadBalancing_Export -Wb,export_include=orbsvcs/LoadBalancing/LoadBalancing_export.h dynamicflags = TAO_LOADBALANCING_BUILD_DLL diff --git a/TAO/orbsvcs/orbsvcs/FTORB.mpc b/TAO/orbsvcs/orbsvcs/FTORB.mpc index 340380679b8..226721c3de6 100644 --- a/TAO/orbsvcs/orbsvcs/FTORB.mpc +++ b/TAO/orbsvcs/orbsvcs/FTORB.mpc @@ -60,7 +60,7 @@ project(FT_ClientORB) : orbsvcslib, ftorbutils, core, messaging, portablegroup, } } -project(FT_ServerORB) : orbsvcslib, ftorbutils, core, messaging, portablegroup, interceptors { +project(FT_ServerORB) : orbsvcslib, ftorbutils, core, messaging, portablegroup, pi_server, pi, interceptors { sharedname = TAO_FT_ServerORB dynamicflags = TAO_FT_SERVERORB_BUILD_DLL tagchecks += FT_ServerORB diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance.mpc b/TAO/orbsvcs/orbsvcs/FaultTolerance.mpc index b1d216f8bbe..7ea57b8282e 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance.mpc +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(FaultTolerance): orbsvcslib, core, notification, ftorb, portablegroup, minimum_corba { +project(FaultTolerance): orbsvcslib, core, pi, pi_server, notification, ftorb, portablegroup, minimum_corba { sharedname = TAO_FaultTolerance idlflags += -Wb,export_macro=TAO_FT_Export -Wb,export_include=orbsvcs/FaultTolerance/fault_tol_export.h -Wb,skel_export_include=tao/PortableServer/PolicyS.h dynamicflags = TAO_FT_BUILD_DLL diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.h index 1b4f8de7cd7..8f82b1f8089 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.h +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.h @@ -18,6 +18,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/TimeBaseC.h" diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.h b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.h index cf0c31f3e39..6a86deacb93 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.h +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.h @@ -23,6 +23,7 @@ #include "FT_ServerORB_export.h" #include "tao/LocalObject.h" #include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/ORB.h" #if defined(_MSC_VER) diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent.mpc b/TAO/orbsvcs/orbsvcs/FtRtEvent.mpc index 16c31ee3547..97744bf45cf 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent.mpc +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent.mpc @@ -37,7 +37,7 @@ project (FtRtEvent) : orbsvcslib, core, ftorbutils, rtevent_serv, naming, minimu } } -project (FTRT_ClientORB) : messaging, orbsvcslib, core { +project (FTRT_ClientORB) : messaging, orbsvcslib, pi, core { sharedname = TAO_FTRT_ClientORB dynamicflags = TAO_FTRT_BUILD_DLL tagchecks = FTRT_ClientORB diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/ClientORB/FTRT_ClientORB_Interceptor.h b/TAO/orbsvcs/orbsvcs/FtRtEvent/ClientORB/FTRT_ClientORB_Interceptor.h index 9a3841f4089..98cbc108bbe 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/ClientORB/FTRT_ClientORB_Interceptor.h +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/ClientORB/FTRT_ClientORB_Interceptor.h @@ -17,6 +17,7 @@ #include /**/ "ace/pre.h" +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/ForwardCtrlServerInterceptor.h b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/ForwardCtrlServerInterceptor.h index 659dfff81f3..4173d2a7e56 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/ForwardCtrlServerInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/ForwardCtrlServerInterceptor.h @@ -11,7 +11,9 @@ //============================================================================= #ifndef FORWARDCTRLSERVERINTERCEPTOR_H #define FORWARDCTRLSERVERINTERCEPTOR_H + #include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/PI_Server.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FtEventServiceInterceptor.h b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FtEventServiceInterceptor.h index b1fe1c99b87..7ac78c1369b 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FtEventServiceInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/FtEventServiceInterceptor.h @@ -18,6 +18,7 @@ #include "tao/LocalObject.h" #include "tao/ORB.h" #include "orbsvcs/FtRtecEventChannelAdminC.h" +#include "tao/PI_Server/PI_Server.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.h b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.h index 45265241b33..835ecab637c 100644 --- a/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.h +++ b/TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/Set_Update_Interceptor.h @@ -13,9 +13,9 @@ #ifndef TAO_SET_UPDATE_INTERCEPTOR_H #define TAO_SET_UPDATE_INTERCEPTOR_H +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" -//#include "tao/TimeBaseC.h" #include "ace/Atomic_Op.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -28,13 +28,12 @@ #endif /* _MSC_VER */ /** - * @class TAO_FT_ClientRequest_Interceptor + * @class TAO_Set_Update_Interceptor * * @brief Interceptors for adding service context to set_update() and * oneway_set_update() methods. * */ - class TAO_Set_Update_Interceptor : public virtual PortableInterceptor::ClientRequestInterceptor, public virtual TAO_Local_RefCounted_Object diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ClientRequestInterceptor.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ClientRequestInterceptor.h index 22de5664cda..6dbb4b71ae3 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ClientRequestInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ClientRequestInterceptor.h @@ -20,6 +20,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.h index f15bb6600b6..dc41b7dbf7b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.h @@ -24,6 +24,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/orbsvcs/orbsvcs/Security.mpc b/TAO/orbsvcs/orbsvcs/Security.mpc index e94d33cd2f7..71b9446efb0 100644 --- a/TAO/orbsvcs/orbsvcs/Security.mpc +++ b/TAO/orbsvcs/orbsvcs/Security.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(Security) : orbsvcslib, corba_messaging, core, portableserver, interceptors, valuetype { +project(Security) : orbsvcslib, corba_messaging, core, portableserver, pi, interceptors, valuetype { sharedname = TAO_Security idlflags += -Wb,export_macro=TAO_Security_Export -Wb,export_include=orbsvcs/Security/security_export.h dynamicflags = TAO_SECURITY_BUILD_DLL @@ -34,7 +34,7 @@ project(Security) : orbsvcslib, corba_messaging, core, portableserver, intercept } Header_Files { - Security/security_export.h + Security/security_export.h } Template_Files { diff --git a/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/LoadBalancing.mpc b/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/LoadBalancing.mpc index 4f1c2eb5531..87e5d8cb4dc 100644 --- a/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/LoadBalancing.mpc +++ b/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/LoadBalancing.mpc @@ -1,7 +1,5 @@ // $Id$ -project(*Performance_Server): loadbalancing, strategies { - includes += $(TAO_ROOT)/orbsvcs - +project(*Performance_Server): loadbalancing, pi_server, strategies { Source_Files { server.cpp Roundtrip.cpp diff --git a/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/ServerRequestInterceptor.h b/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/ServerRequestInterceptor.h index 015a3bb61a7..86f905dd6cd 100644 --- a/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/ServerRequestInterceptor.h +++ b/TAO/orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/ServerRequestInterceptor.h @@ -20,9 +20,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" - #include "ace/Atomic_Op.h" #if defined(_MSC_VER) diff --git a/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/GroupRef_Manipulation.mpc b/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/GroupRef_Manipulation.mpc index 9e3939ae70a..bc7014b5c11 100644 --- a/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/GroupRef_Manipulation.mpc +++ b/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/GroupRef_Manipulation.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, orbsvcsexe, iormanip, ftorb, messaging { +project(*Server): taoserver, orbsvcsexe, iormanip, ftorb, pi_server, messaging { idlflags += -DCORBA3 -I$(TAO_ROOT) Source_Files { diff --git a/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/test.idl b/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/test.idl index 0c8c9980368..b286a53a1db 100644 --- a/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/test.idl +++ b/TAO/orbsvcs/tests/FaultTolerance/GroupRef_Manipulation/test.idl @@ -1,6 +1,7 @@ // -*- IDL -*- //$Id$ #include "tao/PortableInterceptor.pidl" +#include "tao/PI_Server/ServerRequestInterceptor.pidl" module ForwardRequestTest { diff --git a/TAO/tao/ClientRequestInfo.cpp b/TAO/tao/ClientRequestInfo.cpp index cd4469c8b57..aa8ab36a099 100644 --- a/TAO/tao/ClientRequestInfo.cpp +++ b/TAO/tao/ClientRequestInfo.cpp @@ -20,10 +20,6 @@ ACE_RCSID (tao, #include "debug.h" #include "Service_Context.h" -# if !defined (__ACE_INLINE__) -# include "ClientRequestInfo.inl" -# endif /* !__ACE_INLINE__ */ - TAO_ClientRequestInfo::TAO_ClientRequestInfo (TAO::Invocation_Base *inv) : invocation_ (inv), caught_exception_ (0), @@ -674,4 +670,12 @@ TAO_ClientRequestInfo::forward_reference ( this->reply_status_ = PortableInterceptor::LOCATION_FORWARD; } +void +TAO_ClientRequestInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL) +{ + if (this->invocation_ == 0) + ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, + CORBA::COMPLETED_NO)); +} + #endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/ClientRequestInfo.h b/TAO/tao/ClientRequestInfo.h index fc8000cc0ab..ec76c05c467 100644 --- a/TAO/tao/ClientRequestInfo.h +++ b/TAO/tao/ClientRequestInfo.h @@ -64,7 +64,8 @@ namespace Messaging * @brief Implementation of the PortableInterceptor::ClientRequestInfo * interface. */ -class TAO_ClientRequestInfo +/// @todo TAO_Export is temporarily +class TAO_Export TAO_ClientRequestInfo : public virtual PortableInterceptor::ClientRequestInfo, public virtual TAO_Local_RefCounted_Object { @@ -230,7 +231,7 @@ public: void exception (CORBA::Exception *exception); /// Set the status of the received reply. - void reply_status (TAO::Invocation_Status s); + void reply_status (TAO::Invocation_Status invoke_status); /// Extract the forward object reference from the /// PortableInterceptor::ForwardRequest exception, and set the reply @@ -287,12 +288,6 @@ private: TAO::PICurrent_Copy_Callback copy_callback_; }; -// ------------------------------------------------------------------- - -# if defined (__ACE_INLINE__) -# include "ClientRequestInfo.inl" -# endif /* __ACE_INLINE__ */ - #if defined(_MSC_VER) #pragma warning(pop) #endif /* _MSC_VER */ diff --git a/TAO/tao/ClientRequestInfo.inl b/TAO/tao/ClientRequestInfo.inl deleted file mode 100644 index a858b760285..00000000000 --- a/TAO/tao/ClientRequestInfo.inl +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "SystemException.h" - -ACE_INLINE void -TAO_ClientRequestInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL) -{ - if (this->invocation_ == 0) - ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, - CORBA::COMPLETED_NO)); -} - diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.cpp b/TAO/tao/ClientRequestInterceptor_Adapter.cpp index 6460af294ee..1bf7fb37f7b 100644 --- a/TAO/tao/ClientRequestInterceptor_Adapter.cpp +++ b/TAO/tao/ClientRequestInterceptor_Adapter.cpp @@ -1,17 +1,5 @@ #include "ClientRequestInterceptor_Adapter.h" -#if TAO_HAS_INTERCEPTORS == 1 - -#if !defined (__ACE_INLINE__) -#include "ClientRequestInterceptor_Adapter.inl" -#endif /* defined INLINE */ - -#include "ClientRequestInfo.h" -#include "Invocation_Base.h" -#include "ORB_Core.h" -#include "ORB_Core_TSS_Resources.h" -#include "PortableInterceptorC.h" - ACE_RCSID (tao, ClientInterceptorAdapter, "$Id$") @@ -21,187 +9,6 @@ namespace TAO ClientRequestInterceptor_Adapter::~ClientRequestInterceptor_Adapter (void) { } +} - void - ClientRequestInterceptor_Adapter::send_request (TAO_ClientRequestInfo *ri - ACE_ENV_ARG_DECL) - { - // This method implements one of the "starting" client side - // interception point. - ACE_TRY - { - for (size_t i = 0 ; i < this->interceptors_.size (); ++i) - { - this->interceptors_[i]->send_request (ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // The starting interception point completed successfully. - // Push the interceptor on to the flow stack. - ++this->stack_size_; - } - } - ACE_CATCH (PortableInterceptor::ForwardRequest, exc) - { - this->process_forward_request (ri, - exc - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_ENDTRY; - ACE_CHECK; - } - - void - ClientRequestInterceptor_Adapter::receive_reply (TAO_ClientRequestInfo *ri - ACE_ENV_ARG_DECL) - { - // This is an "ending" interception point so we only process the - // interceptors pushed on to the flow stack. - - // Notice that the interceptors are processed in the opposite order - // they were pushed onto the stack since this is an "ending" - // interception point. - - // Unwind the stack. - const size_t len = this->stack_size_; - for (size_t i = 0; i < len; ++i) - { - // Pop the interceptor off of the flow stack before it is - // invoked. This is necessary to prevent an interceptor already - // invoked in this "ending" interception point from being - // invoked in another "ending" interception point. - --this->stack_size_; - - this->interceptors_[this->stack_size_]->receive_reply ( - ri - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - // The receive_reply() interception point does not raise a - // PortableInterceptor::ForwardRequest exception so there is no need - // to attempt to catch it here. - } - - void - ClientRequestInterceptor_Adapter::receive_exception (TAO_ClientRequestInfo *ri - ACE_ENV_ARG_DECL) - { - // This is an "ending" interception point so we only process the - // interceptors pushed on to the flow stack. - - // Notice that the interceptors are processed in the opposite order - // they were pushed onto the stack since this is an "ending" - // interception point. - - ACE_TRY - { - // Unwind the flow stack. - const size_t len = this->stack_size_; - for (size_t i = 0; i < len; ++i) - { - // Pop the interceptor off of the flow stack before it is - // invoked. This is necessary to prevent an interceptor - // already invoked in this "ending" interception point from - // being invoked in another "ending" interception point. - --this->stack_size_; - - this->interceptors_[this->stack_size_]->receive_exception ( - ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (PortableInterceptor::ForwardRequest, exc) - { - this->process_forward_request (ri, exc ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // The receive_exception() interception point in the remaining - // interceptors must be called so call this method (not the - // interceptor's corresponding method) recursively. The call is - // made recursively since the caught exception must survive - // until the remaining interceptors have been called. - - // Note that the recursion will stop once the flow stack size - // drops to zero, i.e., once each interceptor has been invoked. - // This prevents infinite recursion from occuring. - - ri->exception (&ACE_ANY_EXCEPTION); - - this->receive_exception (ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableInterceptor::ReplyStatus status = - ri->reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Only re-throw the exception if it hasn't been transformed by - // the receive_exception() interception point (e.g. to a - // LOCATION_FORWARD). - if (status == PortableInterceptor::SYSTEM_EXCEPTION - || status == PortableInterceptor::USER_EXCEPTION) - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; - } - - void - ClientRequestInterceptor_Adapter::receive_other (TAO_ClientRequestInfo *ri - ACE_ENV_ARG_DECL) - { - // This is an "ending" interception point so we only process the - // interceptors pushed on to the flow stack. - - // Notice that the interceptors are processed in the opposite order - // they were pushed onto the stack since this is an "ending" - // interception point. - - ACE_TRY - { - // Unwind the stack. - const size_t len = this->stack_size_; - for (size_t i = 0; i < len; ++i) - { - // Pop the interceptor off of the flow stack before it is - // invoked. This is necessary to prevent an interceptor - // already invoked in this "ending" interception point from - // being invoked in another "ending" interception point. - --this->stack_size_; - - this->interceptors_[this->stack_size_]->receive_other ( - ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (PortableInterceptor::ForwardRequest, exc) - { - this->process_forward_request (ri, exc ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_ENDTRY; - ACE_CHECK; - } - - void - ClientRequestInterceptor_Adapter::process_forward_request ( - TAO_ClientRequestInfo *ri, - PortableInterceptor::ForwardRequest &exc - ACE_ENV_ARG_DECL) - { - ri->forward_reference (exc); - - this->invocation_->forwarded_reference (exc.forward.in ()); - // receive_other() is potentially invoked recursively. - this->receive_other (ri - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} -#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.h b/TAO/tao/ClientRequestInterceptor_Adapter.h index e2a379e027e..b9dfe2eed56 100644 --- a/TAO/tao/ClientRequestInterceptor_Adapter.h +++ b/TAO/tao/ClientRequestInterceptor_Adapter.h @@ -26,21 +26,16 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "orbconf.h" +#include "ace/CORBA_macros.h" -#if TAO_HAS_INTERCEPTORS == 1 - -#include "ClientRequestInterceptorC.h" -#include "Interceptor_List.h" +class TAO_ClientRequestInfo; -namespace TAO +namespace PortableInterceptor { - typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor> - ClientRequestInterceptor_List; + class ClientRequestInterceptor; + typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr; } -class TAO_ClientRequestInfo; - namespace TAO { class Invocation_Base; @@ -58,13 +53,7 @@ namespace TAO class TAO_Export ClientRequestInterceptor_Adapter { public: - - ClientRequestInterceptor_Adapter ( - ClientRequestInterceptor_List::TYPE & interceptors, - Invocation_Base *invocation - ); - - ~ClientRequestInterceptor_Adapter (void); + virtual ~ClientRequestInterceptor_Adapter (void); /** * @name PortableInterceptor Client Side Interception Points @@ -77,54 +66,37 @@ namespace TAO //@{ /// This method implements one of the "starting" client side /// interception points. - void send_request (TAO_ClientRequestInfo * ri - ACE_ENV_ARG_DECL); + virtual void send_request (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; /// This method implements one of the "ending" client side /// interception point. - void receive_reply (TAO_ClientRequestInfo * ri - ACE_ENV_ARG_DECL); + virtual void receive_reply (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; /// This method implements one of the "ending" client side /// interception point. - void receive_exception (TAO_ClientRequestInfo * ri - ACE_ENV_ARG_DECL); + virtual void receive_exception (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; /// This method implements one of the "ending" client side /// interception point. - void receive_other (TAO_ClientRequestInfo * ri - ACE_ENV_ARG_DECL); - //@} + virtual void receive_other (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; - protected: + /// Register an interceptor. + virtual void add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) = 0; - /// Process the given PortableInterceptor::ForwardRequest exception, - /// i.e. invoke the receive_other() interception point, in addition - /// to notifying the Invocation object of the LOCATION_FORWARD. - void process_forward_request (TAO_ClientRequestInfo * ri, - PortableInterceptor::ForwardRequest & exc - ACE_ENV_ARG_DECL); - - private: - - /// Reference to the list of registered interceptors. - ClientRequestInterceptor_List::TYPE & interceptors_; - - /// Pointer to the GIOP invocation object for the current request. - Invocation_Base * invocation_; - - /// The number of interceptors "pushed" onto the logical flow - /// stack. This is used when unwinding the flow stack. - size_t stack_size_; + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0; }; } -#if defined (__ACE_INLINE__) -#include "ClientRequestInterceptor_Adapter.inl" -#endif /* __ACE_INLINE__ */ - -#endif /* TAO_HAS_INTERCEPTORS */ - #include /**/ "ace/post.h" #endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_H */ diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.inl b/TAO/tao/ClientRequestInterceptor_Adapter.inl deleted file mode 100644 index ca0758ef582..00000000000 --- a/TAO/tao/ClientRequestInterceptor_Adapter.inl +++ /dev/null @@ -1,16 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -namespace TAO -{ - ACE_INLINE - ClientRequestInterceptor_Adapter::ClientRequestInterceptor_Adapter ( - ClientRequestInterceptor_List::TYPE & interceptors, - Invocation_Base * invocation) - : interceptors_ (interceptors) - , invocation_ (invocation) - , stack_size_ (0) - { - } -} diff --git a/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h new file mode 100644 index 00000000000..e34753d8777 --- /dev/null +++ b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h @@ -0,0 +1,47 @@ +// This may look like C, but it's really -*- C++ -*- + +//============================================================================= +/** + * @file ClientRequestInterceptor_Adapter_Factory.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + + +#ifndef TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H +#define TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Object.h" + + +namespace TAO +{ + class ClientRequestInterceptor_Adapter; +} + +/** + * @class TAO_ClientRequestInterceptor_Adapter_Factory + * + * @brief TAO_ClientRequestInterceptor_Adapter_Factory. + */ +class TAO_Export TAO_ClientRequestInterceptor_Adapter_Factory + : public ACE_Service_Object +{ +public: + virtual TAO::ClientRequestInterceptor_Adapter *create (void) = 0; +}; + +#include /**/ "ace/post.h" + +#endif /* TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H */ diff --git a/TAO/tao/IORInterceptor/IORInterceptor.pidl b/TAO/tao/IORInterceptor/IORInterceptor.pidl index cd1a0454ea9..6247886f787 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor.pidl +++ b/TAO/tao/IORInterceptor/IORInterceptor.pidl @@ -36,7 +36,7 @@ #ifndef _IOR_INTERCEPTOR_IDL_ #define _IOR_INTERCEPTOR_IDL_ -#include "tao/PortableInterceptor.pidl" +#include "tao/PI/Interceptor.pidl" #include "tao/IORInterceptor/IORInfo.pidl" #include "tao/ObjRefTemplate/ObjectReferenceTemplate.pidl" diff --git a/TAO/tao/IORInterceptor/IORInterceptorC.h b/TAO/tao/IORInterceptor/IORInterceptorC.h index d8c358510ec..62091a216d1 100644 --- a/TAO/tao/IORInterceptor/IORInterceptorC.h +++ b/TAO/tao/IORInterceptor/IORInterceptorC.h @@ -50,7 +50,7 @@ #include "tao/Object.h" #include "tao/Objref_VarOut_T.h" -#include "tao/PortableInterceptorC.h" +#include "tao/PI/InterceptorC.h" #include "tao/IORInterceptor/IORInfoC.h" #include "tao/ObjRefTemplate/ObjectReferenceTemplateC.h" diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp index 07fb9b3f9e8..1165fa9ab6c 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp @@ -23,15 +23,9 @@ TAO_IORInterceptor_Adapter_Impl::add_interceptor ( ACE_ENV_ARG_DECL ) { - int retval = - this->ior_interceptor_list_.add_interceptor (i - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (retval == -1) - { - ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ()); - } + this->ior_interceptor_list_.add_interceptor (i + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void @@ -49,10 +43,7 @@ TAO_IORInterceptor_Adapter_Impl::establish_components ( ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO::IORInterceptor_List::TYPE & interceptors = - this->ior_interceptor_list_.interceptors (); - - const size_t interceptor_count = interceptors.size (); + const size_t interceptor_count = this->ior_interceptor_list_.size (); if (interceptor_count == 0) return; @@ -78,8 +69,9 @@ TAO_IORInterceptor_Adapter_Impl::establish_components ( { ACE_TRY { - interceptors[i]->establish_components (info.in () - ACE_ENV_ARG_PARAMETER); + this->ior_interceptor_list_.interceptor (i)->establish_components ( + info.in () + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY @@ -91,8 +83,9 @@ TAO_IORInterceptor_Adapter_Impl::establish_components ( // IORInterceptors. if (TAO_debug_level > 1) { - CORBA::String_var name = interceptors[i]->name ( - ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::String_var name = + this->ior_interceptor_list_.interceptor (i)->name ( + ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; // @@ What do we do if we get an exception here? @@ -133,10 +126,7 @@ TAO_IORInterceptor_Adapter_Impl::components_established ( // Iterate over the registered IOR interceptors so that they may be // given the opportunity to add tagged components to the profiles // for this servant. - TAO::IORInterceptor_List::TYPE & interceptors = - this->ior_interceptor_list_.interceptors (); - - const size_t interceptor_count = interceptors.size (); + const size_t interceptor_count = this->ior_interceptor_list_.size (); // All the establish_components() interception points have been // invoked. Now call the components_established() interception point @@ -145,7 +135,7 @@ TAO_IORInterceptor_Adapter_Impl::components_established ( { ACE_TRY { - interceptors[j]->components_established ( + this->ior_interceptor_list_.interceptor (j)->components_established ( info ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -167,10 +157,7 @@ TAO_IORInterceptor_Adapter_Impl::adapter_state_changed ( ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO::IORInterceptor_List::TYPE interceptors = - this->ior_interceptor_list_.interceptors(); - - const size_t interceptor_count = interceptors.size (); + const size_t interceptor_count = this->ior_interceptor_list_.size (); if (interceptor_count == 0) return; @@ -191,9 +178,10 @@ TAO_IORInterceptor_Adapter_Impl::adapter_state_changed ( for (size_t i = 0; i < interceptor_count; ++i) { - interceptors[i]->adapter_state_changed (seq_obj_ref_template, - state - ACE_ENV_ARG_PARAMETER); + this->ior_interceptor_list_.interceptor (i)->adapter_state_changed ( + seq_obj_ref_template, + state + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } } @@ -208,17 +196,14 @@ TAO_IORInterceptor_Adapter_Impl::adapter_manager_state_changed ( /// Whenever the POAManager state is changed, the /// adapter_manager_state_changed method is to be invoked on all the IOR /// Interceptors. - TAO::IORInterceptor_List::TYPE & interceptors = - this->ior_interceptor_list_.interceptors (); - - const size_t interceptor_count = interceptors.size (); + const size_t interceptor_count = this->ior_interceptor_list_.size (); if (interceptor_count == 0) return; for (size_t i = 0; i < interceptor_count; ++i) { - interceptors[i]->adapter_manager_state_changed ( + this->ior_interceptor_list_.interceptor(i)->adapter_manager_state_changed ( id, state ACE_ENV_ARG_PARAMETER); diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h index 3dcf89c485c..f1336733eb8 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h @@ -24,6 +24,13 @@ #include "tao/IORInterceptor_Adapter.h" #include "tao/IORInterceptor/IORInterceptor.h" +#include "tao/PI/Interceptor_List_T.h" + +namespace TAO +{ + typedef Interceptor_List< ::PortableInterceptor::IORInterceptor> + IORInterceptor_List; +} class TAO_Root_POA; diff --git a/TAO/tao/IORInterceptor_Adapter.h b/TAO/tao/IORInterceptor_Adapter.h index f75ad7d504c..c37d8a3a940 100644 --- a/TAO/tao/IORInterceptor_Adapter.h +++ b/TAO/tao/IORInterceptor_Adapter.h @@ -24,12 +24,9 @@ #include "tao/SystemException.h" #include "tao/PI_ForwardC.h" -#include "tao/Interceptor_List.h" namespace PortableInterceptor { - class Interceptor; - typedef Interceptor *Interceptor_ptr; class IORInterceptor; typedef IORInterceptor *IORInterceptor_ptr; class IORInfo; @@ -39,9 +36,6 @@ namespace PortableInterceptor namespace TAO { - typedef Interceptor_List< ::PortableInterceptor::IORInterceptor> - IORInterceptor_List; - typedef ACE_Array_Base< ::PortableInterceptor::ObjectReferenceTemplate*> ObjectReferenceTemplate_Array; } diff --git a/TAO/tao/Invocation_Base.cpp b/TAO/tao/Invocation_Base.cpp index c3dc8aed96f..ac94484a0ca 100644 --- a/TAO/tao/Invocation_Base.cpp +++ b/TAO/tao/Invocation_Base.cpp @@ -5,14 +5,16 @@ #include "TypeCode.h" #include "DynamicC.h" #include "SystemException.h" +#include "PortableInterceptor.h" /* Must always be visible. */ + +#include "ace/Dynamic_Service.h" #if TAO_HAS_INTERCEPTORS == 1 # include "PortableInterceptorC.h" # include "RequestInfo_Util.h" +# include "ClientRequestInterceptor_Adapter_Factory.h" #endif /* TAO_HAS_INTERCEPTORS == 1*/ -#include "PortableInterceptor.h" /* Must always be visible. */ - #if !defined (__ACE_INLINE__) # include "Invocation_Base.inl" #endif /* __ACE_INLINE__ */ @@ -38,15 +40,16 @@ namespace TAO , orb_core_ (stub->orb_core ()) , stub_ (stub) #if TAO_HAS_INTERCEPTORS == 1 - , adapter_ (orb_core_->client_request_interceptors (), - this) + , adapter_ (orb_core_->clientrequestinterceptor_adapter ()) , req_info_ (this) + , stack_size_ (0) #endif /*TAO_HAS_INTERCEPTORS == 1*/ { } Invocation_Base::~Invocation_Base (void) { + adapter_ = 0; } void @@ -140,37 +143,41 @@ namespace TAO Invocation_Base::send_request_interception (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_TRY - { - this->adapter_.send_request (&this->req_info_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - (void) this->handle_any_exception (&ACE_ANY_EXCEPTION - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // This is a begin interception point - ACE_RE_THROW; - } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL + if (adapter_ != 0) { - (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // This is a begin interception point - ACE_RE_THROW; + ACE_TRY + { + this->adapter_->send_request (*this, + &this->req_info_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + (void) this->handle_any_exception (&ACE_ANY_EXCEPTION + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // This is a begin interception point + ACE_RE_THROW; + } + # if defined (ACE_HAS_EXCEPTIONS) \ + && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) + ACE_CATCHALL + { + (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // This is a begin interception point + ACE_RE_THROW; + } + # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ + ACE_ENDTRY; + ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); + + if (this->forwarded_to_.in ()) + return TAO_INVOKE_RESTART; } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); - - if (this->forwarded_to_.in ()) - return TAO_INVOKE_RESTART; // What are the other cases?? return TAO_INVOKE_SUCCESS; @@ -180,40 +187,44 @@ namespace TAO Invocation_Base::receive_reply_interception (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_TRY - { - this->adapter_.receive_reply (&this->req_info_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY + if (adapter_ != 0) { - (void) this->handle_any_exception (&ACE_ANY_EXCEPTION + ACE_TRY + { + this->adapter_->receive_reply (*this, + &this->req_info_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_RE_THROW; - } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL - { - (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_RE_THROW; + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + (void) this->handle_any_exception (&ACE_ANY_EXCEPTION + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_RE_THROW; + } + # if defined (ACE_HAS_EXCEPTIONS) \ + && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) + ACE_CATCHALL + { + (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_RE_THROW; + } + # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ + ACE_ENDTRY; + ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); + + const PortableInterceptor::ReplyStatus status = + this->req_info_.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); + + if (status == PortableInterceptor::LOCATION_FORWARD || + status == PortableInterceptor::TRANSPORT_RETRY) + return TAO_INVOKE_RESTART; } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); - - const PortableInterceptor::ReplyStatus status = - this->req_info_.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); - - if (status == PortableInterceptor::LOCATION_FORWARD || - status == PortableInterceptor::TRANSPORT_RETRY) - return TAO_INVOKE_RESTART; return TAO_INVOKE_SUCCESS; } @@ -223,35 +234,39 @@ namespace TAO Invocation_Base::receive_other_interception (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_TRY + if (adapter_ != 0) { - this->adapter_.receive_other (&this->req_info_ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - (void) this->handle_any_exception (&ACE_ANY_EXCEPTION + ACE_TRY + { + this->adapter_->receive_other (*this, + &this->req_info_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_RE_THROW; + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + (void) this->handle_any_exception (&ACE_ANY_EXCEPTION + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_RE_THROW; + } + # if defined (ACE_HAS_EXCEPTIONS) \ + && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) + ACE_CATCHALL + { + (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_RE_THROW; + } + # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ + ACE_ENDTRY; + ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); + + if (this->forwarded_to_.in ()) + return TAO_INVOKE_RESTART; } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL - { - (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_RE_THROW; - } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); - - if (this->forwarded_to_.in ()) - return TAO_INVOKE_RESTART; return TAO_INVOKE_SUCCESS; } @@ -262,9 +277,13 @@ namespace TAO { this->req_info_.exception (ex); - this->adapter_.receive_exception (&this->req_info_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN); + if (adapter_ != 0) + { + this->adapter_->receive_exception (*this, + &this->req_info_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN); + } const PortableInterceptor::ReplyStatus status = this->req_info_.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -280,9 +299,13 @@ namespace TAO this->req_info_.exception (&ex); - this->adapter_.receive_exception (&this->req_info_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN); + if (adapter_ != 0) + { + this->adapter_->receive_exception (*this, + &this->req_info_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN); + } const PortableInterceptor::ReplyStatus status = this->req_info_.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); diff --git a/TAO/tao/Invocation_Base.h b/TAO/tao/Invocation_Base.h index 452f9436de3..c905410d662 100644 --- a/TAO/tao/Invocation_Base.h +++ b/TAO/tao/Invocation_Base.h @@ -108,7 +108,7 @@ namespace TAO CORBA::Object_ptr target (void) const; /// Does this invocation return a response? - CORBA::Boolean response_expected (void) const; + CORBA::Boolean response_expected (void) const; //@} protected: @@ -142,7 +142,8 @@ namespace TAO private: - ACE_UNIMPLEMENTED_FUNC (Invocation_Base & operator= (const Invocation_Base &)) + Invocation_Base (const Invocation_Base&); + Invocation_Base & operator= (const Invocation_Base &); private: //@{ @@ -192,6 +193,15 @@ namespace TAO /// Return the syncscope policy of the operation. CORBA::Octet sync_scope (void) const; + /// Return a reference to the number of interceptors pushed on to + /// the current interceptor flow stack. + /** + * @note It is a reference since the Portable Interceptor flow stack + * code must be able to modify this value and use that value + * at a later time without being forced to use TSS. + */ + size_t &stack_size (void); + protected: /// Helper method to invoke send_request interception call to all /// the registered interceptors. @@ -220,11 +230,11 @@ namespace TAO protected: /// The client requestor adapter and the request info object for /// making calls on all the registered interceptors. - ClientRequestInterceptor_Adapter adapter_; + ClientRequestInterceptor_Adapter *adapter_; TAO_ClientRequestInfo req_info_; - - + size_t stack_size_; #endif /*TAO_HAS_INTERCEPTORS*/ + //@} }; } diff --git a/TAO/tao/Invocation_Base.inl b/TAO/tao/Invocation_Base.inl index 02540daf836..f6684bffba0 100644 --- a/TAO/tao/Invocation_Base.inl +++ b/TAO/tao/Invocation_Base.inl @@ -56,6 +56,13 @@ namespace TAO return this->target_; } +#if TAO_HAS_INTERCEPTORS == 1 + ACE_INLINE size_t & + Invocation_Base::stack_size (void) + { + return stack_size_; + } +#endif /*TAO_HAS_INTERCEPTORS*/ } diff --git a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp index 3438ebe0b20..e3fab16ec13 100644 --- a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp +++ b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp @@ -65,7 +65,7 @@ TAO_Asynch_Reply_Dispatcher::dispatch_reply ( { ACE_ERROR (( LM_ERROR, - "TAO (%P|%t) - Asynch_Reply_Dispatcher::dispatch_reply " + "TAO_Messaging (%P|%t) - Asynch_Reply_Dispatcher::dispatch_reply " "clone_from failed \n")); } return -1; diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 16d47a57273..a76401e40dc 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -57,6 +57,14 @@ #include "ace/OS_NS_strings.h" #include "ace/OS_NS_string.h" +#if TAO_HAS_INTERCEPTORS == 1 +# include "tao/ClientRequestInterceptor_Adapter.h" +# include "tao/ClientRequestInterceptor_Adapter_Factory.h" +# include "tao/ServerRequestInterceptor_Adapter.h" +# include "tao/ServerRequestInterceptor_Adapter_Factory.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + #if !defined (__ACE_INLINE__) # include "ORB_Core.i" #endif /* ! __ACE_INLINE__ */ @@ -187,8 +195,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) orbinitializer_registry_ (0), #if (TAO_HAS_INTERCEPTORS == 1) pi_current_ (0), - client_request_interceptors_ (), - server_request_interceptors_ (), + client_request_interceptor_adapter_ (0), + server_request_interceptor_adapter_ (0), #endif /* TAO_HAS_INTERCEPTORS == 1 */ ior_interceptor_adapter_ (0), valuetype_adapter_ (0), @@ -2144,13 +2152,24 @@ TAO_ORB_Core::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) ACE_TRY { #if TAO_HAS_INTERCEPTORS == 1 - this->client_request_interceptors_.destroy_interceptors ( - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + if (this->client_request_interceptor_adapter_ != 0) + { + this->client_request_interceptor_adapter_->destroy_interceptors ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + client_request_interceptor_adapter_ = 0; + } + + if (this->server_request_interceptor_adapter_ != 0) + { + this->server_request_interceptor_adapter_->destroy_interceptors ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + server_request_interceptor_adapter_ = 0; + } - this->server_request_interceptors_.destroy_interceptors ( - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; #endif /* TAO_HAS_INTERCEPTORS == 1 */ if (this->ior_interceptor_adapter_ != 0) @@ -2897,6 +2916,111 @@ TAO_ORB_Core::ior_interceptor_adapter (void) return this->ior_interceptor_adapter_; } +#if TAO_HAS_INTERCEPTORS == 1 + +int +TAO_ORB_Core::add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) +{ + if (this->clientrequestinterceptor_adapter_i ()) + { + this->client_request_interceptor_adapter_->add_interceptor (interceptor + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("ERROR: ORB Core unable to find the ") + ACE_TEXT ("Client Request Interceptor Adapter Factory instance"))); + + ACE_THROW (CORBA::INTERNAL ()); + } +} + +TAO::ClientRequestInterceptor_Adapter * +TAO_ORB_Core::clientrequestinterceptor_adapter_i (void) +{ + if (this->client_request_interceptor_adapter_ == 0) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + if (this->client_request_interceptor_adapter_ == 0) + { + TAO_ClientRequestInterceptor_Adapter_Factory *factory = + ACE_Dynamic_Service<TAO_ClientRequestInterceptor_Adapter_Factory>::instance ( + "ClientRequestInterceptor_Adapter_Factory" + ); + + if (factory) + { + this->client_request_interceptor_adapter_ = + factory->create (); + } + } + } + + return this->client_request_interceptor_adapter_; +} + + +int +TAO_ORB_Core::add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) +{ + if (this->serverrequestinterceptor_adapter_i ()) + { + this->server_request_interceptor_adapter_->add_interceptor (interceptor + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("ERROR: ORB Core unable to find the ") + ACE_TEXT ("Server Request Interceptor Adapter Factory instance"))); + + ACE_THROW (CORBA::INTERNAL ()); + } +} + +TAO::ServerRequestInterceptor_Adapter * +TAO_ORB_Core::serverrequestinterceptor_adapter_i (void) +{ + if (this->server_request_interceptor_adapter_ == 0) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + if (this->server_request_interceptor_adapter_ == 0) + { + TAO_ServerRequestInterceptor_Adapter_Factory *factory = + ACE_Dynamic_Service<TAO_ServerRequestInterceptor_Adapter_Factory>::instance ( + "ServerRequestInterceptor_Adapter_Factory" + ); + + if (factory) + { + this->server_request_interceptor_adapter_ = + factory->create (); + } + } + } + + return this->server_request_interceptor_adapter_; +} + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + // **************************************************************** TAO_Export TAO_ORB_Core * diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 05d5fca4083..418ae8ed880 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -40,20 +40,11 @@ #if TAO_HAS_INTERCEPTORS == 1 #include "tao/PICurrent.h" -#include "tao/ClientRequestInterceptorC.h" -#include "tao/ServerRequestInterceptorC.h" -#include "tao/Interceptor_List.h" namespace TAO { - typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor> - ClientRequestInterceptor_List; -} - -namespace TAO -{ - typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor> - ServerRequestInterceptor_List; + class ClientRequestInterceptor_Adapter; + class ServerRequestInterceptor_Adapter; } #endif /* TAO_HAS_INTERCEPTORS == 1 */ @@ -140,6 +131,16 @@ namespace PortableInterceptor { class IORInterceptor; typedef IORInterceptor *IORInterceptor_ptr; + +#if TAO_HAS_INTERCEPTORS == 1 + + class ClientRequestInterceptor; + typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr; + + class ServerRequestInterceptor; + typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr; + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ } // **************************************************************** @@ -847,23 +848,13 @@ public: PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL); - /// Return the array of client-side interceptors specific to this - /// ORB. - /** - * @todo This method has to be removed when the RTCosScheduling doesn't - * use it anymore. - */ - TAO::ClientRequestInterceptor_List::TYPE & - client_request_interceptors (void); + /// Get the Client Request Interceptor adapter. + /// Will not create a new one if not available yet. + TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter (void); - /// Return the array of server-side interceptors specific to this - /// ORB. - /** - * @todo This method has to be removed when the RTCosScheduling doesn't - * use it anymore. - */ - TAO::ServerRequestInterceptor_List::TYPE & - server_request_interceptors (void); + /// Get the Server Request Interceptor adapter. + /// Will not create a new one if not available yet. + TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter (void); #endif /* TAO_HAS_INTERCEPTORS */ @@ -965,6 +956,15 @@ protected: #if TAO_HAS_INTERCEPTORS == 1 /// Obtain and cache the picurrent factory object reference. void resolve_picurrent_i (ACE_ENV_SINGLE_ARG_DECL); + + /// Get the Client Request Interceptor adapter. + /// If not created, this method will try to create one if needed. + TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter_i (void); + + /// Get the Server Request Interceptor adapter. + /// If not created, this method will try to create one if needed. + TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter_i (void); + #endif /* TAO_HAS_INTERCEPTORS */ /// Obtain and cache the codec factory object reference. @@ -1008,15 +1008,15 @@ private: /// The ORB Core should not be copied. //@{ - ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Core(const TAO_ORB_Core&)) - ACE_UNIMPLEMENTED_FUNC (void operator=(const TAO_ORB_Core&)) + TAO_ORB_Core(const TAO_ORB_Core&); + void operator=(const TAO_ORB_Core&); //@} /// Obtain and cache the dynamic any factory object reference. void resolve_ior_table_i (ACE_ENV_SINGLE_ARG_DECL); /// Checks to see whether collocation optimizations have to be - /// applied on objects in the <other_orb> + /// applied on objects in the @a other_orb CORBA::Boolean is_collocation_enabled (TAO_ORB_Core *other_orb, const TAO_MProfile &mp); @@ -1223,11 +1223,12 @@ protected: */ TAO::PICurrent *pi_current_; - /// Client request interceptor registry. - TAO::ClientRequestInterceptor_List client_request_interceptors_; + /// The adapter for handling client request interceptors + TAO::ClientRequestInterceptor_Adapter *client_request_interceptor_adapter_; + + /// The adapter for handling server request interceptors + TAO::ServerRequestInterceptor_Adapter *server_request_interceptor_adapter_; - /// Server request interceptor registry. - TAO::ServerRequestInterceptor_List server_request_interceptors_; #endif /* TAO_HAS_INTERCEPTORS */ /// IORInterceptor adapter. diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 503f6d32c00..768ddf88b0b 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -590,39 +590,16 @@ TAO_ORB_Core::pi_current (TAO::PICurrent *current) this->pi_current_ = current; } -ACE_INLINE int -TAO_ORB_Core::add_interceptor ( - PortableInterceptor::ClientRequestInterceptor_ptr interceptor - ACE_ENV_ARG_DECL) -{ - return this->client_request_interceptors_.add_interceptor (interceptor - ACE_ENV_ARG_PARAMETER); -} - -ACE_INLINE int -TAO_ORB_Core::add_interceptor ( - PortableInterceptor::ServerRequestInterceptor_ptr interceptor - ACE_ENV_ARG_DECL) -{ - return this->server_request_interceptors_.add_interceptor (interceptor - ACE_ENV_ARG_PARAMETER); -} - -ACE_INLINE TAO::ClientRequestInterceptor_List::TYPE & -TAO_ORB_Core::client_request_interceptors (void) +ACE_INLINE TAO::ClientRequestInterceptor_Adapter * +TAO_ORB_Core::clientrequestinterceptor_adapter (void) { - return this->client_request_interceptors_.interceptors (); + return this->client_request_interceptor_adapter_; } -// @@ It would be nice to move these to the PortableServer library, -// perhaps to the RootPOA. However, there is no "RootPOA" class so -// there doesn't appear to be a way that only the RootPOA -// implementation has these server-side interceptor methods and -// attributes. Leave them in the ORB Core for now. -ACE_INLINE TAO::ServerRequestInterceptor_List::TYPE & -TAO_ORB_Core::server_request_interceptors (void) +ACE_INLINE TAO::ServerRequestInterceptor_Adapter * +TAO_ORB_Core::serverrequestinterceptor_adapter (void) { - return this->server_request_interceptors_.interceptors (); + return this->server_request_interceptor_adapter_; } #endif /* TAO_HAS_INTERCEPTORS */ diff --git a/TAO/tao/ClientRequestInterceptor.pidl b/TAO/tao/PI/ClientRequestInterceptor.pidl index f12487fb354..1492f44e2b4 100644 --- a/TAO/tao/ClientRequestInterceptor.pidl +++ b/TAO/tao/PI/ClientRequestInterceptor.pidl @@ -18,8 +18,8 @@ * * tao_idl * -o orig -Gp -Gd -Ge 1 -GA -Sc -SS -Sci - * -Wb,export_include="tao/TAO_Export.h" - * -Wb,export_macro=TAO_Export + * -Wb,export_include="tao/PI_Client/pi_client_export.h.h" + * -Wb,export_macro=TAO_PI_CLIENT_Export * -Wb,pre_include="ace/pre.h" * -Wb,post_include="ace/post.h" * ClientRequestInterceptor.pidl @@ -28,7 +28,7 @@ #ifndef _CLIENT_REQUEST_INTERCEPTOR_IDL_ #define _CLIENT_REQUEST_INTERCEPTOR_IDL_ -#include <Interceptor.pidl> +#include "tao/PI/Interceptor.pidl" #include <PIForwardRequest.pidl> module PortableInterceptor { diff --git a/TAO/tao/ClientRequestInterceptorA.cpp b/TAO/tao/PI/ClientRequestInterceptorA.cpp index 37540f43dbc..37540f43dbc 100644 --- a/TAO/tao/ClientRequestInterceptorA.cpp +++ b/TAO/tao/PI/ClientRequestInterceptorA.cpp diff --git a/TAO/tao/ClientRequestInterceptorC.cpp b/TAO/tao/PI/ClientRequestInterceptorC.cpp index 8e2bf9e81f6..8e2bf9e81f6 100644 --- a/TAO/tao/ClientRequestInterceptorC.cpp +++ b/TAO/tao/PI/ClientRequestInterceptorC.cpp diff --git a/TAO/tao/ClientRequestInterceptorC.h b/TAO/tao/PI/ClientRequestInterceptorC.h index 8b90e4d2280..7f56dcd9eb0 100644 --- a/TAO/tao/ClientRequestInterceptorC.h +++ b/TAO/tao/PI/ClientRequestInterceptorC.h @@ -40,20 +40,20 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/TAO_Export.h" +#include "tao/PI/pi_export.h" #include "tao/ORB.h" #include "tao/SystemException.h" #include "tao/Environment.h" #include "tao/Object.h" #include "tao/Objref_VarOut_T.h" -#include "tao/InterceptorC.h" +#include "tao/PI/InterceptorC.h" #include "tao/PIForwardRequestC.h" #if defined (TAO_EXPORT_MACRO) #undef TAO_EXPORT_MACRO #endif -#define TAO_EXPORT_MACRO TAO_Export +#define TAO_EXPORT_MACRO TAO_PI_Export #if defined(_MSC_VER) #pragma warning(push) @@ -122,7 +122,7 @@ namespace PortableInterceptor #if !defined (_PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR_CH_) #define _PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR_CH_ - class TAO_Export ClientRequestInterceptor + class TAO_PI_Export ClientRequestInterceptor : public virtual ::PortableInterceptor::Interceptor { public: @@ -238,7 +238,7 @@ namespace PortableInterceptor // TAO_IDL - Generated from // be\be_visitor_typecode/typecode_decl.cpp:44 - extern TAO_Export ::CORBA::TypeCode_ptr const _tc_ClientRequestInterceptor; + extern TAO_PI_Export ::CORBA::TypeCode_ptr const _tc_ClientRequestInterceptor; // TAO_IDL - Generated from // be\be_visitor_module/module_ch.cpp:66 @@ -256,7 +256,7 @@ namespace TAO #define _PORTABLEINTERCEPTOR_CLIENTREQUESTINFO__TRAITS_CH_ template<> - struct TAO_Export Objref_Traits< ::PortableInterceptor::ClientRequestInfo> + struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ClientRequestInfo> { static ::PortableInterceptor::ClientRequestInfo_ptr duplicate ( ::PortableInterceptor::ClientRequestInfo_ptr @@ -277,7 +277,7 @@ namespace TAO #define _PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR__TRAITS_CH_ template<> - struct TAO_Export Objref_Traits< ::PortableInterceptor::ClientRequestInterceptor> + struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ClientRequestInterceptor> { static ::PortableInterceptor::ClientRequestInterceptor_ptr duplicate ( ::PortableInterceptor::ClientRequestInterceptor_ptr @@ -298,9 +298,9 @@ namespace TAO // TAO_IDL - Generated from // be\be_visitor_interface/any_op_ch.cpp:52 -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr); // copying -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr *); // non-copying -TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr &); +TAO_PI_Export void operator<<= (CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr); // copying +TAO_PI_Export void operator<<= (CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr *); // non-copying +TAO_PI_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::ClientRequestInterceptor_ptr &); // TAO_IDL - Generated from // be\be_codegen.cpp:955 diff --git a/TAO/tao/ClientRequestInterceptorS.h b/TAO/tao/PI/ClientRequestInterceptorS.h index 17b1360599e..17b1360599e 100644 --- a/TAO/tao/ClientRequestInterceptorS.h +++ b/TAO/tao/PI/ClientRequestInterceptorS.h diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp new file mode 100644 index 00000000000..eadc75d6bf7 --- /dev/null +++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp @@ -0,0 +1,235 @@ +#include "ClientRequestInterceptor_Adapter_Impl.h" + +#if !defined (__ACE_INLINE__) +#include "ClientRequestInterceptor_Adapter_Impl.inl" +#endif /* defined INLINE */ + +#include "tao/ClientRequestInfo.h" +#include "tao/Invocation_Base.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Core_TSS_Resources.h" +#include "tao/PortableInterceptorC.h" + +ACE_RCSID (tao, + ClientInterceptorAdapter, + "$Id$") + +namespace TAO +{ + void + ClientRequestInterceptor_Adapter_Impl::send_request ( + Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) + { + // This method implements one of the "starting" client side + // interception point. + ACE_TRY + { + for (size_t i = 0 ; i < this->interceptor_list_.size (); ++i) + { + this->interceptor_list_.interceptor (i)->send_request (ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // The starting interception point completed successfully. + // Push the interceptor on to the flow stack. + ++invocation.stack_size (); + } + } + ACE_CATCH (PortableInterceptor::ForwardRequest, exc) + { + this->process_forward_request (invocation, + ri, + exc + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_ENDTRY; + ACE_CHECK; + } + + void + ClientRequestInterceptor_Adapter_Impl::receive_reply ( + Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) + { + // This is an "ending" interception point so we only process the + // interceptors pushed on to the flow stack. + + // Notice that the interceptors are processed in the opposite order + // they were pushed onto the stack since this is an "ending" + // interception point. + + // Unwind the stack. + const size_t len = invocation.stack_size (); + for (size_t i = 0; i < len; ++i) + { + // Pop the interceptor off of the flow stack before it is + // invoked. This is necessary to prevent an interceptor already + // invoked in this "ending" interception point from being + // invoked in another "ending" interception point. + --invocation.stack_size (); + + this->interceptor_list_.interceptor (invocation.stack_size ())-> + receive_reply ( + ri + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + // The receive_reply() interception point does not raise a + // PortableInterceptor::ForwardRequest exception so there is no need + // to attempt to catch it here. + } + + void + ClientRequestInterceptor_Adapter_Impl::receive_exception ( + Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) + { + // This is an "ending" interception point so we only process the + // interceptors pushed on to the flow stack. + + // Notice that the interceptors are processed in the opposite order + // they were pushed onto the stack since this is an "ending" + // interception point. + + ACE_TRY + { + // Unwind the flow stack. + const size_t len = invocation.stack_size (); + for (size_t i = 0; i < len; ++i) + { + // Pop the interceptor off of the flow stack before it is + // invoked. This is necessary to prevent an interceptor + // already invoked in this "ending" interception point from + // being invoked in another "ending" interception point. + --invocation.stack_size (); + + this->interceptor_list_.interceptor (invocation.stack_size ())-> + receive_exception ( + ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCH (PortableInterceptor::ForwardRequest, exc) + { + this->process_forward_request (invocation, + ri, + exc + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // The receive_exception() interception point in the remaining + // interceptors must be called so call this method (not the + // interceptor's corresponding method) recursively. The call is + // made recursively since the caught exception must survive + // until the remaining interceptors have been called. + + // Note that the recursion will stop once the flow stack size + // drops to zero, i.e., once each interceptor has been invoked. + // This prevents infinite recursion from occuring. + + ri->exception (&ACE_ANY_EXCEPTION); + + this->receive_exception (invocation, ri ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableInterceptor::ReplyStatus status = + ri->reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Only re-throw the exception if it hasn't been transformed by + // the receive_exception() interception point (e.g. to a + // LOCATION_FORWARD). + if (status == PortableInterceptor::SYSTEM_EXCEPTION + || status == PortableInterceptor::USER_EXCEPTION) + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK; + } + + void + ClientRequestInterceptor_Adapter_Impl::receive_other ( + Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL) + { + // This is an "ending" interception point so we only process the + // interceptors pushed on to the flow stack. + + // Notice that the interceptors are processed in the opposite order + // they were pushed onto the stack since this is an "ending" + // interception point. + + ACE_TRY + { + // Unwind the stack. + const size_t len = invocation.stack_size (); + for (size_t i = 0; i < len; ++i) + { + // Pop the interceptor off of the flow stack before it is + // invoked. This is necessary to prevent an interceptor + // already invoked in this "ending" interception point from + // being invoked in another "ending" interception point. + --invocation.stack_size (); + + this->interceptor_list_.interceptor (invocation.stack_size ())-> + receive_other ( + ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCH (PortableInterceptor::ForwardRequest, exc) + { + this->process_forward_request (invocation, + ri, + exc + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_ENDTRY; + ACE_CHECK; + } + + void + ClientRequestInterceptor_Adapter_Impl::process_forward_request ( + Invocation_Base &invocation, + TAO_ClientRequestInfo *ri, + PortableInterceptor::ForwardRequest &exc + ACE_ENV_ARG_DECL) + { + ri->forward_reference (exc); + + invocation.forwarded_reference (exc.forward.in ()); + + // receive_other() is potentially invoked recursively. + this->receive_other (invocation, + ri + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + void + ClientRequestInterceptor_Adapter_Impl::add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) + { + this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER); + } + + void + ClientRequestInterceptor_Adapter_Impl::destroy_interceptors ( + ACE_ENV_SINGLE_ARG_DECL) + { + this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER); + } +} diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h new file mode 100644 index 00000000000..d869a8bab92 --- /dev/null +++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h @@ -0,0 +1,130 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ClientRequestInterceptor_Adapter.h + * + * $Id$ + * + * This file an adapter class to simplify the support of + * interceptors. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + * @author Ossama Othman <ossama@uci.edu> + * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> + */ +//============================================================================= + +#ifndef TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H +#define TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H + +#include /**/ "ace/pre.h" + +#include "pi_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ClientRequestInterceptorC.h" +#include "tao/ClientRequestInterceptor_Adapter.h" + +#include "Interceptor_List_T.h" + +namespace TAO +{ + typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor> + ClientRequestInterceptor_List; +} + +class TAO_ClientRequestInfo; + +namespace TAO +{ + class Invocation_Base; + + /** + * @class ClientRequestInterceptor_Adapter + * + * @brief A convenient helper class to invoke registered client request + * interceptors + * + * This class invokes all registered interceptors at interception + * point, and enforces flow rules dictated by the Portable Interceptor + * specification/chapter. + */ + class TAO_Export ClientRequestInterceptor_Adapter_Impl : + public ClientRequestInterceptor_Adapter + { + public: + + ClientRequestInterceptor_Adapter_Impl ( +// ClientRequestInterceptor_List::TYPE & interceptors, +// Invocation_Base *invocation + ); + + /** + * @name PortableInterceptor Client Side Interception Points + * + * Each of these methods corresponds to a client side interception + * point. There are no "intermediate" interception points on the + * client side, only "starting" and "ending" interception points. + * + */ + //@{ + /// This method implements one of the "starting" client side + /// interception points. + virtual void send_request (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" client side + /// interception point. + virtual void receive_reply (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" client side + /// interception point. + virtual void receive_exception (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" client side + /// interception point. + virtual void receive_other (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri + ACE_ENV_ARG_DECL); + //@} + + /// Register an interceptor. + virtual void add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL); + + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); + + protected: + + /// Process the given PortableInterceptor::ForwardRequest exception, + /// i.e. invoke the receive_other() interception point, in addition + /// to notifying the Invocation object of the LOCATION_FORWARD. + void process_forward_request (Invocation_Base &invocation, + TAO_ClientRequestInfo *ri, + PortableInterceptor::ForwardRequest &exc + ACE_ENV_ARG_DECL); + + private: + + /// List of registered interceptors. + ClientRequestInterceptor_List interceptor_list_; + }; +} + +#if defined (__ACE_INLINE__) +#include "ClientRequestInterceptor_Adapter_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H */ diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl new file mode 100644 index 00000000000..e234f5d02ac --- /dev/null +++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl @@ -0,0 +1,11 @@ +// -*- C++ -*- +// +// $Id$ + +namespace TAO +{ + ACE_INLINE + ClientRequestInterceptor_Adapter_Impl::ClientRequestInterceptor_Adapter_Impl (void) + { + } +} diff --git a/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp new file mode 100644 index 00000000000..e31811fbe92 --- /dev/null +++ b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp @@ -0,0 +1,42 @@ +/* -*- C++ -*- */ + +// ================================================================= +/** + * @file PolicyFactory_Loader.cpp + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + * + */ +// ================================================================= + +#include "ClientRequestInterceptor_Factory_Impl.h" +#include "ClientRequestInterceptor_Adapter_Impl.h" + +#include "tao/ORB.h" +#include "tao/debug.h" + +ACE_RCSID (PI, + PolicyFactory_Loader, + "$Id$") + +TAO::ClientRequestInterceptor_Adapter* +TAO_ClientRequestInterceptor_Adapter_Factory_Impl::create (void) +// TAO::ClientRequestInterceptor_List::TYPE & interceptors, + // TAO::Invocation_Base *invocation) +{ + TAO::ClientRequestInterceptor_Adapter_Impl* obj = 0; + ACE_NEW_RETURN (obj, + TAO::ClientRequestInterceptor_Adapter_Impl ,//(interceptors, invocation), + 0); + return obj; +} + +ACE_STATIC_SVC_DEFINE (TAO_ClientRequestInterceptor_Adapter_Factory_Impl, + ACE_TEXT ("ClientRequestInterceptor_Adapter_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_ClientRequestInterceptor_Adapter_Factory_Impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (TAO_PI, TAO_ClientRequestInterceptor_Adapter_Factory_Impl) diff --git a/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h new file mode 100644 index 00000000000..204f9231814 --- /dev/null +++ b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ + + +//============================================================================= +/** + * @file PolicyFactory_Loader.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + + +#ifndef TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H +#define TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H + +#include /**/ "ace/pre.h" + +#include "pi_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" + +#include "tao/ClientRequestInterceptor_Adapter_Factory.h" + +namespace TAO +{ + class ClientRequestInterceptor_Adapter; +} + +class TAO_PI_Export TAO_ClientRequestInterceptor_Adapter_Factory_Impl + : public TAO_ClientRequestInterceptor_Adapter_Factory +{ +public: + virtual TAO::ClientRequestInterceptor_Adapter *create (void); +}; + +ACE_STATIC_SVC_DECLARE (TAO_ClientRequestInterceptor_Adapter_Factory_Impl) +ACE_FACTORY_DECLARE (TAO_PI, TAO_ClientRequestInterceptor_Adapter_Factory_Impl) + +#include /**/ "ace/post.h" + +#endif /* TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H */ diff --git a/TAO/tao/Interceptor.pidl b/TAO/tao/PI/Interceptor.pidl index f2a028db841..f2a028db841 100644 --- a/TAO/tao/Interceptor.pidl +++ b/TAO/tao/PI/Interceptor.pidl diff --git a/TAO/tao/InterceptorA.cpp b/TAO/tao/PI/InterceptorA.cpp index d386dfcfff3..d386dfcfff3 100644 --- a/TAO/tao/InterceptorA.cpp +++ b/TAO/tao/PI/InterceptorA.cpp diff --git a/TAO/tao/InterceptorC.cpp b/TAO/tao/PI/InterceptorC.cpp index cc1c0e0b458..cc1c0e0b458 100644 --- a/TAO/tao/InterceptorC.cpp +++ b/TAO/tao/PI/InterceptorC.cpp diff --git a/TAO/tao/InterceptorC.h b/TAO/tao/PI/InterceptorC.h index 78df4da266c..750a1698595 100644 --- a/TAO/tao/InterceptorC.h +++ b/TAO/tao/PI/InterceptorC.h @@ -40,7 +40,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/TAO_Export.h" +#include "tao/PI/pi_export.h" #include "tao/ORB.h" #include "tao/SystemException.h" #include "tao/Environment.h" @@ -50,7 +50,7 @@ #if defined (TAO_EXPORT_MACRO) #undef TAO_EXPORT_MACRO #endif -#define TAO_EXPORT_MACRO TAO_Export +#define TAO_EXPORT_MACRO TAO_PI_Export #if defined(_MSC_VER) #pragma warning(push) @@ -96,7 +96,7 @@ namespace PortableInterceptor #if !defined (_PORTABLEINTERCEPTOR_INTERCEPTOR_CH_) #define _PORTABLEINTERCEPTOR_INTERCEPTOR_CH_ - class TAO_Export Interceptor + class TAO_PI_Export Interceptor : public virtual CORBA::Object { public: @@ -174,7 +174,7 @@ namespace PortableInterceptor // TAO_IDL - Generated from // be\be_visitor_typecode/typecode_decl.cpp:44 - extern TAO_Export ::CORBA::TypeCode_ptr const _tc_Interceptor; + extern TAO_PI_Export ::CORBA::TypeCode_ptr const _tc_Interceptor; // TAO_IDL - Generated from // be\be_visitor_module/module_ch.cpp:66 @@ -192,7 +192,7 @@ namespace TAO #define _PORTABLEINTERCEPTOR_INTERCEPTOR__TRAITS_CH_ template<> - struct TAO_Export Objref_Traits< ::PortableInterceptor::Interceptor> + struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::Interceptor> { static ::PortableInterceptor::Interceptor_ptr duplicate ( ::PortableInterceptor::Interceptor_ptr @@ -213,9 +213,9 @@ namespace TAO // TAO_IDL - Generated from // be\be_visitor_interface/any_op_ch.cpp:52 -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::Interceptor_ptr); // copying -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::Interceptor_ptr *); // non-copying -TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::Interceptor_ptr &); +TAO_PI_Export void operator<<= (CORBA::Any &, PortableInterceptor::Interceptor_ptr); // copying +TAO_PI_Export void operator<<= (CORBA::Any &, PortableInterceptor::Interceptor_ptr *); // non-copying +TAO_PI_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::Interceptor_ptr &); // TAO_IDL - Generated from // be\be_codegen.cpp:955 diff --git a/TAO/tao/InterceptorS.h b/TAO/tao/PI/InterceptorS.h index 17b1360599e..17b1360599e 100644 --- a/TAO/tao/InterceptorS.h +++ b/TAO/tao/PI/InterceptorS.h diff --git a/TAO/tao/Interceptor_List.cpp b/TAO/tao/PI/Interceptor_List_T.cpp index f7476464450..7a4da747639 100644 --- a/TAO/tao/Interceptor_List.cpp +++ b/TAO/tao/PI/Interceptor_List_T.cpp @@ -1,8 +1,7 @@ // $Id$ -#include "tao/Interceptor_List.h" - -#include "tao/InterceptorC.h" +#include "InterceptorC.h" +#include "ORBInitInfoC.h" #include "tao/SystemException.h" #include "tao/ORB_Constants.h" #include "tao/debug.h" @@ -19,14 +18,21 @@ namespace TAO } template <typename InterceptorType> - PortableInterceptor::Interceptor_ptr + Interceptor_List<InterceptorType>::InterceptorType_ptr_type Interceptor_List<InterceptorType>::interceptor (size_t index) { return this->interceptors_[index].in (); } template <typename InterceptorType> - int + size_t + Interceptor_List<InterceptorType>::size (void) + { + return this->interceptors_.size (); + } + + template <typename InterceptorType> + void Interceptor_List<InterceptorType>::add_interceptor ( InterceptorType_ptr_type interceptor ACE_ENV_ARG_DECL) @@ -71,7 +77,7 @@ namespace TAO if (ACE_OS::strcmp (existing_name.in (), name.in ()) == 0) { - return -1; + ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ()); } } } @@ -86,26 +92,16 @@ namespace TAO } else { - ACE_THROW_RETURN ( + ACE_THROW ( CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL ), CORBA::COMPLETED_NO - ), - 0 - ); + ) + ); } - - return 0; - } - - template <typename InterceptorType> - typename Interceptor_List<InterceptorType>::TYPE & - Interceptor_List<InterceptorType>::interceptors (void) - { - return this->interceptors_; } template <typename InterceptorType> diff --git a/TAO/tao/Interceptor_List.h b/TAO/tao/PI/Interceptor_List_T.h index 0adfe94e661..bb3a29db0a8 100644 --- a/TAO/tao/Interceptor_List.h +++ b/TAO/tao/PI/Interceptor_List_T.h @@ -2,7 +2,7 @@ // =================================================================== /** - * @file Interceptor_List.h + * @file Interceptor_List_T.h * * $Id$ * @@ -22,7 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Array_Base.h" +#include "tao/SystemException.h" namespace PortableInterceptor { @@ -52,24 +52,16 @@ namespace TAO /// Constructor. Interceptor_List (void); - /** - * Register an interceptor. - * @retval 0 Interceptor added without problems - * @retval -1 Interceptor not added because of a duplicate name - */ - int add_interceptor ( + void add_interceptor ( InterceptorType_ptr_type i ACE_ENV_ARG_DECL); - /// Return reference to the underlying Portable Interceptor array. - TYPE & interceptors (void); - void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); - protected: - /// Return the interceptor in sequence element @a index. - PortableInterceptor::Interceptor_ptr interceptor (size_t index); + InterceptorType_ptr_type interceptor (size_t index); + + size_t size (void); private: /// Dynamic array of registered interceptors. @@ -79,11 +71,11 @@ namespace TAO } #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Interceptor_List.cpp" +#include "Interceptor_List_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Interceptor_List.cpp") +#pragma implementation ("Interceptor_List_T.cpp") #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include /**/ "ace/post.h" diff --git a/TAO/tao/PI/PI.cpp b/TAO/tao/PI/PI.cpp index 311d151c290..3c0f468f590 100644 --- a/TAO/tao/PI/PI.cpp +++ b/TAO/tao/PI/PI.cpp @@ -1,6 +1,7 @@ #include "PI.h" #include "ORBInitializer_Registry_Impl.h" #include "PolicyFactory_Loader.h" +#include "ClientRequestInterceptor_Factory_Impl.h" ACE_RCSID (PI, PI, @@ -9,6 +10,8 @@ ACE_RCSID (PI, int TAO_PI_Init::Initializer (void) { + ACE_Service_Config::process_directive (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl); + return ACE_Service_Config::process_directive (ace_svc_desc_ORBInitializer_Registry); } diff --git a/TAO/tao/PI/PI.h b/TAO/tao/PI/PI.h index 760c56f7d27..14c51a3aeed 100644 --- a/TAO/tao/PI/PI.h +++ b/TAO/tao/PI/PI.h @@ -55,6 +55,8 @@ TAO_Requires_PI_Initializer = #include "ORBInitializerC.h" #include "PolicyFactoryC.h" #include "ORBInitInfoC.h" +#include "InterceptorC.h" +#include "ClientRequestInterceptorC.h" #undef TAO_PI_SAFE_INCLUDE #endif /* TAO_PI_H */ diff --git a/TAO/tao/PI/diff/ORBInitializer.diff b/TAO/tao/PI/diff/ORBInitializer.diff index c9dd1d62fdf..bf70f5b1ecf 100644 --- a/TAO/tao/PI/diff/ORBInitializer.diff +++ b/TAO/tao/PI/diff/ORBInitializer.diff @@ -1,34 +1,30 @@ ---- orig/ORBInitializerC.h 2005-06-03 13:59:05.470598400 +0200 -+++ ORBInitializerC.h 2005-06-03 14:12:22.646881600 +0200 -@@ -33,6 +33,9 @@ - - #include /**/ "ace/pre.h" - -+ #ifndef TAO_PI_SAFE_INCLUDE -+ #error "You should not include ORBInitializerC.h directly, use PI.h" -+ #endif /* !TAO_PI_SAFE_INCLUDE */ - - #include "ace/config-all.h" - ---- orig/ORBInitializerC.cpp 2005-06-03 13:59:05.470598400 +0200 -+++ ORBInitializerC.cpp 2005-06-03 14:14:33.354830400 +0200 -@@ -29,7 +29,7 @@ - // be\be_codegen.cpp:291 - - --#include "ORBInitializerC.h" -+#include "PI.h" - #include "tao/CDR.h" - #include "ace/OS_NS_string.h" - ---- orig/ORBInitializerA.cpp 2005-06-03 13:59:05.470598400 +0200 -+++ ORBInitializerA.cpp 2005-06-03 14:14:29.088696000 +0200 -@@ -25,7 +25,7 @@ - // Information about TAO is available at: - // http://www.cs.wustl.edu/~schmidt/TAO.html - --#include "ORBInitializerC.h" -+#include "PI.h" - #include "tao/Null_RefCount_Policy.h" - #include "tao/TypeCode_Constants.h" - #include "tao/Alias_TypeCode_Static.h" +--- orig/ORBInitializerC.h 2005-06-07 13:09:54.259456000 +0200 ++++ ORBInitializerC.h 2005-06-14 10:42:12.000000000 +0200 +@@ -1,6 +1,6 @@ + // -*- C++ -*- + // +-// $Id$ ++// $Id$ + + // **** Code generated by the The ACE ORB (TAO) IDL Compiler **** + // TAO and the TAO IDL Compiler have been developed by: +--- orig/ORBInitializerC.cpp 2005-06-07 13:09:54.259456000 +0200 ++++ ORBInitializerC.cpp 2005-06-14 10:42:12.000000000 +0200 +@@ -1,6 +1,6 @@ + // -*- C++ -*- + // +-// $Id$ ++// $Id$ + + // **** Code generated by the The ACE ORB (TAO) IDL Compiler **** + // TAO and the TAO IDL Compiler have been developed by: +--- orig/ORBInitializerA.cpp 2005-06-07 13:09:54.259456000 +0200 ++++ ORBInitializerA.cpp 2005-06-14 10:42:12.000000000 +0200 +@@ -1,6 +1,6 @@ + // -*- C++ -*- + // +-// $Id$ ++// $Id$ + + // **** Code generated by the The ACE ORB (TAO) IDL Compiler **** + // TAO and the TAO IDL Compiler have been developed by: diff --git a/TAO/tao/PI_Server/PI_Server.cpp b/TAO/tao/PI_Server/PI_Server.cpp index 7c79dbc4acc..ada7f9fe58f 100644 --- a/TAO/tao/PI_Server/PI_Server.cpp +++ b/TAO/tao/PI_Server/PI_Server.cpp @@ -1,5 +1,6 @@ #include "PI_Server.h" #include "PI_Server_Loader.h" +#include "ServerRequestInterceptor_Factory_Impl.h" ACE_RCSID (PI_Server, PI_Server, @@ -8,6 +9,8 @@ ACE_RCSID (PI_Server, int TAO_PI_Server_Init::Initializer (void) { + ACE_Service_Config::process_directive (ace_svc_desc_TAO_ServerRequestInterceptor_Adapter_Factory_Impl); + return ACE_Service_Config::process_directive (ace_svc_desc_TAO_PI_Server_Loader); } diff --git a/TAO/tao/PI_Server/PI_Server.h b/TAO/tao/PI_Server/PI_Server.h index 7adefecc73e..5d82f7a2d9b 100644 --- a/TAO/tao/PI_Server/PI_Server.h +++ b/TAO/tao/PI_Server/PI_Server.h @@ -51,6 +51,7 @@ TAO_Requires_PI_Server_Initializer = #define TAO_PI_SERVER_SAFE_INCLUDE #include "PS_CurrentC.h" +#include "ServerRequestInterceptorC.h" #undef TAO_PI_SERVER_SAFE_INCLUDE #include /**/ "ace/post.h" diff --git a/TAO/tao/PI_Server/PS_CurrentA.cpp b/TAO/tao/PI_Server/PS_CurrentA.cpp index daf3632957f..fd0ff6f7c7e 100644 --- a/TAO/tao/PI_Server/PS_CurrentA.cpp +++ b/TAO/tao/PI_Server/PS_CurrentA.cpp @@ -25,7 +25,7 @@ // Information about TAO is available at: // http://www.cs.wustl.edu/~schmidt/TAO.html -#include "PI_Server.h" +#include "PS_CurrentC.h" #include "tao/Null_RefCount_Policy.h" #include "tao/TypeCode_Constants.h" #include "tao/Alias_TypeCode_Static.h" @@ -38,26 +38,25 @@ #include "tao/Any_Dual_Impl_T.h" // TAO_IDL - Generated from -// be/be_visitor_typecode/struct_typecode.cpp:74 +// be\be_visitor_typecode/struct_typecode.cpp:87 static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_PortableServer_Current_NoContext = 0; static TAO::TypeCode::Struct<char const *, - CORBA::TypeCode_ptr const *, - TAO::TypeCode::Struct_Field<char const *, - CORBA::TypeCode_ptr const *> const *, - TAO::Null_RefCount_Policy> + CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> _tao_tc_PortableServer_Current_NoContext ( CORBA::tk_except, "IDL:omg.org/PortableServer/Current/NoContext:2.3", "NoContext", _tao_fields_PortableServer_Current_NoContext, 0); - + ::CORBA::TypeCode_ptr const PortableServer::Current::_tc_NoContext = &_tao_tc_PortableServer_Current_NoContext; // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> @@ -65,7 +64,7 @@ static TAO::TypeCode::Objref<char const *, CORBA::tk_local_interface, "IDL:omg.org/PortableServer/Current:2.3", "Current"); - + namespace PortableServer { ::CORBA::TypeCode_ptr const _tc_Current = @@ -75,7 +74,7 @@ namespace PortableServer // TAO_IDL - Generated from -// be/be_visitor_interface/any_op_cs.cpp:50 +// be\be_visitor_interface/any_op_cs.cpp:50 namespace TAO { @@ -98,7 +97,7 @@ namespace TAO { return false; } - + template<> CORBA::Boolean Any_Impl_T<PortableServer::Current>::demarshal_value (TAO_InputCDR &) @@ -149,8 +148,8 @@ operator>>= ( ); } -// TAO_IDL - Generated from -// be/be_visitor_exception/any_op_cs.cpp:50 +// TAO_IDL - Generated from +// be\be_visitor_exception/any_op_cs.cpp:50 namespace TAO { @@ -160,7 +159,7 @@ namespace TAO { return false; } - + template<> CORBA::Boolean Any_Dual_Impl_T<PortableServer::Current::NoContext>::demarshal_value (TAO_InputCDR &) diff --git a/TAO/tao/PI_Server/PS_CurrentC.cpp b/TAO/tao/PI_Server/PS_CurrentC.cpp index 7ac1e05a182..92de45c9df6 100644 --- a/TAO/tao/PI_Server/PS_CurrentC.cpp +++ b/TAO/tao/PI_Server/PS_CurrentC.cpp @@ -29,7 +29,7 @@ // be\be_codegen.cpp:291 -#include "PI_Server.h" +#include "PS_CurrentC.h" #include "tao/CDR.h" #include "ace/OS_NS_string.h" @@ -38,7 +38,7 @@ #endif /* __BORLANDC__ */ // TAO_IDL - Generated from -// be\be_visitor_arg_traits.cpp:69 +// be\be_visitor_arg_traits.cpp:70 // Arg traits specializations. namespace TAO @@ -82,7 +82,7 @@ TAO::Objref_Traits<PortableServer::Current>::marshal ( return CORBA::Object::marshal (p, cdr); } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_exception/exception_cs.cpp:63 PortableServer::Current::NoContext::NoContext (void) @@ -183,7 +183,7 @@ PortableServer::Current::Current (void) PortableServer::Current::~Current (void) {} -void +void PortableServer::Current::_tao_any_destructor (void *_tao_void_pointer) { Current *_tao_tmp_pointer = @@ -197,15 +197,9 @@ PortableServer::Current::_narrow ( ACE_ENV_ARG_DECL_NOT_USED ) { - if (CORBA::is_nil (_tao_objref)) - { - return Current::_nil (); - } - - Current_ptr proxy = - dynamic_cast<Current_ptr> (_tao_objref); - - return Current::_duplicate (proxy); + return Current::_duplicate ( + dynamic_cast<Current_ptr> (_tao_objref) + ); } PortableServer::Current_ptr @@ -214,15 +208,9 @@ PortableServer::Current::_unchecked_narrow ( ACE_ENV_ARG_DECL_NOT_USED ) { - if (CORBA::is_nil (_tao_objref)) - { - return Current::_nil (); - } - - Current_ptr proxy = - dynamic_cast<Current_ptr> (_tao_objref); - - return Current::_duplicate (proxy); + return Current::_duplicate ( + dynamic_cast<Current_ptr> (_tao_objref) + ); } PortableServer::Current_ptr diff --git a/TAO/tao/PI_Server/PS_CurrentC.h b/TAO/tao/PI_Server/PS_CurrentC.h index cb65151114d..468ba6b69bf 100644 --- a/TAO/tao/PI_Server/PS_CurrentC.h +++ b/TAO/tao/PI_Server/PS_CurrentC.h @@ -40,11 +40,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#ifndef TAO_PI_SERVER_SAFE_INCLUDE -# error "You should not include PS_CurrentC.h directly, use PI_Server.h" -#endif /* !TAO_PI_SAFE_INCLUDE */ - -#include "pi_server_export.h" +#include "tao/PI_Server/pi_server_export.h" #include "tao/ORB.h" #include "tao/SystemException.h" #include "tao/Environment.h" @@ -73,22 +69,22 @@ namespace PortableServer { - + // TAO_IDL - Generated from // be\be_interface.cpp:598 #if !defined (_PORTABLESERVER_CURRENT__VAR_OUT_CH_) #define _PORTABLESERVER_CURRENT__VAR_OUT_CH_ - + class Current; typedef Current *Current_ptr; - + typedef TAO_Objref_Var_T< Current > Current_var; - + typedef TAO_Objref_Out_T< Current @@ -96,65 +92,65 @@ namespace PortableServer Current_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:54 #if !defined (_PORTABLESERVER_CURRENT_CH_) #define _PORTABLESERVER_CURRENT_CH_ - + class TAO_PI_Server_Export Current : public virtual ::CORBA::Current { public: typedef Current_ptr _ptr_type; typedef Current_var _var_type; - + // The static operations. static Current_ptr _duplicate (Current_ptr obj); - + static void _tao_release (Current_ptr obj); - + static Current_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static Current_ptr _unchecked_narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static Current_ptr _nil (void) { return static_cast<Current_ptr> (0); } - + static void _tao_any_destructor (void *); - + // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:51 + // be\be_visitor_exception/exception_ch.cpp:53 #if !defined (_PORTABLESERVER_CURRENT_NOCONTEXT_CH_) #define _PORTABLESERVER_CURRENT_NOCONTEXT_CH_ - + class TAO_PI_Server_Export NoContext : public CORBA::UserException { public: - + NoContext (void); NoContext (const NoContext &); ~NoContext (void); NoContext &operator= (const NoContext &); - + static void _tao_any_destructor (void *); - + static NoContext *_downcast (CORBA::Exception *); static const NoContext *_downcast (CORBA::Exception const *); - + static CORBA::Exception *_alloc (void); - + virtual CORBA::Exception *_tao_duplicate (void) const; virtual void _raise (void) const; @@ -163,28 +159,28 @@ namespace PortableServer TAO_OutputCDR & ACE_ENV_ARG_DECL ) const; - + virtual void _tao_decode ( TAO_InputCDR & ACE_ENV_ARG_DECL ); - + // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:127 - + // be\be_visitor_exception/exception_ch.cpp:129 + virtual CORBA::TypeCode_ptr _tao_type (void) const; }; - + // TAO_IDL - Generated from // be\be_visitor_typecode/typecode_decl.cpp:44 - + static ::CORBA::TypeCode_ptr const _tc_NoContext; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual ::PortableServer::POA_ptr get_POA ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) @@ -192,10 +188,10 @@ namespace PortableServer CORBA::SystemException, ::PortableServer::Current::NoContext )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual ::PortableServer::ObjectId * get_object_id ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) @@ -203,10 +199,10 @@ namespace PortableServer CORBA::SystemException, ::PortableServer::Current::NoContext )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual ::PortableServer::Servant get_servant ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) @@ -214,36 +210,36 @@ namespace PortableServer CORBA::SystemException, ::PortableServer::Current::NoContext )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:210 - + virtual CORBA::Boolean _is_a ( const char *type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + virtual const char* _interface_repository_id (void) const; virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); - + protected: // Abstract or local interface only. Current (void); - + virtual ~Current (void); - + private: // Private and unimplemented for concrete interfaces. Current (const Current &); - + void operator= (const Current &); }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_typecode/typecode_decl.cpp:44 - + extern TAO_PI_Server_Export ::CORBA::TypeCode_ptr const _tc_Current; // TAO_IDL - Generated from @@ -260,7 +256,7 @@ namespace TAO #if !defined (_PORTABLESERVER_CURRENT__TRAITS_CH_) #define _PORTABLESERVER_CURRENT__TRAITS_CH_ - + template<> struct TAO_PI_Server_Export Objref_Traits< ::PortableServer::Current> { diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp index 47ba3705d7e..257ac0c63e0 100644 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp +++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp @@ -8,29 +8,22 @@ ACE_RCSID (PortableServer, ServerInterceptorAdapter, "$Id$") -#ifndef __ACE_INLINE__ -# include "ServerInterceptorAdapter.inl" -#endif /* !__ACE_INLINE__ */ - -#include "ServerRequestInfo.h" -#include "PICurrent_Guard.h" +#include "tao/PortableServer/ServerRequestInfo.h" +#include "tao/PortableServer/PICurrent_Guard.h" +#include "tao/ServerRequestInterceptor_Adapter.h" #include "tao/TAO_Server_Request.h" #include "tao/ORB_Core.h" -TAO::ServerRequestInterceptor_Adapter::ServerRequestInterceptor_Adapter ( - TAO_ServerRequest & server_request) - : interceptors_ (server_request.orb_core ()->server_request_interceptors ()) - , len_ (interceptors_.size ()) - , stack_size_ (server_request.interceptor_count ()) - , location_forwarded_ (false) +TAO::ServerRequestInterceptor_Adapter_Impl::ServerRequestInterceptor_Adapter_Impl (void) { } #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 void -TAO::ServerRequestInterceptor_Adapter::tao_ft_interception_point ( +TAO::ServerRequestInterceptor_Adapter_Impl::tao_ft_interception_point ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri, CORBA::OctetSeq_out oc ACE_ENV_ARG_DECL) @@ -49,7 +42,7 @@ TAO::ServerRequestInterceptor_Adapter::tao_ft_interception_point ( oc = 0; - for (size_t i = 0 ; i < this->len_; ++i) + for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i) { this->interceptors_[i]->tao_ft_interception_point ( ri, @@ -68,7 +61,7 @@ TAO::ServerRequestInterceptor_Adapter::tao_ft_interception_point ( // The starting interception point completed successfully. // Push the interceptor on to the flow stack. - ++this->stack_size_; + ++server_request.interceptor_count (); } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -85,13 +78,14 @@ TAO::ServerRequestInterceptor_Adapter::tao_ft_interception_point ( } void -TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( +TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { // This method implements one of the "intermediate" server side // interception point. - if (this->len_ != this->stack_size_) + if (this->interceptor_list_.size() != this->server_request.interceptor_count ()) { // This method (i.e. the receive_request() interception point) // should only be invoked if all of the interceptors registered @@ -106,7 +100,7 @@ TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( ACE_TRY { - for (size_t i = 0 ; i < this->stack_size_; ++i) + for (size_t i = 0 ; i < server_request.interceptor_count (); ++i) { this->interceptors_[i]->receive_request_service_contexts ( ri @@ -133,7 +127,8 @@ TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( /// messing around things in the same function, which is harder to /// read and could make the code buggier. void -TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( +TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { @@ -150,26 +145,26 @@ TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( TAO::PICurrent_Guard const pi_guard (ri->server_request (), false /* Copy RSC to TSC */); - for (size_t i = 0 ; i < this->len_; ++i) + for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i) { - this->interceptors_[i]->receive_request_service_contexts ( - ri - ACE_ENV_ARG_PARAMETER); + this->interceptor_list_.interceptor(i)-> + receive_request_service_contexts ( + ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // The starting interception point completed successfully. // Push the interceptor on to the flow stack. - ++this->stack_size_; + ++server_request.interceptor_count (); } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) { ri->forward_reference (exc); - this->send_other (ri + this->send_other (server_request, + ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; @@ -178,7 +173,8 @@ TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ void -TAO::ServerRequestInterceptor_Adapter::receive_request ( +TAO::ServerRequestInterceptor_Adapter_Impl::receive_request ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { @@ -186,7 +182,7 @@ TAO::ServerRequestInterceptor_Adapter::receive_request ( // point. Interceptors are invoked in the same order they were // pushed on to the flow stack. - if (this->len_ != this->stack_size_) + if (this->interceptor_list_.size() != server_request.interceptor_count ()) { // This method (i.e. the receive_request() interception point) // should only be invoked if all of the interceptors registered @@ -201,10 +197,11 @@ TAO::ServerRequestInterceptor_Adapter::receive_request ( ACE_TRY { - for (size_t i = 0; i < this->stack_size_; ++i) + for (size_t i = 0; i < server_request.interceptor_count (); ++i) { - this->interceptors_[i]->receive_request (ri - ACE_ENV_ARG_PARAMETER); + this->interceptor_list_.interceptor(i)->receive_request ( + ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Note that no interceptors are pushed on to or popped off @@ -215,11 +212,10 @@ TAO::ServerRequestInterceptor_Adapter::receive_request ( ACE_CATCH (PortableInterceptor::ForwardRequest, exc) { ri->forward_reference (exc); - this->send_other (ri + this->send_other (server_request, + ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; @@ -227,7 +223,8 @@ TAO::ServerRequestInterceptor_Adapter::receive_request ( } void -TAO::ServerRequestInterceptor_Adapter::send_reply ( +TAO::ServerRequestInterceptor_Adapter_Impl::send_reply ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { @@ -239,18 +236,19 @@ TAO::ServerRequestInterceptor_Adapter::send_reply ( // interception point. // Unwind the stack. - size_t const len = this->stack_size_; + size_t const len = server_request.interceptor_count (); for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is // invoked. This is necessary to prevent an interceptor already // invoked in this "ending" interception point from being // invoked in another "ending" interception point. - --this->stack_size_; + --server_request.interceptor_count (); - this->interceptors_[this->stack_size_]->send_reply ( - ri - ACE_ENV_ARG_PARAMETER); + this->interceptor_list_.interceptor ( + server_request.interceptor_count ())->send_reply ( + ri + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } @@ -260,7 +258,8 @@ TAO::ServerRequestInterceptor_Adapter::send_reply ( } void -TAO::ServerRequestInterceptor_Adapter::send_exception ( +TAO::ServerRequestInterceptor_Adapter_Impl::send_exception ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL) { @@ -274,29 +273,29 @@ TAO::ServerRequestInterceptor_Adapter::send_exception ( ACE_TRY { // Unwind the flow stack. - size_t const len = this->stack_size_; + size_t const len = server_request.interceptor_count (); for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is // invoked. This is necessary to prevent an interceptor // already invoked in this "ending" interception point from // being invoked in another "ending" interception point. - --this->stack_size_; + --server_request.interceptor_count (); - this->interceptors_[this->stack_size_]->send_exception ( - ri - ACE_ENV_ARG_PARAMETER); + this->interceptor_list_.interceptor ( + server_request.interceptor_count ())->send_exception ( + ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) { ri->forward_reference (exc); - this->send_other (ri + this->send_other (server_request, + ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - this->location_forwarded_ = true; } ACE_CATCHANY { @@ -312,7 +311,9 @@ TAO::ServerRequestInterceptor_Adapter::send_exception ( ri->exception (&ACE_ANY_EXCEPTION); - this->send_exception (ri ACE_ENV_ARG_PARAMETER); + this->send_exception (server_request, + ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; PortableInterceptor::ReplyStatus status = @@ -331,7 +332,8 @@ TAO::ServerRequestInterceptor_Adapter::send_exception ( } void -TAO::ServerRequestInterceptor_Adapter::send_other ( +TAO::ServerRequestInterceptor_Adapter_Impl::send_other ( + TAO_ServerRequest &server_request, TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { @@ -345,32 +347,48 @@ TAO::ServerRequestInterceptor_Adapter::send_other ( ACE_TRY { // Unwind the flow stack. - size_t const len = this->stack_size_; + size_t const len = server_request.interceptor_count (); for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is // invoked. This is necessary to prevent an interceptor // already invoked in this "ending" interception point from // being invoked in another "ending" interception point. - --this->stack_size_; + --server_request.interceptor_count (); - this->interceptors_[this->stack_size_]->send_other ( - ri - ACE_ENV_ARG_PARAMETER); + this->interceptor_list_.interceptor( + server_request.interceptor_count ())->send_other ( + ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) { ri->forward_reference (exc); - this->send_other (ri + this->send_other (server_request, + ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; } + +void +TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) +{ + this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER); +} + +void +TAO::ServerRequestInterceptor_Adapter_Impl::destroy_interceptors ( + ACE_ENV_SINGLE_ARG_DECL) +{ + this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER); +} + #endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.h b/TAO/tao/PI_Server/ServerInterceptorAdapter.h index 3a31e229406..dab75bd4400 100644 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.h +++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.h @@ -20,20 +20,21 @@ #include /**/ "ace/pre.h" -#include "tao/orbconf.h" +#include "pi_server_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/orbconf.h" #if TAO_HAS_INTERCEPTORS == 1 -#include "portableserver_export.h" +#include "ServerRequestInterceptorC.h" #include "tao/Basic_Types.h" -#include "tao/ServerRequestInterceptorC.h" -#include "tao/Interceptor_List.h" +#include "tao/ServerRequestInterceptor_Adapter.h" +#include "tao/PI/Interceptor_List_T.h" namespace TAO { @@ -48,24 +49,25 @@ namespace TAO class ServerRequestInfo; /** - * @class ServerRequestInterceptor_Adapter + * @class ServerRequestInterceptor_Adapter_Impl * - * @brief ServerRequestInterceptor_Adapter + * @brief ServerRequestInterceptor_Adapter_Impl * * A convenient helper class to invoke registered server request * interceptor(s). */ - class ServerRequestInterceptor_Adapter + class TAO_PI_Server_Export ServerRequestInterceptor_Adapter_Impl : + public ServerRequestInterceptor_Adapter { public: /// Constructor. - ServerRequestInterceptor_Adapter (TAO_ServerRequest & server_request); + ServerRequestInterceptor_Adapter_Impl (void); /** - * @name PortableInterceptor Client Side Interception Points + * @name PortableInterceptor Server Side Interception Points * - * Each of these methods corresponds to a client side interception + * Each of these methods corresponds to a server side interception * point. */ //@{ @@ -74,7 +76,8 @@ namespace TAO /// point. It will be used as the first interception point and it is /// proprietary to TAO. /// @@ Will go away once Bug 1369 is fixed - void tao_ft_interception_point (TAO::ServerRequestInfo * ri , + void tao_ft_interception_point (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri, CORBA::OctetSeq_out oc ACE_ENV_ARG_DECL); #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ @@ -86,59 +89,49 @@ namespace TAO /// @note This method should have been the "starting" interception /// point according to the interceptor spec. This will be /// fixed once Bug 1369 is completely done. - void receive_request_service_contexts (TAO::ServerRequestInfo * ri + void receive_request_service_contexts (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL); /// This method an "intermediate" server side interception point. - void receive_request (TAO::ServerRequestInfo * ri + void receive_request (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL); /// This method implements one of the "ending" server side /// interception points. - void send_reply (TAO::ServerRequestInfo * ri + void send_reply (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL); /// This method implements one of the "ending" server side /// interception points. - void send_exception (TAO::ServerRequestInfo * ri + void send_exception (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL); /// This method implements one of the "ending" server side /// interception points. - void send_other (TAO::ServerRequestInfo * ri + void send_other (TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri ACE_ENV_ARG_DECL); //@} - /// Returns true if a LOCATION_FORWARD was generated, and false - /// otherwise. - bool location_forwarded (void) const; - - private: - - /// Reference to the list of registered interceptors. - TAO::ServerRequestInterceptor_List::TYPE & interceptors_; + /// Register an interceptor. + virtual void add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL); - /// Cache the length of the interceptor list so that we don't have - /// to compute it at each stage of the current interception. - size_t const len_; + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); - /// The number of interceptors "pushed" onto the logical flow - /// stack. This is used when unwinding the flow stack. - size_t & stack_size_; - - /// True if a PortableInterceptor::ForwardRequest exception was - /// thrown. - bool location_forwarded_; + private: + /// List of registered interceptors. + ServerRequestInterceptor_List interceptor_list_; }; } // End namespace TAO - -#if defined (__ACE_INLINE__) -# include "ServerInterceptorAdapter.inl" -#endif /* __ACE_INLINE__ */ - #endif /* TAO_HAS_INTERCEPTORS */ #include /**/ "ace/post.h" diff --git a/TAO/tao/ServerRequestInterceptor.pidl b/TAO/tao/PI_Server/ServerRequestInterceptor.pidl index 6015fcb8214..317f4d79ee6 100644 --- a/TAO/tao/ServerRequestInterceptor.pidl +++ b/TAO/tao/PI_Server/ServerRequestInterceptor.pidl @@ -13,8 +13,8 @@ * * tao_idl * -o orig -Gp -Gd -Ge 1 -GA -Sc -SS -Sci - * -Wb,export_include="tao/TAO_Export.h" - * -Wb,export_macro=TAO_Export + * -Wb,export_include="tao/PI_Server/pi_server_export.h" + * -Wb,export_macro=TAO_PI_Server_Export * -Wb,pre_include="ace/pre.h" * -Wb,post_include="ace/post.h" * ServerRequestInterceptor.pidl @@ -26,7 +26,7 @@ #ifndef _SERVER_REQUEST_INTERCEPTOR_IDL_ #define _SERVER_REQUEST_INTERCEPTOR_IDL_ -#include <Interceptor.pidl> +#include "tao/PI/Interceptor.pidl" #include <OctetSeq.pidl> #include <PIForwardRequest.pidl> diff --git a/TAO/tao/ServerRequestInterceptorA.cpp b/TAO/tao/PI_Server/ServerRequestInterceptorA.cpp index 7ff84e2a730..7ff84e2a730 100644 --- a/TAO/tao/ServerRequestInterceptorA.cpp +++ b/TAO/tao/PI_Server/ServerRequestInterceptorA.cpp diff --git a/TAO/tao/ServerRequestInterceptorC.cpp b/TAO/tao/PI_Server/ServerRequestInterceptorC.cpp index 82e30f3c415..82e30f3c415 100644 --- a/TAO/tao/ServerRequestInterceptorC.cpp +++ b/TAO/tao/PI_Server/ServerRequestInterceptorC.cpp diff --git a/TAO/tao/ServerRequestInterceptorC.h b/TAO/tao/PI_Server/ServerRequestInterceptorC.h index 28a219ca5d6..69d8fec7f52 100644 --- a/TAO/tao/ServerRequestInterceptorC.h +++ b/TAO/tao/PI_Server/ServerRequestInterceptorC.h @@ -40,21 +40,21 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/TAO_Export.h" +#include "tao/PI_Server/pi_server_export.h" #include "tao/ORB.h" #include "tao/SystemException.h" #include "tao/Environment.h" #include "tao/Object.h" #include "tao/Objref_VarOut_T.h" -#include "tao/InterceptorC.h" +#include "tao/PI/InterceptorC.h" #include "tao/OctetSeqC.h" #include "tao/PIForwardRequestC.h" #if defined (TAO_EXPORT_MACRO) #undef TAO_EXPORT_MACRO #endif -#define TAO_EXPORT_MACRO TAO_Export +#define TAO_EXPORT_MACRO TAO_PI_Server_Export #if defined(_MSC_VER) #pragma warning(push) @@ -123,7 +123,7 @@ namespace PortableInterceptor #if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR_CH_) #define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR_CH_ - class TAO_Export ServerRequestInterceptor + class TAO_PI_Server_Export ServerRequestInterceptor : public virtual ::PortableInterceptor::Interceptor { public: @@ -257,7 +257,7 @@ namespace PortableInterceptor // TAO_IDL - Generated from // be\be_visitor_typecode/typecode_decl.cpp:44 - extern TAO_Export ::CORBA::TypeCode_ptr const _tc_ServerRequestInterceptor; + extern TAO_PI_Server_Export ::CORBA::TypeCode_ptr const _tc_ServerRequestInterceptor; // TAO_IDL - Generated from // be\be_visitor_module/module_ch.cpp:66 @@ -275,7 +275,7 @@ namespace TAO #define _PORTABLEINTERCEPTOR_SERVERREQUESTINFO__TRAITS_CH_ template<> - struct TAO_Export Objref_Traits< ::PortableInterceptor::ServerRequestInfo> + struct TAO_PI_Server_Export Objref_Traits< ::PortableInterceptor::ServerRequestInfo> { static ::PortableInterceptor::ServerRequestInfo_ptr duplicate ( ::PortableInterceptor::ServerRequestInfo_ptr @@ -296,7 +296,7 @@ namespace TAO #define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__TRAITS_CH_ template<> - struct TAO_Export Objref_Traits< ::PortableInterceptor::ServerRequestInterceptor> + struct TAO_PI_Server_Export Objref_Traits< ::PortableInterceptor::ServerRequestInterceptor> { static ::PortableInterceptor::ServerRequestInterceptor_ptr duplicate ( ::PortableInterceptor::ServerRequestInterceptor_ptr @@ -317,9 +317,9 @@ namespace TAO // TAO_IDL - Generated from // be\be_visitor_interface/any_op_ch.cpp:52 -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr); // copying -TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr *); // non-copying -TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr &); +TAO_PI_Server_Export void operator<<= (CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr); // copying +TAO_PI_Server_Export void operator<<= (CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr *); // non-copying +TAO_PI_Server_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::ServerRequestInterceptor_ptr &); // TAO_IDL - Generated from // be\be_codegen.cpp:955 diff --git a/TAO/tao/ServerRequestInterceptorS.h b/TAO/tao/PI_Server/ServerRequestInterceptorS.h index 17b1360599e..17b1360599e 100644 --- a/TAO/tao/ServerRequestInterceptorS.h +++ b/TAO/tao/PI_Server/ServerRequestInterceptorS.h diff --git a/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp new file mode 100644 index 00000000000..f67d1dcfbd9 --- /dev/null +++ b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp @@ -0,0 +1,40 @@ +/* -*- C++ -*- */ + +// ================================================================= +/** + * @file PolicyFactory_Loader.cpp + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + * + */ +// ================================================================= + +#include "ServerRequestInterceptor_Factory_Impl.h" +#include "ServerInterceptorAdapter.h" + +#include "tao/ORB.h" +#include "tao/debug.h" + +ACE_RCSID (PI_Server, + PolicyFactory_Loader, + "$Id$") + +TAO::ServerRequestInterceptor_Adapter* +TAO_ServerRequestInterceptor_Adapter_Factory_Impl::create (void) +{ + TAO::ServerRequestInterceptor_Adapter_Impl* obj = 0; + ACE_NEW_RETURN (obj, + TAO::ServerRequestInterceptor_Adapter_Impl , + 0); + return obj; +} + +ACE_STATIC_SVC_DEFINE (TAO_ServerRequestInterceptor_Adapter_Factory_Impl, + ACE_TEXT ("ServerRequestInterceptor_Adapter_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_ServerRequestInterceptor_Adapter_Factory_Impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (TAO_PI_Server, TAO_ServerRequestInterceptor_Adapter_Factory_Impl) diff --git a/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h new file mode 100644 index 00000000000..cbc796a9f79 --- /dev/null +++ b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ + + +//============================================================================= +/** + * @file PolicyFactory_Loader.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + + +#ifndef TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H +#define TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H + +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" + +#include "tao/ServerRequestInterceptor_Adapter_Factory.h" + +namespace TAO +{ + class ServerRequestInterceptor_Adapter; +} + +class TAO_PI_Server_Export TAO_ServerRequestInterceptor_Adapter_Factory_Impl + : public TAO_ServerRequestInterceptor_Adapter_Factory +{ +public: + virtual TAO::ServerRequestInterceptor_Adapter *create (void); +}; + +ACE_STATIC_SVC_DECLARE (TAO_ServerRequestInterceptor_Adapter_Factory_Impl) +ACE_FACTORY_DECLARE (TAO_PI_Server, TAO_ServerRequestInterceptor_Adapter_Factory_Impl) + +#include /**/ "ace/post.h" + +#endif /* TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H */ diff --git a/TAO/tao/PortableInterceptor.pidl b/TAO/tao/PortableInterceptor.pidl index 1869495e41f..0f9d16f4e3b 100644 --- a/TAO/tao/PortableInterceptor.pidl +++ b/TAO/tao/PortableInterceptor.pidl @@ -40,8 +40,6 @@ #include <InvalidSlot.pidl> #include <ClientRequestInfo.pidl> #include <ServerRequestInfo.pidl> -#include <ClientRequestInterceptor.pidl> -#include <ServerRequestInterceptor.pidl> #include <PICurrent.pidl> module PortableInterceptor { diff --git a/TAO/tao/PortableInterceptorC.h b/TAO/tao/PortableInterceptorC.h index 3b81a12fa86..47a84dfc709 100644 --- a/TAO/tao/PortableInterceptorC.h +++ b/TAO/tao/PortableInterceptorC.h @@ -50,8 +50,6 @@ #include "tao/InvalidSlotC.h" #include "tao/ClientRequestInfoC.h" #include "tao/ServerRequestInfoC.h" -#include "tao/ClientRequestInterceptorC.h" -#include "tao/ServerRequestInterceptorC.h" #include "tao/PICurrentC.h" #if defined (TAO_EXPORT_MACRO) @@ -73,60 +71,60 @@ namespace PortableInterceptor { - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::AdapterState HOLDING = 0; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::AdapterState ACTIVE = 1; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::AdapterState DISCARDING = 2; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::AdapterState INACTIVE = 3; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::AdapterState NON_EXISTENT = 4; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus SUCCESSFUL = 0; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus SYSTEM_EXCEPTION = 1; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus USER_EXCEPTION = 2; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus LOCATION_FORWARD = 3; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus TRANSPORT_RETRY = 4; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const PortableInterceptor::ReplyStatus UNKNOWN = 5; // TAO_IDL - Generated from diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 9853b043a6d..349f05e5e8c 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -10,7 +10,6 @@ #include "POA_Guard.h" #include "ServerRequestInfo.h" #include "Default_Servant_Dispatcher.h" -#include "ServerInterceptorAdapter.h" #include "Collocated_Object_Proxy_Broker.h" #include "POAManager.h" #include "Servant_Base.h" @@ -32,6 +31,7 @@ #include "tao/Thread_Lane_Resources_Manager.h" #include "tao/Thread_Lane_Resources.h" #include "tao/Protocols_Hooks.h" +#include "tao/ServerRequestInterceptor_Adapter.h" #if !defined (__ACE_INLINE__) # include "Object_Adapter.i" @@ -732,7 +732,8 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key, int result = 0; #if TAO_HAS_INTERCEPTORS == 1 - TAO::ServerRequestInterceptor_Adapter sri_adapter (request); + TAO::ServerRequestInterceptor_Adapter *sri_adapter = + orb_core_.serverrequestinterceptor_adapter (); TAO::ServerRequestInfo ri (request, 0, // args @@ -743,39 +744,52 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key, ACE_TRY { + if (sri_adapter != 0) + { #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 - CORBA::OctetSeq_var ocs; - sri_adapter.tao_ft_interception_point (&ri, - ocs.out () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::OctetSeq_var ocs; + sri_adapter.tao_ft_interception_point (request, + &ri, + ocs.out () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - /// If we have a cached result, just go ahead and send the reply - /// and let us return - if (ocs.ptr () != 0) - { - // request.result_seq ( - request.send_cached_reply (ocs.inout ()); + /// If we have a cached result, just go ahead and send the reply + /// and let us return + if (ocs.ptr () != 0) + { + // request.result_seq ( + request.send_cached_reply (ocs.inout ()); - return TAO_Adapter::DS_OK; - } -#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ + return TAO_Adapter::DS_OK; + } - // The receive_request_service_contexts() interception point - // must be invoked before the operation is dispatched to the - // servant. - sri_adapter.receive_request_service_contexts (&ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // If a PortableInterceptor::ForwardRequest exception was + // thrown, then set the forward_to object reference and return + // with the appropriate return status. + forward_to.ptr () = request.forward_location (); + if (!CORBA::is_nil (request.forward_location ())) + { + return TAO_Adapter::DS_FORWARD; + } +#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ - // If a PortableInterceptor::ForwardRequest exception was - // thrown, then set the forward_to object reference and return - // with the appropriate return status. - if (sri_adapter.location_forwarded ()) - { - forward_to = ri.forward_reference (ACE_ENV_SINGLE_ARG_PARAMETER); + // The receive_request_service_contexts() interception point + // must be invoked before the operation is dispatched to the + // servant. + sri_adapter->receive_request_service_contexts (request, + &ri + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - return TAO_Adapter::DS_FORWARD; + // If a PortableInterceptor::ForwardRequest exception was + // thrown, then set the forward_to object reference and return + // with the appropriate return status. + forward_to.ptr () = request.forward_location (); + if (!CORBA::is_nil (request.forward_location ())) + { + return TAO_Adapter::DS_FORWARD; + } } #endif /* TAO_HAS_INTERCEPTORS == 1 */ @@ -790,22 +804,37 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key, if (result == TAO_Adapter::DS_FORWARD) { ri.forward_reference (forward_to.ptr ()); - sri_adapter.send_other (&ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (sri_adapter != 0) + { + sri_adapter->send_other (request, + &ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCHANY { - ri.exception (&ACE_ANY_EXCEPTION); + // Just assume the current exception is a system exception, the + // status can only change when the interceptor changes this + // and this is only done when the sri_adapter is available. If we + // don't have an sri_adapter we just rethrow the exception + PortableInterceptor::ReplyStatus status = + PortableInterceptor::SYSTEM_EXCEPTION; - sri_adapter.send_exception (&ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (sri_adapter != 0) + { + ri.exception (&ACE_ANY_EXCEPTION); - PortableInterceptor::ReplyStatus status = - ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + sri_adapter->send_exception (request, + &ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + status = + ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } // Only re-throw the exception if it hasn't been transformed by // the send_exception() interception point (e.g. to a diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.inl b/TAO/tao/PortableServer/ServerInterceptorAdapter.inl deleted file mode 100644 index 30e0c4508ce..00000000000 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.inl +++ /dev/null @@ -1,9 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_INLINE bool -TAO::ServerRequestInterceptor_Adapter::location_forwarded (void) const -{ - return this->location_forwarded_; -} diff --git a/TAO/tao/PortableServer/ServerRequestInfo.h b/TAO/tao/PortableServer/ServerRequestInfo.h index 6ee3c8f4198..47fb4d1b3f5 100644 --- a/TAO/tao/PortableServer/ServerRequestInfo.h +++ b/TAO/tao/PortableServer/ServerRequestInfo.h @@ -27,6 +27,7 @@ #if (TAO_HAS_INTERCEPTORS == 1) +#include "portableserver_export.h" #include "tao/ServerRequestInfoC.h" #include "tao/LocalObject.h" #include "tao/OctetSeqC.h" @@ -64,7 +65,7 @@ namespace TAO * @note This class is currently not meant to be reference counted * since it is instantiated on the stack. */ - class ServerRequestInfo + class TAO_PortableServer_Export ServerRequestInfo : public virtual PortableInterceptor::ServerRequestInfo, public virtual CORBA::LocalObject { diff --git a/TAO/tao/PortableServer/ServerRequestInfo.inl b/TAO/tao/PortableServer/ServerRequestInfo.inl index 4277347ffba..ba414ac59c5 100644 --- a/TAO/tao/PortableServer/ServerRequestInfo.inl +++ b/TAO/tao/PortableServer/ServerRequestInfo.inl @@ -74,3 +74,4 @@ TAO::ServerRequestInfo::server_request (void) { return this->server_request_; } + diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Upcall_Wrapper.cpp index 72cd52a8056..43a84a9df73 100644 --- a/TAO/tao/PortableServer/Upcall_Wrapper.cpp +++ b/TAO/tao/PortableServer/Upcall_Wrapper.cpp @@ -5,9 +5,9 @@ #if TAO_HAS_INTERCEPTORS == 1 # include "PICurrent_Guard.h" - -# include "tao/PortableServer/ServerRequestInfo.h" -# include "tao/PortableServer/ServerInterceptorAdapter.h" +# include "ORB_Core.h" +# include "ServerRequestInfo.h" +# include "ServerRequestInterceptor_Adapter.h" #endif /* TAO_HAS_INTERCEPTORS == 1 */ #include "tao/PortableInterceptor.h" @@ -55,7 +55,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, exceptions, nexceptions); - TAO::ServerRequestInterceptor_Adapter interceptor_adapter (server_request); + TAO::ServerRequestInterceptor_Adapter *interceptor_adapter = + server_request.orb_core ()->serverrequestinterceptor_adapter (); ACE_TRY { @@ -63,14 +64,19 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, TAO::PICurrent_Guard pi_guard (server_request, true /* Copy TSC to RSC */); - // Invoke intermediate server side interception points. - interceptor_adapter.receive_request (&request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (interceptor_adapter != 0) + { + // Invoke intermediate server side interception points. + interceptor_adapter->receive_request (server_request, + &request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } // Don't bother performing the upcall if an interceptor caused a // location forward. - if (!interceptor_adapter.location_forwarded ()) + CORBA::Object_var forward_to = server_request.forward_location (); + if (CORBA::is_nil (forward_to.in ())) { #endif /* TAO_HAS_INTERCEPTORS */ @@ -82,36 +88,56 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, } } - // Do not execute the send_reply() interception point if an - // interceptor caused a location forward. The send_other() - // interception point should already have been executed by the - // ServerRequestInterceptor_Adapter object. - // - // It should actually be safe to call this interception point, - // regardless, since the interceptor flow stack should have been - // emptied by the send_other() interception point. Note that - // we'd still need to avoid resetting the reply status to - // SUCCESSFUL, however. - if (!interceptor_adapter.location_forwarded ()) + if (interceptor_adapter == 0) { - // No location forward by interceptors and successful upcall. - request_info.reply_status (PortableInterceptor::SUCCESSFUL); - interceptor_adapter.send_reply (&request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + } + else + { + // Do not execute the send_reply() interception point if an + // interceptor caused a location forward. The send_other() + // interception point should already have been executed by the + // ServerRequestInterceptor_Adapter object. + // + // It should actually be safe to call this interception point, + // regardless, since the interceptor flow stack should have been + // emptied by the send_other() interception point. Note that + // we'd still need to avoid resetting the reply status to + // SUCCESSFUL, however. + CORBA::Object_var forward_to_after = server_request.forward_location (); + if (CORBA::is_nil (forward_to_after.in ())) + { + // No location forward by interceptors and successful upcall. + request_info.reply_status (PortableInterceptor::SUCCESSFUL); + interceptor_adapter->send_reply (server_request, + &request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCHANY { + // Just assume the current exception is a system exception, the + // status can only change when the interceptor changes this + // and this is only done when the sri_adapter is available. If we + // don't have an sri_adapter we just rethrow the exception + PortableInterceptor::ReplyStatus status = + PortableInterceptor::SYSTEM_EXCEPTION; + request_info.exception (&ACE_ANY_EXCEPTION); - interceptor_adapter.send_exception (&request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableInterceptor::ReplyStatus status = - request_info.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + if (interceptor_adapter != 0) + { + interceptor_adapter->send_exception (server_request, + &request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + status = + request_info.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } if (status == PortableInterceptor::SYSTEM_EXCEPTION || status == PortableInterceptor::USER_EXCEPTION) @@ -126,9 +152,13 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, CORBA::UNKNOWN ex; request_info.exception (&ex); - interceptor_adapter.send_exception (&request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (interceptor_adapter != 0) + { + interceptor_adapter->send_exception (server_request, + &request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } PortableInterceptor::ReplyStatus status = request_info.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -151,7 +181,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, #if TAO_HAS_INTERCEPTORS == 1 // Don't bother marshaling inout/out/return values if an interceptor // caused a location forward. - if (!interceptor_adapter.location_forwarded ()) + CORBA::Object_var forward_to_end = server_request.forward_location (); + if (CORBA::is_nil (forward_to_end.in ())) #endif /* TAO_HAS_INTERCEPTORS == 1 */ { if (server_request.outgoing ()) diff --git a/TAO/tao/RTScheduler.mpc b/TAO/tao/RTScheduler.mpc index 69b42366b9b..cf7725ce8e0 100644 --- a/TAO/tao/RTScheduler.mpc +++ b/TAO/tao/RTScheduler.mpc @@ -1,5 +1,5 @@ //$Id$ -project : taolib, rtcorba, portableserver, core, corba_messaging { +project : taolib, rtcorba, pi, pi_server, portableserver, core, corba_messaging { sharedname = TAO_RTScheduler dynamicflags = TAO_RTSCHEDULER_BUILD_DLL diff --git a/TAO/tao/RTScheduling/RTScheduler.pidl b/TAO/tao/RTScheduling/RTScheduler.pidl index ddd19f01bca..da848594c25 100644 --- a/TAO/tao/RTScheduling/RTScheduler.pidl +++ b/TAO/tao/RTScheduling/RTScheduler.pidl @@ -29,7 +29,7 @@ #include "tao/RTCORBA/RTCORBA_include.pidl" #include "tao/PortableServer/PortableServer_include.pidl" #include "tao/PortableInterceptor.pidl" - +#include "tao/PIForwardRequest.pidl" module CORBA { diff --git a/TAO/tao/RTScheduling/RTSchedulerA.cpp b/TAO/tao/RTScheduling/RTSchedulerA.cpp index 5f604f5c9e1..0f18cf7b3b9 100644 --- a/TAO/tao/RTScheduling/RTSchedulerA.cpp +++ b/TAO/tao/RTScheduling/RTSchedulerA.cpp @@ -37,7 +37,7 @@ #include "tao/TypeCode_Struct_Field.h" // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> @@ -55,7 +55,7 @@ namespace RTScheduling // TAO_IDL - Generated from -// be/be_visitor_typecode/enum_typecode.cpp:34 +// be\be_visitor_typecode/enum_typecode.cpp:34 static char const * const _tao_enumerators_RTScheduling_DistributableThread_DT_State[] = { @@ -77,7 +77,7 @@ static TAO::TypeCode::Enum<char const *, &_tao_tc_RTScheduling_DistributableThread_DT_State; // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> @@ -95,14 +95,13 @@ namespace RTScheduling // TAO_IDL - Generated from -// be/be_visitor_typecode/struct_typecode.cpp:74 +// be\be_visitor_typecode/struct_typecode.cpp:87 static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE = 0; static TAO::TypeCode::Struct<char const *, - CORBA::TypeCode_ptr const *, - TAO::TypeCode::Struct_Field<char const *, - CORBA::TypeCode_ptr const *> const *, - TAO::Null_RefCount_Policy> + CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> _tao_tc_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE ( CORBA::tk_except, "IDL:RTScheduling/Current/UNSUPPORTED_SCHEDULING_DISCIPLINE:1.0", @@ -114,12 +113,12 @@ static TAO::TypeCode::Struct<char const *, &_tao_tc_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE; // TAO_IDL - Generated from -// be/be_visitor_typecode/alias_typecode.cpp:31 +// be\be_visitor_typecode/alias_typecode.cpp:50 // TAO_IDL - Generated from -// be/be_visitor_typecode/typecode_defn.cpp:925 +// be\be_visitor_typecode/typecode_defn.cpp:937 #ifndef _TAO_TYPECODE_RTScheduling_Current_IdType_GUARD @@ -143,6 +142,7 @@ namespace TAO #endif /* _TAO_TYPECODE_RTScheduling_Current_IdType_GUARD */ + static TAO::TypeCode::Alias<char const *, CORBA::TypeCode_ptr const *, TAO::Null_RefCount_Policy> @@ -156,12 +156,12 @@ static TAO::TypeCode::Alias<char const *, &_tao_tc_RTScheduling_Current_IdType; // TAO_IDL - Generated from -// be/be_visitor_typecode/alias_typecode.cpp:31 +// be\be_visitor_typecode/alias_typecode.cpp:50 // TAO_IDL - Generated from -// be/be_visitor_typecode/typecode_defn.cpp:925 +// be\be_visitor_typecode/typecode_defn.cpp:937 #ifndef _TAO_TYPECODE_RTScheduling_Current_NameList_GUARD @@ -185,6 +185,7 @@ namespace TAO #endif /* _TAO_TYPECODE_RTScheduling_Current_NameList_GUARD */ + static TAO::TypeCode::Alias<char const *, CORBA::TypeCode_ptr const *, TAO::Null_RefCount_Policy> @@ -198,7 +199,7 @@ static TAO::TypeCode::Alias<char const *, &_tao_tc_RTScheduling_Current_NameList; // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> @@ -216,7 +217,7 @@ namespace RTScheduling // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> @@ -234,14 +235,13 @@ namespace RTScheduling // TAO_IDL - Generated from -// be/be_visitor_typecode/struct_typecode.cpp:74 +// be\be_visitor_typecode/struct_typecode.cpp:87 static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES = 0; static TAO::TypeCode::Struct<char const *, - CORBA::TypeCode_ptr const *, - TAO::TypeCode::Struct_Field<char const *, - CORBA::TypeCode_ptr const *> const *, - TAO::Null_RefCount_Policy> + CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> _tao_tc_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES ( CORBA::tk_except, "IDL:RTScheduling/Scheduler/INCOMPATIBLE_SCHEDULING_DISCIPLINES:1.0", @@ -253,7 +253,7 @@ static TAO::TypeCode::Struct<char const *, &_tao_tc_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES; // TAO_IDL - Generated from -// be/be_visitor_typecode/objref_typecode.cpp:76 +// be\be_visitor_typecode/objref_typecode.cpp:76 static TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy> diff --git a/TAO/tao/RTScheduling/RTSchedulerC.h b/TAO/tao/RTScheduling/RTSchedulerC.h index 12f0f991e07..a0324e928fb 100644 --- a/TAO/tao/RTScheduling/RTSchedulerC.h +++ b/TAO/tao/RTScheduling/RTSchedulerC.h @@ -53,6 +53,7 @@ #include "tao/RTCORBA/RTCORBA_includeC.h" #include "tao/PortableServer/PortableServer_includeC.h" #include "tao/PortableInterceptorC.h" +#include "tao/PIForwardRequestC.h" #ifndef TAO_RTSCHEDULER_SAFE_INCLUDE #error "You should not include RTSchedulerC.h directly, use RTScheduler.h" @@ -393,7 +394,7 @@ namespace RTScheduling )) = 0; // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:51 + // be\be_visitor_exception/exception_ch.cpp:53 #if !defined (_RTSCHEDULING_CURRENT_UNSUPPORTED_SCHEDULING_DISCIPLINE_CH_) #define _RTSCHEDULING_CURRENT_UNSUPPORTED_SCHEDULING_DISCIPLINE_CH_ @@ -428,7 +429,7 @@ namespace RTScheduling ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:127 + // be\be_visitor_exception/exception_ch.cpp:129 virtual CORBA::TypeCode_ptr _tao_type (void) const; }; @@ -817,7 +818,7 @@ namespace RTScheduling // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:51 + // be\be_visitor_exception/exception_ch.cpp:53 #if !defined (_RTSCHEDULING_SCHEDULER_INCOMPATIBLE_SCHEDULING_DISCIPLINES_CH_) #define _RTSCHEDULING_SCHEDULER_INCOMPATIBLE_SCHEDULING_DISCIPLINES_CH_ @@ -852,7 +853,7 @@ namespace RTScheduling ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:127 + // be\be_visitor_exception/exception_ch.cpp:129 virtual CORBA::TypeCode_ptr _tao_type (void) const; }; diff --git a/TAO/tao/RTScheduling/Request_Interceptor.h b/TAO/tao/RTScheduling/Request_Interceptor.h index 3cbe529f288..189b5220d47 100644 --- a/TAO/tao/RTScheduling/Request_Interceptor.h +++ b/TAO/tao/RTScheduling/Request_Interceptor.h @@ -6,15 +6,17 @@ #define TAO_RTSCHEDULING_REQUEST_INTERCEPTOR_H #include "rtscheduler_export.h" -#include "tao/PortableInterceptorC.h" #include "RTScheduler.h" #include "ace/Atomic_Op.h" #include "Current.h" +#include "tao/PI/PI.h" +#include "tao/PI_Server/PI_Server.h" + extern ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> server_guid_counter; class TAO_RTScheduler_Export Client_Interceptor : - public PortableInterceptor::ClientRequestInterceptor + public PortableInterceptor::ClientRequestInterceptor { public: diff --git a/TAO/tao/ServerRequestInterceptor_Adapter.cpp b/TAO/tao/ServerRequestInterceptor_Adapter.cpp new file mode 100644 index 00000000000..d92d818b480 --- /dev/null +++ b/TAO/tao/ServerRequestInterceptor_Adapter.cpp @@ -0,0 +1,14 @@ +#include "ServerRequestInterceptor_Adapter.h" + +ACE_RCSID (tao, + ServerRequestInterceptorAdapter, + "$Id$") + +namespace TAO +{ + ServerRequestInterceptor_Adapter::~ServerRequestInterceptor_Adapter (void) + { + } +} + + diff --git a/TAO/tao/ServerRequestInterceptor_Adapter.h b/TAO/tao/ServerRequestInterceptor_Adapter.h new file mode 100644 index 00000000000..e09f7c163f1 --- /dev/null +++ b/TAO/tao/ServerRequestInterceptor_Adapter.h @@ -0,0 +1,119 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ServerRequestInterceptor_Adapter.h + * + * $Id$ + * + * This file an adapter class to simplify the support of + * interceptors. + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H +#define TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H + +#include /**/ "ace/pre.h" + +#include "TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/CORBA_macros.h" + +namespace PortableInterceptor +{ + class ServerRequestInterceptor; + typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr; +} + +class TAO_ServerRequest; + +namespace TAO +{ + class ServerRequestInfo; + + /** + * @class ServerRequestInterceptor_Adapter + */ + class TAO_Export ServerRequestInterceptor_Adapter + { + public: + virtual ~ServerRequestInterceptor_Adapter (void); + + /** + * @name PortableInterceptor Server Side Interception Points + * + * Each of these methods corresponds to a client side interception + * point. + */ + //@{ +#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 + /// This method implements the "starting" server side interception + /// point. It will be used as the first interception point and it is + /// proprietary to TAO. + /// @@ Will go away once Bug 1369 is fixed + virtual void tao_ft_interception_point ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri , + CORBA::OctetSeq_out oc + ACE_ENV_ARG_DECL) = 0; +#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ + + /// 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. + /// + /// @note This method should have been the "starting" interception + /// point according to the interceptor spec. This will be + /// fixed once Bug 1369 is completely done. + virtual void receive_request_service_contexts ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; + + /// This method an "intermediate" server side interception point. + virtual void receive_request ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; + + /// This method implements one of the "ending" server side + /// interception points. + virtual void send_reply ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo *ri + ACE_ENV_ARG_DECL) = 0; + + /// This method implements one of the "ending" server side + /// interception points. + virtual void send_exception ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL) = 0; + + /// This method implements one of the "ending" server side + /// interception points. + virtual void send_other ( + TAO_ServerRequest &server_request, + TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL) = 0; + //@} + + /// Register an interceptor. + virtual void add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor + ACE_ENV_ARG_DECL) = 0; + + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0; + }; + +} +#include /**/ "ace/post.h" + +#endif /* TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H */ diff --git a/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h new file mode 100644 index 00000000000..f5699fde601 --- /dev/null +++ b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h @@ -0,0 +1,45 @@ +// This may look like C, but it's really -*- C++ -*- + +//============================================================================= +/** + * @file ServerRequestInterceptor_Adapter_Factory.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + + +#ifndef TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H +#define TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H + +#include /**/ "ace/pre.h" +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/SystemException.h" + +namespace TAO +{ + class ServerRequestInterceptor_Adapter; +} + +/** + * @class TAO_ServerRequestInterceptor_Adapter_Factory + * + * @brief TAO_ServerRequestInterceptor_Adapter_Factory. + */ +class TAO_Export TAO_ServerRequestInterceptor_Adapter_Factory + : public ACE_Service_Object +{ +public: + virtual TAO::ServerRequestInterceptor_Adapter * create (void) = 0; +}; + +#include /**/ "ace/post.h" + +#endif /* TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H */ diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index 86d216cdcdf..05d775e0e0a 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -45,8 +45,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { ClientRequestInfoA.cpp ClientRequestInfoC.cpp ClientRequestInterceptor_Adapter.cpp - ClientRequestInterceptorA.cpp - ClientRequestInterceptorC.cpp Codeset_Manager.cpp Codeset_Translator_Factory.cpp Collocated_Invocation.cpp @@ -122,8 +120,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { IIOPA.cpp IIOPC.cpp Incoming_Message_Queue.cpp - InterceptorA.cpp - InterceptorC.cpp InvalidSlotA.cpp InvalidSlotC.cpp Invocation_Adapter.cpp @@ -238,8 +234,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Server_Strategy_Factory.cpp ServerRequestInfoA.cpp ServerRequestInfoC.cpp - ServerRequestInterceptorA.cpp - ServerRequestInterceptorC.cpp + ServerRequestInterceptor_Adapter.cpp Service_Callbacks.cpp Service_Context.cpp Services_Activate.cpp @@ -370,8 +365,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { ClientRequestInfoC.h ClientRequestInfoS.h ClientRequestInterceptor_Adapter.h - ClientRequestInterceptorC.h - ClientRequestInterceptorS.h Client_Strategy_Factory.h Codeset_Manager.h Codeset_Translator_Factory.h @@ -460,8 +453,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { IIOP_Profile.h IIOP_Transport.h Incoming_Message_Queue.h - InterceptorC.h - InterceptorS.h Interceptor_List.h InvalidSlotC.h InvalidSlotS.h @@ -596,8 +587,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Server_Strategy_Factory.h ServerRequestInfoC.h ServerRequestInfoS.h - ServerRequestInterceptorC.h - ServerRequestInterceptorS.h Service_Callbacks.h Service_Context.h Services_Activate.h diff --git a/TAO/tests/Bug_1495_Regression/Bug_1495.mpc b/TAO/tests/Bug_1495_Regression/Bug_1495.mpc index e8db7ce8986..17b9c050382 100644 --- a/TAO/tests/Bug_1495_Regression/Bug_1495.mpc +++ b/TAO/tests/Bug_1495_Regression/Bug_1495.mpc @@ -1,21 +1,22 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp Server_ORBInitializer.cpp - interceptors.cpp + server_interceptor.cpp Threaded_Server.cpp } } -project(*Client): taoserver, taoclient, interceptors { +project(*Client): taoserver, pi, interceptors { + exename = client Source_Files { test_i.cpp testC.cpp testS.cpp - interceptors.cpp + client_interceptor.cpp Threaded_Client.cpp Server_Task.cpp diff --git a/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.cpp b/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.cpp index 492b1b888c2..9993a624d7f 100644 --- a/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.cpp +++ b/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.cpp @@ -4,7 +4,7 @@ // #include "Server_ORBInitializer.h" -#include "interceptors.h" +#include "server_interceptor.h" ACE_RCSID (Service_Context_Manipulation, Server_ORBInitializer, "$Id$") diff --git a/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.h b/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.h index 5b3c199490d..f47e9ce5e68 100644 --- a/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.h +++ b/TAO/tests/Bug_1495_Regression/Server_ORBInitializer.h @@ -14,7 +14,8 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" -#include "interceptors.h" + +class Echo_Server_Request_Interceptor; // This is to remove "inherits via dominance" warnings from MSVC. // MSVC is being a little too paranoid. diff --git a/TAO/tests/Bug_1495_Regression/Threaded_Server.cpp b/TAO/tests/Bug_1495_Regression/Threaded_Server.cpp index 5d2cb6a1669..95cd68db7e7 100644 --- a/TAO/tests/Bug_1495_Regression/Threaded_Server.cpp +++ b/TAO/tests/Bug_1495_Regression/Threaded_Server.cpp @@ -3,7 +3,7 @@ #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" #include "test_i.h" -#include "interceptors.h" +#include "server_interceptor.h" #include "Server_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Bug_1495_Regression/client_interceptor.cpp b/TAO/tests/Bug_1495_Regression/client_interceptor.cpp new file mode 100644 index 00000000000..fc019f046ed --- /dev/null +++ b/TAO/tests/Bug_1495_Regression/client_interceptor.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "client_interceptor.h" +#include "tao/OctetSeqC.h" +#include "ace/Log_Msg.h" +#include "tao/ORB_Constants.h" +#include "ace/OS_NS_string.h" +#include "ace/Thread.h" + +ACE_RCSID (Bug_1495_Regression_Test, + client_interceptor, + "$Id$") + + +Echo_Client_Request_Interceptor:: +Echo_Client_Request_Interceptor (const char *id) + : myname_ ("Echo_Client_Interceptor"), + orb_id_ (CORBA::string_dup (id)) +{ +} + +Echo_Client_Request_Interceptor::~Echo_Client_Request_Interceptor (void) +{ +} + +char * +Echo_Client_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Echo_Client_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Echo_Client_Request_Interceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Do Nothing +} + +void +Echo_Client_Request_Interceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + ACE_UNUSED_ARG (ri); +// No Op +} + +void +Echo_Client_Request_Interceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (ri); + // No Op +} + +void +Echo_Client_Request_Interceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + ACE_UNUSED_ARG (ri); +// no op +} + +void +Echo_Client_Request_Interceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // No op + ACE_UNUSED_ARG (ri); +} + + diff --git a/TAO/tests/Bug_1495_Regression/client_interceptor.h b/TAO/tests/Bug_1495_Regression/client_interceptor.h new file mode 100644 index 00000000000..2503a4b75b7 --- /dev/null +++ b/TAO/tests/Bug_1495_Regression/client_interceptor.h @@ -0,0 +1,78 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_CLIENT_INTERCEPTOR_H +#define TAO_CLIENT_INTERCEPTOR_H + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/ORB.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Echo_Client_Request_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side echo interceptor. For checking interceptor visually only. +public: + Echo_Client_Request_Interceptor (const char *orb_id); + // ctor. + + virtual ~Echo_Client_Request_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; + + CORBA::String_var orb_id_; + // The ID of the ORB where this interceptor was created, usually + // obtained from the ORBInitInfo + + CORBA::ORB_var orb_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_CLIENT_INTERCEPTOR_H */ diff --git a/TAO/tests/Bug_1495_Regression/interceptors.cpp b/TAO/tests/Bug_1495_Regression/server_interceptor.cpp index 247735b187b..c4a32357087 100644 --- a/TAO/tests/Bug_1495_Regression/interceptors.cpp +++ b/TAO/tests/Bug_1495_Regression/server_interceptor.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "interceptors.h" +#include "server_interceptor.h" #include "tao/OctetSeqC.h" #include "ace/Log_Msg.h" #include "tao/ORB_Constants.h" @@ -8,86 +8,10 @@ #include "ace/Thread.h" ACE_RCSID (Bug_1495_Regression_Test, - interceptors, + server_interceptor, "$Id$") -Echo_Client_Request_Interceptor:: -Echo_Client_Request_Interceptor (const char *id) - : myname_ ("Echo_Client_Interceptor"), - orb_id_ (CORBA::string_dup (id)) -{ -} - -Echo_Client_Request_Interceptor::~Echo_Client_Request_Interceptor (void) -{ -} - -char * -Echo_Client_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Echo_Client_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Echo_Client_Request_Interceptor::send_poll ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Do Nothing -} - -void -Echo_Client_Request_Interceptor::send_request ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - ACE_UNUSED_ARG (ri); -// No Op -} - -void -Echo_Client_Request_Interceptor::receive_reply ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_UNUSED_ARG (ri); - // No Op -} - -void -Echo_Client_Request_Interceptor::receive_other ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - ACE_UNUSED_ARG (ri); -// no op -} - -void -Echo_Client_Request_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // No op - ACE_UNUSED_ARG (ri); -} - Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) : myname_ ("Echo_Server_Interceptor") { diff --git a/TAO/tests/Bug_1495_Regression/interceptors.h b/TAO/tests/Bug_1495_Regression/server_interceptor.h index af06178218d..f1f682be9f9 100644 --- a/TAO/tests/Bug_1495_Regression/interceptors.h +++ b/TAO/tests/Bug_1495_Regression/server_interceptor.h @@ -2,9 +2,10 @@ // // $Id$ -#ifndef TAO_INTERCEPTORS_H -#define TAO_INTERCEPTORS_H +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" @@ -18,58 +19,6 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -class Echo_Client_Request_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side echo interceptor. For checking interceptor visually only. -public: - Echo_Client_Request_Interceptor (const char *orb_id); - // ctor. - - virtual ~Echo_Client_Request_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; - - CORBA::String_var orb_id_; - // The ID of the ORB where this interceptor was created, usually - // obtained from the ORBInitInfo - - CORBA::ORB_var orb_; -}; - class Echo_Server_Request_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -131,4 +80,4 @@ private: #pragma warning(pop) #endif /* _MSC_VER */ -#endif /* TAO_INTERCEPTORS_H */ +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/AMI/Client_Interceptor.h b/TAO/tests/Portable_Interceptors/AMI/Client_Interceptor.h index 65cd26b41dd..f775ebe2052 100644 --- a/TAO/tests/Portable_Interceptors/AMI/Client_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/AMI/Client_Interceptor.h @@ -8,6 +8,7 @@ #ifndef Client_Interceptor__h_ #define Client_Interceptor__h_ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" diff --git a/TAO/tests/Portable_Interceptors/AMI/PI_AMI.mpc b/TAO/tests/Portable_Interceptors/AMI/PI_AMI.mpc index b5ba7c2e4b8..2ea07840a8d 100644 --- a/TAO/tests/Portable_Interceptors/AMI/PI_AMI.mpc +++ b/TAO/tests/Portable_Interceptors/AMI/PI_AMI.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Client) : messaging, taoserver, ami, interceptors { +project(*Client) : messaging, taoserver, ami, pi, interceptors { exename = client source_files { client.cpp @@ -11,7 +11,7 @@ project(*Client) : messaging, taoserver, ami, interceptors { } } -project(*server) : messaging, taoserver, ami, interceptors { +project(*server) : messaging, taoserver, pi_server, interceptors { exename = server source_files { server.cpp diff --git a/TAO/tests/Portable_Interceptors/AMI/Server_Interceptor.h b/TAO/tests/Portable_Interceptors/AMI/Server_Interceptor.h index 3d6935fd758..6ccb824bc8a 100644 --- a/TAO/tests/Portable_Interceptors/AMI/Server_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/AMI/Server_Interceptor.h @@ -8,6 +8,7 @@ #ifndef Server_Interceptor__h_ #define Server_Interceptor__h_ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" diff --git a/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp index ac66f70dc63..4cad9dde31b 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp @@ -4,7 +4,7 @@ // #include "Client_ORBInitializer.h" -#include "interceptors.h" +#include "client_interceptors.h" #include "Interceptor_Type.h" ACE_RCSID (Benchmark, Client_ORBInitializer, "$Id$") diff --git a/TAO/tests/Portable_Interceptors/Benchmark/PI_Benchmark.mpc b/TAO/tests/Portable_Interceptors/Benchmark/PI_Benchmark.mpc index 127c20adda3..44a76c957f7 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/PI_Benchmark.mpc +++ b/TAO/tests/Portable_Interceptors/Benchmark/PI_Benchmark.mpc @@ -1,10 +1,10 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp - interceptors.cpp + server_interceptors.cpp marker.cpp Server_ORBInitializer.cpp Interceptor_Type.cpp @@ -12,10 +12,10 @@ project(*Server): taoserver, interceptors { } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp - interceptors.cpp + client_interceptors.cpp marker.cpp Client_ORBInitializer.cpp Interceptor_Type.cpp diff --git a/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp index 908f0505579..5ab4c2336d5 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp @@ -5,7 +5,7 @@ #include "Server_ORBInitializer.h" #include "Interceptor_Type.h" -#include "interceptors.h" +#include "server_interceptors.h" ACE_RCSID (Benchmark, Server_ORBInitializer, diff --git a/TAO/tests/Portable_Interceptors/Benchmark/client.cpp b/TAO/tests/Portable_Interceptors/Benchmark/client.cpp index 388a6668a6a..76a58219cf4 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/client.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/client.cpp @@ -1,7 +1,6 @@ // $Id$ #include "testC.h" -#include "interceptors.h" #include "marker.h" #include "Client_ORBInitializer.h" #include "Interceptor_Type.h" diff --git a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp b/TAO/tests/Portable_Interceptors/Benchmark/client_interceptors.cpp index d618520e124..f28091c7e3e 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/client_interceptors.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "interceptors.h" +#include "client_interceptors.h" #include "tao/DynamicC.h" #include "tao/TypeCode.h" @@ -8,7 +8,7 @@ #include "ace/Log_Msg.h" ACE_RCSID (Benchmark, - interceptors, + client_interceptors, "$Id$") const CORBA::ULong request_ctx_id = 0xdead; @@ -149,119 +149,6 @@ Vault_Client_Request_Interceptor::receive_exception ( } -Vault_Server_Request_Interceptor::Vault_Server_Request_Interceptor (void) - : myname_ ("Vault_Server_Interceptor") -{ -} - -Vault_Server_Request_Interceptor::~Vault_Server_Request_Interceptor () -{ -} - -char * -Vault_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Vault_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Vault_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Vault_Server_Request_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (op.in (), "authenticate") == 0) - { - IOP::ServiceId id = request_ctx_id; - IOP::ServiceContext_var sc = - ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = - reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf, "root123") != 0) - ACE_THROW (CORBA::NO_PERMISSION ()); - } - - if (ACE_OS::strcmp (op.in (), "update_records") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test_Interceptors::Secure_Vault::Record *record; - CORBA::Long id; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i++].argument >>= id; - paramlist[i].argument >>= record; - } -} - -void -Vault_Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (op.in (), "update_records") == 0) - { - CORBA::Long result; - CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - (result_any.in ()) >>= result; - } -} - -void -Vault_Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} - -void -Vault_Server_Request_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} - - ////////////////////////////////// Context ///////////////////////// Vault_Client_Request_Context_Interceptor::Vault_Client_Request_Context_Interceptor (void) @@ -373,87 +260,6 @@ Vault_Client_Request_Context_Interceptor::receive_exception ( } -Vault_Server_Request_Context_Interceptor::Vault_Server_Request_Context_Interceptor (void) - : myname_ ("Vault_Server_Context_Interceptor") -{ -} - -Vault_Server_Request_Context_Interceptor::~Vault_Server_Request_Context_Interceptor () -{ -} - -char * -Vault_Server_Request_Context_Interceptor::name ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Vault_Server_Request_Context_Interceptor::destroy ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Vault_Server_Request_Context_Interceptor::receive_request_service_contexts( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Vault_Server_Request_Context_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - IOP::ServiceId id = request_ctx_id; - IOP::ServiceContext_var sc = - ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf, "root123") !=0) - ACE_THROW (CORBA::NO_PERMISSION ()); -} - -void -Vault_Server_Request_Context_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - -} - -void -Vault_Server_Request_Context_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -Vault_Server_Request_Context_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} - ///////////////////////////////////Dynamic //////////////////////////////////// Vault_Client_Request_Dynamic_Interceptor::Vault_Client_Request_Dynamic_Interceptor (void) @@ -596,126 +402,6 @@ Vault_Client_Request_Dynamic_Interceptor::receive_exception ( } -Vault_Server_Request_Dynamic_Interceptor::Vault_Server_Request_Dynamic_Interceptor (void) - : myname_ ("Vault_Server_Dynamic_Interceptor") -{ -} - -Vault_Server_Request_Dynamic_Interceptor::~Vault_Server_Request_Dynamic_Interceptor () -{ -} - -char * -Vault_Server_Request_Dynamic_Interceptor::name ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Vault_Server_Request_Dynamic_Interceptor::destroy ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Vault_Server_Request_Dynamic_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (op.in (), "authenticate") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - const char *user; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i].argument >>= user; - } - - if (ACE_OS::strcmp (op.in (), "update_records") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test_Interceptors::Secure_Vault::Record *record; - CORBA::Long id; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i++].argument >>= id; - paramlist[i].argument >>= record; - } -} - -void -Vault_Server_Request_Dynamic_Interceptor::receive_request_service_contexts( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Vault_Server_Request_Dynamic_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (op.in (), "ready") == 0) - { - CORBA::Short result; - CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - (result_any.in ()) >>= result; - } - - if (ACE_OS::strcmp (op.in (), "update_records") == 0) - { - CORBA::Long result; - CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - (result_any.in ()) >>= result; - } -} - -void -Vault_Server_Request_Dynamic_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -Vault_Server_Request_Dynamic_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} - //////////////////////////////NOOP/////////////////////////////////////// Vault_Client_Request_NOOP_Interceptor::Vault_Client_Request_NOOP_Interceptor (void) @@ -807,72 +493,3 @@ Vault_Client_Request_NOOP_Interceptor::receive_exception ( } -Vault_Server_Request_NOOP_Interceptor::Vault_Server_Request_NOOP_Interceptor (void) - : myname_ ("Vault_Server_NOOP_Interceptor") -{ -} - -Vault_Server_Request_NOOP_Interceptor::~Vault_Server_Request_NOOP_Interceptor () -{ -} - -char * -Vault_Server_Request_NOOP_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Vault_Server_Request_NOOP_Interceptor::destroy ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Vault_Server_Request_NOOP_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -Vault_Server_Request_NOOP_Interceptor::receive_request_service_contexts( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Vault_Server_Request_NOOP_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - -} - -void -Vault_Server_Request_NOOP_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -Vault_Server_Request_NOOP_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} diff --git a/TAO/tests/Portable_Interceptors/Benchmark/client_interceptors.h b/TAO/tests/Portable_Interceptors/Benchmark/client_interceptors.h new file mode 100644 index 00000000000..75f8d621f40 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Benchmark/client_interceptors.h @@ -0,0 +1,207 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_CLIENT_INTERCEPTOR_H +#define TAO_CLIENT_INTERCEPTOR_H + +#include "testC.h" + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Vault_Client_Request_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side Vault interceptor. For checking interceptor visually only. +public: + Vault_Client_Request_Interceptor (void); + // ctor. + virtual ~Vault_Client_Request_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; +}; + +class Vault_Client_Request_Context_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side Vault interceptor. For checking interceptor visually only. +public: + Vault_Client_Request_Context_Interceptor (void); + // ctor. + virtual ~Vault_Client_Request_Context_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; +}; + +class Vault_Client_Request_Dynamic_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side Vault interceptor. For checking interceptor visually only. +public: + Vault_Client_Request_Dynamic_Interceptor (void); + // ctor. + virtual ~Vault_Client_Request_Dynamic_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; +}; + +class Vault_Client_Request_NOOP_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side Vault interceptor. For checking interceptor visually only. +public: + Vault_Client_Request_NOOP_Interceptor (void); + // ctor. + virtual ~Vault_Client_Request_NOOP_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_CLIENT_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Benchmark/server.cpp b/TAO/tests/Portable_Interceptors/Benchmark/server.cpp index 35bec9b15a9..c556aed2940 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/server.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/server.cpp @@ -3,7 +3,6 @@ #include "test_i.h" #include "Server_ORBInitializer.h" #include "Interceptor_Type.h" -#include "interceptors.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Portable_Interceptors/Benchmark/server_interceptors.cpp b/TAO/tests/Portable_Interceptors/Benchmark/server_interceptors.cpp new file mode 100644 index 00000000000..a2cfbb32e3a --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Benchmark/server_interceptors.cpp @@ -0,0 +1,405 @@ +// $Id$ + +#include "server_interceptors.h" + +#include "tao/DynamicC.h" +#include "tao/TypeCode.h" +#include "ace/OS_NS_string.h" +#include "ace/Log_Msg.h" + +ACE_RCSID (Benchmark, + server_interceptors, + "$Id$") + +const CORBA::ULong request_ctx_id = 0xdead; +//const CORBA::ULong reply_ctx_id = 0xbeef; // Never used. + +Vault_Server_Request_Interceptor::Vault_Server_Request_Interceptor (void) + : myname_ ("Vault_Server_Interceptor") +{ +} + +Vault_Server_Request_Interceptor::~Vault_Server_Request_Interceptor () +{ +} + +char * +Vault_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Vault_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Vault_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Vault_Server_Request_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) + { + IOP::ServiceId id = request_ctx_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = + reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf, "root123") != 0) + ACE_THROW (CORBA::NO_PERMISSION ()); + } + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + Test_Interceptors::Secure_Vault::Record *record; + CORBA::Long id; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; + } +} + +void +Vault_Server_Request_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) + { + CORBA::Long result; + CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + (result_any.in ()) >>= result; + } +} + +void +Vault_Server_Request_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} + +void +Vault_Server_Request_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} + + +////////////////////////////////// Context ///////////////////////// + +Vault_Server_Request_Context_Interceptor::Vault_Server_Request_Context_Interceptor (void) + : myname_ ("Vault_Server_Context_Interceptor") +{ +} + +Vault_Server_Request_Context_Interceptor::~Vault_Server_Request_Context_Interceptor () +{ +} + +char * +Vault_Server_Request_Context_Interceptor::name ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Vault_Server_Request_Context_Interceptor::destroy ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Vault_Server_Request_Context_Interceptor::receive_request_service_contexts( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Vault_Server_Request_Context_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + IOP::ServiceId id = request_ctx_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf, "root123") !=0) + ACE_THROW (CORBA::NO_PERMISSION ()); +} + +void +Vault_Server_Request_Context_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + +void +Vault_Server_Request_Context_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Vault_Server_Request_Context_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} + +///////////////////////////////////Dynamic //////////////////////////////////// + +Vault_Server_Request_Dynamic_Interceptor::Vault_Server_Request_Dynamic_Interceptor (void) + : myname_ ("Vault_Server_Dynamic_Interceptor") +{ +} + +Vault_Server_Request_Dynamic_Interceptor::~Vault_Server_Request_Dynamic_Interceptor () +{ +} + +char * +Vault_Server_Request_Dynamic_Interceptor::name ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Vault_Server_Request_Dynamic_Interceptor::destroy ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Vault_Server_Request_Dynamic_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + const char *user; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= user; + } + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + Test_Interceptors::Secure_Vault::Record *record; + CORBA::Long id; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; + } +} + +void +Vault_Server_Request_Dynamic_Interceptor::receive_request_service_contexts( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Vault_Server_Request_Dynamic_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "ready") == 0) + { + CORBA::Short result; + CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + (result_any.in ()) >>= result; + } + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) + { + CORBA::Long result; + CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + (result_any.in ()) >>= result; + } +} + +void +Vault_Server_Request_Dynamic_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Vault_Server_Request_Dynamic_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} + +//////////////////////////////NOOP/////////////////////////////////////// + +Vault_Server_Request_NOOP_Interceptor::Vault_Server_Request_NOOP_Interceptor (void) + : myname_ ("Vault_Server_NOOP_Interceptor") +{ +} + +Vault_Server_Request_NOOP_Interceptor::~Vault_Server_Request_NOOP_Interceptor () +{ +} + +char * +Vault_Server_Request_NOOP_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Vault_Server_Request_NOOP_Interceptor::destroy ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Vault_Server_Request_NOOP_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Vault_Server_Request_NOOP_Interceptor::receive_request_service_contexts( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Vault_Server_Request_NOOP_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + +void +Vault_Server_Request_NOOP_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Vault_Server_Request_NOOP_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} diff --git a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.h b/TAO/tests/Portable_Interceptors/Benchmark/server_interceptors.h index 6d8a4f53ae3..3adc2fe8424 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Benchmark/server_interceptors.h @@ -2,11 +2,12 @@ // // $Id$ -#ifndef TAO_INTERCEPTORS_H -#define TAO_INTERCEPTORS_H +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H #include "testC.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" @@ -19,51 +20,6 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -class Vault_Client_Request_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side Vault interceptor. For checking interceptor visually only. -public: - Vault_Client_Request_Interceptor (void); - // ctor. - virtual ~Vault_Client_Request_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; -}; - class Vault_Server_Request_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -111,51 +67,6 @@ private: const char *myname_; }; -class Vault_Client_Request_Context_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side Vault interceptor. For checking interceptor visually only. -public: - Vault_Client_Request_Context_Interceptor (void); - // ctor. - virtual ~Vault_Client_Request_Context_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; -}; - class Vault_Server_Request_Context_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -203,52 +114,6 @@ private: const char *myname_; }; - -class Vault_Client_Request_Dynamic_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side Vault interceptor. For checking interceptor visually only. -public: - Vault_Client_Request_Dynamic_Interceptor (void); - // ctor. - virtual ~Vault_Client_Request_Dynamic_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; -}; - class Vault_Server_Request_Dynamic_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -296,52 +161,6 @@ private: const char *myname_; }; - -class Vault_Client_Request_NOOP_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side Vault interceptor. For checking interceptor visually only. -public: - Vault_Client_Request_NOOP_Interceptor (void); - // ctor. - virtual ~Vault_Client_Request_NOOP_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; -}; - class Vault_Server_Request_NOOP_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -393,4 +212,4 @@ private: #pragma warning(pop) #endif /* _MSC_VER */ -#endif /* TAO_INTERCEPTORS_H */ +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/Bug_1559.mpc b/TAO/tests/Portable_Interceptors/Bug_1559/Bug_1559.mpc index 4c6778375a6..1a864c9e26f 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/Bug_1559.mpc +++ b/TAO/tests/Portable_Interceptors/Bug_1559/Bug_1559.mpc @@ -1,20 +1,20 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp Server_ORBInitializer.cpp - interceptors.cpp + server_interceptor.cpp server.cpp } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp Client_ORBInitializer.cpp - interceptors.cpp + client_interceptor.cpp client.cpp } } diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/Client_ORBInitializer.cpp index b4732ce7376..fd053e810f0 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/Client_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Bug_1559/Client_ORBInitializer.cpp @@ -4,7 +4,7 @@ // #include "Client_ORBInitializer.h" -#include "interceptors.h" +#include "client_interceptor.h" ACE_RCSID (Service_Context_Manipulation, Client_ORBInitializer, "$Id$") diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.cpp index ec2e84ac627..b5590a28f3b 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.cpp @@ -4,9 +4,10 @@ // #include "Server_ORBInitializer.h" -#include "interceptors.h" -ACE_RCSID (Service_Context_Manipulation, Server_ORBInitializer, "$Id$") +ACE_RCSID (Bug_1559, + Server_ORBInitializer, + "$Id$") Server_ORBInitializer::Server_ORBInitializer (void) { diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.h b/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.h index 5b3c199490d..1cd2c636db6 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.h +++ b/TAO/tests/Portable_Interceptors/Bug_1559/Server_ORBInitializer.h @@ -14,7 +14,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" -#include "interceptors.h" +#include "server_interceptor.h" // This is to remove "inherits via dominance" warnings from MSVC. // MSVC is being a little too paranoid. diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/client.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/client.cpp index fc917015aee..09231faacf2 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/client.cpp +++ b/TAO/tests/Portable_Interceptors/Bug_1559/client.cpp @@ -2,7 +2,6 @@ #include "ace/Get_Opt.h" #include "testC.h" -#include "interceptors.h" #include "Client_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/interceptors.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/client_interceptor.cpp index 067a0436399..a9ea659b832 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Bug_1559/client_interceptor.cpp @@ -1,13 +1,13 @@ // $Id$ -#include "interceptors.h" +#include "client_interceptor.h" #include "tao/OctetSeqC.h" #include "ace/Log_Msg.h" #include "tao/ORB_Constants.h" #include "ace/OS_NS_string.h" -ACE_RCSID (Service_Context_Manipulation, - interceptors, +ACE_RCSID (Bug_1559, + client_interceptor, "$Id$") const IOP::ServiceId service_id = 0xdeadbeef; @@ -384,270 +384,3 @@ Echo_Client_Request_Interceptor::receive_exception ( exception_count = 0; } -Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) - : myname_ ("Echo_Server_Interceptor") -{ -} - -Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (CORBA::Object_ptr forward_location) - : myname_ ("Echo_Server_Interceptor"), - forward_location_ (CORBA::Object::_duplicate (forward_location)) -{ -} - -Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor (void) -{ -} - -void -Echo_Server_Request_Interceptor::forward_reference (CORBA::Object_ptr forward_location - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (CORBA::is_nil (forward_location)) - ACE_THROW (CORBA::INV_OBJREF ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - EINVAL), - CORBA::COMPLETED_NO)); - this->forward_location_ = CORBA::Object::_duplicate (forward_location); -} - -char * -Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Echo_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.receive_request_service_contexts from " - "\"%s\"\n", - this->myname_, - operation.in ())); - - // Ignore the "_is_a" operation since it may have been invoked - // locally on the server side as a side effect of another call, - // meaning that the client hasn't added the service context yet. - // Same goes for the shutdown call - if (ACE_OS_String::strcmp ("shutdown", operation.in ()) == 0) - return; - - IOP::ServiceId id = ::service_id; - IOP::ServiceContext_var sc = - ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = - reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - ACE_DEBUG ((LM_DEBUG, - " Received service context: %s\n", - buf)); - if (ACE_OS::strcmp (buf, request_msg) == 0) - { - ACE_DEBUG ((LM_DEBUG, "Sending LOCATION_FORWARD\n")); - ACE_THROW (PortableInterceptor::ForwardRequest (this->forward_location_)); - } - else if (ACE_OS::strcmp (buf, forward_msg) == 0) - { - // Make the context to send the context to the client - IOP::ServiceContext scc; - - scc.context_id = ::service_id; - - CORBA::ULong string_len = ACE_OS::strlen (reply_msg) + 1; - CORBA::Octet *buff = CORBA::OctetSeq::allocbuf (string_len); - - ACE_OS::strcpy (reinterpret_cast<char *> (buff), reply_msg); - - scc.context_data.replace (string_len, string_len, buff, 1); - - // Add this context to the service context list. - ri->add_reply_service_context (scc, 0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - else - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: " - "Expected request service context to be: %s or %s\n", - request_msg, - forward_msg)); - } -} - - -void -Echo_Server_Request_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Echo_Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.send_reply from \"%s\"\n", - this->myname_, - operation.in ())); - - // Check that the reply service context is set as expected. - IOP::ServiceContext_var sc = - ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - ACE_DEBUG ((LM_DEBUG, - " Reply service context: %s\n", - buf)); - - if (ACE_OS::strcmp (buf, reply_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_reply: " - "Expected reply service context to be: %s\n", - reply_msg)); - } - - // Check that the request service context hasn't been changed. - IOP::ServiceContext_var sc2 = - ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf2, forward_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_reply: " - "Expected request service context to be: %s.\n" - " Got: %s\n", - forward_msg, - buf2)); - } -} - -void -Echo_Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.send_exception from \"%s\"\n", - this->myname_, - operation.in ())); - - // Check that the reply service context is set as expected. - IOP::ServiceContext_var sc = - ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - ACE_DEBUG ((LM_DEBUG, - " Reply service context: %s\n", - buf)); - - if (ACE_OS::strcmp (buf, reply_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_exception: " - "Expected reply service context to be: %s\n", - reply_msg)); - } - - // Check that the request service context hasn't been changed. - IOP::ServiceContext_var sc2 = - ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf2, forward_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_exception: " - "Expected request service context to be: %s.\n" - " Got: %s\n", - forward_msg, - buf2)); - } -} - -void -Echo_Server_Request_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.send_other from \"%s\"\n", - this->myname_, - operation.in ())); - - // Check that the request service context hasn't been changed. - IOP::ServiceContext_var sc = - ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf, request_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_reply: " - "Expected request service context to be: %s.\n" - " Got: %s\n", - request_msg, - buf)); - } - - // If we get this far then we should have received a - // LOCATION_FORWARD reply. - - // This will throw an exception if a location forward has not - // occured. If an exception is thrown then something is wrong with - // the PortableInterceptor::ForwardRequest support. - CORBA::Object_var forward = ri->forward_reference (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (forward.in ())) - ACE_THROW (CORBA::INTERNAL ()); -} diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/client_interceptor.h b/TAO/tests/Portable_Interceptors/Bug_1559/client_interceptor.h new file mode 100644 index 00000000000..2503a4b75b7 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Bug_1559/client_interceptor.h @@ -0,0 +1,78 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_CLIENT_INTERCEPTOR_H +#define TAO_CLIENT_INTERCEPTOR_H + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/ORB.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Echo_Client_Request_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side echo interceptor. For checking interceptor visually only. +public: + Echo_Client_Request_Interceptor (const char *orb_id); + // ctor. + + virtual ~Echo_Client_Request_Interceptor (); + // dtor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; + + CORBA::String_var orb_id_; + // The ID of the ORB where this interceptor was created, usually + // obtained from the ORBInitInfo + + CORBA::ORB_var orb_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_CLIENT_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/server.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/server.cpp index 6d63af38d04..35f0c3ada75 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/server.cpp +++ b/TAO/tests/Portable_Interceptors/Bug_1559/server.cpp @@ -3,7 +3,6 @@ #include "ace/Get_Opt.h" #include "ace/OS_NS_stdio.h" #include "test_i.h" -#include "interceptors.h" #include "Server_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/server_interceptor.cpp b/TAO/tests/Portable_Interceptors/Bug_1559/server_interceptor.cpp new file mode 100644 index 00000000000..7739e548ed1 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Bug_1559/server_interceptor.cpp @@ -0,0 +1,286 @@ +// $Id$ + +#include "server_interceptor.h" +#include "tao/OctetSeqC.h" +#include "ace/Log_Msg.h" +#include "tao/ORB_Constants.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (Bug_1559, + server_interceptor, + "$Id$") + +const IOP::ServiceId service_id = 0xdeadbeef; +const char *request_msg = "REQUEST message"; +const char *reply_msg = "REPLY message"; +const char *forward_msg = "FORWARD message"; +int send_request_count = 0; +int exception_count = 0; + +Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) + : myname_ ("Echo_Server_Interceptor") +{ +} + +Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (CORBA::Object_ptr forward_location) + : myname_ ("Echo_Server_Interceptor"), + forward_location_ (CORBA::Object::_duplicate (forward_location)) +{ +} + +Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor (void) +{ +} + +void +Echo_Server_Request_Interceptor::forward_reference (CORBA::Object_ptr forward_location + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (forward_location)) + ACE_THROW (CORBA::INV_OBJREF ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + EINVAL), + CORBA::COMPLETED_NO)); + this->forward_location_ = CORBA::Object::_duplicate (forward_location); +} + +char * +Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Echo_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.receive_request_service_contexts from " + "\"%s\"\n", + this->myname_, + operation.in ())); + + // Ignore the "_is_a" operation since it may have been invoked + // locally on the server side as a side effect of another call, + // meaning that the client hasn't added the service context yet. + // Same goes for the shutdown call + if (ACE_OS_String::strcmp ("shutdown", operation.in ()) == 0) + return; + + IOP::ServiceId id = ::service_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = + reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + ACE_DEBUG ((LM_DEBUG, + " Received service context: %s\n", + buf)); + if (ACE_OS::strcmp (buf, request_msg) == 0) + { + ACE_DEBUG ((LM_DEBUG, "Sending LOCATION_FORWARD\n")); + ACE_THROW (PortableInterceptor::ForwardRequest (this->forward_location_)); + } + else if (ACE_OS::strcmp (buf, forward_msg) == 0) + { + // Make the context to send the context to the client + IOP::ServiceContext scc; + + scc.context_id = ::service_id; + + CORBA::ULong string_len = ACE_OS::strlen (reply_msg) + 1; + CORBA::Octet *buff = CORBA::OctetSeq::allocbuf (string_len); + + ACE_OS::strcpy (reinterpret_cast<char *> (buff), reply_msg); + + scc.context_data.replace (string_len, string_len, buff, 1); + + // Add this context to the service context list. + ri->add_reply_service_context (scc, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: " + "Expected request service context to be: %s or %s\n", + request_msg, + forward_msg)); + } +} + + +void +Echo_Server_Request_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Echo_Server_Request_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.send_reply from \"%s\"\n", + this->myname_, + operation.in ())); + + // Check that the reply service context is set as expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + ACE_DEBUG ((LM_DEBUG, + " Reply service context: %s\n", + buf)); + + if (ACE_OS::strcmp (buf, reply_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_reply: " + "Expected reply service context to be: %s\n", + reply_msg)); + } + + // Check that the request service context hasn't been changed. + IOP::ServiceContext_var sc2 = + ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf2, forward_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_reply: " + "Expected request service context to be: %s.\n" + " Got: %s\n", + forward_msg, + buf2)); + } +} + +void +Echo_Server_Request_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.send_exception from \"%s\"\n", + this->myname_, + operation.in ())); + + // Check that the reply service context is set as expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + ACE_DEBUG ((LM_DEBUG, + " Reply service context: %s\n", + buf)); + + if (ACE_OS::strcmp (buf, reply_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_exception: " + "Expected reply service context to be: %s\n", + reply_msg)); + } + + // Check that the request service context hasn't been changed. + IOP::ServiceContext_var sc2 = + ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf2, forward_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_exception: " + "Expected request service context to be: %s.\n" + " Got: %s\n", + forward_msg, + buf2)); + } +} + +void +Echo_Server_Request_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.send_other from \"%s\"\n", + this->myname_, + operation.in ())); + + // Check that the request service context hasn't been changed. + IOP::ServiceContext_var sc = + ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf, request_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_reply: " + "Expected request service context to be: %s.\n" + " Got: %s\n", + request_msg, + buf)); + } + + // If we get this far then we should have received a + // LOCATION_FORWARD reply. + + // This will throw an exception if a location forward has not + // occured. If an exception is thrown then something is wrong with + // the PortableInterceptor::ForwardRequest support. + CORBA::Object_var forward = ri->forward_reference (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (forward.in ())) + ACE_THROW (CORBA::INTERNAL ()); +} diff --git a/TAO/tests/Portable_Interceptors/Bug_1559/interceptors.h b/TAO/tests/Portable_Interceptors/Bug_1559/server_interceptor.h index eccf3ba839c..81924ce2902 100644 --- a/TAO/tests/Portable_Interceptors/Bug_1559/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Bug_1559/server_interceptor.h @@ -2,9 +2,10 @@ // // $Id$ -#ifndef TAO_INTERCEPTORS_H -#define TAO_INTERCEPTORS_H +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" @@ -18,58 +19,6 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -class Echo_Client_Request_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side echo interceptor. For checking interceptor visually only. -public: - Echo_Client_Request_Interceptor (const char *orb_id); - // ctor. - - virtual ~Echo_Client_Request_Interceptor (); - // dtor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; - - CORBA::String_var orb_id_; - // The ID of the ORB where this interceptor was created, usually - // obtained from the ORBInitInfo - - CORBA::ORB_var orb_; -}; - class Echo_Server_Request_Interceptor : public virtual PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -129,4 +78,4 @@ private: #pragma warning(pop) #endif /* _MSC_VER */ -#endif /* TAO_INTERCEPTORS_H */ +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Bug_2088/Bug_2088.mpc b/TAO/tests/Portable_Interceptors/Bug_2088/Bug_2088.mpc index 52b4b6feb17..87022b449ba 100644 --- a/TAO/tests/Portable_Interceptors/Bug_2088/Bug_2088.mpc +++ b/TAO/tests/Portable_Interceptors/Bug_2088/Bug_2088.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { Client_ORBInitializer.cpp client.cpp diff --git a/TAO/tests/Portable_Interceptors/Collocated/Dynamic/PI_Dynamic.mpc b/TAO/tests/Portable_Interceptors/Collocated/Dynamic/PI_Dynamic.mpc index fdc67018fb0..e116424db27 100644 --- a/TAO/tests/Portable_Interceptors/Collocated/Dynamic/PI_Dynamic.mpc +++ b/TAO/tests/Portable_Interceptors/Collocated/Dynamic/PI_Dynamic.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Collocated): taoserver, interceptors { +project(*Collocated): taoserver, pi, pi_server, interceptors { exename = Collocated_Test Source_Files { testC.cpp diff --git a/TAO/tests/Portable_Interceptors/Collocated/Dynamic/interceptors.h b/TAO/tests/Portable_Interceptors/Collocated/Dynamic/interceptors.h index 32d48f61eb3..194ab46566d 100644 --- a/TAO/tests/Portable_Interceptors/Collocated/Dynamic/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Collocated/Dynamic/interceptors.h @@ -12,6 +12,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/LocalObject.h" #if defined(_MSC_VER) diff --git a/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc b/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc index 4b9cd5bf967..fcf3dbabb25 100644 --- a/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc +++ b/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Collocated): taoserver, interceptors { +project(*Collocated): taoserver, pi, pi_server, interceptors { exename = collocated Source_Files { testC.cpp diff --git a/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/interceptors.h b/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/interceptors.h index a31854cfe69..29904bf2b55 100644 --- a/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Collocated/Service_Context_Manipulation/interceptors.h @@ -3,6 +3,8 @@ #ifndef SERVICE_CONTEXT_MANIPULATION_COLLOCATED_INTERCEPTORS_H #define SERVICE_CONTEXT_MANIPULATION_COLLOCATED_INTERCEPTORS_H +#include "tao/PI/PI.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" diff --git a/TAO/tests/Portable_Interceptors/Dynamic/Echo_Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Dynamic/Echo_Client_ORBInitializer.cpp index eff774840ce..e67eb2afb3c 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/Echo_Client_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/Echo_Client_ORBInitializer.cpp @@ -8,7 +8,7 @@ ACE_RCSID (Dynamic, Echo_Client_ORBInitializer, "$Id$") #if TAO_HAS_INTERCEPTORS == 1 -#include "interceptors.h" +#include "client_interceptor.h" void Echo_Client_ORBInitializer::pre_init ( diff --git a/TAO/tests/Portable_Interceptors/Dynamic/Echo_Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Dynamic/Echo_Server_ORBInitializer.cpp index d97e189d466..cdb8f91338e 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/Echo_Server_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/Echo_Server_ORBInitializer.cpp @@ -8,7 +8,7 @@ ACE_RCSID (Dynamic, Echo_Server_ORBInitializer, "$Id$") #if TAO_HAS_INTERCEPTORS == 1 -#include "interceptors.h" +#include "server_interceptor.h" void Echo_Server_ORBInitializer::pre_init ( diff --git a/TAO/tests/Portable_Interceptors/Dynamic/PI_Dynamic.mpc b/TAO/tests/Portable_Interceptors/Dynamic/PI_Dynamic.mpc index 788d04d99e5..88fa97fd7ba 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/PI_Dynamic.mpc +++ b/TAO/tests/Portable_Interceptors/Dynamic/PI_Dynamic.mpc @@ -1,19 +1,19 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp - interceptors.cpp + server_interceptor.cpp Echo_Server_ORBInitializer.cpp server.cpp } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp - interceptors.cpp + client_interceptor.cpp Echo_Client_ORBInitializer.cpp client.cpp } diff --git a/TAO/tests/Portable_Interceptors/Dynamic/client.cpp b/TAO/tests/Portable_Interceptors/Dynamic/client.cpp index 7a64a02ff5e..c3d906faeb3 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/client.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/client.cpp @@ -3,7 +3,6 @@ #include "ace/Get_Opt.h" #include "testC.h" -#include "interceptors.h" #include "Echo_Client_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" @@ -102,7 +101,7 @@ main (int argc, char *argv[]) { ACE_TRY_NEW_ENV { -#if TAO_HAS_INTERCEPTORS == 1 +#if TAO_HAS_INTERCEPTORS == 1 PortableInterceptor::ORBInitializer_ptr temp_initializer = PortableInterceptor::ORBInitializer::_nil (); diff --git a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp index 3813e57ebc0..29eae24ccda 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "interceptors.h" +#include "client_interceptor.h" #include "testC.h" #include "tao/DynamicC.h" @@ -10,7 +10,7 @@ #include "ace/OS_NS_string.h" ACE_RCSID (Dynamic, - interceptors, + client_interceptor, "$Id$") Echo_Client_Request_Interceptor::Echo_Client_Request_Interceptor (void) @@ -251,169 +251,4 @@ Echo_Client_Request_Interceptor::receive_exception ( exception_id.in ())); } -Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) - : myname_ ("Echo_Server_Interceptor") -{ -} - -Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor () -{ -} - -char * -Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Echo_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -Echo_Server_Request_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Echo_Server_Request_Interceptor::receive_request from \"%s\"\n", - op.in ())); - - if (ACE_OS::strcmp (op.in (), "normal") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Long param; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i].argument >>= param; - - ACE_DEBUG ((LM_DEBUG, - "The arg is %d\n", - param)); - - } - - CORBA::String_var tmdi = - ri->target_most_derived_interface (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Target most derived interface: %s\n", - tmdi.in ())); -} - -void -Echo_Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Echo_Server_Request_Interceptor::send_reply from \"%s\"\n", - op.in ())); - if (ACE_OS::strcmp (op.in (), "normal") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Long param; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i].argument >>= param; - ACE_DEBUG ((LM_DEBUG, - "The arg is %d\n", - param)); - } - - if (ACE_OS::strcmp (op.in (), "calculate") == 0) - { - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Long param1, param2, result = 0; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - paramlist[i++].argument >>= param1; - paramlist[i].argument >>= param2; - - CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - (result_any.in ()) >>= result; - - ACE_DEBUG ((LM_DEBUG, - "The result of calculate is %d + %d = %d\n", - param1, - param2, - result)); - } -} - -void -Echo_Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Echo_Server_Request_Interceptor::send_exception " - "from \"%s\"\n", - op.in ())); - - - CORBA::Any_var any = - ri->sending_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::TypeCode_var type = any->type (); - - const char *exception_id = type->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Exception ID = %s\n", - exception_id)); -} - -void -Echo_Server_Request_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} diff --git a/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h new file mode 100644 index 00000000000..d2de8b3455a --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h @@ -0,0 +1,84 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_CLIENT_INTERCEPTOR_H +#define TAO_CLIENT_INTERCEPTOR_H + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Echo_Client_Request_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Client-side echo interceptor. For checking interceptor visually only. +public: + + Echo_Client_Request_Interceptor (void); + // ctor. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_poll ( + PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_other ( + PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableInterceptor::ForwardRequest + )); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +protected: + + virtual ~Echo_Client_Request_Interceptor (void); + // dtor. + +private: + const char *myname_; + +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_CLIENT_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Dynamic/server.cpp b/TAO/tests/Portable_Interceptors/Dynamic/server.cpp index e29b51d392c..2197bc560bb 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/server.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/server.cpp @@ -2,7 +2,6 @@ #include "ace/Get_Opt.h" #include "test_i.h" -#include "interceptors.h" #include "Echo_Server_ORBInitializer.h" #include "ace/OS_NS_stdio.h" diff --git a/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp new file mode 100644 index 00000000000..8e072515d51 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp @@ -0,0 +1,181 @@ +// $Id$ + +#include "server_interceptor.h" +#include "testC.h" + +#include "tao/DynamicC.h" +#include "tao/TypeCode.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (Dynamic, + server_interceptor, + "$Id$") + +Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) + : myname_ ("Echo_Server_Interceptor") +{ +} + +Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor () +{ +} + +char * +Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Echo_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Echo_Server_Request_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Echo_Server_Request_Interceptor::receive_request from \"%s\"\n", + op.in ())); + + if (ACE_OS::strcmp (op.in (), "normal") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; + + ACE_DEBUG ((LM_DEBUG, + "The arg is %d\n", + param)); + + } + + CORBA::String_var tmdi = + ri->target_most_derived_interface (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Target most derived interface: %s\n", + tmdi.in ())); +} + +void +Echo_Server_Request_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Echo_Server_Request_Interceptor::send_reply from \"%s\"\n", + op.in ())); + + if (ACE_OS::strcmp (op.in (), "normal") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; + ACE_DEBUG ((LM_DEBUG, + "The arg is %d\n", + param)); + } + + if (ACE_OS::strcmp (op.in (), "calculate") == 0) + { + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long param1, param2, result = 0; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= param1; + paramlist[i].argument >>= param2; + + CORBA::Any_var result_any = ri->result (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + (result_any.in ()) >>= result; + + ACE_DEBUG ((LM_DEBUG, + "The result of calculate is %d + %d = %d\n", + param1, + param2, + result)); + } +} + +void +Echo_Server_Request_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var op = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Echo_Server_Request_Interceptor::send_exception " + "from \"%s\"\n", + op.in ())); + + + CORBA::Any_var any = + ri->sending_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::TypeCode_var type = any->type (); + + const char *exception_id = type->id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Exception ID = %s\n", + exception_id)); +} + +void +Echo_Server_Request_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} diff --git a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.h b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.h index 08e31458494..f536de965c0 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.h @@ -2,9 +2,10 @@ // // $Id$ -#ifndef TAO_INTERCEPTORS_H -#define TAO_INTERCEPTORS_H +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" @@ -17,65 +18,6 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -class Echo_Client_Request_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Client-side echo interceptor. For checking interceptor visually only. -public: - - Echo_Client_Request_Interceptor (void); - // ctor. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_poll ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_other ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - PortableInterceptor::ForwardRequest - )); - - virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -protected: - - virtual ~Echo_Client_Request_Interceptor (void); - // dtor. - -private: - const char *myname_; - -}; - class Echo_Server_Request_Interceptor : public PortableInterceptor::ServerRequestInterceptor, public virtual TAO_Local_RefCounted_Object @@ -138,4 +80,4 @@ private: #pragma warning(pop) #endif /* _MSC_VER */ -#endif /* TAO_INTERCEPTORS_H */ +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/ForwardRequest/Client_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/ForwardRequest/Client_Request_Interceptor.h index fd92d7afc55..b39c5ae1297 100644 --- a/TAO/tests/Portable_Interceptors/ForwardRequest/Client_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/ForwardRequest/Client_Request_Interceptor.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" diff --git a/TAO/tests/Portable_Interceptors/ForwardRequest/PI_ForwardRequest.mpc b/TAO/tests/Portable_Interceptors/ForwardRequest/PI_ForwardRequest.mpc index 5e8d9d3f3c9..bf1c0f6349a 100644 --- a/TAO/tests/Portable_Interceptors/ForwardRequest/PI_ForwardRequest.mpc +++ b/TAO/tests/Portable_Interceptors/ForwardRequest/PI_ForwardRequest.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, valuetype, interceptors { +project(*Server): taoserver, valuetype, pi_server, interceptors { idlflags += -DCORBA3 -I$(TAO_ROOT) Source_Files { @@ -12,7 +12,7 @@ project(*Server): taoserver, valuetype, interceptors { } } -project(*Client): taoclient, valuetype, interceptors { +project(*Client): taoclient, valuetype, pi, interceptors { idlflags += -DCORBA3 -I$(TAO_ROOT) Source_Files { diff --git a/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h index 9117858d7d3..003883dfd77 100644 --- a/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.h @@ -24,6 +24,7 @@ #include "testC.h" #include "tao/LocalObject.h" +#include "tao/PortableInterceptorC.h" #if defined(_MSC_VER) #pragma warning(push) diff --git a/TAO/tests/Portable_Interceptors/ForwardRequest/test.idl b/TAO/tests/Portable_Interceptors/ForwardRequest/test.idl index 11bac421a0b..153cf4559de 100644 --- a/TAO/tests/Portable_Interceptors/ForwardRequest/test.idl +++ b/TAO/tests/Portable_Interceptors/ForwardRequest/test.idl @@ -13,7 +13,7 @@ */ //============================================================================= -#include "tao/PortableInterceptor.pidl" +#include "tao/PI_Server/ServerRequestInterceptor.pidl" module ForwardRequestTest { diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc b/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc index 9ca88675e54..1bdc7d0b821 100644 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc +++ b/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc @@ -10,7 +10,7 @@ project(*Server): taoserver, iorinterceptor, codecfactory, interceptors { } } -project(*Client): taoclient, codecfactory, interceptors { +project(*Client): taoclient, pi, codecfactory, interceptors { Source_Files { testC.cpp FOO_Client_ORBInitializer.cpp diff --git a/TAO/tests/Portable_Interceptors/ORB_Shutdown/PI_ORB_Shutdown.mpc b/TAO/tests/Portable_Interceptors/ORB_Shutdown/PI_ORB_Shutdown.mpc index 63830c7efad..47621eb156b 100644 --- a/TAO/tests/Portable_Interceptors/ORB_Shutdown/PI_ORB_Shutdown.mpc +++ b/TAO/tests/Portable_Interceptors/ORB_Shutdown/PI_ORB_Shutdown.mpc @@ -2,7 +2,7 @@ // // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp Server_ORBInitializer.cpp diff --git a/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h index fb51c80f274..10e3add572b 100644 --- a/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/ORB_Shutdown/Server_Request_Interceptor.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor.h b/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor.h index 1b5df1908e1..c4709fff0a6 100644 --- a/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor.h +++ b/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor.h @@ -19,6 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor2.h b/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor2.h index 80e5a1812ce..cfca53a52d6 100644 --- a/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor2.h +++ b/TAO/tests/Portable_Interceptors/PICurrent/ClientRequestInterceptor2.h @@ -19,6 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/tests/Portable_Interceptors/PICurrent/PI_PICurrent.mpc b/TAO/tests/Portable_Interceptors/PICurrent/PI_PICurrent.mpc index 2c7b78ec5c4..fcb0a6c8382 100644 --- a/TAO/tests/Portable_Interceptors/PICurrent/PI_PICurrent.mpc +++ b/TAO/tests/Portable_Interceptors/PICurrent/PI_PICurrent.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp ServerORBInitializer.cpp @@ -11,7 +11,7 @@ project(*Server): taoserver, interceptors { } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp ClientORBInitializer.cpp diff --git a/TAO/tests/Portable_Interceptors/PICurrent/ServerRequestInterceptor.h b/TAO/tests/Portable_Interceptors/PICurrent/ServerRequestInterceptor.h index 6dd03706a71..0e7c09d7d9c 100644 --- a/TAO/tests/Portable_Interceptors/PICurrent/ServerRequestInterceptor.h +++ b/TAO/tests/Portable_Interceptors/PICurrent/ServerRequestInterceptor.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PI_Server/PI_Server.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h index b9f3a729894..2c29fd378cc 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h @@ -23,6 +23,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/PortableInterceptorC.h" +#include "tao/PI/PI.h" #include "tao/LocalObject.h" #include "Request_Interceptor.h" diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc index 4f1adf84453..15ecab48119 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp Server_ORBInitializer.cpp @@ -11,7 +11,7 @@ project(*Server): taoserver, interceptors { } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp Client_ORBInitializer.cpp diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h index b1261adaa35..2eb51870c7b 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h @@ -25,6 +25,7 @@ #include "ace/Atomic_Op.h" #include "tao/PortableInterceptorC.h" +#include "tao/PI/PI.h" #include "tao/LocalObject.h" #include "tao/CORBA_String.h" diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h index c7a6053fa86..590491e9f62 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h @@ -23,6 +23,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/PI_Server.h" #include "tao/LocalObject.h" #include "Request_Interceptor.h" diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp index 47d582bce6d..606f68fca22 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp @@ -60,6 +60,13 @@ client_test (Test_ptr server ACE_ENV_ARG_DECL) { server->client_test (i ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + + if (i == 1) + { + ACE_ERROR ((LM_ERROR, + "\nERROR: No exception has been thrown from client_test() " + "operation.\n")); + } } ACE_CATCH (Test::X, ex) { @@ -108,6 +115,13 @@ server_test (Test_ptr server ACE_ENV_ARG_DECL) { server->server_test (i ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + + if (i == 1) + { + ACE_ERROR ((LM_ERROR, + "\nERROR: No exception has been thrown from server_test() " + "operation.\n")); + } } ACE_CATCH (Test::X, ex) { diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Client_ORBInitializer.cpp index b4732ce7376..fd053e810f0 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Client_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Client_ORBInitializer.cpp @@ -4,7 +4,7 @@ // #include "Client_ORBInitializer.h" -#include "interceptors.h" +#include "client_interceptor.h" ACE_RCSID (Service_Context_Manipulation, Client_ORBInitializer, "$Id$") diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc index 4c6778375a6..1a864c9e26f 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/PI_Svc_Context_Manip.mpc @@ -1,20 +1,20 @@ // -*- MPC -*- // $Id$ -project(*Server): taoserver, interceptors { +project(*Server): taoserver, pi_server, interceptors { Source_Files { test_i.cpp Server_ORBInitializer.cpp - interceptors.cpp + server_interceptor.cpp server.cpp } } -project(*Client): taoclient, interceptors { +project(*Client): taoclient, pi, interceptors { Source_Files { testC.cpp Client_ORBInitializer.cpp - interceptors.cpp + client_interceptor.cpp client.cpp } } diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Server_ORBInitializer.cpp index e0c859a8680..0ad8960c819 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Server_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/Server_ORBInitializer.cpp @@ -4,7 +4,7 @@ // #include "Server_ORBInitializer.h" -#include "interceptors.h" +#include "server_interceptor.h" ACE_RCSID (Service_Context_Manipulation, Server_ORBInitializer, "$Id$") diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client.cpp index b8b3945906c..80c6cfad678 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client.cpp +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client.cpp @@ -2,7 +2,6 @@ #include "ace/Get_Opt.h" #include "testC.h" -#include "interceptors.h" #include "Client_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/interceptors.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client_interceptor.cpp index 9d44f81d09e..e9ef8474a32 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client_interceptor.cpp @@ -1,6 +1,6 @@ // $Id$ -#include "interceptors.h" +#include "client_interceptor.h" #include "tao/OctetSeqC.h" #include "ace/Log_Msg.h" @@ -282,211 +282,3 @@ Echo_Client_Request_Interceptor::receive_exception ( } } -Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) - : myname_ ("Echo_Server_Interceptor") -{ -} - -Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor (void) -{ -} - -char * -Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->myname_); -} - -void -Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Echo_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.receive_request_service_contexts from " - "\"%s\"\n", - this->myname_, - operation.in ())); - - IOP::ServiceId id = ::service_id; - IOP::ServiceContext_var sc = - ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = - reinterpret_cast<const char *> (sc->context_data.get_buffer ()); -#if 0 - ACE_DEBUG ((LM_DEBUG, - " Received service context: %s\n", - buf)); -#endif /*if 0*/ - - if (ACE_OS::strcmp (buf, request_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: " - "Expected request service context to be: %s\n", - request_msg)); - } - - // Make the context to send the context to the client - IOP::ServiceContext scc; - - scc.context_id = ::service_id; - - CORBA::ULong string_len = ACE_OS::strlen (reply_msg) + 1; - CORBA::Octet *buff = CORBA::OctetSeq::allocbuf (string_len); - - ACE_OS::strcpy (reinterpret_cast<char *> (buff), reply_msg); - - scc.context_data.replace (string_len, string_len, buff, 1); - - // Add this context to the service context list. - ri->add_reply_service_context (scc, 0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - - -void -Echo_Server_Request_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void -Echo_Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "%s.send_reply from \"%s\"\n", - this->myname_, - operation.in ())); - - // Check that the reply service context is set as expected. - IOP::ServiceContext_var sc = - ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - -#if 0 - ACE_DEBUG ((LM_DEBUG, - " Reply service context: %s\n", - buf)); -#endif /*if 0*/ - - if (ACE_OS::strcmp (buf, reply_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_reply: " - "Expected reply service context to be: %s\n", - reply_msg)); - } - - // Check that the request service context hasn't been changed. - IOP::ServiceContext_var sc2 = - ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf2, request_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_reply: " - "Expected request service context to be: %s.\n" - " Got: %s\n", - request_msg, - buf2)); - } -} - -void -Echo_Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - -#if 0 - ACE_DEBUG ((LM_DEBUG, - "%s.send_exception from \"%s\"\n", - this->myname_, - operation.in ())); -#endif /*if 0*/ - - // Check that the reply service context is set as expected. - IOP::ServiceContext_var sc = - ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); - -#if 0 - ACE_DEBUG ((LM_DEBUG, - " Reply service context: %s\n", - buf)); -#endif /*if 0*/ - - if (ACE_OS::strcmp (buf, reply_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_exception: " - "Expected reply service context to be: %s\n", - reply_msg)); - } - - // Check that the request service context hasn't been changed. - IOP::ServiceContext_var sc2 = - ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); - - if (ACE_OS::strcmp (buf2, request_msg) != 0) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Echo_Server_Request_Interceptor::send_exception: " - "Expected request service context to be: %s.\n" - " Got: %s\n", - request_msg, - buf2)); - } -} - -void -Echo_Server_Request_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do Nothing -} diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/interceptors.h b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client_interceptor.h index 1b04bc02105..10fcbd62f70 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/interceptors.h +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/client_interceptor.h @@ -2,9 +2,10 @@ // // $Id$ -#ifndef TAO_INTERCEPTORS_H -#define TAO_INTERCEPTORS_H +#ifndef TAO_CLIENT_INTERCEPTOR_H +#define TAO_CLIENT_INTERCEPTOR_H +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" @@ -70,56 +71,8 @@ private: CORBA::ORB_var orb_; }; -class Echo_Server_Request_Interceptor - : public virtual PortableInterceptor::ServerRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ - // = Server-side echo interceptor. For checking interceptor visually only. -public: - Echo_Server_Request_Interceptor (void); - // cotr. - - ~Echo_Server_Request_Interceptor (); - // dotr. - - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Canonical name of the interceptor. - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - -private: - const char *myname_; -}; - #if defined(_MSC_VER) #pragma warning(pop) #endif /* _MSC_VER */ -#endif /* TAO_INTERCEPTORS_H */ +#endif /* TAO_CLIENT_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server.cpp index d13b9bb4c63..bb361528705 100644 --- a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server.cpp +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server.cpp @@ -2,7 +2,6 @@ #include "ace/Get_Opt.h" #include "test_i.h" -#include "interceptors.h" #include "Server_ORBInitializer.h" #include "tao/ORBInitializer_Registry.h" diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.cpp b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.cpp new file mode 100644 index 00000000000..d253b1ab045 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.cpp @@ -0,0 +1,224 @@ +// $Id$ + +#include "server_interceptor.h" +#include "tao/OctetSeqC.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (Service_Context_Manipulation, + server_interceptor, + "$Id$") + +const IOP::ServiceId service_id = 0xdeadbeef; +const char *request_msg = "The Echo_Request_Interceptor request message"; +const char *reply_msg = "The Echo_Request_Interceptor reply message"; + +Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor (void) + : myname_ ("Echo_Server_Interceptor") +{ +} + +Echo_Server_Request_Interceptor::~Echo_Server_Request_Interceptor (void) +{ +} + +char * +Echo_Server_Request_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->myname_); +} + +void +Echo_Server_Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +Echo_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.receive_request_service_contexts from " + "\"%s\"\n", + this->myname_, + operation.in ())); + + IOP::ServiceId id = ::service_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = + reinterpret_cast<const char *> (sc->context_data.get_buffer ()); +#if 0 + ACE_DEBUG ((LM_DEBUG, + " Received service context: %s\n", + buf)); +#endif /*if 0*/ + + if (ACE_OS::strcmp (buf, request_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::receive_request_service_contexts: " + "Expected request service context to be: %s\n", + request_msg)); + } + + // Make the context to send the context to the client + IOP::ServiceContext scc; + + scc.context_id = ::service_id; + + CORBA::ULong string_len = ACE_OS::strlen (reply_msg) + 1; + CORBA::Octet *buff = CORBA::OctetSeq::allocbuf (string_len); + + ACE_OS::strcpy (reinterpret_cast<char *> (buff), reply_msg); + + scc.context_data.replace (string_len, string_len, buff, 1); + + // Add this context to the service context list. + ri->add_reply_service_context (scc, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + + +void +Echo_Server_Request_Interceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void +Echo_Server_Request_Interceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "%s.send_reply from \"%s\"\n", + this->myname_, + operation.in ())); + + // Check that the reply service context is set as expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + +#if 0 + ACE_DEBUG ((LM_DEBUG, + " Reply service context: %s\n", + buf)); +#endif /*if 0*/ + + if (ACE_OS::strcmp (buf, reply_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_reply: " + "Expected reply service context to be: %s\n", + reply_msg)); + } + + // Check that the request service context hasn't been changed. + IOP::ServiceContext_var sc2 = + ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf2, request_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_reply: " + "Expected request service context to be: %s.\n" + " Got: %s\n", + request_msg, + buf2)); + } +} + +void +Echo_Server_Request_Interceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#if 0 + ACE_DEBUG ((LM_DEBUG, + "%s.send_exception from \"%s\"\n", + this->myname_, + operation.in ())); +#endif /*if 0*/ + + // Check that the reply service context is set as expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf = reinterpret_cast<const char *> (sc->context_data.get_buffer ()); + +#if 0 + ACE_DEBUG ((LM_DEBUG, + " Reply service context: %s\n", + buf)); +#endif /*if 0*/ + + if (ACE_OS::strcmp (buf, reply_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_exception: " + "Expected reply service context to be: %s\n", + reply_msg)); + } + + // Check that the request service context hasn't been changed. + IOP::ServiceContext_var sc2 = + ri->get_request_service_context (::service_id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + const char *buf2 = reinterpret_cast<const char *> (sc2->context_data.get_buffer ()); + + if (ACE_OS::strcmp (buf2, request_msg) != 0) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Echo_Server_Request_Interceptor::send_exception: " + "Expected request service context to be: %s.\n" + " Got: %s\n", + request_msg, + buf2)); + } +} + +void +Echo_Server_Request_Interceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do Nothing +} diff --git a/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.h b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.h new file mode 100644 index 00000000000..9549d70f549 --- /dev/null +++ b/TAO/tests/Portable_Interceptors/Service_Context_Manipulation/server_interceptor.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef TAO_SERVER_INTERCEPTOR_H +#define TAO_SERVER_INTERCEPTOR_H + +#include "tao/PI_Server/PI_Server.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/ORB.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class Echo_Server_Request_Interceptor + : public virtual PortableInterceptor::ServerRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ + // = Server-side echo interceptor. For checking interceptor visually only. +public: + Echo_Server_Request_Interceptor (void); + // cotr. + + ~Echo_Server_Request_Interceptor (); + // dotr. + + virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Canonical name of the interceptor. + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + +private: + const char *myname_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_SERVER_INTERCEPTOR_H */ diff --git a/TAO/tests/RTCORBA/Client_Propagated/interceptors.h b/TAO/tests/RTCORBA/Client_Propagated/interceptors.h index e107f6fe6c1..414fa636345 100644 --- a/TAO/tests/RTCORBA/Client_Propagated/interceptors.h +++ b/TAO/tests/RTCORBA/Client_Propagated/interceptors.h @@ -5,6 +5,7 @@ #ifndef INTERCEPTORS_H #define INTERCEPTORS_H +#include "tao/PI/PI.h" #include "tao/PortableInterceptorC.h" #include "tao/LocalObject.h" #include "tao/ORB.h" |