3 //=============================================================================
5 * @file ClientRequestInfo.h
7 * This is the implementation of the
8 * PortableInterceptor::ClientRequestInfo interface.
10 * @author Ossama Othman <ossama@uci.edu>
12 //=============================================================================
14 #ifndef TAO_CLIENT_REQUEST_INFO_H
15 #define TAO_CLIENT_REQUEST_INFO_H
17 #include /**/ "ace/pre.h"
19 #include "tao/orbconf.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if (TAO_HAS_INTERCEPTORS == 1)
29 #pragma warning(disable:4250)
32 #include "tao/AnyTypeCode/AnyTypeCode_methods.h"
33 #include "tao/PI/PI_includeC.h"
34 #include "tao/PI/PICurrent_Impl.h"
35 #include "tao/CORBA_methods.h"
36 #include "tao/ORB_Constants.h"
37 #include "tao/LocalObject.h"
38 #include "tao/Invocation_Utils.h"
39 #include "tao/TimeBaseC.h"
41 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
43 class TAO_Service_Context
;
47 class Invocation_Base
;
54 typedef CORBA::StringSeq RequestContext
;
55 typedef CORBA::StringSeq ContextList
;
60 typedef CORBA::Short SyncScope
;
64 * @class TAO_ClientRequestInfo
66 * @brief Implementation of the PortableInterceptor::ClientRequestInfo
69 class TAO_PI_Export TAO_ClientRequestInfo
70 : public virtual PortableInterceptor::ClientRequestInfo
,
71 public virtual ::CORBA::LocalObject
74 TAO_ClientRequestInfo (TAO::Invocation_Base
*invocation
);
76 /// Return an ID unique to the current request. This request ID may
77 /// or may not be the same as the GIOP request ID.
78 virtual CORBA::ULong
request_id ();
80 /// Return the operation name for the current request.
81 virtual char * operation ();
83 /// Return the list of arguments passed to the current operation.
84 virtual Dynamic::ParameterList
* arguments ();
86 /// Return the list of exceptions the current operation is capable
88 virtual Dynamic::ExceptionList
* exceptions ();
90 virtual Dynamic::ContextList
* contexts ();
92 virtual Dynamic::RequestContext
* operation_context ();
94 /// Return the result of the current request. If there is no return
95 /// value then an Any with tk_void TypeCode is returned. This is
96 /// method is not valid for oneway operations.
97 virtual CORBA::Any
* result ();
99 /// Returns true for a two-way operation, and false otherwise.
100 virtual CORBA::Boolean
response_expected ();
102 /// Return the sync_scope policy value for the current one-way
103 /// operation. If the operation is not a one-way, a
104 /// CORBA::BAD_INV_ORDER exception is thrown.
105 virtual Messaging::SyncScope
sync_scope ();
107 /// Return the reply status for the current request.
109 * Statuses can be PortableInterceptor::SUCCESSFUL,
110 * SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD,
111 * TRANSPORT_RETRY, UNKNOWN.
113 virtual PortableInterceptor::ReplyStatus
reply_status ();
115 /// If the reply status is PortableInterceptor::LOCATION_FORWARD or
116 /// return the object reference to which the request was forwarded.
117 virtual CORBA::Object_ptr
forward_reference ();
119 virtual CORBA::Any
* get_slot (PortableInterceptor::SlotId id
);
121 /// Return the IOP::ServiceContext with the given IOP::ServiceId
122 /// from the request service context list.
123 virtual IOP::ServiceContext
* get_request_service_context (
126 /// Return the IOP::ServiceContext with the given IOP::ServiceId
127 /// from the reply service context list.
128 virtual IOP::ServiceContext
* get_reply_service_context (IOP::ServiceId id
);
130 /// Return the (initial, non-forwarded, or permanently forwarded)
131 /// object reference of the target.
132 virtual CORBA::Object_ptr
target ();
134 /// Return the object reference for the current target. The target
135 /// may change in the even of a location forward.
136 virtual CORBA::Object_ptr
effective_target ();
138 virtual IOP::TaggedProfile
* effective_profile ();
140 /// Return an Any containing the received exception, if any.
141 /// Otherwise, throw a CORBA::BAD_INV_ORDER exception.
143 * @note There is no trivial way to extract the exception from an Any.
145 virtual CORBA::Any
* received_exception ();
147 /// Return the repository ID for the received exception.
148 virtual char * received_exception_id ();
150 /// Return the first IOP::TaggedComponent that matches the given
151 /// IOP::ComponentId in the object reference for the current
153 virtual IOP::TaggedComponent
* get_effective_component (IOP::ComponentId id
);
155 /// Return all IOP::TaggedComponent(s) that match the given
156 /// IOP::ComponentId in the object reference for the current
158 virtual IOP::TaggedComponentSeq
* get_effective_components (IOP::ComponentId id
);
160 /// Return the policy of the given type in effect for the current
162 virtual CORBA::Policy_ptr
get_request_policy (CORBA::PolicyType type
);
164 /// Add the IOP::ServiceContext to the request (outgoing)
165 /// IOP::ServiceContextList.
166 virtual void add_request_service_context (
167 const IOP::ServiceContext
& service_context
,
168 CORBA::Boolean replace
);
171 * Proprietary accessor methods for the FT retention ID and
172 * request expiration time.
175 /// Set the absolute FT expiration time for this request.
176 void tao_ft_expiration_time (TimeBase::TimeT time
);
178 /// Get the absolute FT expiration time for this request
179 TimeBase::TimeT
tao_ft_expiration_time () const;
181 /// Set the FT request retention ID for this request.
182 void tao_ft_retention_id (CORBA::Long request_id
);
184 /// Get the FT request retention ID for this request.
185 CORBA::Long
tao_ft_retention_id () const;
188 * End proprietary FT methods.
192 bool parameter_list (Dynamic::ParameterList
¶m_list
);
194 bool exception_list (Dynamic::ExceptionList
&exception_list
);
196 bool result (CORBA::Any
*any
);
198 /// Check if this ClientRequestInfo object is called within the
199 /// context of a request.
200 void check_validity ();
202 /// Setup thread scope and request scope
203 /// PortableInterceptor::Current objects.
204 void setup_picurrent ();
206 /// Helper method to get the request and response service contexts.
207 IOP::ServiceContext
*get_service_context_i (
208 TAO_Service_Context
&service_context_list
,
212 /// Pointer to the invocation object.
213 TAO::Invocation_Base
*invocation_
;
215 /// The "Request Scope Current" (RSC) object, as required by
216 /// Portable Interceptors.
217 TAO::PICurrent_Impl rs_pi_current_
;
220 TAO_END_VERSIONED_NAMESPACE_DECL
222 #if defined(_MSC_VER)
224 #endif /* _MSC_VER */
226 #endif /* TAO_HAS_INTERCEPTORS == 1 */
228 #include /**/ "ace/post.h"
230 #endif /* TAO_CLIENT_REQUEST_INFO_H */