2 #include "tao/Messaging/AMI_Arguments_Converter_Impl.h"
3 #include "tao/operation_details.h"
4 #include "tao/SystemException.h"
5 #include "tao/Pluggable_Messaging_Utils.h"
6 #include "tao/Reply_Dispatcher.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO_AMI_Arguments_Converter_Impl::convert_request (
13 TAO_ServerRequest
& server_request
,
14 TAO::Argument
* const args
[],
17 // The AMI requests on client side just has the in and inout arguments,
18 // Since the argument list in the client side is used by server side
19 // in collocation case and the server expects the full list of arguments
20 // and not just the inout arguments we need to expand the client arguments
21 // to be list of Arguments.
24 this->dsi_convert_request (server_request
, output
);
26 TAO_InputCDR
input (output
);
28 for (CORBA::ULong j
= 1; j
< nargs
; ++j
)
30 if (!(args
[j
]->demarshal (input
)))
32 TAO_InputCDR::throw_skel_exception (errno
);
36 TAO_Operation_Details
* details
37 = const_cast <TAO_Operation_Details
*> (server_request
.operation_details ());
39 details
->use_stub_args (false);
43 TAO_AMI_Arguments_Converter_Impl::dsi_convert_request (
44 TAO_ServerRequest
& server_request
,
45 TAO_OutputCDR
& output
)
47 // The AMI requests on client side just has the in and inout arguments
48 CORBA::ULong
const nrarg
= server_request
.operation_details ()->args_num ();
50 for (CORBA::ULong i
= 1; i
< nrarg
; ++i
)
52 if (!(server_request
.operation_details ()->args()[i
])->marshal (output
))
54 throw ::CORBA::BAD_PARAM ();
60 TAO_AMI_Arguments_Converter_Impl::convert_reply (
61 TAO_ServerRequest
& server_request
,
62 TAO::Argument
* const args
[],
65 if (server_request
.operation_details ()->reply_dispatcher ())
69 for (CORBA::ULong j
= 0; j
< nargs
; ++j
)
71 if (!(args
[j
]->marshal (output
)))
73 TAO_OutputCDR::throw_skel_exception (errno
);
76 TAO_InputCDR
input (output
);
77 this->dsi_convert_reply (server_request
, input
);
82 TAO_AMI_Arguments_Converter_Impl::dsi_convert_reply (
83 TAO_ServerRequest
& server_request
,
86 if (server_request
.operation_details ()->reply_dispatcher ())
88 TAO_Pluggable_Reply_Params
params (0);
89 params
.reply_status (GIOP::NO_EXCEPTION
);
90 params
.input_cdr_
= &input
;
91 server_request
.operation_details ()->
92 reply_dispatcher ()->dispatch_reply (params
);
97 TAO_AMI_Arguments_Converter_Impl::handle_corba_exception (
98 TAO_ServerRequest
& server_request
,
99 CORBA::Exception
*exception
)
101 TAO_OutputCDR output
;
102 TAO_Pluggable_Reply_Params
params (0);
103 exception
->_tao_encode (output
);
104 if (CORBA::SystemException::_downcast (exception
) != 0)
106 params
.reply_status (GIOP::SYSTEM_EXCEPTION
);
110 params
.reply_status (GIOP::USER_EXCEPTION
);
112 TAO_InputCDR
input (output
);
113 params
.input_cdr_
= &input
;
114 server_request
.operation_details ()->
115 reply_dispatcher ()->dispatch_reply (params
);
118 // *********************************************************************
120 // Initialization and registration of dynamic service object.
123 TAO_AMI_Arguments_Converter_Impl::Initializer ()
125 return ACE_Service_Config::process_directive (
126 ace_svc_desc_TAO_AMI_Arguments_Converter_Impl
);
130 ACE_STATIC_SVC_DEFINE (
131 TAO_AMI_Arguments_Converter_Impl
,
132 ACE_TEXT ("AMI_Arguments_Converter"),
134 &ACE_SVC_NAME (TAO_AMI_Arguments_Converter_Impl
),
135 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
139 ACE_FACTORY_DEFINE (TAO_Messaging
, TAO_AMI_Arguments_Converter_Impl
)
141 TAO_END_VERSIONED_NAMESPACE_DECL