summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-22 22:03:31 +0000
committerzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-22 22:03:31 +0000
commit7fb5c42da8602c47b9bcbbb7e74282cb767e867a (patch)
treec22f99190a559861717c2934a7e4d06a9df8f8b9
parent1c2fe363afd295930496434008718e63880492c4 (diff)
downloadATCD-7fb5c42da8602c47b9bcbbb7e74282cb767e867a.tar.gz
Thu Feb 22 22:01:13 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
* tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc: * tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h: * tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp: * tests/DSI_AMI_Gateway/test_dsi.h: * tests/DSI_AMI_Gateway/test_dsi.inl: * tests/DSI_AMI_Gateway/test_dsi.cpp: Updated this test with full features, i.e., DII+AMI+DSI+DSH.
-rw-r--r--TAO/ChangeLog.oci_rt973412
-rw-r--r--TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc5
-rw-r--r--TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp39
-rw-r--r--TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h23
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.cpp104
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.h18
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.inl3
7 files changed, 162 insertions, 42 deletions
diff --git a/TAO/ChangeLog.oci_rt9734 b/TAO/ChangeLog.oci_rt9734
index 46d3fea97b5..233d3fb5385 100644
--- a/TAO/ChangeLog.oci_rt9734
+++ b/TAO/ChangeLog.oci_rt9734
@@ -1,3 +1,15 @@
+Thu Feb 22 22:01:13 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
+
+ * tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc:
+ * tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h:
+ * tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp:
+ * tests/DSI_AMI_Gateway/test_dsi.h:
+ * tests/DSI_AMI_Gateway/test_dsi.inl:
+ * tests/DSI_AMI_Gateway/test_dsi.cpp:
+
+ Updated this test with full features, i.e.,
+ DII+AMI+DSI+DSH.
+
Wed Feb 21 23:55:27 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
* tests/DSI_AMI_Gateway:
diff --git a/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc b/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc
index 7703b170041..391233412d6 100644
--- a/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc
+++ b/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc
@@ -41,10 +41,7 @@ project(*Gateway): taoexe, portableserver, messaging, avoids_minimum_corba, avoi
Source_Files {
test_dsi.cpp
gateway.cpp
- }
- Source_Files {
- testC.cpp
- testS.cpp
+ My_DII_Reply_Handler.cpp
}
IDL_Files {
}
diff --git a/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp b/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp
new file mode 100644
index 00000000000..960ca19332a
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.cpp
@@ -0,0 +1,39 @@
+#include "My_DII_Reply_Handler.h"
+#include "ace/Log_Msg.h"
+#include "tao/AnyTypeCode/NVList.h"
+
+My_DII_Reply_Handler::My_DII_Reply_Handler(TAO_AMH_DSI_Response_Handler_ptr rph,
+ CORBA::ORB_var orb)
+ : response_handler_ (rph),
+ orb_ (orb)
+{
+}
+
+My_DII_Reply_Handler::~My_DII_Reply_Handler()
+{
+}
+
+void
+My_DII_Reply_Handler::handle_response(TAO_InputCDR &incoming)
+{
+ CORBA::NVList_ptr list;
+ this->orb_->create_list (0, list);
+
+ bool lazy_evaluation = true;
+ list->_tao_incoming_cdr (incoming,
+ CORBA::ARG_OUT | CORBA::ARG_INOUT,
+ lazy_evaluation);
+
+ if (!CORBA::is_nil (this->response_handler_))
+ this->response_handler_->invoke_reply (list,
+ 0 // result
+ );
+}
+
+void
+My_DII_Reply_Handler::handle_excep (TAO_InputCDR &incoming,
+ CORBA::ULong reply_status)
+{
+ ACE_DEBUG((LM_DEBUG, "calling DII_Reply_Handler::handle_excep()\n"));
+}
+
diff --git a/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h b/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h
new file mode 100644
index 00000000000..f17d13047b1
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/My_DII_Reply_Handler.h
@@ -0,0 +1,23 @@
+#include "tao/Messaging/MessagingS.h"
+#include "tao/DynamicInterface/DII_Reply_Handler.h"
+#include "tao/DynamicInterface/AMH_DSI_Response_Handler.h"
+class My_DII_Reply_Handler : public virtual TAO_DII_Reply_Handler,
+ public virtual Messaging::ReplyHandler
+{
+ // Used to handle replies from the server and to complete the
+ // call back to the client.
+ //
+public:
+ My_DII_Reply_Handler (TAO_AMH_DSI_Response_Handler_ptr rph,
+ CORBA::ORB_var orb);
+ virtual ~My_DII_Reply_Handler (void);
+
+ // Callback method for deferred synchronous requests.
+ virtual void handle_response (TAO_InputCDR &incoming);
+ virtual void handle_excep (TAO_InputCDR &incoming,
+ CORBA::ULong reply_status);
+
+private:
+ TAO_AMH_DSI_Response_Handler * response_handler_;
+ CORBA::ORB_var orb_;
+};
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp b/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp
index 09110580f28..b02595f72b9 100644
--- a/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp
@@ -5,20 +5,85 @@
#include "tao/DynamicInterface/Unknown_User_Exception.h"
#include "tao/TAO_Server_Request.h"
#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "My_DII_Reply_Handler.h"
#if !defined(__ACE_INLINE__)
#include "test_dsi.inl"
#endif /* __ACE_INLINE__ */
-ACE_RCSID(DSI_Gateway, test_dsi, "$Id$")
+ACE_RCSID(DSI_AMI_Gateway, test_dsi, "$Id$")
+
+void
+DSI_Simple_Server::_dispatch (TAO_ServerRequest &request,
+ void * //context
+ )
+{
+ // No need to do any of this if the client isn't waiting.
+ if (request.response_expected ())
+ {
+ if (!CORBA::is_nil (request.forward_location ()))
+ {
+ request.init_reply ();
+ request.tao_send_reply ();
+
+ // No need to invoke in this case.
+ return;
+ }
+ else if (request.sync_with_server ())
+ {
+ // The last line before the call to this function
+ // was an ACE_CHECK_RETURN, so if we're here, we
+ // know there is no exception so far, and that's all
+ // a SYNC_WITH_SERVER client request cares about.
+ request.send_no_exception_reply ();
+ }
+ }
+
+ // Create DSI request object.
+ CORBA::ServerRequest *dsi_request = 0;
+ ACE_NEW (dsi_request,
+ CORBA::ServerRequest (request));
+
+ ACE_TRY
+ {
+ TAO_AMH_DSI_Response_Handler_ptr rh_ptr = 0;
+ ACE_NEW (rh_ptr, TAO_AMH_DSI_Response_Handler(request));
+
+ TAO_AMH_DSI_Response_Handler_var rh = rh_ptr;
+
+ // init the handler
+ TAO_AMH_BUFFER_ALLOCATOR* amh_allocator =
+ request.orb()->orb_core ()->lane_resources().amh_response_handler_allocator();
+ rh->init (request, amh_allocator);
+ // Delegate to user.
+ this->invoke (dsi_request,
+ rh.in());
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+
+ {
+ // Only if the client is waiting.
+ if (request.response_expected () && !request.sync_with_server ())
+ {
+ request.tao_send_reply_exception (ex);
+ }
+ }
+ ACE_ENDTRY;
+
+ CORBA::release (dsi_request);
+}
void
DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request)
- ACE_THROW_SPEC ((CORBA::SystemException))
{
- //marshal_demarshal_=true;
- if(marshal_demarshal_)
- {
+}
+
+void
+DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request,
+ TAO_AMH_DSI_Response_Handler * rph)
+{
CORBA::NVList_ptr list;
this->orb_->create_list (0, list);
@@ -43,7 +108,10 @@ DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request)
try
{
// Updates the byte order state, if necessary.
- target_request->invoke ();
+ My_DII_Reply_Handler * rh_ptr = 0;
+ ACE_NEW (rh_ptr, My_DII_Reply_Handler (rph, this->orb_));
+
+ target_request->sendc (rh_ptr);
}
catch (const CORBA::UNKNOWN& ex)
{
@@ -60,29 +128,6 @@ DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request)
// Outgoing reply must have the same byte order as the incoming one.
request->_tao_reply_byte_order (target_request->_tao_byte_order ());
- }
- else
- {
- // forward the request without marshalling and demarshalling.
- TAO_ServerRequest & tao_server_request = request->_tao_server_request ();
- TAO_Transport* request_ptr = tao_server_request.transport ();
- TAO_Stub *stubobj = target_ ->_stubobj ();
-
- // the following code is doing the copy but with memory leak
- TAO_OutputCDR outcdr (tao_server_request.incoming ()->start ()->duplicate ());
- outcdr.write_octet_array_mb(tao_server_request.incoming ()->start ());
-
- ACE_DEBUG((LM_DEBUG,"the length of incoming cdr = %d\n"
- "the length of outgoing cdr = %d\n"
- "the length of my outcdr = %d\n",
- tao_server_request.incoming()->length(),
- tao_server_request.outgoing()->length(),
- outcdr.length ()));
- request_ptr->send_message ( outcdr,
- stubobj,
- TAO_Transport::TAO_ONEWAY_REQUEST);
-
- }
if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0)
{
this->orb_->shutdown (0);
@@ -92,7 +137,6 @@ DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request)
CORBA::RepositoryId
DSI_Simple_Server::_primary_interface (const PortableServer::ObjectId &,
PortableServer::POA_ptr)
- ACE_THROW_SPEC (())
{
return CORBA::string_dup ("IDL:Simple_Server:1.0");
}
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.h b/TAO/tests/DSI_AMI_Gateway/test_dsi.h
index 9b995ecd092..9852de1af8c 100644
--- a/TAO/tests/DSI_AMI_Gateway/test_dsi.h
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.h
@@ -18,6 +18,7 @@
#include "tao/DynamicInterface/Server_Request.h"
#include "tao/DynamicInterface/Dynamic_Implementation.h"
+#include "tao/DynamicInterface/AMH_DSI_Response_Handler.h"
#include "tao/PortableServer/PortableServer.h"
#include "tao/ORB.h"
@@ -35,15 +36,22 @@ public:
PortableServer::POA_ptr poa);
// ctor
+ virtual void _dispatch (TAO_ServerRequest &request,
+ void *context);
+ // Turns around and calls invoke, but using AMH style handler
// = The DynamicImplementation methods.
- virtual void invoke (CORBA::ServerRequest_ptr request)
- ACE_THROW_SPEC ((CORBA::SystemException));
+ //
+
+ // we need this because it is a pure virtual method in
+ // its parent class
+ virtual void invoke (CORBA::ServerRequest_ptr request);
+ virtual void invoke (CORBA::ServerRequest_ptr request,
+ TAO_AMH_DSI_Response_Handler_ptr rh);
virtual CORBA::RepositoryId _primary_interface (
const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa
- )
- ACE_THROW_SPEC (());
+ );
virtual PortableServer::POA_ptr _default_POA (
);
@@ -57,8 +65,6 @@ private:
PortableServer::POA_var poa_;
// The POA
-
- bool marshal_demarshal_;
};
#if defined(__ACE_INLINE__)
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.inl b/TAO/tests/DSI_AMI_Gateway/test_dsi.inl
index 26ab9b53ad3..dab987ec71e 100644
--- a/TAO/tests/DSI_AMI_Gateway/test_dsi.inl
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.inl
@@ -6,7 +6,6 @@ DSI_Simple_Server::DSI_Simple_Server (CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa)
: orb_ (CORBA::ORB::_duplicate (orb)),
target_ (CORBA::Object::_duplicate (target)),//Simple_Server::_duplicate (target)),
- poa_ (PortableServer::POA::_duplicate (poa)),
- marshal_demarshal_(false)
+ poa_ (PortableServer::POA::_duplicate (poa))
{
}