diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2005-12-22 14:54:51 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2005-12-22 14:54:51 +0000 |
commit | 3a3690d728bba12cf437485a49db546f00474c40 (patch) | |
tree | fc6af8395f38530adade43b8c51065c302328602 /TAO/tao | |
parent | f3c59cbbc82d1dc600bdaaf8bebcb35e37d64d53 (diff) | |
download | ATCD-3a3690d728bba12cf437485a49db546f00474c40.tar.gz |
ChangeLogTag: Thu Dec 22 08:54:09 2005 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/tao')
42 files changed, 2084 insertions, 244 deletions
diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.h b/TAO/tao/ClientRequestInterceptor_Adapter.h index e05d9bf63a6..4e9220a98f7 100644 --- a/TAO/tao/ClientRequestInterceptor_Adapter.h +++ b/TAO/tao/ClientRequestInterceptor_Adapter.h @@ -42,6 +42,11 @@ namespace PortableInterceptor typedef CORBA::Short ReplyStatus; } +namespace CORBA +{ + class PolicyList; +} + namespace TAO { class Invocation_Base; @@ -95,6 +100,12 @@ namespace TAO PortableInterceptor::ClientRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL) = 0; + /// Register an interceptor with policies. + virtual void add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) = 0; + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0; /// Convert TAO Invocation status to a PI status diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp index f3b08462ad9..50f030251c2 100644 --- a/TAO/tao/Collocated_Invocation.cpp +++ b/TAO/tao/Collocated_Invocation.cpp @@ -28,7 +28,8 @@ namespace TAO et, stub, detail, - response_expected) + response_expected, + false /* request_is_remote */ ) { } diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp index 0124de24c1e..4e9ecb68d5a 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp @@ -31,6 +31,19 @@ TAO_IORInterceptor_Adapter_Impl::add_interceptor ( } void +TAO_IORInterceptor_Adapter_Impl::add_interceptor ( + PortableInterceptor::IORInterceptor_ptr i, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL + ) +{ + this->ior_interceptor_list_.add_interceptor (i, + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) { this->ior_interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER); diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h index d9d0bfd7a3e..949f4be9611 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h @@ -25,12 +25,14 @@ #include "tao/IORInterceptor/IORInterceptor.h" #include "tao/IORInterceptor_Adapter.h" #include "tao/PI/Interceptor_List_T.h" +#include "IORInterceptor_Details.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - typedef Interceptor_List< ::PortableInterceptor::IORInterceptor> + typedef Interceptor_List< ::PortableInterceptor::IORInterceptor, + IORInterceptor_Details> IORInterceptor_List; } @@ -55,6 +57,11 @@ public: PortableInterceptor::IORInterceptor_ptr interceptor ACE_ENV_ARG_DECL); + virtual void add_interceptor ( + PortableInterceptor::IORInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); virtual void establish_components (TAO_Root_POA *poa ACE_ENV_ARG_DECL) diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp new file mode 100644 index 00000000000..90fcd105861 --- /dev/null +++ b/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp @@ -0,0 +1,28 @@ +#include "IORInterceptor_Details.h" + +#if !defined (__ACE_INLINE__) +#include "IORInterceptor_Details.inl" +#endif /* defined INLINE */ + +ACE_RCSID (PI, + IORInterceptor_Details, + "$Id$") + +#include "tao/SystemException.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + void + IORInterceptor_Details::apply_policies ( + const CORBA::PolicyList &policies + ACE_ENV_ARG_DECL) + { + // There are currently no policies that apply to IOR Interceptors. + ACE_UNUSED_ARG (policies); + ACE_THROW (CORBA::INV_POLICY ()); + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Details.h b/TAO/tao/IORInterceptor/IORInterceptor_Details.h new file mode 100644 index 00000000000..f9587e88693 --- /dev/null +++ b/TAO/tao/IORInterceptor/IORInterceptor_Details.h @@ -0,0 +1,71 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file IORInterceptor_Details.h + * + * $Id$ + * + * This file declares a class that manages the details + * about a registered client request interceptor. Policies can be + * used when interceptors are registered, and the policy values + * will be processed and used to modify the values of the + * IORInterceptor_Details object associated with the registered + * client request interceptor. + * + * @author Tim Bradley <bradley_t@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_IOR_INTERCEPTOR_DETAILS_H +#define TAO_IOR_INTERCEPTOR_DETAILS_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/orbconf.h" + +#include "tao/Policy_ForwardC.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + /** + * @class IORInterceptor_Details + * + * @brief The policy-driven details for a registered IOR interceptor + * + * Each time an IOR interceptor is registered with an ORB, an + * IORInterceptor_Details object will be created and associated with + * the registered IOR interceptor. If the interceptor is + * registered with policies, the policies will be used to adjust the + * values in the IORInterceptor_Details appropriately. + * + * Currently, there are no policies that are applicable to + * IOR Interceptors. + */ + class IORInterceptor_Details + { + public: + + IORInterceptor_Details (void); + ~IORInterceptor_Details (void); + + void apply_policies (const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "IORInterceptor_Details.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* TAO_IOR_INTERCEPTOR_DETAILS_H */ diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Details.inl b/TAO/tao/IORInterceptor/IORInterceptor_Details.inl new file mode 100644 index 00000000000..a82589f3410 --- /dev/null +++ b/TAO/tao/IORInterceptor/IORInterceptor_Details.inl @@ -0,0 +1,20 @@ +// -*- C++ -*- +// +// $Id$ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + ACE_INLINE + IORInterceptor_Details::IORInterceptor_Details (void) + { + } + + ACE_INLINE + IORInterceptor_Details::~IORInterceptor_Details (void) + { + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/IORInterceptor_Adapter.h b/TAO/tao/IORInterceptor_Adapter.h index 587b3e8f902..ea337f5c9f3 100644 --- a/TAO/tao/IORInterceptor_Adapter.h +++ b/TAO/tao/IORInterceptor_Adapter.h @@ -67,6 +67,12 @@ public: ACE_ENV_ARG_DECL ) = 0; + virtual void add_interceptor ( + PortableInterceptor::IORInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL + ) = 0; + virtual void destroy_interceptors ( ACE_ENV_SINGLE_ARG_DECL ) = 0; diff --git a/TAO/tao/Invocation_Base.cpp b/TAO/tao/Invocation_Base.cpp index f3e715f88e4..bc2d641348f 100644 --- a/TAO/tao/Invocation_Base.cpp +++ b/TAO/tao/Invocation_Base.cpp @@ -30,7 +30,8 @@ namespace TAO CORBA::Object_ptr t, TAO_Stub *stub, TAO_Operation_Details &details, - bool response_expected) + bool response_expected, + bool request_is_remote) : details_ (details) , forwarded_to_ (0) , response_expected_ (response_expected) @@ -43,8 +44,12 @@ namespace TAO , stack_size_ (0) , invoke_status_ (TAO_INVOKE_START) , caught_exception_ (0) + , is_remote_request_ (request_is_remote) #endif /*TAO_HAS_INTERCEPTORS == 1*/ { +#if TAO_HAS_INTERCEPTORS == 0 + ACE_UNUSED_ARG (request_is_remote); +#endif /*TAO_HAS_INTERCEPTORS == 0*/ } Invocation_Base::~Invocation_Base (void) diff --git a/TAO/tao/Invocation_Base.h b/TAO/tao/Invocation_Base.h index 75370bf25bb..0d497371678 100644 --- a/TAO/tao/Invocation_Base.h +++ b/TAO/tao/Invocation_Base.h @@ -127,7 +127,8 @@ namespace TAO CORBA::Object_ptr target, TAO_Stub *stub, TAO_Operation_Details &op, - bool response_expected); + bool response_expected, + bool request_is_remote); protected: /// The operation details on which we are operating on. @@ -189,6 +190,11 @@ namespace TAO PortableInterceptor::ReplyStatus reply_status (void) const; + /// Accessor used to determine if the current invocation is part + /// of a remote request, and if not, it will be considered to be + /// part of a collocated request. + bool is_remote_request() const; + protected: /// Helper method to invoke send_request interception call to all /// the registered interceptors. @@ -225,6 +231,10 @@ namespace TAO private: /// Pointer to the caught exception. CORBA::Exception *caught_exception_; + + /// Flag used to distinguish a remote invocation versus a collocated + /// (thru-poa) invocation. + bool is_remote_request_; #endif /*TAO_HAS_INTERCEPTORS*/ //@} }; diff --git a/TAO/tao/Invocation_Base.inl b/TAO/tao/Invocation_Base.inl index 30e4c6c16d3..c6a27ca28ab 100644 --- a/TAO/tao/Invocation_Base.inl +++ b/TAO/tao/Invocation_Base.inl @@ -84,6 +84,12 @@ namespace TAO { return this->invoke_status_; } + + ACE_INLINE bool + Invocation_Base::is_remote_request (void) const + { + return this->is_remote_request_; + } #endif /* TAO_HAS_INTERCEPTORS */ } diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index f84bc6a98ab..1e3f0bfe020 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -2981,7 +2981,6 @@ TAO_ORB_Core::clientrequestinterceptor_adapter_i (void) return this->client_request_interceptor_adapter_; } - void TAO_ORB_Core::add_interceptor ( PortableInterceptor::ServerRequestInterceptor_ptr interceptor @@ -3004,6 +3003,58 @@ TAO_ORB_Core::add_interceptor ( } } +void +TAO_ORB_Core::add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) +{ + if (this->clientrequestinterceptor_adapter_i ()) + { + this->client_request_interceptor_adapter_->add_interceptor ( + interceptor, + policies + 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 ()); + } +} + +void +TAO_ORB_Core::add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) +{ + if (this->serverrequestinterceptor_adapter_i ()) + { + this->server_request_interceptor_adapter_->add_interceptor ( + interceptor, + policies + 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) { diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 00da0667814..d53e25d49a7 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -791,6 +791,18 @@ public: PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL); + /// Register a client request interceptor with policies. + void add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + + /// Register a server request interceptor with policies. + void add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + /// Get the Client Request Interceptor adapter. /// Will not create a new one if not available yet. TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter (void); diff --git a/TAO/tao/PI/ClientRequestDetails.cpp b/TAO/tao/PI/ClientRequestDetails.cpp new file mode 100644 index 00000000000..6dd19106e38 --- /dev/null +++ b/TAO/tao/PI/ClientRequestDetails.cpp @@ -0,0 +1,77 @@ +#include "ClientRequestDetails.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#if !defined (__ACE_INLINE__) +#include "ClientRequestDetails.inl" +#endif /* defined INLINE */ + +ACE_RCSID (PI, + ClientRequestDetails, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + void + ClientRequestDetails::apply_policies ( + const CORBA::PolicyList &policies + ACE_ENV_ARG_DECL) + { + // Flag to check for duplicate ProcessingModePolicy objects in the list. + bool processing_mode_applied = false; + + const CORBA::ULong plen = policies.length (); + + for (CORBA::ULong i = 0; i < plen; ++i) + { + CORBA::Policy_var policy = policies[i]; + + if (CORBA::is_nil (policy.in ())) + { + // Just ignore nil policies... + continue; + } + + // Obtain the PolicyType from the current Policy object. + const CORBA::PolicyType policy_type = + policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE) + { + if (processing_mode_applied) + { + // This is the second time we have run into this policy type, + // and that is not allowed. + ACE_THROW (CORBA::INV_POLICY ()); + } + + // Flip the flag to true in order to trap any dupes. + processing_mode_applied = true; + + // Narrow the Policy to the ProcessingModePolicy interface. + PortableInterceptor::ProcessingModePolicy_var pm_policy = + PortableInterceptor::ProcessingModePolicy::_narrow ( + policy.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Save the value of the ProcessingModePolicy in our data member. + this->processing_mode_ = + pm_policy->processing_mode (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + else + { + // We don't support the current policy type. + ACE_THROW (CORBA::INV_POLICY ()); + } + } + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/PI/ClientRequestDetails.h b/TAO/tao/PI/ClientRequestDetails.h new file mode 100644 index 00000000000..59c551f8b93 --- /dev/null +++ b/TAO/tao/PI/ClientRequestDetails.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ClientRequestDetails.h + * + * $Id$ + * + * This file declares a class that manages the details + * about a registered client request interceptor. Policies can be + * used when interceptors are registered, and the policy values + * will be processed and used to modify the values of the + * ClientRequestDetails object associated with the registered + * client request interceptor. + * + * @author Tim Bradley <bradley_t@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_CLIENT_REQUEST_DETAILS_H +#define TAO_CLIENT_REQUEST_DETAILS_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/orbconf.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "ProcessingModePolicyC.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + /** + * @class ClientRequestDetails + * + * @brief The policy-driven details for a registered client request + * interceptor + * + * Each time a client request interceptor is registered with an ORB, + * a ClientRequestDetails object will be created and associated with + * the registered client request interceptor. If the interceptor is + * registered with policies, the policies will be used to adjust the + * values in the ClientRequestDetails appropriately. + */ + class ClientRequestDetails + { + public: + + ClientRequestDetails (void); + ~ClientRequestDetails (void); + + void apply_policies (const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + + /// Returns true if the ProcessingMode setting permits the "firing" + /// of the associated client request interceptor based upon the + /// remote vs. collocated nature of the current servant request + /// that is being dispatched. + bool should_be_processed (bool is_remote_request) const; + + private: + + /// The ProcessingMode setting that can be adjusted via the + /// PortableInterceptor::ProcessingModePolicy. + PortableInterceptor::ProcessingMode processing_mode_; + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ClientRequestDetails.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" + +#endif /* TAO_CLIENT_REQUEST_DETAILS_H */ diff --git a/TAO/tao/PI/ClientRequestDetails.inl b/TAO/tao/PI/ClientRequestDetails.inl new file mode 100644 index 00000000000..7ea1ecbb12f --- /dev/null +++ b/TAO/tao/PI/ClientRequestDetails.inl @@ -0,0 +1,32 @@ +// -*- C++ -*- +// +// $Id$ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + ACE_INLINE + ClientRequestDetails::ClientRequestDetails (void) + : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE) + { + } + + ACE_INLINE + ClientRequestDetails::~ClientRequestDetails (void) + { + } + + ACE_INLINE + bool + ClientRequestDetails::should_be_processed (bool is_remote_request) const + { + return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) || + ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) && + (is_remote_request)) || + ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) && + (!is_remote_request))); + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PI/ClientRequestInfo.cpp b/TAO/tao/PI/ClientRequestInfo.cpp index 00f25e22d2c..4bd5af7ebdd 100644 --- a/TAO/tao/PI/ClientRequestInfo.cpp +++ b/TAO/tao/PI/ClientRequestInfo.cpp @@ -603,8 +603,10 @@ TAO_ClientRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL) bool TAO_ClientRequestInfo::result (CORBA::Any *any) { - for (CORBA::ULong i = 0; i != this->invocation_->operation_details ().args_num (); ++i) - (*this->invocation_->operation_details ().args ()[i]).interceptor_value (any); + // Result is always first element in TAO::Argument array. + TAO::Argument * const r = this->invocation_->operation_details ().args ()[0]; + + r->interceptor_value (any); return true; } diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp index 3c05b186fcf..4c15fb3bd61 100644 --- a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp +++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp @@ -28,16 +28,25 @@ namespace TAO { // This method implements one of the "starting" client side // interception point. + + bool is_remote_request = invocation.is_remote_request(); + ACE_TRY { TAO_ClientRequestInfo ri (&invocation); 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; + ClientRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor (i); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + send_request (&ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } // The starting interception point completed successfully. // Push the interceptor on to the flow stack. @@ -63,6 +72,8 @@ namespace TAO // This is an "ending" interception point so we only process the // interceptors pushed on to the flow stack. + bool is_remote_request = invocation.is_remote_request(); + // Notice that the interceptors are processed in the opposite order // they were pushed onto the stack since this is an "ending" // interception point. @@ -79,11 +90,18 @@ namespace TAO // 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; + ClientRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + invocation.stack_size ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_reply ( + &ri + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } } // The receive_reply() interception point does not raise a @@ -99,6 +117,8 @@ namespace TAO // This is an "ending" interception point so we only process the // interceptors pushed on to the flow stack. + bool is_remote_request = invocation.is_remote_request(); + // Notice that the interceptors are processed in the opposite order // they were pushed onto the stack since this is an "ending" // interception point. @@ -116,11 +136,18 @@ namespace TAO // 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; + ClientRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + invocation.stack_size ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_exception ( + &ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -169,6 +196,8 @@ namespace TAO // This is an "ending" interception point so we only process the // interceptors pushed on to the flow stack. + bool is_remote_request = invocation.is_remote_request(); + // Notice that the interceptors are processed in the opposite order // they were pushed onto the stack since this is an "ending" // interception point. @@ -187,11 +216,18 @@ namespace TAO // 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; + ClientRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + invocation.stack_size ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_other ( + &ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -229,6 +265,18 @@ namespace TAO } void + ClientRequestInterceptor_Adapter_Impl::add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) + { + this->interceptor_list_.add_interceptor (interceptor, + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + void ClientRequestInterceptor_Adapter_Impl::destroy_interceptors ( ACE_ENV_SINGLE_ARG_DECL) { diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h index f76c07b3a55..a4145cfd95a 100644 --- a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h +++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h @@ -32,13 +32,15 @@ #include "Interceptor_List_T.h" #include "ClientRequestInterceptorC.h" +#include "ClientRequestDetails.h" #include "tao/ClientRequestInterceptor_Adapter.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor> + typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor, + ClientRequestDetails> ClientRequestInterceptor_List; } @@ -100,6 +102,12 @@ namespace TAO PortableInterceptor::ClientRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL); + /// Register an interceptor with policies. + virtual void add_interceptor ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); virtual PortableInterceptor::ReplyStatus reply_status ( diff --git a/TAO/tao/PI/Interceptor_List_T.cpp b/TAO/tao/PI/Interceptor_List_T.cpp index bbb53171661..a62542fc6b8 100644 --- a/TAO/tao/PI/Interceptor_List_T.cpp +++ b/TAO/tao/PI/Interceptor_List_T.cpp @@ -14,28 +14,36 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - template <typename InterceptorType> - Interceptor_List<InterceptorType>::Interceptor_List (void) + template <typename InterceptorType, typename DetailsType> + Interceptor_List<InterceptorType,DetailsType>::Interceptor_List (void) { } - template <typename InterceptorType> - typename Interceptor_List<InterceptorType>::InterceptorType_ptr_type - Interceptor_List<InterceptorType>::interceptor (size_t index) + template <typename InterceptorType, typename DetailsType> + typename Interceptor_List<InterceptorType,DetailsType>::RegisteredInterceptor& + Interceptor_List<InterceptorType,DetailsType>::registered_interceptor ( + size_t index) { - return this->interceptors_[index].in (); + return this->interceptors_[index]; } - template <typename InterceptorType> + template <typename InterceptorType, typename DetailsType> + typename Interceptor_List<InterceptorType,DetailsType>::InterceptorType_ptr_type + Interceptor_List<InterceptorType,DetailsType>::interceptor (size_t index) + { + return this->interceptors_[index].interceptor_.in (); + } + + template <typename InterceptorType, typename DetailsType> size_t - Interceptor_List<InterceptorType>::size (void) + Interceptor_List<InterceptorType,DetailsType>::size (void) { return this->interceptors_.size (); } - template <typename InterceptorType> + template <typename InterceptorType, typename DetailsType> void - Interceptor_List<InterceptorType>::add_interceptor ( + Interceptor_List<InterceptorType,DetailsType>::add_interceptor ( InterceptorType_ptr_type interceptor ACE_ENV_ARG_DECL) { @@ -90,7 +98,91 @@ namespace TAO this->interceptors_.size (new_len); // Add the interceptor - this->interceptors_[old_len] = InterceptorType::_duplicate (interceptor); + this->interceptors_[old_len].interceptor_ = + InterceptorType::_duplicate (interceptor); + } + else + { + ACE_THROW ( + CORBA::INV_OBJREF ( + CORBA::SystemException::_tao_minor_code ( + 0, + EINVAL + ), + CORBA::COMPLETED_NO + ) + ); + } + } + + template <typename InterceptorType, typename DetailsType> + void + Interceptor_List<InterceptorType,DetailsType>::add_interceptor ( + InterceptorType_ptr_type interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) + { + if (!CORBA::is_nil (interceptor)) + { + const size_t old_len = this->interceptors_.size (); + + // Don't bother checking the name for duplicates if no + // interceptors have been registered. This saves an + // allocation. + if (old_len > 0) + { + /// If the Interceptor is not anonymous, make sure an + /// Interceptor with the same isn't already registered. + CORBA::String_var name = + interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (ACE_OS::strlen (name.in ()) != 0) + { + // @@ This simple search algorithm isn't the greatest + // thing in the world, but since we only register + // interceptors when bootstrapping an ORB, there will + // be no runtime penalty. + // + // Another source of inefficiency is that + // Interceptors duplicate their name each time the + // name() accessor is called! This can slow down + // bootstrap time noticeably when registering a huge + // number of interceptors. We could cache the names + // somewhere, but since this is only a bootstrapping + // issue there's no rush to implement such a scheme. + + // Prevent interceptors with the same name from being + // registered. Anonymous interceptors are okay. + for (size_t i = 0; i < old_len; ++i) + { + CORBA::String_var existing_name = + this->interceptor (i)->name (); + + if (ACE_OS::strcmp (existing_name.in (), + name.in ()) == 0) + { + ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ()); + } + } + } + } + + // Create a DetailsType object, and attempt to apply the policies. + DetailsType details; + details.apply_policies(policies ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + /// Increase the length of the Interceptor sequence by one. + const size_t new_len = old_len + 1; + this->interceptors_.size (new_len); + + // Add the interceptor + this->interceptors_[old_len].interceptor_ = + InterceptorType::_duplicate (interceptor); + + // Set the details + this->interceptors_[old_len].details_ = details; } else { @@ -106,9 +198,9 @@ namespace TAO } } - template <typename InterceptorType> + template <typename InterceptorType, typename DetailsType> void - Interceptor_List<InterceptorType>::destroy_interceptors ( + Interceptor_List<InterceptorType,DetailsType>::destroy_interceptors ( ACE_ENV_SINGLE_ARG_DECL) { const size_t len = this->interceptors_.size (); diff --git a/TAO/tao/PI/Interceptor_List_T.h b/TAO/tao/PI/Interceptor_List_T.h index c6f11f4d75b..24f7d0c1e5d 100644 --- a/TAO/tao/PI/Interceptor_List_T.h +++ b/TAO/tao/PI/Interceptor_List_T.h @@ -32,6 +32,11 @@ namespace PortableInterceptor typedef Interceptor *Interceptor_ptr; } +namespace CORBA +{ + class PolicyList; +} + namespace TAO { /** @@ -42,14 +47,19 @@ namespace TAO * Template for the various portable interceptor lists used * internally by TAO. */ - template <typename InterceptorType> + template <typename InterceptorType, typename DetailsType> class Interceptor_List { public: /// Define the traits for the underlying portable interceptor array. typedef typename InterceptorType::_var_type InterceptorType_var_type; typedef typename InterceptorType::_ptr_type InterceptorType_ptr_type; - typedef ACE_Array_Base<InterceptorType_var_type> TYPE; + + struct RegisteredInterceptor + { + InterceptorType_var_type interceptor_; + DetailsType details_; + }; /// Constructor. Interceptor_List (void); @@ -58,17 +68,28 @@ namespace TAO InterceptorType_ptr_type i ACE_ENV_ARG_DECL); + /// Register an interceptor with policies. + void add_interceptor (InterceptorType_ptr_type i, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); + /// Return the registered interceptor in sequence element @a index. + RegisteredInterceptor& registered_interceptor ( + size_t index); + /// Return the interceptor in sequence element @a index. InterceptorType_ptr_type interceptor (size_t index); size_t size (void); private: - /// Dynamic array of registered interceptors. - TYPE interceptors_; + typedef ACE_Array_Base<RegisteredInterceptor > RegisteredArray; + + /// Dynamic array of registered interceptors. + RegisteredArray interceptors_; }; } diff --git a/TAO/tao/PI/ORBInitInfo.cpp b/TAO/tao/PI/ORBInitInfo.cpp index 4819da4e5c6..787c3b858ee 100644 --- a/TAO/tao/PI/ORBInitInfo.cpp +++ b/TAO/tao/PI/ORBInitInfo.cpp @@ -260,6 +260,86 @@ TAO_ORBInitInfo::add_ior_interceptor ( ACE_ENV_ARG_PARAMETER); } +void +TAO_ORBInitInfo::add_client_request_interceptor_with_policy ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)) +{ +# if TAO_HAS_INTERCEPTORS == 1 + this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->orb_core_->add_interceptor (interceptor, + policies + ACE_ENV_ARG_PARAMETER); +#else + ACE_UNUSED_ARG (interceptor); + ACE_UNUSED_ARG (policies); + ACE_THROW (CORBA::NO_IMPLEMENT ( + CORBA::SystemException::_tao_minor_code ( + 0, + ENOTSUP), + CORBA::COMPLETED_NO)); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ +} + +void +TAO_ORBInitInfo::add_server_request_interceptor_with_policy ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)) +{ +# if TAO_HAS_INTERCEPTORS == 1 + this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->orb_core_->add_interceptor (interceptor, + policies + ACE_ENV_ARG_PARAMETER); + +#else + ACE_UNUSED_ARG (interceptor); + ACE_UNUSED_ARG (policies); + ACE_THROW (CORBA::NO_IMPLEMENT ( + CORBA::SystemException::_tao_minor_code ( + 0, + ENOTSUP), + CORBA::COMPLETED_NO)); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ +} + +void +TAO_ORBInitInfo::add_ior_interceptor_with_policy ( + PortableInterceptor::IORInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)) +{ + this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Since there are currently no PI Policies that pertain to + // IOR Interceptors, we will always raise the NO_IMPLEMENT + // CORBA System Exception here to indicate that this method + // is currently not implemented/supported. + ACE_UNUSED_ARG (interceptor); + ACE_UNUSED_ARG (policies); + ACE_THROW (CORBA::NO_IMPLEMENT ( + CORBA::SystemException::_tao_minor_code ( + 0, + ENOTSUP), + CORBA::COMPLETED_NO)); +} + PortableInterceptor::SlotId TAO_ORBInitInfo::allocate_slot_id (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) diff --git a/TAO/tao/PI/ORBInitInfo.h b/TAO/tao/PI/ORBInitInfo.h index 0598088c330..729d9ecac13 100644 --- a/TAO/tao/PI/ORBInitInfo.h +++ b/TAO/tao/PI/ORBInitInfo.h @@ -50,14 +50,14 @@ typedef TAO_Objref_Out_T<TAO_ORBInitInfo> /** * @class TAO_ORBInitInfo * - * @brief An implementation of the PortableInterceptor::ORBInitInfo + * @brief An implementation of the PortableInterceptor::ORBInitInfo_3_1 * interface. * * This class encapsulates the data passed to ORBInitializers during * ORB initialization. */ class TAO_PI_Export TAO_ORBInitInfo - : public virtual PortableInterceptor::ORBInitInfo, + : public virtual PortableInterceptor::ORBInitInfo_3_1, public virtual TAO_Local_RefCounted_Object { public: @@ -142,6 +142,36 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ORBInitInfo::DuplicateName)); + /// Register a client request interceptor with the ORB currently + /// being initialized, along with a list of policies. + virtual void add_client_request_interceptor_with_policy ( + PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)); + + /// Register a server request interceptor with the ORB currently + /// being initialized, along with a list of policies. + virtual void add_server_request_interceptor_with_policy ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)); + + /// Register an IOR interceptor with the ORB currently being + /// initialized, along with a list of policies. + virtual void add_ior_interceptor_with_policy ( + PortableInterceptor::IORInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ORBInitInfo::DuplicateName, + CORBA::PolicyError)); + /// Reserve a slot in table found within the /// PortableInterceptor::Current object. virtual PortableInterceptor::SlotId allocate_slot_id ( diff --git a/TAO/tao/PI/ORBInitInfo.pidl b/TAO/tao/PI/ORBInitInfo.pidl index 714ad493171..91dcbdf06f7 100644 --- a/TAO/tao/PI/ORBInitInfo.pidl +++ b/TAO/tao/PI/ORBInitInfo.pidl @@ -68,6 +68,23 @@ module PortableInterceptor { in CORBA::PolicyType type, in PolicyFactory policy_factory); }; + + local interface ORBInitInfo_3_1 : ORBInitInfo + { + void add_client_request_interceptor_with_policy( + in ClientRequestInterceptor interceptor, + in CORBA::PolicyList policies) + raises (DuplicateName, CORBA::PolicyError); + void add_server_request_interceptor_with_policy( + in ServerRequestInterceptor interceptor, + in CORBA::PolicyList policies) + raises (DuplicateName, CORBA::PolicyError); + void add_ior_interceptor_with_policy( + in IORInterceptor interceptor, + in CORBA::PolicyList policies) + raises (DuplicateName, CORBA::PolicyError); + }; + }; #endif /* _ORBINITINFO_PIDL_ */ diff --git a/TAO/tao/PI/ORBInitInfoC.cpp b/TAO/tao/PI/ORBInitInfoC.cpp index 59150dfa366..52663736295 100644 --- a/TAO/tao/PI/ORBInitInfoC.cpp +++ b/TAO/tao/PI/ORBInitInfoC.cpp @@ -26,7 +26,7 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:277 +// be/be_codegen.cpp:292 #include "ORBInitInfoC.h" @@ -43,11 +43,13 @@ #include "tao/AnyTypeCode/Any_Dual_Impl_T.h" #include "ace/OS_NS_string.h" -// TAO_IDL - Generated from -// be\be_visitor_arg_traits.cpp:70 - TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:70 + // Arg traits specializations. namespace TAO { @@ -55,7 +57,7 @@ namespace TAO // TAO_IDL - Generated from -// be\be_visitor_interface/interface_cs.cpp:60 +// be/be_visitor_interface/interface_cs.cpp:60 // Traits specializations for PortableInterceptor::ORBInitInfo. @@ -83,7 +85,7 @@ TAO::Objref_Traits<PortableInterceptor::ORBInitInfo>::nil (void) ::CORBA::Boolean TAO::Objref_Traits<PortableInterceptor::ORBInitInfo>::marshal ( - PortableInterceptor::ORBInitInfo_ptr p, + const PortableInterceptor::ORBInitInfo_ptr p, TAO_OutputCDR & cdr ) { @@ -91,7 +93,7 @@ TAO::Objref_Traits<PortableInterceptor::ORBInitInfo>::marshal ( } // TAO_IDL - Generated from -// be\be_visitor_typecode/alias_typecode.cpp:50 +// be/be_visitor_typecode/alias_typecode.cpp:50 static TAO::TypeCode::Alias<char const *, ::CORBA::TypeCode_ptr const *, @@ -101,12 +103,12 @@ static TAO::TypeCode::Alias<char const *, "IDL:omg.org/PortableInterceptor/ORBInitInfo/ObjectId:1.0", "ObjectId", &CORBA::_tc_string); - + ::CORBA::TypeCode_ptr const PortableInterceptor::ORBInitInfo::_tc_ObjectId = &_tao_tc_PortableInterceptor_ORBInitInfo_ObjectId; -// TAO_IDL - Generated from -// be\be_visitor_exception/exception_cs.cpp:63 +// TAO_IDL - Generated from +// be/be_visitor_exception/exception_cs.cpp:63 PortableInterceptor::ORBInitInfo::DuplicateName::DuplicateName (void) : ::CORBA::UserException ( @@ -199,7 +201,7 @@ void PortableInterceptor::ORBInitInfo::DuplicateName::_tao_decode ( // TAO_IDL - Generated from -// be\be_visitor_exception/exception_ctor.cpp:66 +// be/be_visitor_exception/exception_ctor.cpp:66 PortableInterceptor::ORBInitInfo::DuplicateName::DuplicateName ( const char * _tao_name @@ -219,12 +221,12 @@ PortableInterceptor::ORBInitInfo::DuplicateName::DuplicateName ( } // TAO_IDL - Generated from -// be\be_visitor_typecode/struct_typecode.cpp:89 +// be/be_visitor_typecode/struct_typecode.cpp:89 static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const _tao_fields_PortableInterceptor_ORBInitInfo_DuplicateName[] = { { "name", &CORBA::_tc_string } - + }; static TAO::TypeCode::Struct<char const *, ::CORBA::TypeCode_ptr const *, @@ -236,12 +238,12 @@ static TAO::TypeCode::Struct<char const *, "DuplicateName", _tao_fields_PortableInterceptor_ORBInitInfo_DuplicateName, 1); - + ::CORBA::TypeCode_ptr const PortableInterceptor::ORBInitInfo::_tc_DuplicateName = &_tao_tc_PortableInterceptor_ORBInitInfo_DuplicateName; -// TAO_IDL - Generated from -// be\be_visitor_exception/exception_cs.cpp:63 +// TAO_IDL - Generated from +// be/be_visitor_exception/exception_cs.cpp:63 PortableInterceptor::ORBInitInfo::InvalidName::InvalidName (void) : ::CORBA::UserException ( @@ -336,7 +338,7 @@ void PortableInterceptor::ORBInitInfo::InvalidName::_tao_decode ( } // TAO_IDL - Generated from -// be\be_visitor_typecode/struct_typecode.cpp:89 +// be/be_visitor_typecode/struct_typecode.cpp:89 static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const * const _tao_fields_PortableInterceptor_ORBInitInfo_InvalidName = 0; static TAO::TypeCode::Struct<char const *, @@ -349,7 +351,7 @@ static TAO::TypeCode::Struct<char const *, "InvalidName", _tao_fields_PortableInterceptor_ORBInitInfo_InvalidName, 0); - + ::CORBA::TypeCode_ptr const PortableInterceptor::ORBInitInfo::_tc_InvalidName = &_tao_tc_PortableInterceptor_ORBInitInfo_InvalidName; @@ -388,7 +390,7 @@ PortableInterceptor::ORBInitInfo::_duplicate (ORBInitInfo_ptr obj) { obj->_add_ref (); } - + return obj; } @@ -439,7 +441,7 @@ PortableInterceptor::ORBInitInfo::marshal (TAO_OutputCDR &) } // 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> @@ -447,7 +449,7 @@ static TAO::TypeCode::Objref<char const *, ::CORBA::tk_local_interface, "IDL:omg.org/PortableInterceptor/ORBInitInfo:1.0", "ORBInitInfo"); - + namespace PortableInterceptor { ::CORBA::TypeCode_ptr const _tc_ORBInitInfo = @@ -455,4 +457,151 @@ namespace PortableInterceptor } + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for PortableInterceptor::ORBInitInfo_3_1. + +PortableInterceptor::ORBInitInfo_3_1_ptr +TAO::Objref_Traits<PortableInterceptor::ORBInitInfo_3_1>::duplicate ( + PortableInterceptor::ORBInitInfo_3_1_ptr p + ) +{ + return PortableInterceptor::ORBInitInfo_3_1::_duplicate (p); +} + +void +TAO::Objref_Traits<PortableInterceptor::ORBInitInfo_3_1>::release ( + PortableInterceptor::ORBInitInfo_3_1_ptr p + ) +{ + CORBA::release (p); +} + +PortableInterceptor::ORBInitInfo_3_1_ptr +TAO::Objref_Traits<PortableInterceptor::ORBInitInfo_3_1>::nil (void) +{ + return PortableInterceptor::ORBInitInfo_3_1::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<PortableInterceptor::ORBInitInfo_3_1>::marshal ( + const PortableInterceptor::ORBInitInfo_3_1_ptr p, + TAO_OutputCDR & cdr + ) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +PortableInterceptor::ORBInitInfo_3_1::ORBInitInfo_3_1 (void) +{} + +PortableInterceptor::ORBInitInfo_3_1::~ORBInitInfo_3_1 (void) +{} + +PortableInterceptor::ORBInitInfo_3_1_ptr +PortableInterceptor::ORBInitInfo_3_1::_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return ORBInitInfo_3_1::_duplicate ( + dynamic_cast<ORBInitInfo_3_1_ptr> (_tao_objref) + ); +} + +PortableInterceptor::ORBInitInfo_3_1_ptr +PortableInterceptor::ORBInitInfo_3_1::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return ORBInitInfo_3_1::_duplicate ( + dynamic_cast<ORBInitInfo_3_1_ptr> (_tao_objref) + ); +} + +PortableInterceptor::ORBInitInfo_3_1_ptr +PortableInterceptor::ORBInitInfo_3_1::_duplicate (ORBInitInfo_3_1_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +PortableInterceptor::ORBInitInfo_3_1::_tao_release (ORBInitInfo_3_1_ptr obj) +{ + CORBA::release (obj); +} + +::CORBA::Boolean +PortableInterceptor::ORBInitInfo_3_1::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:omg.org/PortableInterceptor/ORBInitInfo:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/PortableInterceptor/ORBInitInfo_3_1:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* PortableInterceptor::ORBInitInfo_3_1::_interface_repository_id (void) const +{ + return "IDL:omg.org/PortableInterceptor/ORBInitInfo_3_1:1.0"; +} + +::CORBA::Boolean +PortableInterceptor::ORBInitInfo_3_1::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableInterceptor_ORBInitInfo_3_1 ( + ::CORBA::tk_local_interface, + "IDL:omg.org/PortableInterceptor/ORBInitInfo_3_1:1.0", + "ORBInitInfo_3_1"); + +namespace PortableInterceptor +{ + ::CORBA::TypeCode_ptr const _tc_ORBInitInfo_3_1 = + &_tao_tc_PortableInterceptor_ORBInitInfo_3_1; +} + + + + TAO_END_VERSIONED_NAMESPACE_DECL + + diff --git a/TAO/tao/PI/ORBInitInfoC.h b/TAO/tao/PI/ORBInitInfoC.h index 58baf32bb58..7ba6d29d08a 100644 --- a/TAO/tao/PI/ORBInitInfoC.h +++ b/TAO/tao/PI/ORBInitInfoC.h @@ -26,10 +26,10 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:154 +// be/be_codegen.cpp:164 -#ifndef _TAO_IDL_ORBINITINFOC_H_ -#define _TAO_IDL_ORBINITINFOC_H_ +#ifndef _TAO_IDL_ORIG_ORBINITINFOC_H_ +#define _TAO_IDL_ORIG_ORBINITINFOC_H_ #include /**/ "ace/pre.h" @@ -46,11 +46,13 @@ #include "tao/SystemException.h" #include "tao/Environment.h" #include "tao/Object.h" +#include "tao/Managed_Types.h" #include "tao/AnyTypeCode/StringSeqA.h" #include "tao/CodecFactory/IOP_Codec_includeA.h" #include "tao/AnyTypeCode/PI_ForwardA.h" #include "tao/AnyTypeCode/PolicyA.h" #include "tao/Objref_VarOut_T.h" +#include "tao/Versioned_Namespace.h" #include "tao/StringSeqC.h" #include "tao/CodecFactory/IOP_Codec_includeC.h" @@ -62,29 +64,31 @@ #endif #define TAO_EXPORT_MACRO TAO_PI_Export -// TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:49 - TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + namespace PortableInterceptor { - + // TAO_IDL - Generated from - // be\be_interface.cpp:646 + // be/be_interface.cpp:646 #if !defined (_PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR__VAR_OUT_CH_) #define _PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR__VAR_OUT_CH_ - + class ClientRequestInterceptor; typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr; - + typedef TAO_Objref_Var_T< ClientRequestInterceptor > ClientRequestInterceptor_var; - + typedef TAO_Objref_Out_T< ClientRequestInterceptor @@ -92,22 +96,22 @@ namespace PortableInterceptor ClientRequestInterceptor_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_interface.cpp:646 + // be/be_interface.cpp:646 #if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__VAR_OUT_CH_) #define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__VAR_OUT_CH_ - + class ServerRequestInterceptor; typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr; - + typedef TAO_Objref_Var_T< ServerRequestInterceptor > ServerRequestInterceptor_var; - + typedef TAO_Objref_Out_T< ServerRequestInterceptor @@ -115,22 +119,22 @@ namespace PortableInterceptor ServerRequestInterceptor_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_interface.cpp:646 + // be/be_interface.cpp:646 #if !defined (_PORTABLEINTERCEPTOR_IORINTERCEPTOR__VAR_OUT_CH_) #define _PORTABLEINTERCEPTOR_IORINTERCEPTOR__VAR_OUT_CH_ - + class IORInterceptor; typedef IORInterceptor *IORInterceptor_ptr; - + typedef TAO_Objref_Var_T< IORInterceptor > IORInterceptor_var; - + typedef TAO_Objref_Out_T< IORInterceptor @@ -138,22 +142,22 @@ namespace PortableInterceptor IORInterceptor_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_interface.cpp:646 + // be/be_interface.cpp:646 #if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_) #define _PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_ - + class PolicyFactory; typedef PolicyFactory *PolicyFactory_ptr; - + typedef TAO_Objref_Var_T< PolicyFactory > PolicyFactory_var; - + typedef TAO_Objref_Out_T< PolicyFactory @@ -161,22 +165,22 @@ namespace PortableInterceptor PolicyFactory_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_interface.cpp:646 + // be/be_interface.cpp:646 #if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO__VAR_OUT_CH_) #define _PORTABLEINTERCEPTOR_ORBINITINFO__VAR_OUT_CH_ - + class ORBInitInfo; typedef ORBInitInfo *ORBInitInfo_ptr; - + typedef TAO_Objref_Var_T< ORBInitInfo > ORBInitInfo_var; - + typedef TAO_Objref_Out_T< ORBInitInfo @@ -184,78 +188,78 @@ namespace PortableInterceptor ORBInitInfo_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:54 + // be/be_visitor_interface/interface_ch.cpp:54 #if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_CH_) #define _PORTABLEINTERCEPTOR_ORBINITINFO_CH_ - + class TAO_PI_Export ORBInitInfo : public virtual ::CORBA::Object { public: typedef ORBInitInfo_ptr _ptr_type; typedef ORBInitInfo_var _var_type; - + // The static operations. static ORBInitInfo_ptr _duplicate (ORBInitInfo_ptr obj); - + static void _tao_release (ORBInitInfo_ptr obj); - + static ORBInitInfo_ptr _narrow ( ::CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static ORBInitInfo_ptr _unchecked_narrow ( ::CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static ORBInitInfo_ptr _nil (void) { return static_cast<ORBInitInfo_ptr> (0); } - - - + + + // TAO_IDL - Generated from - // be\be_visitor_typedef/typedef_ch.cpp:413 - + // be/be_visitor_typedef/typedef_ch.cpp:413 + typedef char * ObjectId; typedef ::CORBA::String_var ObjectId_var; typedef ::CORBA::String_out ObjectId_out; - + // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:49 - + // be/be_visitor_typecode/typecode_decl.cpp:49 + static ::CORBA::TypeCode_ptr const _tc_ObjectId; - + // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:53 + // be/be_visitor_exception/exception_ch.cpp:53 #if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_DUPLICATENAME_CH_) #define _PORTABLEINTERCEPTOR_ORBINITINFO_DUPLICATENAME_CH_ - + class TAO_PI_Export DuplicateName : public ::CORBA::UserException { public: - + TAO_String_Manager name; DuplicateName (void); DuplicateName (const DuplicateName &); ~DuplicateName (void); DuplicateName &operator= (const DuplicateName &); - + static void _tao_any_destructor (void *); - + static DuplicateName *_downcast ( ::CORBA::Exception *); static const DuplicateName *_downcast ( ::CORBA::Exception const *); - + static ::CORBA::Exception *_alloc (void); - + virtual ::CORBA::Exception *_tao_duplicate (void) const; virtual void _raise (void) const; @@ -264,52 +268,52 @@ namespace PortableInterceptor 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_ctor.cpp:66 - + // be/be_visitor_exception/exception_ctor.cpp:66 + DuplicateName ( const char * _tao_name ); - + virtual ::CORBA::TypeCode_ptr _tao_type (void) const; }; - + // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:49 - + // be/be_visitor_typecode/typecode_decl.cpp:49 + static ::CORBA::TypeCode_ptr const _tc_DuplicateName; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:53 + // be/be_visitor_exception/exception_ch.cpp:53 #if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_INVALIDNAME_CH_) #define _PORTABLEINTERCEPTOR_ORBINITINFO_INVALIDNAME_CH_ - + class TAO_PI_Export InvalidName : public ::CORBA::UserException { public: - + InvalidName (void); InvalidName (const InvalidName &); ~InvalidName (void); InvalidName &operator= (const InvalidName &); - + static void _tao_any_destructor (void *); - + static InvalidName *_downcast ( ::CORBA::Exception *); static const InvalidName *_downcast ( ::CORBA::Exception const *); - + static ::CORBA::Exception *_alloc (void); - + virtual ::CORBA::Exception *_tao_duplicate (void) const; virtual void _raise (void) const; @@ -318,55 +322,55 @@ namespace PortableInterceptor TAO_OutputCDR & ACE_ENV_ARG_DECL ) const; - + virtual void _tao_decode ( TAO_InputCDR & ACE_ENV_ARG_DECL ); - + virtual ::CORBA::TypeCode_ptr _tao_type (void) const; }; - + // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:49 - + // be/be_visitor_typecode/typecode_decl.cpp:49 + static ::CORBA::TypeCode_ptr const _tc_InvalidName; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual ::CORBA::StringSeq * arguments ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( ::CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual char * orb_id ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( ::CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual ::IOP::CodecFactory_ptr codec_factory ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( ::CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual void register_initial_reference ( const char * id, ::CORBA::Object_ptr obj @@ -376,10 +380,10 @@ namespace PortableInterceptor ::CORBA::SystemException, ::PortableInterceptor::ORBInitInfo::InvalidName )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual ::CORBA::Object_ptr resolve_initial_references ( const char * id ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -388,10 +392,10 @@ namespace PortableInterceptor ::CORBA::SystemException, ::PortableInterceptor::ORBInitInfo::InvalidName )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual void add_client_request_interceptor ( ::PortableInterceptor::ClientRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -400,10 +404,10 @@ namespace PortableInterceptor ::CORBA::SystemException, ::PortableInterceptor::ORBInitInfo::DuplicateName )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual void add_server_request_interceptor ( ::PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -412,10 +416,10 @@ namespace PortableInterceptor ::CORBA::SystemException, ::PortableInterceptor::ORBInitInfo::DuplicateName )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual void add_ior_interceptor ( ::PortableInterceptor::IORInterceptor_ptr interceptor ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -424,20 +428,20 @@ namespace PortableInterceptor ::CORBA::SystemException, ::PortableInterceptor::ORBInitInfo::DuplicateName )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual ::PortableInterceptor::SlotId allocate_slot_id ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( ::CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 - + // be/be_visitor_operation/operation_ch.cpp:46 + virtual void register_policy_factory ( ::CORBA::PolicyType type, ::PortableInterceptor::PolicyFactory_ptr policy_factory @@ -446,45 +450,176 @@ namespace PortableInterceptor ACE_THROW_SPEC (( ::CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:210 - + // 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. ORBInitInfo (void); - + virtual ~ORBInitInfo (void); - + private: // Private and unimplemented for concrete interfaces. ORBInitInfo (const ORBInitInfo &); - + void operator= (const ORBInitInfo &); }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:49 - + // be/be_visitor_typecode/typecode_decl.cpp:49 + extern TAO_PI_Export ::CORBA::TypeCode_ptr const _tc_ORBInitInfo; + // TAO_IDL - Generated from + // be/be_interface.cpp:646 + +#if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_3_1__VAR_OUT_CH_) +#define _PORTABLEINTERCEPTOR_ORBINITINFO_3_1__VAR_OUT_CH_ + + class ORBInitInfo_3_1; + typedef ORBInitInfo_3_1 *ORBInitInfo_3_1_ptr; + + typedef + TAO_Objref_Var_T< + ORBInitInfo_3_1 + > + ORBInitInfo_3_1_var; + + typedef + TAO_Objref_Out_T< + ORBInitInfo_3_1 + > + ORBInitInfo_3_1_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_3_1_CH_) +#define _PORTABLEINTERCEPTOR_ORBINITINFO_3_1_CH_ + + class TAO_PI_Export ORBInitInfo_3_1 + : public virtual ::PortableInterceptor::ORBInitInfo + { + public: + typedef ORBInitInfo_3_1_ptr _ptr_type; + typedef ORBInitInfo_3_1_var _var_type; + + // The static operations. + static ORBInitInfo_3_1_ptr _duplicate (ORBInitInfo_3_1_ptr obj); + + static void _tao_release (ORBInitInfo_3_1_ptr obj); + + static ORBInitInfo_3_1_ptr _narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static ORBInitInfo_3_1_ptr _unchecked_narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static ORBInitInfo_3_1_ptr _nil (void) + { + return static_cast<ORBInitInfo_3_1_ptr> (0); + } + + + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void add_client_request_interceptor_with_policy ( + ::PortableInterceptor::ClientRequestInterceptor_ptr interceptor, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::PortableInterceptor::ORBInitInfo::DuplicateName, + ::CORBA::PolicyError + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void add_server_request_interceptor_with_policy ( + ::PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::PortableInterceptor::ORBInitInfo::DuplicateName, + ::CORBA::PolicyError + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void add_ior_interceptor_with_policy ( + ::PortableInterceptor::IORInterceptor_ptr interceptor, + const ::CORBA::PolicyList & policies + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::PortableInterceptor::ORBInitInfo::DuplicateName, + ::CORBA::PolicyError + )) = 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. + ORBInitInfo_3_1 (void); + + virtual ~ORBInitInfo_3_1 (void); + + private: + // Private and unimplemented for concrete interfaces. + ORBInitInfo_3_1 (const ORBInitInfo_3_1 &); + + void operator= (const ORBInitInfo_3_1 &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_PI_Export ::CORBA::TypeCode_ptr const _tc_ORBInitInfo_3_1; + // TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:78 +// be/be_visitor_module/module_ch.cpp:78 } // module PortableInterceptor // TAO_IDL - Generated from -// be\be_visitor_traits.cpp:61 +// be/be_visitor_traits.cpp:62 // Traits specializations. namespace TAO @@ -492,7 +627,7 @@ namespace TAO #if !defined (_PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR__TRAITS_) #define _PORTABLEINTERCEPTOR_CLIENTREQUESTINTERCEPTOR__TRAITS_ - + template<> struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ClientRequestInterceptor> { @@ -504,7 +639,7 @@ namespace TAO ); static ::PortableInterceptor::ClientRequestInterceptor_ptr nil (void); static ::CORBA::Boolean marshal ( - ::PortableInterceptor::ClientRequestInterceptor_ptr p, + const ::PortableInterceptor::ClientRequestInterceptor_ptr p, TAO_OutputCDR & cdr ); }; @@ -513,7 +648,7 @@ namespace TAO #if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__TRAITS_) #define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__TRAITS_ - + template<> struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ServerRequestInterceptor> { @@ -525,7 +660,7 @@ namespace TAO ); static ::PortableInterceptor::ServerRequestInterceptor_ptr nil (void); static ::CORBA::Boolean marshal ( - ::PortableInterceptor::ServerRequestInterceptor_ptr p, + const ::PortableInterceptor::ServerRequestInterceptor_ptr p, TAO_OutputCDR & cdr ); }; @@ -534,7 +669,7 @@ namespace TAO #if !defined (_PORTABLEINTERCEPTOR_IORINTERCEPTOR__TRAITS_) #define _PORTABLEINTERCEPTOR_IORINTERCEPTOR__TRAITS_ - + template<> struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::IORInterceptor> { @@ -546,7 +681,7 @@ namespace TAO ); static ::PortableInterceptor::IORInterceptor_ptr nil (void); static ::CORBA::Boolean marshal ( - ::PortableInterceptor::IORInterceptor_ptr p, + const ::PortableInterceptor::IORInterceptor_ptr p, TAO_OutputCDR & cdr ); }; @@ -555,7 +690,7 @@ namespace TAO #if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY__TRAITS_) #define _PORTABLEINTERCEPTOR_POLICYFACTORY__TRAITS_ - + template<> struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::PolicyFactory> { @@ -567,7 +702,7 @@ namespace TAO ); static ::PortableInterceptor::PolicyFactory_ptr nil (void); static ::CORBA::Boolean marshal ( - ::PortableInterceptor::PolicyFactory_ptr p, + const ::PortableInterceptor::PolicyFactory_ptr p, TAO_OutputCDR & cdr ); }; @@ -576,7 +711,7 @@ namespace TAO #if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO__TRAITS_) #define _PORTABLEINTERCEPTOR_ORBINITINFO__TRAITS_ - + template<> struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ORBInitInfo> { @@ -588,7 +723,28 @@ namespace TAO ); static ::PortableInterceptor::ORBInitInfo_ptr nil (void); static ::CORBA::Boolean marshal ( - ::PortableInterceptor::ORBInitInfo_ptr p, + const ::PortableInterceptor::ORBInitInfo_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ + +#if !defined (_PORTABLEINTERCEPTOR_ORBINITINFO_3_1__TRAITS_) +#define _PORTABLEINTERCEPTOR_ORBINITINFO_3_1__TRAITS_ + + template<> + struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::ORBInitInfo_3_1> + { + static ::PortableInterceptor::ORBInitInfo_3_1_ptr duplicate ( + ::PortableInterceptor::ORBInitInfo_3_1_ptr + ); + static void release ( + ::PortableInterceptor::ORBInitInfo_3_1_ptr + ); + static ::PortableInterceptor::ORBInitInfo_3_1_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::PortableInterceptor::ORBInitInfo_3_1_ptr p, TAO_OutputCDR & cdr ); }; @@ -597,7 +753,7 @@ namespace TAO } // TAO_IDL - Generated from -// be\be_codegen.cpp:1040 +// be/be_codegen.cpp:1101 TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PI/PI.cpp b/TAO/tao/PI/PI.cpp index 1d4592cc6ca..5fe8f1dca9e 100644 --- a/TAO/tao/PI/PI.cpp +++ b/TAO/tao/PI/PI.cpp @@ -3,6 +3,9 @@ #include "PolicyFactory_Loader.h" #include "ClientRequestInterceptor_Factory_Impl.h" #include "PICurrent_Loader.h" +#include "PI_ORBInitializer.h" +#include "tao/ORBInitializer_Registry.h" +#include "tao/ORB_Constants.h" ACE_RCSID (PI, PI, @@ -19,7 +22,46 @@ TAO_PI_Init::Initializer (void) ACE_Service_Config::process_directive (ace_svc_desc_TAO_PICurrent_Loader); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - return ACE_Service_Config::process_directive (ace_svc_desc_ORBInitializer_Registry); + int status = ACE_Service_Config::process_directive ( + ace_svc_desc_ORBInitializer_Registry); +#if TAO_HAS_INTERCEPTORS == 1 + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + + PortableInterceptor::ORBInitializer_var orb_initializer; + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + /// Register the PI ORBInitializer. + + ACE_NEW_THROW_EX (temp_orb_initializer, + TAO_PI_ORBInitializer, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_TRY_CHECK; + + orb_initializer = temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + if (TAO_debug_level > 0) + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "(%P | %t) Caught exception:"); + } + return -1; + } + ACE_ENDTRY; +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + return status; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PI/PI_ORBInitializer.cpp b/TAO/tao/PI/PI_ORBInitializer.cpp new file mode 100644 index 00000000000..4c7e1daee95 --- /dev/null +++ b/TAO/tao/PI/PI_ORBInitializer.cpp @@ -0,0 +1,103 @@ +// -*- C++ -*- + +#include "tao/PI/PI_ORBInitializer.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/PI/PI_PolicyFactory.h" +#include "tao/PI/ProcessingModePolicyC.h" +#include "tao/ORB_Core.h" +#include "ORBInitInfoC.h" + +ACE_RCSID (tao, + PI_ORBInitializer, + "$Id$") + +void +TAO_PI_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (info); +} + + +void +TAO_PI_ORBInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // The PI policy factory is stateless and reentrant, so share a + // single instance between all ORBs. + if (CORBA::is_nil (this->policy_factory_.in ())) + { + PortableInterceptor::PolicyFactory_ptr policy_factory; + ACE_NEW_THROW_EX (policy_factory, + TAO_PI_PolicyFactory, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + + this->policy_factory_ = policy_factory; + } + + + this->register_policy_factories (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + + +void +TAO_PI_ORBInitializer::register_policy_factories ( + PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) +{ + // Register the PI policy factory. + + // Bind the same policy factory to all PortableInterceptor related policy + // types since a single policy factory is used to create each of the + // different types of PortableInterceptor policies. + CORBA::PolicyType type[] = { + PortableInterceptor::PROCESSING_MODE_POLICY_TYPE + }; + + const CORBA::PolicyType *end = type + sizeof (type) / sizeof (type[0]); + + for (CORBA::PolicyType *i = type; i != end; ++i) + { + ACE_TRY + { + info->register_policy_factory (*i, + this->policy_factory_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (CORBA::BAD_INV_ORDER, ex) + { + if (ex.minor () == (CORBA::OMGVMCID | 16)) + { + // The factory is already there, it happens because the + // magic initializer in PI_Initializer.cpp registers + // with the ORB multiple times. This is an indication + // that we should do no more work in this + // ORBInitializer. + return; + } + ACE_RE_THROW; + } + ACE_CATCHANY + { + // Rethrow any other exceptions... + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK; + } +} + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/PI/PI_ORBInitializer.h b/TAO/tao/PI/PI_ORBInitializer.h new file mode 100644 index 00000000000..5219913a274 --- /dev/null +++ b/TAO/tao/PI/PI_ORBInitializer.h @@ -0,0 +1,80 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file PI_ORBInitializer.h + * + * $Id$ + * + * @author Tim Bradley <bradley_t@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_PI_ORB_INITIALIZER_H +#define TAO_PI_ORB_INITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "tao/orbconf.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ORBInitializerC.h" +#include "PolicyFactoryC.h" + +/// Forward Declarations +class TAO_PI_PolicyFactory; + +/// PortableServer ORB initializer. +class TAO_Export TAO_PI_ORBInitializer + : public virtual PortableInterceptor::ORBInitializer, + public virtual TAO_Local_RefCounted_Object +{ +public: + + /** + * @name PortableInterceptor::ORBInitializer methods + * + * The following methods are required by the + * PortableInterceptor::ORBInitializer interface. + */ + //@{ + + void pre_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void post_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + //@} + + +private: + + /// Register PortableInterceptor policy factories. + void register_policy_factories (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL); + + + /// Instance of the PI policy factory. + /** + * The PI policy factory is stateless and reentrant, so share + * a single instance between all ORBs. + */ + PortableInterceptor::PolicyFactory_var policy_factory_; +}; + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" + +#endif /* TAO_PI_ORB_INITIALIZER_H */ diff --git a/TAO/tao/PI/PI_PolicyFactory.cpp b/TAO/tao/PI/PI_PolicyFactory.cpp new file mode 100644 index 00000000000..70778de1af4 --- /dev/null +++ b/TAO/tao/PI/PI_PolicyFactory.cpp @@ -0,0 +1,46 @@ +#include "tao/PI/PI_PolicyFactory.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/PI/ProcessingModePolicy.h" +#include "tao/ORB_Constants.h" + +ACE_RCSID (tao, + PI_PolicyFactory, + "$Id$") + +CORBA::Policy_ptr +TAO_PI_PolicyFactory::create_policy ( + CORBA::PolicyType type, + const CORBA::Any &value + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)) +{ +// TBD - Should there be a "#if (TAO_HAS_MINIMUM_POA == 0)" check here? + + if (type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE) + { + TAO_ProcessingModePolicy *processing_mode_policy = 0; + PortableInterceptor::ProcessingMode policy_value; + + if ((value >>= policy_value) == 0) + { + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE), + CORBA::Policy::_nil ()); + } + + ACE_NEW_THROW_EX (processing_mode_policy, + TAO_ProcessingModePolicy (policy_value), + CORBA::NO_MEMORY (TAO::VMCID, + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return processing_mode_policy; + } + + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), + CORBA::Policy::_nil ()); +} + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/PI/PI_PolicyFactory.h b/TAO/tao/PI/PI_PolicyFactory.h new file mode 100644 index 00000000000..42ad04cbf51 --- /dev/null +++ b/TAO/tao/PI/PI_PolicyFactory.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file PI_PolicyFactory.h + * + * $Id$ + * + * @author Tim Bradley <bradley_t@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_PI_POLICY_FACTORY_H +#define TAO_PI_POLICY_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "tao/orbconf.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "PolicyFactoryC.h" + +/// Policy factory for all PortableInterceptor related policies. +class TAO_Export TAO_PI_PolicyFactory + : public virtual PortableInterceptor::PolicyFactory, + public virtual TAO_Local_RefCounted_Object +{ +public: + CORBA::Policy_ptr create_policy (CORBA::PolicyType type, + const CORBA::Any & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)); +}; + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" + +#endif /* TAO_PI_POLICY_FACTORY_H */ diff --git a/TAO/tao/PI/ProcessingModePolicy.cpp b/TAO/tao/PI/ProcessingModePolicy.cpp new file mode 100644 index 00000000000..0bedfa260b1 --- /dev/null +++ b/TAO/tao/PI/ProcessingModePolicy.cpp @@ -0,0 +1,55 @@ +// $Id$ + +#include "ProcessingModePolicy.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/PortableInterceptorC.h" + +ACE_RCSID (tao, + ProcessingModePolicy, + "$Id$") + +// Should this all be wrapped in #if (TAO_HAS_MINIMUM_POA == 0)? + +TAO_ProcessingModePolicy::TAO_ProcessingModePolicy + (PortableInterceptor::ProcessingMode mode) + : processing_mode_ (mode) +{ +} + +CORBA::Policy_ptr +TAO_ProcessingModePolicy::copy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + TAO_ProcessingModePolicy *copy = 0; + ACE_NEW_THROW_EX (copy, + TAO_ProcessingModePolicy (this->processing_mode_), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return copy; +} + +void +TAO_ProcessingModePolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +PortableInterceptor::ProcessingMode +TAO_ProcessingModePolicy::processing_mode (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return processing_mode_; +} + +CORBA::PolicyType +TAO_ProcessingModePolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return PortableInterceptor::PROCESSING_MODE_POLICY_TYPE; +} + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + diff --git a/TAO/tao/PI/ProcessingModePolicy.h b/TAO/tao/PI/ProcessingModePolicy.h new file mode 100644 index 00000000000..e5bfd4f2b0c --- /dev/null +++ b/TAO/tao/PI/ProcessingModePolicy.h @@ -0,0 +1,79 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file ProcessingModePolicy.h + * + * $Id$ + * + * @author Tim Bradley (bradley_t@ociweb.com) + */ +//============================================================================= + +#ifndef TAO_PROCESSING_MODE_POLICY_H +#define TAO_PROCESSING_MODE_POLICY_H + +#include /**/ "ace/pre.h" + +#include "tao/orbconf.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ProcessingModePolicyC.h" + +// TBD - Should this be wrapped in a check for (TAO_HAS_MINIMUM_POA == 0)? + + +/** + * @class TAO_ProcessingModePolicy + * + * @brief Implementation class for Portable Interceptor ProcessingModePolicy. + * + * This policy is used to specify which kinds of requests (collocated vs. + * remote) should (or should not) cause a Portable Interceptor to be used. + */ + +class TAO_Export TAO_ProcessingModePolicy + : public PortableInterceptor::ProcessingModePolicy, + public TAO_Local_RefCounted_Object +{ +public: + /// Constructor. + TAO_ProcessingModePolicy (PortableInterceptor::ProcessingMode mode); + + virtual PortableInterceptor::ProcessingMode processing_mode + (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // TBD - Should these be overridden? + + // Return the cached policy type for this policy. + // virtual TAO_Cached_Policy_Type _tao_cached_type (void) const; + + // Return the scope at which this policy can be applied. See orbconf.h. + // virtual TAO_Policy_Scope _tao_scope (void) const; + +private: + /// The attribute + PortableInterceptor::ProcessingMode processing_mode_; +}; + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" +#endif /* TAO_PROCESSING_MODE_POLICY_H */ diff --git a/TAO/tao/PI/ProcessingModePolicy.pidl b/TAO/tao/PI/ProcessingModePolicy.pidl new file mode 100644 index 00000000000..0b0243a0ad3 --- /dev/null +++ b/TAO/tao/PI/ProcessingModePolicy.pidl @@ -0,0 +1,42 @@ +/** + * @file ProcessingModePolicy.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source for the ProcessingModePolicy within + * the PortableInterceptor module. + * + * tao_idl \ + * -o orig -Gp -Gd -Ge 1 -GT -Sc -GA \ + * -Wb,export_include="tao/TAO_Export.h" \ + * -Wb,export_macro=TAO_Export \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * ProcessingModePolicy.pidl + */ + +#ifndef _PROCESSING_MODE_POLICY_PIDL_ +#define _PROCESSING_MODE_POLICY_PIDL_ + +#include <tao/Policy.pidl> + +module PortableInterceptor +{ + + // ProcessingMode Policy (default = LOCAL_AND_REMOTE) + typedef short ProcessingMode; + const ProcessingMode LOCAL_AND_REMOTE = 0; + const ProcessingMode REMOTE_ONLY = 1; + const ProcessingMode LOCAL_ONLY = 2; + + // TBD - Need to get the proper Policy Type code from OMG + const CORBA::PolicyType PROCESSING_MODE_POLICY_TYPE = 100; + + local interface ProcessingModePolicy : CORBA::Policy + { + readonly attribute ProcessingMode processing_mode; + }; + +}; + +#endif /* _PROCESSING_MODE_POLICY_PIDL_ */ diff --git a/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp index 076bc989ab6..b38a0fa0a19 100644 --- a/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp +++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp @@ -39,6 +39,7 @@ TAO::ServerRequestInterceptor_Adapter_Impl::tao_ft_interception_point ( { // This method implements one of the "starting" server side // interception point. + bool is_remote_request = !server_request.collocated (); ACE_TRY { @@ -53,11 +54,17 @@ TAO::ServerRequestInterceptor_Adapter_Impl::tao_ft_interception_point ( for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i) { - this->interceptors_[i]->tao_ft_interception_point ( - ri, - oc - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor (i); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + tao_ft_interception_point (ri, + oc + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } if (oc != 0) { @@ -98,6 +105,8 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( { // This method implements one of the "intermediate" server side // interception point. + bool is_remote_request = !server_request.collocated (); + if (this->interceptor_list_.size() != this->server_request.interceptor_count ()) { // This method (i.e. the receive_request() interception point) @@ -122,10 +131,16 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( for (size_t i = 0 ; i < server_request.interceptor_count (); ++i) { - this->interceptors_[i]->receive_request_service_contexts ( - ri - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor (i); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_request_service_contexts (ri + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -156,10 +171,11 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( CORBA::ULong nexceptions ACE_ENV_ARG_DECL) { - // This method implements one of the "starting" server side // interception point if extended interceptors are not in place. + bool is_remote_request = !server_request.collocated (); + TAO::ServerRequestInfo request_info (server_request, args, nargs, @@ -179,11 +195,16 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts ( for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i) { - this->interceptor_list_.interceptor(i)-> - receive_request_service_contexts ( - &request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor (i); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_request_service_contexts (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } // The starting interception point completed successfully. // Push the interceptor on to the flow stack. @@ -223,6 +244,8 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request ( // point. Interceptors are invoked in the same order they were // pushed on to the flow stack. + bool is_remote_request = !server_request.collocated (); + if (this->interceptor_list_.size() != server_request.interceptor_count ()) { // This method (i.e. the receive_request() interception point) @@ -250,10 +273,16 @@ TAO::ServerRequestInterceptor_Adapter_Impl::receive_request ( { for (size_t i = 0; i < server_request.interceptor_count (); ++i) { - this->interceptor_list_.interceptor(i)->receive_request ( - &request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor (i); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + receive_request (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } // Note that no interceptors are pushed on to or popped off // of the flow stack in this interception point since it is @@ -291,6 +320,8 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_reply ( // This is an "ending" interception point so we only process the // interceptors pushed on to the flow stack. + bool is_remote_request = !server_request.collocated (); + // Notice that the interceptors are processed in the opposite order // they were pushed onto the stack since this is an "ending" // interception point. @@ -312,11 +343,17 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_reply ( // invoked in another "ending" interception point. --server_request.interceptor_count (); - this->interceptor_list_.interceptor ( - server_request.interceptor_count ())->send_reply ( - &request_info - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + server_request.interceptor_count ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + send_reply (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } } // The send_reply() interception point does not raise a @@ -337,6 +374,8 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_exception ( // This is an "ending" server side interception point so we only // process the interceptors pushed on to the flow stack. + bool is_remote_request = !server_request.collocated (); + // Notice that the interceptors are processed in the opposite order // they were pushed onto the stack since this is an "ending" server // side interception point. @@ -360,11 +399,17 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_exception ( // being invoked in another "ending" interception point. --server_request.interceptor_count (); - this->interceptor_list_.interceptor ( - server_request.interceptor_count ())->send_exception ( - &request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + server_request.interceptor_count ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + send_exception (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -430,6 +475,8 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_other ( // This is an "ending" server side interception point so we only // process the interceptors pushed on to the flow stack. + bool is_remote_request = !server_request.collocated (); + TAO::ServerRequestInfo request_info (server_request, args, nargs, @@ -453,11 +500,17 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_other ( // being invoked in another "ending" interception point. --server_request.interceptor_count (); - this->interceptor_list_.interceptor( - server_request.interceptor_count ())->send_other ( - &request_info - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ServerRequestInterceptor_List::RegisteredInterceptor& registered = + this->interceptor_list_.registered_interceptor ( + server_request.interceptor_count ()); + + if (registered.details_.should_be_processed (is_remote_request)) + { + registered.interceptor_-> + send_other (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } } ACE_CATCH (PortableInterceptor::ForwardRequest, exc) @@ -477,7 +530,6 @@ TAO::ServerRequestInterceptor_Adapter_Impl::send_other ( ACE_CHECK; } - void TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor ( PortableInterceptor::ServerRequestInterceptor_ptr interceptor @@ -487,6 +539,17 @@ TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor ( } void +TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) +{ + this->interceptor_list_.add_interceptor (interceptor, + policies + ACE_ENV_ARG_PARAMETER); +} + +void TAO::ServerRequestInterceptor_Adapter_Impl::destroy_interceptors ( ACE_ENV_SINGLE_ARG_DECL) { diff --git a/TAO/tao/PI_Server/ServerInterceptorAdapter.h b/TAO/tao/PI_Server/ServerInterceptorAdapter.h index 6cb2878b1e6..82424e9018c 100644 --- a/TAO/tao/PI_Server/ServerInterceptorAdapter.h +++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.h @@ -34,16 +34,23 @@ #include "tao/PI/Interceptor_List_T.h" #include "tao/ServerRequestInterceptor_Adapter.h" #include "tao/Basic_Types.h" +#include "ServerRequestDetails.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor> + typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor, + ServerRequestDetails> ServerRequestInterceptor_List; } +namespace CORBA +{ + class PolicyList; +} + class TAO_ServerRequest; namespace TAO @@ -154,6 +161,11 @@ namespace TAO PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL); + virtual void add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL); virtual TAO::PICurrent_Impl *allocate_pi_current (void); diff --git a/TAO/tao/PI_Server/ServerRequestDetails.cpp b/TAO/tao/PI_Server/ServerRequestDetails.cpp new file mode 100644 index 00000000000..4479564bd1c --- /dev/null +++ b/TAO/tao/PI_Server/ServerRequestDetails.cpp @@ -0,0 +1,77 @@ +#include "ServerRequestDetails.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#if !defined (__ACE_INLINE__) +#include "ServerRequestDetails.inl" +#endif /* defined INLINE */ + +ACE_RCSID (PI_Server, + ServerRequestDetails, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + void + ServerRequestDetails::apply_policies ( + const CORBA::PolicyList &policies + ACE_ENV_ARG_DECL) + { + // Flag to check for duplicate ProcessingModePolicy objects in the list. + bool processing_mode_applied = false; + + const CORBA::ULong plen = policies.length (); + + for (CORBA::ULong i = 0; i < plen; ++i) + { + CORBA::Policy_var policy = policies[i]; + + if (CORBA::is_nil (policy.in ())) + { + // Just ignore nil policies... + continue; + } + + // Obtain the PolicyType from the current Policy object. + const CORBA::PolicyType policy_type = + policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE) + { + if (processing_mode_applied) + { + // This is the second time we have run into this policy type, + // and that is not allowed. + ACE_THROW (CORBA::INV_POLICY ()); + } + + // Flip the flag to true in order to trap any dupes. + processing_mode_applied = true; + + // Narrow the Policy to the ProcessingModePolicy interface. + PortableInterceptor::ProcessingModePolicy_var pm_policy = + PortableInterceptor::ProcessingModePolicy::_narrow ( + policy.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Save the value of the ProcessingModePolicy in our data member. + this->processing_mode_ = + pm_policy->processing_mode (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + else + { + // We don't support the current policy type. + ACE_THROW (CORBA::INV_POLICY ()); + } + } + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/PI_Server/ServerRequestDetails.h b/TAO/tao/PI_Server/ServerRequestDetails.h new file mode 100644 index 00000000000..8f7aa99ad7d --- /dev/null +++ b/TAO/tao/PI_Server/ServerRequestDetails.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ServerRequestDetails.h + * + * $Id$ + * + * This file declares a class that manages the details + * about a registered server request interceptor. Policies can be + * used when interceptors are registered, and the policy values + * will be processed and used to modify the values of the + * ServerRequestDetails object associated with the registered + * server request interceptor. + * + * @author Tim Bradley <bradley_t@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_SERVER_REQUEST_DETAILS_H +#define TAO_SERVER_REQUEST_DETAILS_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/orbconf.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/PI/ProcessingModePolicyC.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + /** + * @class ServerRequestDetails + * + * @brief The policy-driven details for a registered server request + * interceptor + * + * Each time a server request interceptor is registered with an ORB, + * a ServerRequestDetails object will be created and associated with + * the registered server request interceptor. If the interceptor is + * registered with policies, the policies will be used to adjust the + * values in the ServerRequestDetails appropriately. + */ + class ServerRequestDetails + { + public: + + ServerRequestDetails (void); + ~ServerRequestDetails (void); + + void apply_policies (const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL); + + /// Returns true if the ProcessingMode setting permits the "firing" + /// of the associated server request interceptor based upon the + /// remote vs. collocated nature of the current servant request + /// that is being dispatched. + bool should_be_processed (bool is_remote_request) const; + + private: + + /// The ProcessingMode setting that can be adjusted via the + /// PortableInterceptor::ProcessingModePolicy. + PortableInterceptor::ProcessingMode processing_mode_; + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ServerRequestDetails.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" + +#endif /* TAO_SERVER_REQUEST_DETAILS_H */ diff --git a/TAO/tao/PI_Server/ServerRequestDetails.inl b/TAO/tao/PI_Server/ServerRequestDetails.inl new file mode 100644 index 00000000000..dd05eeb04d5 --- /dev/null +++ b/TAO/tao/PI_Server/ServerRequestDetails.inl @@ -0,0 +1,32 @@ +// -*- C++ -*- +// +// $Id$ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + ACE_INLINE + ServerRequestDetails::ServerRequestDetails (void) + : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE) + { + } + + ACE_INLINE + ServerRequestDetails::~ServerRequestDetails (void) + { + } + + ACE_INLINE + bool + ServerRequestDetails::should_be_processed (bool is_remote_request) const + { + return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) || + ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) && + (is_remote_request)) || + ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) && + (!is_remote_request))); + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Upcall_Wrapper.cpp index 76e668873bc..352ff184aeb 100644 --- a/TAO/tao/PortableServer/Upcall_Wrapper.cpp +++ b/TAO/tao/PortableServer/Upcall_Wrapper.cpp @@ -14,6 +14,7 @@ #include "tao/TAO_Server_Request.h" #include "tao/CDR.h" #include "tao/Argument.h" +#include "tao/operation_details.h" #include "ace/Log_Msg.h" ACE_RCSID (PortableServer, @@ -48,6 +49,32 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, #if TAO_HAS_INTERCEPTORS == 1 + // Make sure that, for the collocated case, we use the client-side + // arguments. For the non-collocated case, we will use the server-side + // arguments since they got set up in our pre_upcall() method. Note that + // our pre_upcall() method doesn't get invoked in the collocated case, + // and is the reason why we need to provide the client-side args instead + // of the (never set or initialized) server-side args. + // + // Before the following logic was added, the + // $TAO_ROOT/tests/Portable_Interceptors/Collocated/run_test.pl + // showed that the server-side request interceptor was getting bogus + // values when it took a look at the request arguments. Some + // additional testing revealed that this only occurred in the + // collocated request case. + + // By default, we assume that we will use the server-side args. + TAO::Argument * const * the_args = args; + size_t the_nargs = nargs; + + if (server_request.collocated()) + { + // It is a collocated request so we need to use the client-side + // args instead. + the_args = server_request.operation_details()->args(); + the_nargs = server_request.operation_details()->args_num(); + } + TAO::ServerRequestInterceptor_Adapter *interceptor_adapter = server_request.orb_core ()->serverrequestinterceptor_adapter (); @@ -58,8 +85,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, { // Invoke intermediate server side interception points. interceptor_adapter->receive_request (server_request, - args, - nargs, + the_args, + the_nargs, servant_upcall, exceptions, nexceptions @@ -113,8 +140,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, // No location forward by interceptors and successful upcall. server_request.reply_status (PortableInterceptor::SUCCESSFUL); interceptor_adapter->send_reply (server_request, - args, - nargs, + the_args, + the_nargs, servant_upcall, exceptions, nexceptions @@ -137,8 +164,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, if (interceptor_adapter != 0) { interceptor_adapter->send_exception (server_request, - args, - nargs, + the_args, + the_nargs, servant_upcall, exceptions, nexceptions @@ -173,8 +200,8 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, if (interceptor_adapter != 0) { interceptor_adapter->send_exception (server_request, - args, - nargs, + the_args, + the_nargs, servant_upcall, exceptions, nexceptions diff --git a/TAO/tao/Remote_Invocation.cpp b/TAO/tao/Remote_Invocation.cpp index aae02a33237..01a39121e30 100644 --- a/TAO/tao/Remote_Invocation.cpp +++ b/TAO/tao/Remote_Invocation.cpp @@ -27,7 +27,8 @@ namespace TAO resolver.object (), resolver.stub (), detail, - response_expected) + response_expected, + true /* request_is_remote */ ) , resolver_ (resolver) { } diff --git a/TAO/tao/ServerRequestInterceptor_Adapter.h b/TAO/tao/ServerRequestInterceptor_Adapter.h index 50126db4e1b..2781dc111c2 100644 --- a/TAO/tao/ServerRequestInterceptor_Adapter.h +++ b/TAO/tao/ServerRequestInterceptor_Adapter.h @@ -27,7 +27,6 @@ #include "ace/CORBA_macros.h" #include "tao/SystemException.h" - TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace PortableInterceptor @@ -38,6 +37,11 @@ namespace PortableInterceptor typedef CORBA::Short ReplyStatus; } +namespace CORBA +{ + class PolicyList; +} + class TAO_ServerRequest; namespace TAO @@ -144,6 +148,12 @@ namespace TAO PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL) = 0; + /// Register an interceptor with policies. + virtual void add_interceptor ( + PortableInterceptor::ServerRequestInterceptor_ptr interceptor, + const CORBA::PolicyList& policies + ACE_ENV_ARG_DECL) = 0; + virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0; virtual TAO::PICurrent_Impl *allocate_pi_current (void) = 0; |