ClientRequestInfo.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file ClientRequestInfo.h
00006  *
00007  * $Id: ClientRequestInfo.h 77151 2007-02-15 13:24:41Z johnnyw $
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 (void);
00082 
00083   /// Return the operation name for the current request.
00084   virtual char * operation (void);
00085 
00086   /// Return the list of arguments passed to the current operation.
00087   virtual Dynamic::ParameterList * arguments (void);
00088 
00089   /// Return the list of exceptions the current operation is capable
00090   /// of throwing.
00091   virtual Dynamic::ExceptionList * exceptions (void);
00092 
00093   virtual Dynamic::ContextList * contexts (void);
00094 
00095   virtual Dynamic::RequestContext * operation_context (void);
00096 
00097   /// Return the result of the current request.  If there is no return
00098   /// value then an Any with tk_void TypeCode is returned.  This is
00099   /// method is not valid for oneway operations.
00100   virtual CORBA::Any * result (void);
00101 
00102   /// Returns true for a two-way operation, and false otherwise.
00103   virtual CORBA::Boolean response_expected (void);
00104 
00105   /// Return the sync_scope policy value for the current one-way
00106   /// operation.  If the operation is not a one-way, a
00107   /// CORBA::BAD_INV_ORDER exception is thrown.
00108   virtual Messaging::SyncScope sync_scope (void);
00109 
00110   /// Return the reply status for the current request.
00111   /**
00112    * Statuses can be PortableInterceptor::SUCCESSFUL,
00113    * SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD,
00114    * TRANSPORT_RETRY, UNKNOWN.
00115    */
00116   virtual PortableInterceptor::ReplyStatus reply_status (void);
00117 
00118   /// If the reply status is PortableInterceptor::LOCATION_FORWARD or
00119   /// return the object reference to which the request was forwarded.
00120   virtual CORBA::Object_ptr forward_reference (void);
00121 
00122   virtual CORBA::Any * get_slot (PortableInterceptor::SlotId id);
00123 
00124   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00125   /// from the request service context list.
00126   virtual IOP::ServiceContext * get_request_service_context (
00127       IOP::ServiceId id);
00128 
00129   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00130   /// from the reply service context list.
00131   virtual IOP::ServiceContext * get_reply_service_context (IOP::ServiceId id);
00132 
00133   /// Return the (initial, non-forwarded, or permanently forwarded)
00134   /// object reference of the target.
00135   virtual CORBA::Object_ptr target (void);
00136 
00137   /// Return the object reference for the current target.  The target
00138   /// may change in the even of a location forward.
00139   virtual CORBA::Object_ptr effective_target (void);
00140 
00141   virtual IOP::TaggedProfile * effective_profile (void);
00142 
00143   /// Return an Any containing the received exception, if any.
00144   /// Otherwise, throw a CORBA::BAD_INV_ORDER exception.
00145   /**
00146    * @note There is no trivial way to extract the exception from an Any.
00147    */
00148   virtual CORBA::Any * received_exception (void);
00149 
00150   /// Return the repository ID for the received exception.
00151   virtual char * received_exception_id (void);
00152 
00153   /// Return the first IOP::TaggedComponent that matches the given
00154   /// IOP::ComponentId in the object reference for the current
00155   /// target.
00156   virtual IOP::TaggedComponent * get_effective_component (IOP::ComponentId id);
00157 
00158   /// Return all IOP::TaggedComponent(s) that match the given
00159   /// IOP::ComponentId in the object reference for the current
00160   /// target.
00161   virtual IOP::TaggedComponentSeq * get_effective_components (IOP::ComponentId id);
00162 
00163   /// Return the policy of the given type in effect for the current
00164   /// request.
00165   virtual CORBA::Policy_ptr get_request_policy (CORBA::PolicyType type);
00166 
00167   /// Add the IOP::ServiceContext to the request (outgoing)
00168   /// IOP::ServiceContextList.
00169   virtual void add_request_service_context (
00170       const IOP::ServiceContext & service_context,
00171       CORBA::Boolean replace);
00172 
00173   /*
00174   * Proprietary accessor methods for the FT retention ID and
00175   * request expiration time.
00176   */
00177 
00178   /// Set the absolute FT expiration time for this request.
00179   void tao_ft_expiration_time (TimeBase::TimeT time);
00180 
00181   /// Get the absolute FT expiration time for this request
00182   TimeBase::TimeT tao_ft_expiration_time (void) const;
00183 
00184   /// Set the FT request retention ID for this request.
00185   void tao_ft_retention_id (CORBA::Long request_id);
00186 
00187   /// Get the FT request retention ID for this request.
00188   CORBA::Long tao_ft_retention_id (void) const;
00189 
00190   /*
00191   * End proprietary FT methods.
00192   */
00193 
00194 private:
00195 
00196   bool parameter_list (Dynamic::ParameterList &param_list);
00197 
00198   bool exception_list (Dynamic::ExceptionList &exception_list);
00199 
00200   bool result (CORBA::Any *any);
00201 
00202   /// Check if this ClientRequestInfo object is called within the
00203   /// context of a request.
00204   void check_validity (void);
00205 
00206   /// Setup thread scope and request scope
00207   /// PortableInterceptor::Current objects.
00208   void setup_picurrent (void);
00209 
00210   /// Helper method to get the request and response service contexts.
00211   IOP::ServiceContext *get_service_context_i (
00212       TAO_Service_Context &service_context_list,
00213       IOP::ServiceId id);
00214 
00215 private:
00216   /// Pointer to the invocation object.
00217   TAO::Invocation_Base *invocation_;
00218 
00219   /// The "Request Scope Current" (RSC) object, as required by
00220   /// Portable Interceptors.
00221   TAO::PICurrent_Impl rs_pi_current_;
00222 };
00223 
00224 TAO_END_VERSIONED_NAMESPACE_DECL
00225 
00226 #if defined(_MSC_VER)
00227 #pragma warning(pop)
00228 #endif /* _MSC_VER */
00229 
00230 #endif /* TAO_HAS_INTERCEPTORS == 1 */
00231 
00232 #include /**/ "ace/post.h"
00233 
00234 #endif /* TAO_CLIENT_REQUEST_INFO_H */

Generated on Sun Jan 27 13:29:59 2008 for TAO_PI by doxygen 1.3.6