Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ClientRequestInfo_i.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file ClientRequestInfo_i.h
00006  *
00007  * $Id: ClientRequestInfo_i.h,v 1.1.1.1.2.1 2003/04/01 14:45:51 chad Exp $
00008  *
00009  * This is the implementation of the
00010  * PortableInterceptor::ClientRequestInfo interface.
00011  *
00012  * @author Ossama Othman <ossama@uci.edu>
00013  * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
00014  */
00015 //=============================================================================
00016 
00017 #ifndef TAO_CLIENT_REQUEST_INFO_I_H
00018 #define TAO_CLIENT_REQUEST_INFO_I_H
00019 
00020 #include "ace/pre.h"
00021 
00022 #include "tao/corbafwd.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #if (TAO_HAS_INTERCEPTORS == 1)
00029 
00030 #include "tao/PortableInterceptorC.h"
00031 #include "tao/StringSeqC.h"
00032 #include "tao/Service_Context.h"
00033 #include "tao/PICurrent.h"
00034 
00035 class TAO_GIOP_Invocation;
00036 
00037 /**
00038  * @class TAO_ClientRequestInfo_i
00039  *
00040  * @brief Implementation of the PortableInterceptor::ClientRequestInfo
00041  *        interface.
00042  */
00043 class TAO_Export TAO_ClientRequestInfo_i
00044 {
00045 public:
00046 
00047   /// Constructor from concrete interface.
00048   TAO_ClientRequestInfo_i (TAO_GIOP_Invocation *invocation,
00049                            CORBA::Object_ptr target);
00050 
00051   /// Constructor from abstract interface.
00052   TAO_ClientRequestInfo_i (TAO_GIOP_Invocation *invocation,
00053                            CORBA::AbstractBase_ptr abstract_target);
00054 
00055   /// Destructor.
00056   virtual ~TAO_ClientRequestInfo_i (void);
00057 
00058   /// Return an ID unique to the current request.  This request ID may
00059   /// or may not be the same as the GIOP request ID.
00060   CORBA::ULong request_id (
00061       ACE_ENV_SINGLE_ARG_DECL)
00062     ACE_THROW_SPEC ((CORBA::SystemException));
00063 
00064   /// Return the operation name for the current request.
00065   char * operation (
00066       ACE_ENV_SINGLE_ARG_DECL)
00067     ACE_THROW_SPEC ((CORBA::SystemException));
00068 
00069   /// Return the list of arguments passed to the current operation.
00070   virtual Dynamic::ParameterList * arguments (ACE_ENV_SINGLE_ARG_DECL)
00071     ACE_THROW_SPEC ((CORBA::SystemException));
00072 
00073   /// Return the list of exceptions the current operation is capable
00074   /// of throwing.
00075   virtual Dynamic::ExceptionList * exceptions (ACE_ENV_SINGLE_ARG_DECL)
00076     ACE_THROW_SPEC ((CORBA::SystemException));
00077 
00078   Dynamic::ContextList * contexts (
00079       ACE_ENV_SINGLE_ARG_DECL)
00080     ACE_THROW_SPEC ((CORBA::SystemException));
00081 
00082   Dynamic::RequestContext * operation_context (
00083       ACE_ENV_SINGLE_ARG_DECL)
00084     ACE_THROW_SPEC ((CORBA::SystemException));
00085 
00086   /// Return the result of the current request.  If there is no return
00087   /// value then an Any with tk_void TypeCode is returned.  This is
00088   /// method is not valid for oneway operations.
00089   virtual CORBA::Any * result (ACE_ENV_SINGLE_ARG_DECL)
00090     ACE_THROW_SPEC ((CORBA::SystemException));
00091 
00092   /// Returns true for a two-way operation, and false otherwise.
00093   CORBA::Boolean response_expected (ACE_ENV_SINGLE_ARG_DECL)
00094     ACE_THROW_SPEC ((CORBA::SystemException)) ;
00095 
00096   /// Return the sync_scope policy value for the current one-way
00097   /// operation.  If the operation is not a one-way, a
00098   /// CORBA::BAD_INV_ORDER exception is thrown.
00099   Messaging::SyncScope sync_scope (ACE_ENV_SINGLE_ARG_DECL)
00100     ACE_THROW_SPEC ((CORBA::SystemException));
00101 
00102   /// Return the reply status for the current request.  Statuses can
00103   /// be PortableInterceptor::SUCCESSFUL, SYSTEM_EXCEPTION,
00104   /// USER_EXCEPTION, LOCATION_FORWARD, LOCATION_FORWARD_PERMANENT,
00105   /// TRANSPORT_RETRY.
00106   PortableInterceptor::ReplyStatus reply_status (
00107       ACE_ENV_SINGLE_ARG_DECL)
00108     ACE_THROW_SPEC ((CORBA::SystemException));
00109 
00110   /// If the reply status is PortableInterceptor::LOCATION_FORWARD or
00111   /// PortableInterceptor::LOCATION_FORWARD_PERMANENT, return the
00112   /// object reference to which the request was forwarded.
00113   CORBA::Object_ptr forward_reference (
00114       ACE_ENV_SINGLE_ARG_DECL)
00115     ACE_THROW_SPEC ((CORBA::SystemException)) ;
00116 
00117   CORBA::Any * get_slot (
00118       PortableInterceptor::SlotId id
00119       ACE_ENV_ARG_DECL)
00120     ACE_THROW_SPEC ((CORBA::SystemException,
00121                      PortableInterceptor::InvalidSlot));
00122 
00123   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00124   /// from the request service context list.
00125   IOP::ServiceContext * get_request_service_context (
00126       IOP::ServiceId id
00127       ACE_ENV_ARG_DECL)
00128     ACE_THROW_SPEC ((CORBA::SystemException));
00129 
00130   /// Return the IOP::ServiceContext with the given IOP::ServiceId
00131   /// from the reply service context list.
00132   IOP::ServiceContext * get_reply_service_context (
00133       IOP::ServiceId id
00134       ACE_ENV_ARG_DECL)
00135     ACE_THROW_SPEC ((CORBA::SystemException));
00136 
00137   /// Return the (initial, non-forwarded, or permanently forwarded)
00138   /// object reference of the target.
00139   CORBA::Object_ptr target (
00140       ACE_ENV_SINGLE_ARG_DECL)
00141     ACE_THROW_SPEC ((CORBA::SystemException));
00142 
00143   /// Return the object reference for the current target.  The target
00144   /// may change in the even of a location forward.
00145   CORBA::Object_ptr effective_target (
00146       ACE_ENV_SINGLE_ARG_DECL)
00147     ACE_THROW_SPEC ((CORBA::SystemException));
00148 
00149   IOP::TaggedProfile * effective_profile (
00150       ACE_ENV_SINGLE_ARG_DECL)
00151     ACE_THROW_SPEC ((CORBA::SystemException));
00152 
00153   /// Return an Any containing the received exception, if any.
00154   /// Otherwise, throw a CORBA::BAD_INV_ORDER exception.
00155   /**
00156    * @note There is no trivial way to extract the exception from an Any.
00157    */
00158   CORBA::Any * received_exception (
00159       ACE_ENV_SINGLE_ARG_DECL)
00160     ACE_THROW_SPEC ((CORBA::SystemException));
00161 
00162   /// Return the repository ID for the received exception.
00163   char * received_exception_id (
00164       ACE_ENV_SINGLE_ARG_DECL)
00165     ACE_THROW_SPEC ((CORBA::SystemException));
00166 
00167   /// Return the first IOP::TaggedComponent that matches the given
00168   /// IOP::ComponentId in the object reference for the current
00169   /// target.
00170   IOP::TaggedComponent * get_effective_component (
00171       IOP::ComponentId id
00172       ACE_ENV_ARG_DECL)
00173     ACE_THROW_SPEC ((CORBA::SystemException));
00174 
00175   /// Return all IOP::TaggedComponent(s) that match the given
00176   /// IOP::ComponentId in the object reference for the current
00177   /// target.
00178   IOP::TaggedComponentSeq * get_effective_components (
00179       IOP::ComponentId id
00180       ACE_ENV_ARG_DECL)
00181     ACE_THROW_SPEC ((CORBA::SystemException));
00182 
00183   /// Return the policy of the given type in effect for the current
00184   /// request.
00185   CORBA::Policy_ptr get_request_policy (
00186       CORBA::PolicyType type
00187       ACE_ENV_ARG_DECL)
00188     ACE_THROW_SPEC ((CORBA::SystemException));
00189 
00190   /// Add the IOP::ServiceContext to the request (outgoing)
00191   /// IOP::ServiceContextList.
00192   void add_request_service_context (
00193       const IOP::ServiceContext & service_context,
00194       CORBA::Boolean replace
00195       ACE_ENV_ARG_DECL)
00196      ACE_THROW_SPEC ((CORBA::SystemException));
00197 
00198   /**
00199    * @name Stub helper methods
00200    *
00201    * The following methods are used in the implementation of the
00202    * Stubs, they are not part of the ClientRequestInfo interface, but
00203    * an extension used internally by TAO.
00204    */
00205   //@{
00206 
00207   /// Change the exception status.
00208   void exception (CORBA::Exception *exception);
00209 
00210   /// Set the flag that states whether or not a response is expected.
00211   /// For example, no response is expected in a one-way operation.
00212   void response_expected (CORBA::Boolean flag);
00213 
00214   /// Set the status of the received reply.
00215   void reply_status (int invoke_status);
00216 
00217   /// Extract the forward object reference from the
00218   /// PortableInterceptor::ForwardRequest exception, and set the reply
00219   /// status flag accordingly.
00220   void forward_reference (PortableInterceptor::ForwardRequest &exc);
00221   //@}
00222 
00223 protected:
00224 
00225   /// Setup thread scope and request scope
00226   /// PortableInterceptor::Current objects.
00227   void setup_picurrent (void);
00228   
00229 
00230   /// Helper method to get the request and response service contexts.
00231   IOP::ServiceContext *get_service_context_i (
00232       TAO_Service_Context &service_context_list,
00233       IOP::ServiceId id
00234       ACE_ENV_ARG_DECL)
00235     ACE_THROW_SPEC ((CORBA::SystemException));
00236 
00237 protected:
00238 
00239   /// Pointer to the GIOP invocation object.
00240   TAO_GIOP_Invocation *invocation_;
00241 
00242   /// Reference to the target object.
00243   CORBA::Object_ptr target_;
00244 
00245   /// Reference to the abstract interface target.
00246   CORBA::AbstractBase_ptr abstract_target_;
00247 
00248   /// Pointer to the caught exception.
00249   CORBA::Exception *caught_exception_;
00250 
00251   /// True if a two-way operation, false otherwise.
00252   CORBA::Boolean response_expected_;
00253 
00254   /// Reply status for the current request.
00255   PortableInterceptor::ReplyStatus reply_status_;
00256 
00257   /// The "Request Scope Current" (RSC) object, as required by
00258   /// Portable Interceptors.
00259   TAO_PICurrent_Impl rs_pi_current_;
00260 
00261 };
00262 
00263 # if defined (__ACE_INLINE__)
00264 #  include "ClientRequestInfo_i.inl"
00265 # endif  /* __ACE_INLINE__ */
00266 
00267 #endif /* TAO_HAS_INTERCEPTORS == 1 */
00268 
00269 #include "ace/post.h"
00270 
00271 #endif /* TAO_CLIENT_REQUEST_INFO_I_H */

Generated on Mon Jun 16 13:48:04 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002