summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-28 23:14:14 +0000
committerzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-28 23:14:14 +0000
commit54961d29c11f92944adb80f85b357efa15c6ea50 (patch)
tree0d5730bc4212bf13595020111745e3da7f886d87
parent0d37f11830d58b24dd108d3c2783cee99fe5b01d (diff)
downloadATCD-54961d29c11f92944adb80f85b357efa15c6ea50.tar.gz
Wed Feb 28 23:11:13 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
-rw-r--r--TAO/ChangeLog.oci_rt97347
-rw-r--r--TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.cpp108
-rw-r--r--TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h6
3 files changed, 118 insertions, 3 deletions
diff --git a/TAO/ChangeLog.oci_rt9734 b/TAO/ChangeLog.oci_rt9734
index 81e2e8b4b5c..01cdf4ab3ac 100644
--- a/TAO/ChangeLog.oci_rt9734
+++ b/TAO/ChangeLog.oci_rt9734
@@ -1,3 +1,10 @@
+Wed Feb 28 23:11:13 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
+
+ * orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h:
+ * orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.cpp:
+
+ Added basic implementation for TAO_ProxyServant.
+
Wed Feb 28 16:41:23 2007 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/orbsvcs/AsynchProxyTools/AsynchProxyTools_Export.h:
diff --git a/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.cpp b/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.cpp
new file mode 100644
index 00000000000..47c82c1de3b
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.cpp
@@ -0,0 +1,108 @@
+//$Id$
+
+#include "ProxyServant.h"
+
+TAO_ProxyServant::TAO_ProxyServant ()
+{
+}
+
+TAO_ProxyServant::~TAO_ProxyServant ()
+{
+}
+
+void
+TAO_ProxyServant::_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));
+ 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());
+ }
+ catch (CORBA::Exception, ex)
+ {
+ // Only if the client is waiting.
+ if (request.response_expected () && !request.sync_with_server ())
+ {
+ request.tao_send_reply_exception (ex);
+ }
+ }
+ CORBA::release (dsi_request);
+}
+
+TAO_ProxyServant::invoke(CORBA::ServerRequest_ptr request,
+ TAO_AMH_DSI_Response_Handler_ptr rh)
+ throw (CORBA::SystemException)
+{
+ if ( ACE_OS::strcmp ("_get_interface", request->operation ()) == 0)
+ this->invoke_get_interface (request);
+ else if ( ACE_OS::strcmp ("_primary_interface", request->operation ()) == 0)
+ this->invoke_primary_interface (request);
+ else
+ this->invoke_i (request, rh);
+}
+
+void
+TAO_ProxyServant::invoke_get_interface (CORBA::ServerRequest_ptr request)
+{
+ CORBA::NVList_ptr args;
+ this->orb_->create_list (0, args );
+ request->arguments (args );
+
+ CORBA::InterfaceDef_var theIntDef = this->_get_interface ();
+ CORBA::Any theResult;
+ theResult.type (CORBA::_tc_Object);
+ theResult <<= theIntDef.in ();
+ request->set_result (theResult);
+}
+
+void
+TAO_ProxyServant::invoke_primary_interface (CORBA::ServerRequest_ptr request)
+{
+ CORBA::NVList_ptr args;
+ this->orb_->create_list (0, args);
+ request->arguments (args);
+ CORBA::String_var rep_id =
+ this->interface_repository_id();
+
+ CORBA::Any a;
+ a.type(CORBA::_tc_string);
+ a <<= rep_id.in ();
+ request->set_result (a);
+}
diff --git a/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h b/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h
index 15e25823960..107f5518daf 100644
--- a/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h
+++ b/TAO/orbsvcs/orbsvcs/AsynchProxyTools/ProxyServant.h
@@ -20,8 +20,8 @@ public:
TAO_ProxyServant();
void invoke (CORBA::ServerRequest_ptr request,
TAO_AMH_DSI_Response_Handler_ptr rh);
- virtual void invoke_i () = 0;
+ virtual void invoke_i (CORBA::ServerRequest_ptr request,
+ TAO_AMH_DSI_Response_Handler_ptr response_handler
+ ) = 0;
};
-
-
#endif // TAO_PROXY_SERVANT