1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
// $Id$
#include "tao/Messaging/AMI_Arguments_Converter_Impl.h"
#include "tao/operation_details.h"
#include "tao/SystemException.h"
#include "tao/Pluggable_Messaging_Utils.h"
#include "tao/Reply_Dispatcher.h"
#include "tao/CDR.h"
ACE_RCSID (Messaging,
AMI_Arguments_Converter_Impl,
"$Id$")
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
void
TAO_AMI_Arguments_Converter_Impl::convert_request (
TAO_ServerRequest & server_request,
TAO::Argument * const args[],
size_t nargs)
{
// The AMI requests on client side just has the in and inout argumenst,
// Since the argument list in the client side is used by server side
// in collocation case and the server expects the full list of arguments
// and not just the inout arguments we need to expand the client arguments
// to be list of Arguments.
CORBA::ULong const nrarg = server_request.operation_details ()->args_num ();
TAO_OutputCDR output;
for (CORBA::ULong i = 1; i < nrarg; ++i)
{
if (!(server_request.operation_details ()->args()[i])->marshal (output))
{
throw ::CORBA::BAD_PARAM ();
}
}
TAO_InputCDR input (output);
for (CORBA::ULong j = 1; j < nargs; ++j)
{
if (!(args[j]->demarshal (input)))
{
TAO_InputCDR::throw_skel_exception (errno);
}
}
TAO_Operation_Details* details
= const_cast <TAO_Operation_Details*> (server_request.operation_details ());
details->use_stub_args (false);
}
void
TAO_AMI_Arguments_Converter_Impl::convert_reply (
TAO_ServerRequest & server_request,
TAO::Argument * const args[],
size_t nargs)
{
if (server_request.operation_details ()->reply_dispatcher ())
{
TAO_OutputCDR output;
TAO_Pluggable_Reply_Params params (0);
params.reply_status (GIOP::NO_EXCEPTION);
for (CORBA::ULong j = 0; j < nargs; ++j)
{
if (!(args[j]->marshal (output)))
{
TAO_OutputCDR::throw_skel_exception (errno);
}
}
TAO_InputCDR input (output);
params.input_cdr_ = &input;
server_request.operation_details ()->
reply_dispatcher ()->dispatch_reply (params);
}
}
void
TAO_AMI_Arguments_Converter_Impl::handle_corba_exception (
TAO_ServerRequest & server_request,
CORBA::Exception *exception)
{
TAO_OutputCDR output;
TAO_Pluggable_Reply_Params params (0);
exception->_tao_encode (output);
if (CORBA::SystemException::_downcast (exception) != 0)
{
params.reply_status (GIOP::SYSTEM_EXCEPTION);
}
else
{
params.reply_status (GIOP::USER_EXCEPTION);
}
TAO_InputCDR input (output);
params.input_cdr_ = &input;
server_request.operation_details ()->
reply_dispatcher ()->dispatch_reply (params);
}
// *********************************************************************
// Initialization and registration of dynamic service object.
int
TAO_AMI_Arguments_Converter_Impl::Initializer (void)
{
return ACE_Service_Config::process_directive (
ace_svc_desc_TAO_AMI_Arguments_Converter_Impl);
}
TAO_END_VERSIONED_NAMESPACE_DECL
ACE_STATIC_SVC_DEFINE (
TAO_AMI_Arguments_Converter_Impl,
ACE_TEXT ("AMI_Arguments_Converter"),
ACE_SVC_OBJ_T,
&ACE_SVC_NAME (TAO_AMI_Arguments_Converter_Impl),
ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
0
)
ACE_FACTORY_DEFINE (TAO_Messaging, TAO_AMI_Arguments_Converter_Impl)
|