ClientRequestInfo.h

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

Generated on Tue Feb 2 17:42:01 2010 for TAO_PI by  doxygen 1.4.7