summaryrefslogtreecommitdiff
path: root/TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-04-01 14:17:09 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-04-01 14:17:09 +0000
commit23eecf6f92138e4fab2254d65fe903376aa8bb57 (patch)
tree75c80e81433478444289a3e7a1671664a0657eac /TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp
parent11ddbaea8d4cd7196d04a8aa42152541db7ad7cd (diff)
downloadATCD-23eecf6f92138e4fab2254d65fe903376aa8bb57.tar.gz
ChangeLogTag: Tue Apr 1 14:11:00 UTC 2008 Vladimir Zykov <vladimir.zykov@prismtech.com>
Diffstat (limited to 'TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp')
-rw-r--r--TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp99
1 files changed, 99 insertions, 0 deletions
diff --git a/TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp b/TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp
new file mode 100644
index 00000000000..2602da3ff9e
--- /dev/null
+++ b/TAO/tests/Collocated_Forwarding/Server_Request_Interceptor.cpp
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+#include "Server_Request_Interceptor.h"
+#include "tao/PI_Server/PI_Server.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CDR.h"
+#include "testS.h"
+
+ACE_RCSID (Collocated_Forwarding,
+ Server_Request_Interceptor,
+ "$Id$")
+
+//static const CORBA::ULong expected_version = 5;
+
+Server_Request_Interceptor::Server_Request_Interceptor (CORBA::ULong request_pass_count)
+ : request_pass_count_ (request_pass_count)
+ , request_count_ (0)
+ , to_ (CORBA::Object::_nil ())
+{
+}
+
+void
+Server_Request_Interceptor::forward (
+ CORBA::Object_ptr to)
+{
+ if (CORBA::is_nil (to))
+ throw CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO);
+
+ char *argv[] = {NULL};
+ int argc = 0;
+
+ // Fetch the ORB having been initialized in main()
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "Server ORB");
+
+ CORBA::String_var s_to = orb->object_to_string (to);
+
+ this->to_ = orb->string_to_object (s_to.in ());
+}
+
+char *
+Server_Request_Interceptor::name (void)
+{
+ return CORBA::string_dup ("Server_Request_Interceptor");
+}
+
+void
+Server_Request_Interceptor::destroy (void)
+{
+ CORBA::release (this->to_);
+}
+
+void
+Server_Request_Interceptor::receive_request_service_contexts (
+ PortableInterceptor::ServerRequestInfo_ptr)
+{
+ this->request_count_++;
+}
+
+void
+Server_Request_Interceptor::receive_request (
+ PortableInterceptor::ServerRequestInfo_ptr)
+{
+ if (this->request_count_ == this->request_pass_count_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "SERVER: Request %d will be forwarded "
+ "to object 'to'\nSERVER: via "
+ "receive_request_service_contexts().\n",
+ this->request_count_));
+
+ // Throw forward exception
+ throw PortableInterceptor::ForwardRequest (this->to_);
+ }
+
+ return;
+}
+
+void
+Server_Request_Interceptor::send_reply (
+ PortableInterceptor::ServerRequestInfo_ptr)
+{
+}
+
+void
+Server_Request_Interceptor::send_exception (
+ PortableInterceptor::ServerRequestInfo_ptr)
+{
+}
+
+void
+Server_Request_Interceptor::send_other (
+ PortableInterceptor::ServerRequestInfo_ptr)
+{
+}