ClientRequestInfo.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file ClientRequestInfo.h
00006  *
00007  * ClientRequestInfo.h,v 1.11 2006/06/26 09:24:20 sma Exp
00008  *
00009  * This is the implementation of the
00010  * PortableInterceptor::ClientRequestInfo interface.
00011  *
00012  * @author Ossama Othman <ossama@uci.edu>
00013  */
00014 //=============================================================================
00015 
00016 #ifndef TAO_CLIENT_REQUEST_INFO_H
00017 #define TAO_CLIENT_REQUEST_INFO_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "tao/orbconf.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #if (TAO_HAS_INTERCEPTORS == 1)
00028 
00029 #if defined(_MSC_VER)
00030 #pragma warning(push)
00031 #pragma warning(disable:4250)
00032 #endif /* _MSC_VER */
00033 
00034 #include "tao/AnyTypeCode/AnyTypeCode_methods.h"
00035 #include "tao/PI/ClientRequestInfoC.h"
00036 #include "tao/PI/PIForwardRequestC.h"
00037 #include "tao/PI/PICurrent_Impl.h"
00038 #include "tao/CORBA_methods.h"
00039 #include "tao/ORB_Constants.h"
00040 #include "tao/LocalObject.h"
00041 #include "tao/Invocation_Utils.h"
00042 #include "tao/TimeBaseC.h"
00043 
00044 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00045 
00046 class TAO_Service_Context;
00047 
00048 namespace TAO
00049 {
00050   class Invocation_Base;
00051 }
00052 
00053 namespace Dynamic
00054 {
00055   class ParameterList;
00056   class ExceptionList;
00057   typedef CORBA::StringSeq RequestContext;
00058   typedef CORBA::StringSeq ContextList;
00059 }
00060 
00061 namespace Messaging
00062 {
00063   typedef CORBA::Short SyncScope;
00064 }
00065 
00066 /**
00067  * @class TAO_ClientRequestInfo
00068  *
00069  * @brief Implementation of the PortableInterceptor::ClientRequestInfo
00070  *        interface.
00071  */
00072 class TAO_PI_Export TAO_ClientRequestInfo
00073   : public virtual PortableInterceptor::ClientRequestInfo,
00074     public virtual TAO_Local_RefCounted_Object
00075 {
00076 public:
00077   TAO_ClientRequestInfo (TAO::Invocation_Base *invocation);
00078 
00079   /// Return an ID unique to the current request.  This request ID may
00080   /// or may not be the same as the GIOP request ID.
00081   virtual CORBA::ULong request_id (
00082       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00083     ACE_THROW_SPEC ((CORBA::SystemException));
00084 
00085   /// Return the operation name for the current request.
00086   virtual char * operation (
00087       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00088     ACE_THROW_SPEC ((CORBA::SystemException));
00089 
00090   /// Return the list of arguments passed to the current operation.
00091   virtual Dynamic::ParameterList * arguments (
00092       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00093     ACE_THROW_SPEC ((CORBA::SystemException));
00094 
00095   /// Return the list of exceptions the current operation is capable
00096   /// of throwing.
00097   virtual Dynamic::ExceptionList * exceptions (
00098       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00099     ACE_THROW_SPEC ((CORBA::SystemException));
00100 
00101   virtual Dynamic::ContextList * contexts (
00102       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00103     ACE_THROW_SPEC ((CORBA::SystemException));
00104 
00105   virtual Dynamic::RequestContext * operation_context (
00106       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00107     ACE_THROW_SPEC ((CORBA::SystemException));
00108 
00109   /// Return the result of the current request.  If there is no return
00110   /// value then an Any with tk_void TypeCode is returned.  This is
00111   /// method is not valid for oneway operations.
00112   virtual CORBA::Any * result (
00113       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00114     ACE_THROW_SPEC ((CORBA::SystemException));
00115 
00116   /// Returns true for a two-way operation, and false otherwise.
00117   virtual CORBA::Boolean response_expected (
00118       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00119     ACE_THROW_SPEC ((CORBA::SystemException)) ;
00120 
00121   /// Return the sync_scope policy value for the current one-way
00122   /// operation.  If the operation is not a one-way, a
00123   /// CORBA::BAD_INV_ORDER exception is thrown.
00124   virtual Messaging::SyncScope sync_scope (
00125       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00126     ACE_THROW_SPEC ((CORBA::SystemException));
00127 
00128   /// Return the reply status for the current request.
00129   /**
00130    * Statuses can be PortableInterceptor::SUCCESSFUL,
00131    * SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD,
00132    * TRANSPORT_RETRY, UNKNOWN.
00133    */
00134   virtual PortableInterceptor::ReplyStatus reply_status (
00135       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00136     ACE_THROW_SPEC ((CORBA::SystemException));
00137 
00138   /// If the reply status is PortableInterceptor::LOCATION_FORWARD or
00139   /// return the object reference to which the request was forwarded.
00140   virtual CORBA::Object_ptr forward_reference (
00141       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00142     ACE_THROW_SPEC ((CORBA::SystemException)) ;
00143 
00144   virtual CORBA::Any * get_slot (
00145       PortableInterceptor::SlotId id
00146       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00147     ACE_THROW_SPEC ((CORBA::SystemException,
00148                      PortableInterceptor::InvalidSlot));
00149 
00150   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00151   /// from the request service context list.
00152   virtual IOP::ServiceContext * get_request_service_context (
00153       IOP::ServiceId id
00154       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00155     ACE_THROW_SPEC ((CORBA::SystemException));
00156 
00157   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00158   /// from the reply service context list.
00159   virtual IOP::ServiceContext * get_reply_service_context (
00160       IOP::ServiceId id
00161       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00162     ACE_THROW_SPEC ((CORBA::SystemException));
00163 
00164   /// Return the (initial, non-forwarded, or permanently forwarded)
00165   /// object reference of the target.
00166   virtual CORBA::Object_ptr target (
00167       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00168     ACE_THROW_SPEC ((CORBA::SystemException));
00169 
00170   /// Return the object reference for the current target.  The target
00171   /// may change in the even of a location forward.
00172   virtual CORBA::Object_ptr effective_target (
00173       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00174     ACE_THROW_SPEC ((CORBA::SystemException));
00175 
00176   virtual IOP::TaggedProfile * effective_profile (
00177       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00178     ACE_THROW_SPEC ((CORBA::SystemException));
00179 
00180   /// Return an Any containing the received exception, if any.
00181   /// Otherwise, throw a CORBA::BAD_INV_ORDER exception.
00182   /**
00183    * @note There is no trivial way to extract the exception from an Any.
00184    */
00185   virtual CORBA::Any * received_exception (
00186       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00187     ACE_THROW_SPEC ((CORBA::SystemException));
00188 
00189   /// Return the repository ID for the received exception.
00190   virtual char * received_exception_id (
00191       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00192     ACE_THROW_SPEC ((CORBA::SystemException));
00193 
00194   /// Return the first IOP::TaggedComponent that matches the given
00195   /// IOP::ComponentId in the object reference for the current
00196   /// target.
00197   virtual IOP::TaggedComponent * get_effective_component (
00198       IOP::ComponentId id
00199       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00200     ACE_THROW_SPEC ((CORBA::SystemException));
00201 
00202   /// Return all IOP::TaggedComponent(s) that match the given
00203   /// IOP::ComponentId in the object reference for the current
00204   /// target.
00205   virtual IOP::TaggedComponentSeq * get_effective_components (
00206       IOP::ComponentId id
00207       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00208     ACE_THROW_SPEC ((CORBA::SystemException));
00209 
00210   /// Return the policy of the given type in effect for the current
00211   /// request.
00212   virtual CORBA::Policy_ptr get_request_policy (
00213       CORBA::PolicyType type
00214       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00215     ACE_THROW_SPEC ((CORBA::SystemException));
00216 
00217   /// Add the IOP::ServiceContext to the request (outgoing)
00218   /// IOP::ServiceContextList.
00219   virtual void add_request_service_context (
00220       const IOP::ServiceContext & service_context,
00221       CORBA::Boolean replace
00222       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00223      ACE_THROW_SPEC ((CORBA::SystemException));
00224 
00225   /*
00226   * Proprietary accessor methods for the FT retention ID and
00227   * request expiration time.
00228   */
00229 
00230   /// Set the absolute FT expiration time for this request.
00231   void tao_ft_expiration_time (TimeBase::TimeT time);
00232 
00233   /// Get the absolute FT expiration time for this request
00234   TimeBase::TimeT tao_ft_expiration_time (void) const;
00235 
00236   /// Set the FT request retention ID for this request.
00237   void tao_ft_retention_id (CORBA::Long request_id);
00238 
00239   /// Get the FT request retention ID for this request.
00240   CORBA::Long tao_ft_retention_id (void) const;
00241 
00242   /*
00243   * End proprietary FT methods.
00244   */
00245 
00246 private:
00247 
00248   bool parameter_list (Dynamic::ParameterList &param_list);
00249 
00250   bool exception_list (Dynamic::ExceptionList &exception_list);
00251 
00252   bool result (CORBA::Any *any);
00253 
00254   /// Check if this ClientRequestInfo object is called within the
00255   /// context of a request.
00256   void check_validity (ACE_ENV_SINGLE_ARG_DECL);
00257 
00258   /// Setup thread scope and request scope
00259   /// PortableInterceptor::Current objects.
00260   void setup_picurrent (void);
00261 
00262   /// Helper method to get the request and response service contexts.
00263   IOP::ServiceContext *get_service_context_i (
00264       TAO_Service_Context &service_context_list,
00265       IOP::ServiceId id
00266       ACE_ENV_ARG_DECL)
00267     ACE_THROW_SPEC ((CORBA::SystemException));
00268 
00269 private:
00270   /// Pointer to the invocation object.
00271   TAO::Invocation_Base *invocation_;
00272 
00273   /// The "Request Scope Current" (RSC) object, as required by
00274   /// Portable Interceptors.
00275   TAO::PICurrent_Impl rs_pi_current_;
00276 };
00277 
00278 TAO_END_VERSIONED_NAMESPACE_DECL
00279 
00280 #if defined(_MSC_VER)
00281 #pragma warning(pop)
00282 #endif /* _MSC_VER */
00283 
00284 #endif /* TAO_HAS_INTERCEPTORS == 1 */
00285 
00286 #include /**/ "ace/post.h"
00287 
00288 #endif /* TAO_CLIENT_REQUEST_INFO_H */

Generated on Thu Nov 9 12:51:39 2006 for TAO_PI by doxygen 1.3.6