summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a232
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp120
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp38
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp43
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp228
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp120
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp24
-rw-r--r--TAO/tao/ClientRequestInfo.cpp167
-rw-r--r--TAO/tao/ClientRequestInfo.h26
-rw-r--r--TAO/tao/ClientRequestInfo.inl52
-rw-r--r--TAO/tao/DomainC.cpp125
-rw-r--r--TAO/tao/DomainC.h8
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_10.cpp27
-rw-r--r--TAO/tao/Invocation.cpp104
-rw-r--r--TAO/tao/Invocation.h261
-rw-r--r--TAO/tao/Invocation.i51
-rw-r--r--TAO/tao/Makefile1
-rw-r--r--TAO/tao/Makefile.bor1
-rw-r--r--TAO/tao/PortableInterceptor.h56
-rw-r--r--TAO/tao/PortableInterceptor.i92
-rw-r--r--TAO/tao/PortableServer/DomainS.cpp136
-rw-r--r--TAO/tao/PortableServer/DomainS.h19
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp65
-rw-r--r--TAO/tao/PortableServer/ServerRequestInfo.cpp162
-rw-r--r--TAO/tao/PortableServer/ServerRequestInfo.h88
-rw-r--r--TAO/tao/PortableServer/ServerRequestInfo.inl55
-rw-r--r--TAO/tao/PortableServer/TAO_PortableServer.dsp4
-rw-r--r--TAO/tao/PortableServer/TAO_PortableServer_Static.dsp4
-rw-r--r--TAO/tao/RequestInfo_Util.cpp125
-rw-r--r--TAO/tao/RequestInfo_Util.h66
-rw-r--r--TAO/tao/TAO.dsp23
-rw-r--r--TAO/tao/TAO_Server_Request.cpp6
-rw-r--r--TAO/tao/TAO_Server_Request.h85
-rw-r--r--TAO/tao/TAO_Server_Request.i15
-rw-r--r--TAO/tao/TAO_Static.dsp8
39 files changed, 1961 insertions, 789 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index d666ea57dd9..9f70e119b66 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,235 @@
+Mon Dec 18 16:44:03 2000 Ossama Othman <ossama@uci.edu>
+
+ * TAO_IDL/be/be_visitor_argument/paramlist.cpp (visit_argument):
+ * TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
+ (gen_exceptlist):
+ * TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
+ (visit_array, visit_enum, visit_interface, visit_interface_fwd,
+ visit_predefined_type, visit_sequence, visit_string,
+ visit_structure, visit_union):
+
+ Updated generated code to be consistent with the return value
+ updates/fixes. A cached value is no longer returned since it
+ breaks conformance with the CORBA C++ mapping.
+
+ * TAO_IDL/be/be_codegen.cpp (start_client_stubs,
+ start_server_skeletons):
+
+ Include the "tao/RequestInfo_Util.h" header when
+ TAO_HAS_INTERCEPTORS is defined to 1. Needed to pull in the
+ utility factory methods related to the return value types
+ defined in the "Dynamic" module.
+
+ * TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+ (visit_operation):
+
+ In the case of a one-way request, invoke the send_other()
+ interception point, not the send_reply() interception point.
+
+ Added support for the PortableInterceptor::ForwardRequest
+ exception, meaning the send_other() interception point, too.
+
+ * TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
+ (visit_operation):
+
+ Added support for the PortableInterceptor::ForwardRequest
+ exception. This includes support for the receive_other()
+ interception point.
+
+ * TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
+ (visit_operation):
+ * TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
+ (visit_operation):
+
+ Pass a pointer to the TAO_GIOP_Invocation object for the
+ current invocation to the ClientRequestInfo object. This saves
+ us the trouble of passing the operation name and the service
+ context list since the invocation object already encapsulates
+ both of them either directly or indirectly. Doing so also makes
+ it possible to implement the ClientRequestInfo::sync_scope()
+ method.
+
+ * TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
+ (visit_operation):
+
+ Pass a pointer to the TAO_ServerRequest object for the current
+ invocation to the ServerRequestInfo object. This saves us the
+ trouble of passing the operation name and the service context
+ list since the invocation object already encapsulates both of
+ them either directly or indirectly. Doing so also makes it
+ possible to implement the ServerRequestInfo::sync_scope()
+ method, and various other ServerRequestInfo methods.
+
+ * TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
+ (visit_operation):
+
+ Corrected a long standing typographical error that prevented the
+ result from being inserted into an Any when invoking the
+ ServerRequestInfo::result() accessor method. This accounts for
+ the garbage result on the server seen in the
+ PortableInterceptors/Dynamic test. The raw be_operation node
+ was accepting the visitor instead of the narrowed be_type.
+
+ Updated generated code to be consistent with the return value
+ updates/fixes. A cached value is no longer returned since it
+ breaks conformance with the CORBA C++ mapping.
+
+ Generate the target_most_derived_interface() and the
+ target_is_a() ServerRequestInfo methods in the ServerRequestInfo
+ subclasses. In other words, these methods have now been
+ implemented.
+
+ * tao/RequestInfo_Util.h:
+ * tao/RequestInfo_Util.cpp:
+
+ New files that contain helper class that provides methods useful
+ for both PortableInterceptor::ClientRequestInfo and
+ PortableInterceptor::ServerRequestInfo objects, such as factory
+ methods for sequences and Anys.
+
+ * tao/ClientRequestInfo.h (TAO_ClientRequestInfo):
+
+ This constructor now accepts a pointer to a TAO_GIOP_Invocation
+ object. This allows us to remove the operation name and request
+ ID fields since both can be obtained from the Invocation
+ object.
+
+ * tao/ClientRequestInfo.cpp (request_id, operation):
+
+ Obtain these attributes from the Invocation object.
+
+ (arguments, exceptions, contexts, operation_context, result):
+
+ Throw a CORBA::BAD_INV_ORDER() exception. The subclasses in the
+ generated stub will override these methods appropriately.
+
+ (sync_scope):
+
+ Implemented this method. If the Invocation object is a
+ TAO_GIOP_Oneway_Invocation, then query its own sync_scope()
+ method and return that value as the result.
+
+ (forward_reference):
+
+ Implemented this method. This was made possible by an update to
+ the interceptor support in generated stubs, and to the
+ TAO_GIOP_Invocation class.
+
+ * tao/Invocation.h (start, invoke, invoke_i, prepare_header,
+ location_forward, init_inconsistent_policies,
+ add_rt_service_context):
+
+ Removed "TAO_default_environment()" default CORBA::Environment
+ argument. All of these methods are internal to TAO. Method
+ invocations internal to TAO should always explicitly use the
+ CORBA::Environment argument, and not rely on a default
+ CORBA::Environment argument.
+
+ * tao/Invocation.i (operation):
+
+ New method to return the name of the operation for the current
+ request.
+
+ (forward_reference):
+
+ New method that returns the object reference returned in a
+ LOCATION_FORWARD reply. The reference is only valid if the
+ invocation status is TAO_INVOKE_RESTART, except during a
+ transport retry. This method is used by the client side
+ Portable Interceptor implementation.
+
+ (location_forward_i):
+
+ Inlined method that contains code common to both
+ location_forward() methods. This method takes the TAO_Stub
+ object pointer argument, and adds the profiles in that object to
+ the list of forward profiles.
+
+ * tao/Invocation.cpp (location_forward):
+
+ Refactored code common to both location_forward() methods to the
+ new location_forward_i() inlined method.
+
+ * tao/PortableInterceptor.h:
+
+ Removed unused "ending_intercept_called_" class member from the
+ TAO_ClientRequestInterceptor_Adapter and the
+ TAO_ServerRequestInterceptor_Adapter classes.
+
+ * tao/PortableInterceptor.i
+ (TAO_ServerRequestInterceptor_Adapter):
+
+ The current flow stack size is now passed in as a reference
+ argument to make it possible to implement the
+ "receive_request_service_contexts" interception point.
+
+ (receive_request_service_contexts):
+
+ New adapter method that implements the
+ "receive_request_service_contexts" server side starting
+ interception point.
+
+ (send_other):
+
+ New adapter method for the
+ ServerRequestInterceptor::send_other() method. It is used in
+ one-way requests and LOCATION_FORWARD replies..
+
+ * tao/TAO_Server_Request.h:
+ * tao/TAO_Server_Request.i (forward_location):
+
+ New method to set the reference to which the request will be
+ forwarded. It is needed in order to implement the
+ PortableInterceptor::ForwardRequest exception.
+
+ * tao/TAO_Server_Request.cpp (TAO_ServerRequest):
+
+ Initialize the interceptor count to zero in the constructors.
+
+ * tao/GIOP_Message_Generator_Parser_10.cpp:
+
+ Fixed compile-time problem. Include "CORBA_String.h" to pull
+ CORBA::String_var class declaration.
+
+ * tao/Makefile:
+ * tao/Makefile.bor:
+ * tao/TAO.dsp:
+ * tao/TAO_Static.dsp:
+
+ Added the new RequestInfo_Util.* files to the source lists.
+
+ * tao/DomainC.h:
+ * tao/DomainC.cpp:
+ * tao/PortableServer/DomainS.cpp:
+ * tao/PortableServer/DomainS.h:
+
+ Updated (by hand) with the changes made to the stubs and
+ skeletons now generated by TAO_IDL.
+
+ * tao/PortableServer/Object_Adapter.cpp (dispatch):
+
+ Added support for the receive_request_service_contexts()
+ interception point, and the accompanying send_other() and
+ send_exception() interception points. This includes support for
+ the PortableInterceptor::ForwardRequest exception.
+
+ * tao/PortableServer/ServerRequestInfo.h:
+
+ This constructor now accepts a reference to a TAO_ServerRequest
+ object. This allows us to remove the operation name and service
+ context list fields since both can be obtained from the
+ TAO_ServerRequest object.
+
+ * tao/PortableServer/ServerRequestInfo.cpp:
+
+ Implemented most of the remaining unimplemented
+ ServerRequestInfo methods.
+
+ * tao/PortableServer/TAO_PortableServer.dsp:
+ * tao/PortableServer/TAO_PortableServer_Static.dsp:
+
+ Added ServerRequestInfo.inl to the list of inline sources.
+
Mon Dec 18 12:01:49 2000 Jeff Parsons <parsons@cs.wustl.edu.edu>
* tao/Exception.cpp:
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index ba650eb7d91..0aad54511ff 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -421,6 +421,33 @@ TAO_CodeGen::start_client_stubs (const char *fname)
<< be_global->be_get_client_hdr_fname (1)
<< "\"\n\n";
+ // Include the RequestInfo_Util utility header. Used by the
+ // PortableInterceptor::RequestInfo subclasses.
+ *this->client_stubs_ << "#if TAO_HAS_INTERCEPTORS == 1\n"
+ << "#include ";
+
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_stubs_ << "\"";
+ }
+ else
+ {
+ *this->client_stubs_ << "<";
+ }
+
+ *this->client_stubs_ << "tao/RequestInfo_Util.h";
+
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->client_stubs_ << "\"\n";
+ }
+ else
+ {
+ *this->client_stubs_ << ">\n";
+ }
+
+ *this->client_stubs_ << "#endif /* TAO_HAS_INTERCEPTORS == 1 */\n\n";
+
// Generate the code that includes the inline file if not included in the
// header file.
*this->client_stubs_ << "#if !defined (__ACE_INLINE__)\n";
@@ -632,8 +659,8 @@ TAO_CodeGen::start_server_header (const char *fname)
<< "#include \"tao/PortableServer/PortableServer.h\"\n"
<< "#include \"tao/PortableServer/Servant_Base.h\"\n"
<< "#include \"tao/PortableServer/Collocated_Object.h\"\n"
- << "#include \"tao/PortableServer/ThruPOA_Object_Proxy_Impl.h\"\n"
- << "#include \"tao/PortableServer/Direct_Object_Proxy_Impl.h\"\n"
+ << "#include \"tao/PortableServer/ThruPOA_Object_Proxy_Impl.h\"\n"
+ << "#include \"tao/PortableServer/Direct_Object_Proxy_Impl.h\"\n"
<< "#include \"tao/PortableServer/ServerRequestInfo.h\"\n"
<< "\n";
@@ -829,6 +856,34 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
<< "#include \"tao/PortableServer/Operation_Table.h\"\n"
<< "\n";
+ // Include the RequestInfo_Util utility header. Used by the
+ // PortableInterceptor::RequestInfo subclasses.
+ *this->server_skeletons_ << "#if TAO_HAS_INTERCEPTORS == 1\n"
+ << "#include ";
+
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_skeletons_ << "\"";
+ }
+ else
+ {
+ *this->server_skeletons_ << "<";
+ }
+
+ *this->server_skeletons_ << "tao/RequestInfo_Util.h";
+
+ if (be_global->changing_standard_include_files () == 1)
+ {
+ *this->server_skeletons_ << "\"\n";
+ }
+ else
+ {
+ *this->server_skeletons_ << ">\n";
+ }
+
+ *this->server_skeletons_ << "#endif /* TAO_HAS_INTERCEPTORS == 1 */\n\n";
+
+
// Generate the code that includes the inline file if not included in the
// header file.
*this->server_skeletons_ << "#if !defined (__ACE_INLINE__)\n";
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
index f6f4da1ae33..5f113e69985 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp
@@ -90,9 +90,10 @@ int be_visitor_args_paramlist::visit_argument (be_argument *node)
}
// Just to make the length var unique.
- *os << "CORBA::ULong length_" << node->local_name ()
- << " = this->parameter_list_.length ();" << be_nl
- << "this->parameter_list_.length (length_"
+ *os << be_nl
+ << "CORBA::ULong length_" << node->local_name ()
+ << " = parameter_list->length ();" << be_nl
+ << "parameter_list->length (length_"
<< node->local_name () << " + 1);" << be_nl;
// Amazed by the zillion os operators below? Its just to combat
@@ -112,13 +113,13 @@ int be_visitor_args_paramlist::visit_argument (be_argument *node)
*os << "(const ::" << bt->name () << "_slice *) ";
*os << "this->";
*os << node->local_name () << "_));" << be_nl;
- *os << "this->parameter_list_[length_"
+ *os << "(*parameter_list)[length_"
<< node->local_name () << "].argument <<= _tao_forany_" ;
*os << node->local_name () << ";" << be_nl;
}
else
{
- *os << "this->parameter_list_[length_"
+ *os << "(*parameter_list)[length_"
<< node->local_name () << "].argument ";
// Insertion into an Any has some special cases which need to be
// dealt with.
@@ -152,17 +153,17 @@ int be_visitor_args_paramlist::visit_argument (be_argument *node)
switch (node->direction ())
{
case AST_Argument::dir_IN:
- *os << "this->parameter_list_[length_"
+ *os << "(*parameter_list)[length_"
<< node->local_name ()
<< "].mode = Dynamic::PARAM_IN;" << be_nl;
break;
case AST_Argument::dir_OUT:
- *os << "this->parameter_list_[length_"
+ *os << "(*parameter_list)[length_"
<< node->local_name ()
<< "].mode = Dynamic::PARAM_OUT;" << be_nl;
break;
case AST_Argument::dir_INOUT:
- *os << "this->parameter_list_[length_"
+ *os << "(*parameter_list)[length_"
<< node->local_name ()
<< "].mode = Dynamic::PARAM_INOUT;" << be_nl;
break;
@@ -172,8 +173,6 @@ int be_visitor_args_paramlist::visit_argument (be_argument *node)
"visit_argument - "
"Bad context\n"),
-1);
-
-
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
index 70b3a8954bd..9ca52d959f3 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp
@@ -145,9 +145,8 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
}
*os << " (" << be_idt << be_idt_nl
- << "const char *_tao_operation," << be_nl
- << "IOP::ServiceContextList &_tao_service_context_list," << be_nl
- << "CORBA::Object *_tao_target";
+ << "TAO_GIOP_Invocation *_tao_invocation," << be_nl
+ << "CORBA::Object_ptr _tao_target";
// Generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing.
@@ -407,7 +406,7 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node)
-1);
}
- *os << " result_;" << be_uidt_nl;
+ *os << " _result;" << be_uidt_nl;
}
else
{
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
index 669284860f8..6decb1062ae 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp
@@ -134,9 +134,8 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
}
*os << " (" << be_idt << be_idt_nl
- << "const char *_tao_operation," << be_nl
- << "IOP::ServiceContextList &_tao_service_context_list," << be_nl
- << "CORBA::Object *_tao_target";
+ << "TAO_GIOP_Invocation *_tao_invocation," << be_nl
+ << "CORBA::Object_ptr _tao_target";
// Generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing.
@@ -162,8 +161,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
// Generate the member list and set each member but before that,
// its necessary to pass on some args to the base class.
os->indent ();
- *os << " : TAO_ClientRequestInfo (_tao_operation, "
- << "_tao_service_context_list, _tao_target)";
+ *os << " : TAO_ClientRequestInfo (_tao_invocation, _tao_target)";
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS);
@@ -184,6 +182,9 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
os->decr_indent ();
*os << be_nl << "{}\n\n";
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ClientRequestInfo::arguments()
+ // -----------------------------------------------------------------
*os << "Dynamic::ParameterList *" << be_nl;
if (node->is_nested ())
@@ -227,10 +228,15 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
}
}
- *os << "::arguments (CORBA::Environment &)" << be_idt_nl
+ *os << "::arguments (CORBA::Environment &ACE_TRY_ENV)" << be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))"<< be_uidt_nl
<< "{" << be_idt_nl
- << "// Generate the arg list on demand" << be_nl;
+ << "// Generate the argument list on demand." << be_nl
+ << "Dynamic::ParameterList *parameter_list =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl;
if (node->argument_count () == 0 ||
// Now make sure that we have some in and inout
@@ -239,11 +245,13 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
(!(this->has_param_type (node, AST_Argument::dir_IN)) &&
!(this->has_param_type (node, AST_Argument::dir_INOUT))))
{
- *os << "return 0;" << be_uidt_nl
- << "}\n\n";
+ *os << "return parameter_list;" << be_uidt_nl;
}
else
{
+ *os << "Dynamic::ParameterList_var safe_parameter_list = "
+ << "parameter_list;" << be_nl;
+
// The insertion operator is different for different nodes.
// We change our scope to go to the argument scope to
// be able to decide this.
@@ -264,11 +272,16 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
delete visitor;
*os << be_nl
- << "return &this->parameter_list_;" << be_uidt_nl
- << "}\n\n";
+ << "return safe_parameter_list._retn ();" << be_uidt_nl;
}
+ *os << "}\n\n";
+
os->decr_indent ();
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ClientRequestInfo::exceptions()
+ // -----------------------------------------------------------------
*os << "Dynamic::ExceptionList *" << be_nl;
if (node->is_nested ())
@@ -311,18 +324,25 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
}
}
- *os << "::exceptions (CORBA::Environment &)"<< be_idt_nl
+ *os << "::exceptions (CORBA::Environment &ACE_TRY_ENV)"<< be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
- << "// Generate the exception list on demand " << be_nl;
+ << "// Generate the exception list on demand." << be_nl
+ << "Dynamic::ExceptionList *exception_list =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl;
if (!node->exceptions ())
{
- *os << "return 0;" << be_uidt_nl
- << "}\n\n" << be_nl;
+ *os << "return exception_list;" << be_uidt_nl;
}
else
{
+ *os << "Dynamic::ExceptionList_var safe_exception_list = "
+ << "exception_list;" << be_nl;
+
// We change our scope to be able to generate the exceptionlist.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST);
@@ -341,11 +361,16 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
delete visitor;
*os << be_nl
- << "return &this->exception_list_;" << be_uidt_nl
- << "}\n\n";
+ << "return safe_exception_list._retn ();" << be_uidt_nl;
}
+ *os << "}\n\n" << be_nl;
+
os->decr_indent ();
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ClientRequestInfo::result()
+ // -----------------------------------------------------------------
*os << "CORBA::Any * " << be_nl;
if (node->is_nested ())
@@ -388,7 +413,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
}
}
- *os << "::result (CORBA::Environment &)" << be_idt_nl
+ *os << "::result (CORBA::Environment &ACE_TRY_ENV)" << be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
<< "// Generate the result on demand." << be_nl;
@@ -397,36 +422,53 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
if (this->void_return_type (bt))
{
- *os << "CORBA::TypeCode tc (CORBA::tk_void);" << be_nl
- << "this->result_val_.type (&tc);" << be_nl;
+ // Return an Any with tk_void TypeCode.
+ *os << "CORBA::Boolean tk_void_any = 1;" << be_nl
+ << "CORBA::Any *result_any =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_any (tk_void_any, ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl
+ << "return result_any;" << be_uidt_nl;
}
else
{
+ *os << "CORBA::Boolean tk_void_any = 0;" << be_nl
+ << "CORBA::Any *result_any =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_any (0, ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl
+ << "CORBA::Any_var safe_result_any = "
+ << "result_any;" << be_nl << be_nl;
+
// Generate the insertion of result into Any.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT);
- visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "visit_operation - "
- "codegen for result failed\n"),
- -1);
- }
-
- delete visitor;
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT);
+ visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor || (bt->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for result failed\n"),
+ -1);
+ }
+
+ delete visitor;
+
+ *os << "return safe_result_any._retn ();" << be_uidt_nl;
}
- *os << be_nl
- << "return &this->result_val_;" << be_uidt_nl
- << "}\n\n";
+ *os << "}\n\n";
os->decr_indent ();
+ // -----------------------------------------------------------------
// Update the result.
+ // -----------------------------------------------------------------
bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
@@ -507,7 +549,7 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node)
*os << " result)" << be_uidt << be_uidt << be_uidt_nl
<< "{" << be_idt_nl
<< "// update the result " << be_nl
- << "this->result_ = result;" << be_uidt_nl
+ << "this->_result = result;" << be_uidt_nl
<< "}\n\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
index f018f2f075a..3a0771664c0 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
@@ -73,8 +73,9 @@ be_visitor_operation_interceptors_exceptlist::gen_exceptlist (be_operation *node
this->ctx_->node (node); // save the node for future use
// Generate the exception data array.
- *os << "static TAO_Exception_Data " << "_tao_" << node->flat_name ()
- << "_exceptiondata [] = " << be_nl;
+ *os << be_nl
+ << "static TAO_Exception_Data " << "_tao_" << node->flat_name ()
+ << "_exceptiondata[] = " << be_nl;
*os << "{" << be_idt_nl;
// initialize an iterator to iterate thru the exception list
UTL_ExceptlistActiveIterator *ei;
@@ -112,19 +113,20 @@ be_visitor_operation_interceptors_exceptlist::gen_exceptlist (be_operation *node
} // end of while loop
delete ei;
- *os << be_uidt_nl << "};\n\n";
+ *os << be_uidt_nl << "};" << be_nl;
long excp_count = (node->exceptions())->length ();
- *os <<" CORBA::ULong length = 0;"<<be_nl
- << "for (CORBA::ULong i = 0;i < "<< excp_count <<"; ++i)" << be_nl
- << " {" << be_idt_nl
- << " CORBA::TypeCode_ptr tcp = _tao_" << node->flat_name ()
- << "_exceptiondata [i].tc;" << be_nl
- << "length = this->exception_list_.length ();" << be_nl
- << "this->exception_list_.length (length + 1);"<<be_nl
- << "TAO_Pseudo_Object_Manager<CORBA::TypeCode,CORBA::TypeCode_var> tcp_object (&tcp, 1);"<<be_nl
- << "this->exception_list_[length] = tcp_object;" << be_uidt_nl
- << " }\n";
+ *os << be_nl << "CORBA::ULong len = 0;" << be_nl
+ << "for (CORBA::ULong i = 0; i < " << excp_count << "; ++i)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "CORBA::TypeCode_ptr tcp = _tao_" << node->flat_name ()
+ << "_exceptiondata[i].tc;" << be_nl
+ << "len = exception_list->length ();" << be_nl
+ << "exception_list->length (len + 1);"<<be_nl
+ << "TAO_Pseudo_Object_Manager<CORBA::TypeCode,CORBA::TypeCode_var> tcp_object (&tcp, 1);" << be_nl
+ << "(*exception_list)[len] = tcp_object;" << be_uidt_nl
+ << "}\n" << be_uidt;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
index 67e50995b6e..16a5deba94e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp
@@ -57,8 +57,8 @@ be_visitor_operation_interceptors_result::visit_array (be_array *node)
}
*os << bt->name () << "_forany _tao_forany_result"
- << " (this->result_);" << be_nl
- << "this->result_val_ <<= _tao_forany_result;"<< be_nl;
+ << " (this->_result);" << be_nl
+ << "(*result_any) <<= _tao_forany_result;"<< be_nl;
return 0;
}
@@ -68,7 +68,7 @@ be_visitor_operation_interceptors_result::visit_enum (be_enum *)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -78,7 +78,7 @@ be_visitor_operation_interceptors_result::visit_interface (be_interface *)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -88,7 +88,7 @@ be_visitor_operation_interceptors_result::visit_interface_fwd (be_interface_fwd
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -101,7 +101,7 @@ be_visitor_operation_interceptors_result::visit_valuetype (be_valuetype *)
// TAO_OutStream *os = this->ctx_->stream (); // get output stream
- // *os << "this->result_val_ <<= this->result_;";
+ // *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -113,7 +113,7 @@ be_visitor_operation_interceptors_result::visit_valuetype_fwd (be_valuetype_fwd
// TAO_OutStream *os = this->ctx_->stream (); // get output stream
- // *os << "this->result_val_ <<= this->result_;";
+ // *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -125,21 +125,21 @@ be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_t
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= ";
+ *os << "(*result_any) <<= ";
switch (node->pt ())
{
case AST_PredefinedType::PT_boolean:
- *os << "CORBA::Any::from_boolean (this->result_);" << be_nl;
+ *os << "CORBA::Any::from_boolean (this->_result);" << be_nl;
break;
case AST_PredefinedType::PT_char:
- *os << "CORBA::Any::from_char (this->result_);"<<be_nl;
+ *os << "CORBA::Any::from_char (this->_result);"<<be_nl;
break;
case AST_PredefinedType::PT_wchar:
- *os << "CORBA::Any::from_wchar (this->result_);"<<be_nl;
+ *os << "CORBA::Any::from_wchar (this->_result);"<<be_nl;
break;
case AST_PredefinedType::PT_octet:
- *os << "CORBA::Any::from_octet (this->result_);"<<be_nl;
+ *os << "CORBA::Any::from_octet (this->_result);"<<be_nl;
break;
case AST_PredefinedType::PT_pseudo:
case AST_PredefinedType::PT_any:
@@ -152,7 +152,7 @@ be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_t
case AST_PredefinedType::PT_float:
case AST_PredefinedType::PT_double:
case AST_PredefinedType::PT_longdouble:
- *os << "this->result_;"<<be_nl;
+ *os << "this->_result;"<<be_nl;
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -171,7 +171,7 @@ be_visitor_operation_interceptors_result::visit_sequence (be_sequence *)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
}
@@ -181,7 +181,7 @@ be_visitor_operation_interceptors_result::visit_string (be_string *node)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= ";
+ *os << "(*result_any) <<= ";
// we need to make a distinction between bounded and unbounded strings
if (node->max_size ()->ev ()->u.ulval != 0)
@@ -196,13 +196,13 @@ be_visitor_operation_interceptors_result::visit_string (be_string *node)
*os << "CORBA::Any::from_wstring ((CORBA::WChar *)";
}
- *os <<"this->result_, "
+ *os <<"this->_result, "
<< node->max_size ()->ev ()->u.ulval
<< ");";
}
else
{
- *os << "this->result_; ";
+ *os << "this->_result; ";
}
return 0;
@@ -213,7 +213,7 @@ be_visitor_operation_interceptors_result::visit_structure (be_structure *)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
@@ -224,7 +224,7 @@ be_visitor_operation_interceptors_result::visit_union (be_union *)
{
TAO_OutStream *os = this->ctx_->stream (); // get output stream
- *os << "this->result_val_ <<= this->result_;";
+ *os << "(*result_any) <<= this->_result;";
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
index eadb04df41b..dd3148514b2 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp
@@ -131,8 +131,24 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
*os << " (" << be_idt_nl
- << "const char * _tao_operation," << be_nl
- << "IOP::ServiceContextList &_tao_service_context_list";
+ << "TAO_ServerRequest &_tao_server_request," << be_nl;
+
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interceptors_sh::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Get the right object implementation.
+ *os << intf->full_skel_name () << " *tao_impl" << be_nl;
// Generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing.
@@ -188,7 +204,21 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
<< "TAO_default_environment ()" << be_uidt << be_uidt_nl
<< ")" << be_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException));"
- << be_uidt_nl;
+ << be_uidt_nl << be_nl;
+
+ *os << "virtual char * target_most_derived_interface ("
+ << be_idt << be_idt_nl
+ << "CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())"
+ << be_uidt_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException));"
+ << be_uidt_nl << be_nl;
+
+ *os << "virtual CORBA::Boolean target_is_a (" << be_idt << be_idt_nl
+ << "const char * id," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())"
+ << be_uidt_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException));"
+ << be_uidt_nl << be_nl;
*os << be_uidt_nl << "private:" << be_idt_nl;
@@ -294,6 +324,11 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
*os << " &);" << be_nl;
+ *os << be_uidt_nl << "private:" << be_idt_nl;
+
+ // Get the right object implementation.
+ *os << intf->full_skel_name () << " *_tao_impl;" << be_nl;
+
// Need to generate the args as reference memebers...
// generate the member list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing and
@@ -393,7 +428,7 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node)
}
os->indent ();
- *os << " result_;" << be_uidt << be_uidt << be_uidt_nl;
+ *os << " _result;" << be_uidt << be_uidt << be_uidt_nl;
}
os->decr_indent ();
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
index 97d2373933c..2f72b09b76d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp
@@ -59,6 +59,10 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
// Start with the current indentation level.
os->indent ();
+ // -----------------------------------------------------------------
+ // Constructor
+ // -----------------------------------------------------------------
+
// Generate the ServerRequestInfo object definition per operation
// to be used by the interceptors.
if (node->is_nested ())
@@ -135,8 +139,24 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
}
*os << " (" << be_idt << be_idt_nl
- << "const char *_tao_operation," << be_nl
- << "IOP::ServiceContextList &_tao_service_context_list";
+ << "TAO_ServerRequest &_tao_server_request," << be_nl;
+
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interceptors_ss::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Get the right object implementation.
+ *os << intf->full_skel_name () << " *tao_impl" << be_nl;
// Generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing.
@@ -161,8 +181,8 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
// Generate the member list and set each member but before that,
// its necessary to pass on some args to the base class.
- *os << ": TAO_ServerRequestInfo (_tao_operation, "
- << "_tao_service_context_list)";
+ *os << ": TAO_ServerRequestInfo (_tao_server_request)," << be_nl
+ << " _tao_impl (tao_impl)";
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS);
@@ -183,6 +203,9 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
os->decr_indent ();
*os << be_nl << "{}\n\n";
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ServerRequestInfo::arguments()
+ // -----------------------------------------------------------------
*os << "Dynamic::ParameterList *" << be_nl;
if (node->is_nested ())
@@ -225,10 +248,15 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
}
}
- *os << "::arguments (CORBA::Environment &)" << be_idt_nl
+ *os << "::arguments (CORBA::Environment &ACE_TRY_ENV)" << be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
- << "// Generate the arg list on demand" << be_nl;
+ << "// Generate the argument list on demand." << be_nl
+ << "Dynamic::ParameterList *parameter_list =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl;
if (node->argument_count () == 0 ||
// Now make sure that we have some in and inout
@@ -237,10 +265,13 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
(!(this->has_param_type (node, AST_Argument::dir_IN)) &&
!(this->has_param_type (node, AST_Argument::dir_INOUT))))
{
- *os << "return 0;\n}\n\n" << be_nl;
+ *os << "return parameter_list;" << be_uidt_nl;
}
else
{
+ *os << "Dynamic::ParameterList_var safe_parameter_list = "
+ << "parameter_list;" << be_nl;
+
// The insertion operator is different for different nodes.
// We change our scope to go to the argument scope to
// be able to decide this.
@@ -260,11 +291,17 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
delete visitor;
- *os << be_nl << "return &this->parameter_list_;" << be_uidt_nl
- << "}\n\n";
+ *os << be_nl
+ << "return safe_parameter_list._retn ();" << be_uidt_nl;
}
+ *os << "}\n\n";
+
os->decr_indent ();
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ServerRequestInfo::exceptions()
+ // -----------------------------------------------------------------
*os << "Dynamic::ExceptionList *" << be_nl;
if (node->is_nested ())
@@ -307,18 +344,25 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
}
}
- *os << "::exceptions (CORBA::Environment &)" << be_idt_nl
+ *os << "::exceptions (CORBA::Environment &ACE_TRY_ENV)" << be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
- << "// Generate the exception list on demand" << be_nl;
+ << "// Generate the exception list on demand." << be_nl
+ << "Dynamic::ExceptionList *exception_list =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl;
if (!node->exceptions ())
{
- *os << "return 0;" << be_uidt_nl
- << "}\n\n";
+ *os << "return exception_list;" << be_uidt_nl;
}
else
{
+ *os << "Dynamic::ExceptionList_var safe_exception_list = "
+ << "exception_list;" << be_nl;
+
// We change our scope to be able to generate the exceptionlist.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST);
@@ -337,11 +381,16 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
delete visitor;
*os << be_nl
- << "return &this->exception_list_;" << be_uidt_nl
- << "}\n\n";
+ << "return safe_exception_list._retn ();" << be_uidt_nl;
}
+ *os << "}\n\n";
+
os->decr_indent ();
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ServerRequestInfo::result()
+ // -----------------------------------------------------------------
*os << "CORBA::Any * " << be_nl;
if (node->is_nested ())
@@ -349,10 +398,10 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
be_decl *parent =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
- *os << "POA_" <<parent->full_name () << "::";
+ *os << "POA_" << parent->full_name () << "::";
}
- *os << "TAO_ServerRequestInfo_"<<node->flat_name ();
+ *os << "TAO_ServerRequestInfo_"<< node->flat_name ();
// We need the interface node in which this operation was defined. However,
// if this operation node was an attribute node in disguise, we get this
@@ -384,26 +433,41 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
}
}
- *os << "::result (CORBA::Environment &)"<< be_idt_nl
+ *os << "::result (CORBA::Environment &ACE_TRY_ENV)"<< be_idt_nl
<< "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
<< "{" << be_idt_nl
- << "// Generate the result on demand" << be_nl;
+ << "// Generate the result on demand." << be_nl;
bt = be_type::narrow_from_decl (node->return_type ());
if (this->void_return_type (bt))
{
- *os << "CORBA::TypeCode tc (CORBA::tk_void);" << be_nl
- << "this->result_val_.type (&tc);" << be_nl;
+ // Return an Any with tk_void TypeCode.
+ *os << "CORBA::Boolean tk_void_any = 1;" << be_nl
+ << "CORBA::Any *result_any =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_any (tk_void_any, ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl
+ << "return result_any;" << be_uidt_nl;
}
else
{
+ *os << "CORBA::Boolean tk_void_any = 0;" << be_nl
+ << "CORBA::Any *result_any =" << be_idt_nl
+ << "TAO_RequestInfo_Util::make_any (0, ACE_TRY_ENV);"
+ << be_uidt_nl
+ << "ACE_CHECK_RETURN (0);" << be_nl
+ << be_nl
+ << "CORBA::Any_var safe_result_any = "
+ << "result_any;" << be_nl << be_nl;
+
// Generate the insertion of result into Any.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_RESULT);
visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (!visitor || (bt->accept (visitor) == -1))
{
delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
@@ -414,11 +478,121 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
}
delete visitor;
+
+ *os << be_nl
+ << "return safe_result_any._retn ();" << be_uidt_nl;
+ }
+
+ *os << "}\n\n";
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ServerRequestInfo::target_most_derived_interface()
+ // -----------------------------------------------------------------
+ *os << "char *" << be_nl;
+
+ if (node->is_nested ())
+ {
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << "POA_" << parent->full_name () << "::";
}
- *os << be_nl
- << "return &this->result_val_;" << be_uidt_nl
- << "}\n\n";
+ *os << "TAO_ServerRequestInfo_"<< node->flat_name ();
+
+ // We need the interface node in which this operation was defined. However,
+ // if this operation node was an attribute node in disguise, we get this
+ // information from the context and add a "_get"/"_set" to the flat
+ // name to get around the problem of overloaded methods which are
+ // generated for attributes.
+ if (this->ctx_->attribute ())
+ {
+ bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interceptors_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type if its not
+ // void it means it is not the accessor.
+ if (!this->void_return_type (bt))
+ {
+ *os << "_get";
+ }
+ else
+ {
+ *os << "_set";
+ }
+ }
+
+ *os << "::target_most_derived_interface ("
+ << be_idt << be_idt_nl
+ << "CORBA::Environment &)" << be_uidt_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return" << be_idt_nl
+ << "CORBA::string_dup (this->_tao_impl->_interface_repository_id ());"
+ << be_uidt << be_uidt_nl << "}" << be_nl << be_nl;
+
+ // -----------------------------------------------------------------
+ // PortableInterceptor::ServerRequestInfo::target_is_a()
+ // -----------------------------------------------------------------
+ *os << "CORBA::Boolean" << be_nl;
+
+ if (node->is_nested ())
+ {
+ be_decl *parent =
+ be_scope::narrow_from_scope (node->defined_in ())->decl ();
+
+ *os << "POA_" << parent->full_name () << "::";
+ }
+
+ *os << "TAO_ServerRequestInfo_"<< node->flat_name ();
+
+ // We need the interface node in which this operation was defined. However,
+ // if this operation node was an attribute node in disguise, we get this
+ // information from the context and add a "_get"/"_set" to the flat
+ // name to get around the problem of overloaded methods which are
+ // generated for attributes.
+ if (this->ctx_->attribute ())
+ {
+ bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interceptors_ch::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type if its not
+ // void it means it is not the accessor.
+ if (!this->void_return_type (bt))
+ {
+ *os << "_get";
+ }
+ else
+ {
+ *os << "_set";
+ }
+ }
+
+ *os << "::target_is_a (" << be_idt << be_idt_nl
+ << "const char * id," << be_nl
+ << "CORBA::Environment &ACE_TRY_ENV)" << be_uidt_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "return this->_tao_impl->_is_a (id, ACE_TRY_ENV);"
+ << be_uidt_nl << "}" << be_nl << be_nl;
+
+ // -----------------------------------------------------------------
os->decr_indent ();
// Update the result.
@@ -500,8 +674,8 @@ be_visitor_operation_interceptors_ss::visit_operation (be_operation *node)
os->indent ();
*os << " result)" << be_uidt << be_uidt << be_uidt_nl
<< "{" << be_idt_nl
- << "// update the result " << be_nl
- << " this->result_ = result;" << be_uidt_nl
+ << "// Update the result." << be_nl
+ << " this->_result = result;" << be_uidt_nl
<< "}\n\n";
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
index c926f94915b..5931167a4b4 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -218,12 +218,13 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- // Fish out the interceptor and do preinvoke.
- *os << "#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl
+ // Fish out the interceptors.
+ *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl
<< "TAO_ServerRequestInterceptor_Adapter _tao_vfr ("
<< be_idt << be_idt_nl
- << "_tao_server_request.orb_core ()->server_request_interceptors ()"
- << be_uidt_nl
+ << "_tao_server_request.orb_core ()->server_request_interceptors (),"
+ << be_nl
+ << "_tao_server_request.interceptor_count ()" << be_uidt_nl
<< ");" << be_uidt_nl << be_nl;
// Obtain the scope.
@@ -267,8 +268,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
*os << " ri (" << be_idt << be_idt_nl
- << this->compute_operation_name (node) << "," << be_nl
- << "_tao_server_request.service_info ()";
+ << "_tao_server_request," << be_nl
+ << "_tao_impl" << be_nl;
// Generate the formal argument fields which are passed to the
// RequestInfo object.
@@ -292,19 +293,11 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "ACE_TRY" << be_idt_nl
<< "{" << be_idt_nl;
- // Update the request id field of the Request Info.
- *os << "ri.request_id (_tao_server_request.request_id ());" << be_nl
- << "_tao_vfr.receive_request (&ri, ACE_TRY_ENV);" << be_nl
- << "TAO_INTERCEPTOR_CHECK;\n";
-
- if (node->flags () == AST_Operation::OP_oneway
- && !this->has_param_type (node, AST_Argument::dir_IN))
- {
- *os << "#else" << be_nl
- << "ACE_UNUSED_ARG (_tao_server_request);\n";
- }
+ // Invoke the receive_request() interception point.
+ *os << "_tao_vfr.receive_request (&ri, ACE_TRY_ENV);" << be_nl
+ << "ACE_TRY_CHECK;" << be_nl;
- *os << "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
+ *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
// Make the upcall and assign to the return val.
ctx = *this->ctx_;
@@ -322,7 +315,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
// Make the upcall.
- *os << "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt_nl;
+ *os << "\n" << be_nl
+ << "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt_nl;
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
visitor = tao_cg->make_visitor (&ctx);
@@ -338,7 +332,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
// End the upcall.
- *os << be_uidt_nl << ");" << be_uidt_nl;
+ *os << be_uidt_nl << ");" << be_uidt_nl
+ << "TAO_INTERCEPTOR_CHECK;" << be_nl << be_nl;
// Update the result.
bt = be_type::narrow_from_decl (node->return_type ());
@@ -352,22 +347,22 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
+ // Invoke the send_reply() or send_other() interception point, and
+ // check for exception.
+ *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
+
// Grab the right visitor to generate the return type accessor if
// it's not void since we can't have a private member to be of void
// type.
if (!this->void_return_type (bt))
{
- *os <<"\n#if (TAO_HAS_INTERCEPTORS == 1)\n";
-
- // Heres what we are going to do to have a uniform way of getting the
- // return value updated for the Request Info:
+ // Here's what we are going to do to have a uniform way of
+ // getting the return value updated for the Request Info:
// declare a operation_retval type object and assign the
- // _tao_safe_retval._retn () to it.
- // We pass this to the result updation method (note: it hasnt
- // got destroyed)
- // We then put it back into the original _tao_safe_retval
- // object.
- // And finally the _retn () is returned from the operation w.o
+ // _tao_safe_retval._retn() to it. We pass this to the result
+ // updation method (note: it hasn't been destroyed). We then
+ // put it back into the original _tao_safe_retval object. And
+ // finally the _retn() is returned from the operation without
// causing any problems.
// Generate the return type mapping (same as in the header file)
ctx = *this->ctx_;
@@ -393,33 +388,53 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
{
*os << " _tao_retval_info = _tao_retval._retn ();" << be_nl
<< "ri.result (_tao_retval_info);" << be_nl
- << "_tao_retval = _tao_retval_info;\n"
- << "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
+ << "_tao_retval = _tao_retval_info;" << be_nl;
}
else
{
*os << " _tao_retval_info = _tao_retval;" << be_nl
- << "ri.result (_tao_retval_info);\n"
- << "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
+ << "ri.result (_tao_retval_info);" << be_nl;
}
}
-// os->indent ();
- *os << "TAO_INTERCEPTOR_CHECK;\n\n";
+ *os << "ri.reply_status (PortableInterceptor::SUCCESSFUL);"
+ << be_nl;
- // Do postinvoke, and check for exception.
- *os << "#if (TAO_HAS_INTERCEPTORS == 1)\n";
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ *os << "_tao_vfr.send_other (&ri, ACE_TRY_ENV);"<< be_nl
+ << "ACE_TRY_CHECK;" << be_uidt_nl;
+ }
+ else
+ {
+ *os << "_tao_vfr.send_reply (&ri, ACE_TRY_ENV);"<< be_nl
+ << "ACE_TRY_CHECK;" << be_uidt_nl;
+ }
- os->indent ();
+ *os << "}" << be_uidt_nl
+ << "ACE_CATCH (PortableInterceptor::ForwardRequest, exc)"
+ << be_idt_nl << "{" << be_idt_nl
+ << "ri.forward_reference (exc); " << be_nl
+ << "_tao_vfr.send_other (" << be_idt_nl
+ << "&ri," << be_nl
+ << "ACE_TRY_ENV" << be_uidt_nl
+ << ");" << be_nl
+ << "ACE_TRY_CHECK;" << be_nl
+ // Unlike the ClientRequestInfo counterpart, we set the forward
+ // location in the TAO_ServerRequest object after we're sure no
+ // other interceptors thrown an exception in the send_other()
+ // interception point. This is okay since the ServerRequestInfo
+ // makes a copy of the forward reference (ClientRequestInfo
+ // doesn't). Used as a simple optimization.
+ << "_tao_server_request.forward_location (exc.forward.in ());"
+ << be_uidt_nl
+ << "}" << be_uidt_nl;
- *os << "_tao_vfr.send_reply (&ri, ACE_TRY_ENV);"<< be_nl
- << "TAO_INTERCEPTOR_CHECK;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "ACE_CATCHANY" << be_idt_nl
+ *os << "ACE_CATCHANY" << be_idt_nl
<< "{" << be_idt_nl;
- // Update the exception field of teh request info.
- *os << "ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl;
- *os << "_tao_vfr.send_exception (" << be_idt << be_idt_nl
+ // Update the ServerRequestInfo exception attribute.
+ *os << "ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl
+ << "_tao_vfr.send_exception (" << be_idt << be_idt_nl
<< "&ri," << be_nl
<< "ACE_TRY_ENV" << be_uidt_nl
<< ");" << be_uidt_nl
@@ -437,24 +452,22 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "}" << be_uidt_nl
<< "ACE_ENDTRY;" << be_nl;
*os << "ACE_CHECK;\n"
- << "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
+ << "#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl;
// Check if we are oneway in which case, we are done.
if (node->flags () == AST_Operation::OP_oneway)
{
// We are done. Nothing else to do, except closing the function body.
- os->indent ();
- *os << "if (_tao_server_request.response_expected ()" << be_idt << be_idt_nl
+ *os << "if (_tao_server_request.response_expected ()" << be_idt
+ << be_idt_nl
<< "&& !_tao_server_request.sync_with_server ())" << be_uidt_nl
<< "{" << be_idt_nl
<< "_tao_server_request.init_reply ();" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}\n\n";
- return 0;
+ << "}" << be_uidt << be_uidt_nl;
}
// Marshal outgoing parameters.
- if (this->gen_marshal_params (node, bt) == -1)
+ else if (this->gen_marshal_params (node, bt) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
@@ -463,7 +476,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- os->decr_indent ();
*os << "}\n\n";
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
index 46f98f7a302..d0018990837 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp
@@ -418,8 +418,7 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
}
*os << " ri (" << be_idt_nl
- << this->compute_operation_name (node) << "," << be_nl
- << "_tao_call.service_info ()," << be_nl
+ << "&_tao_call," << be_nl
<< "_collocated_tao_target_";
// Generate the formal argument fields which are passed
@@ -484,10 +483,6 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
// Invoke send_request() interception point.
*os << be_nl << "TAO_INTERCEPTOR (" << be_idt_nl
- // Get the request_id field for the Request Info. In TAO, request
- // id's change with differnet profiles so this seems to be the
- // appropriate place to populate the Request Info with it.
- << "ri.request_id (_tao_call.request_id ()); " << be_nl
<< "_tao_vfr.send_request (" << be_idt_nl
<< "&ri," << be_nl
<< "ACE_TRY_ENV" << be_uidt_nl
@@ -781,13 +776,24 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
// satisfy the General Flow Rules.
if (node->flags () != AST_Operation::OP_oneway)
{
- // Invoke receive_reply() interception point.
+ // Invoke receive_reply() or receive_other() interception
+ // point.
*os << be_nl << "TAO_INTERCEPTOR (" << be_idt_nl
<< "ri.reply_status (_invoke_status);" << be_nl
+ << "if (_invoke_status == TAO_INVOKE_OK)" << be_idt_nl
+ << "{" << be_idt_nl
<< "_tao_vfr.receive_reply (" << be_idt_nl
<< "&ri," << be_nl
<< "ACE_TRY_ENV" << be_uidt_nl
- << ")" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_tao_vfr.receive_other (" << be_idt_nl
+ << "&ri," << be_nl
+ << "ACE_TRY_ENV" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "}" << be_uidt_nl << be_uidt_nl
<< ");" << be_nl;
}
else if (node->flags () == AST_Operation::OP_oneway)
@@ -815,7 +821,6 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
*os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_uidt_nl
<< "}" << be_uidt_nl;
- /*
*os << "ACE_CATCH (PortableInterceptor::ForwardRequest, exc)" << be_idt_nl
<< "{" << be_idt_nl
<< "_invoke_status =" << be_idt_nl
@@ -830,7 +835,6 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke (
<< ");" << be_nl
<< "ACE_TRY_CHECK;" << be_uidt_nl
<< "}" << be_uidt_nl;
- */
*os << "ACE_CATCHANY" << be_idt_nl
<< "{" << be_idt_nl;
diff --git a/TAO/tao/ClientRequestInfo.cpp b/TAO/tao/ClientRequestInfo.cpp
index f6ef408dafb..2d9938e2a3a 100644
--- a/TAO/tao/ClientRequestInfo.cpp
+++ b/TAO/tao/ClientRequestInfo.cpp
@@ -3,6 +3,7 @@
// $Id$
#include "ClientRequestInfo.h"
+#include "Invocation.h"
#include "Stub.h"
#include "Tagged_Components.h"
@@ -14,13 +15,9 @@ ACE_RCSID (tao, ClientRequestInfo, "$Id$")
# include "ClientRequestInfo.inl"
# endif /* !__ACE_INLINE__ */
-
-TAO_ClientRequestInfo::TAO_ClientRequestInfo (const char * operation,
- IOP::ServiceContextList
- &service_context_list,
+TAO_ClientRequestInfo::TAO_ClientRequestInfo (TAO_GIOP_Invocation *inv,
CORBA::Object_ptr target)
- : operation_ (operation),
- service_context_list_ (service_context_list),
+ : invocation_ (inv),
target_ (CORBA::Object::_duplicate (target)),
caught_exception_ (0),
response_expected_ (1),
@@ -32,14 +29,14 @@ CORBA::Object_ptr
TAO_ClientRequestInfo::target (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
-// if (this->reply_status_ ==
-// PortableInterceptor::LOCATION_FORWARD_PERMANENT)
-// {
-// // TAO_GIOP_Invocation::forward_reference() already duplicates
-// // the reference before returning it so there is no need to
-// // duplicate it here.
-// return this->invocation_->forward_reference ();
-// }
+ if (this->reply_status_ ==
+ PortableInterceptor::LOCATION_FORWARD_PERMANENT)
+ {
+ // TAO_GIOP_Invocation::forward_reference() already duplicates
+ // the reference before returning it so there is no need to
+ // duplicate it here.
+ return this->invocation_->forward_reference ();
+ }
return CORBA::Object::_duplicate (this->target_.in ());
}
@@ -48,15 +45,15 @@ CORBA::Object_ptr
TAO_ClientRequestInfo::effective_target (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
-// if (this->reply_status_ == PortableInterceptor::LOCATION_FORWARD
-// || this->reply_status_ ==
-// PortableInterceptor::LOCATION_FORWARD_PERMANENT)
-// {
-// // TAO_GIOP_Invocation::forward_reference() already duplicates
-// // the reference before returning it so there is no need to
-// // duplicate it here.
-// return this->invocation_->forward_reference ();
-// }
+ if (this->reply_status_ == PortableInterceptor::LOCATION_FORWARD
+ || this->reply_status_ ==
+ PortableInterceptor::LOCATION_FORWARD_PERMANENT)
+ {
+ // TAO_GIOP_Invocation::forward_reference() already duplicates
+ // the reference before returning it so there is no need to
+ // duplicate it here.
+ return this->invocation_->forward_reference ();
+ }
return CORBA::Object::_duplicate (this->target_.in ());
}
@@ -93,6 +90,13 @@ CORBA::Any *
TAO_ClientRequestInfo::received_exception (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION
+ && this->reply_status_ != PortableInterceptor::USER_EXCEPTION)
+ {
+ // @@ Need the minor code once it is available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+ }
+
// The spec says that if it is a user exception which can't be
// inserted then the UNKNOWN exception needs to be thrown with minor
// code TBD_U.
@@ -126,9 +130,18 @@ TAO_ClientRequestInfo::_received_exception (CORBA::Environment &)
}
char *
-TAO_ClientRequestInfo::received_exception_id (CORBA::Environment &)
+TAO_ClientRequestInfo::received_exception_id (
+ CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION
+ && this->reply_status_ != PortableInterceptor::USER_EXCEPTION)
+ {
+ // Need the minor code from the PI spec once it becomes
+ // available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+ }
+
return CORBA::string_dup (this->caught_exception_->_id ());
}
@@ -183,18 +196,21 @@ TAO_ClientRequestInfo::add_request_service_context (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ IOP::ServiceContextList &service_context_list =
+ this->invocation_->service_info ();
+
// Copy the service context into the list.
- CORBA::ULong len = this->service_context_list_.length ();
+ CORBA::ULong len = service_context_list.length ();
// First check if a service context with the same ID exists.
for (CORBA::ULong i = 0; i < len; ++i)
{
- if (this->service_context_list_[i].context_id ==
+ if (service_context_list[i].context_id ==
service_context.context_id)
{
if (replace)
{
- this->service_context_list_[i] = service_context;
+ service_context_list[i] = service_context;
return;
}
else
@@ -204,58 +220,63 @@ TAO_ClientRequestInfo::add_request_service_context (
}
// No service context with the given ID exists so add one.
- this->service_context_list_.length (len + 1);
+ service_context_list.length (len + 1);
- this->service_context_list_[len] = service_context;
+ service_context_list[len] = service_context;
}
CORBA::ULong
TAO_ClientRequestInfo::request_id (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return this->request_id_;
+ return this->invocation_->request_id ();
}
char *
TAO_ClientRequestInfo::operation (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return CORBA::string_dup (this->operation_);
+ return CORBA::string_dup (this->invocation_->operation ());
}
Dynamic::ParameterList *
-TAO_ClientRequestInfo::arguments (CORBA::Environment &)
+TAO_ClientRequestInfo::arguments (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->parameter_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::ExceptionList *
-TAO_ClientRequestInfo::exceptions (CORBA::Environment &)
+TAO_ClientRequestInfo::exceptions (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->exception_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::ContextList *
-TAO_ClientRequestInfo::contexts (CORBA::Environment &)
+TAO_ClientRequestInfo::contexts (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->context_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::RequestContext *
-TAO_ClientRequestInfo::operation_context (CORBA::Environment &)
+TAO_ClientRequestInfo::operation_context (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
-{
- return &this->request_context_;
+{
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
CORBA::Any *
-TAO_ClientRequestInfo::result (CORBA::Environment &)
+TAO_ClientRequestInfo::result (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return 0;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
CORBA::Boolean
@@ -267,25 +288,24 @@ TAO_ClientRequestInfo::response_expected (CORBA::Environment &)
# if TAO_HAS_CORBA_MESSAGING == 1
CORBA::Short
-TAO_ClientRequestInfo::sync_scope (CORBA::Environment &)
+TAO_ClientRequestInfo::sync_scope (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
-// TAO_GIOP_Oneway_Invocation *inv =
-// ACE_dynamic_cast (TAO_GIOP_Oneway_Invocation *,
-// this->invocation_);
-
-// // The response_expected_ check is a precautionary measure for
-// // platforms that do not support RTTI, i.e. where the dynamic_cast
-// // above would incorrectly work. If the response_expected flag is
-// // not equal to zero then it is fairly safe to assume that the
-// // invocation is not a one-way, meaning that the sync_scope() method
-// // is not available.
-// if (inv != 0 && this->response_expected_ == 0)
-// return inv->sync_scope ();
-
-// ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), -1);
-
- return 0;
+ TAO_GIOP_Oneway_Invocation *inv =
+ ACE_dynamic_cast (TAO_GIOP_Oneway_Invocation *,
+ this->invocation_);
+
+ // The response_expected_ check is a precautionary measure for
+ // platforms that do not support RTTI, i.e. where the dynamic_cast
+ // above would incorrectly work. If the response_expected flag is
+ // not equal to zero then it is fairly safe to assume that the
+ // invocation is not a one-way, meaning that the sync_scope() method
+ // is not available.
+ if (inv != 0 && this->response_expected_ == 0)
+ return inv->sync_scope ();
+
+ // @@ Need the minor once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), -1);
}
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
@@ -304,18 +324,17 @@ CORBA::Object_ptr
TAO_ClientRequestInfo::forward_reference (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ // @@ Need the minor code once it becomes available.
if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD
- || this->reply_status_ !=
+ && this->reply_status_ !=
PortableInterceptor::LOCATION_FORWARD_PERMANENT)
ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (),
CORBA::Object::_nil ());
-// // TAO_GIOP_Invocation::forward_reference() already duplicates the
-// // reference before returning it so there is no need to duplicate it
-// // here.
-// return this->invocation_->forward_reference ();
-
- return CORBA::Object::_nil ();
+ // TAO_GIOP_Invocation::forward_reference() already duplicates the
+ // reference before returning it so there is no need to duplicate it
+ // here.
+ return this->invocation_->forward_reference ();
}
CORBA::Any *
@@ -338,10 +357,12 @@ TAO_ClientRequestInfo::get_request_service_context (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- CORBA::ULong len = this->service_context_list_.length ();
+ IOP::ServiceContextList &service_context_list =
+ this->invocation_->service_info ();
+ CORBA::ULong len = service_context_list.length ();
for (CORBA::ULong i = 0; i < len; ++i)
- if (this->service_context_list_[i].context_id == id)
+ if (service_context_list[i].context_id == id)
{
IOP::ServiceContext *service_context = 0;
ACE_NEW_THROW_EX (service_context,
@@ -355,7 +376,7 @@ TAO_ClientRequestInfo::get_request_service_context (
IOP::ServiceContext_var safe_service_context = service_context;
- (*service_context) = this->service_context_list_[i];
+ (*service_context) = service_context_list[i];
return safe_service_context._retn ();
}
@@ -374,10 +395,12 @@ TAO_ClientRequestInfo::get_reply_service_context (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- CORBA::ULong len = this->service_context_list_.length ();
+ IOP::ServiceContextList &service_context_list =
+ this->invocation_->service_info ();
+ CORBA::ULong len = service_context_list.length ();
for (CORBA::ULong i = 0; i < len; ++i)
- if (this->service_context_list_[i].context_id == id)
+ if (service_context_list[i].context_id == id)
{
IOP::ServiceContext *service_context = 0;
ACE_NEW_THROW_EX (service_context,
@@ -391,7 +414,7 @@ TAO_ClientRequestInfo::get_reply_service_context (
IOP::ServiceContext_var safe_service_context = service_context;
- (*service_context) = this->service_context_list_[i];
+ (*service_context) = service_context_list[i];
return safe_service_context._retn ();
}
diff --git a/TAO/tao/ClientRequestInfo.h b/TAO/tao/ClientRequestInfo.h
index ad83903425d..4704fed93ff 100644
--- a/TAO/tao/ClientRequestInfo.h
+++ b/TAO/tao/ClientRequestInfo.h
@@ -39,13 +39,14 @@
#include "StringSeqC.h"
#include "Invocation.h"
+class TAO_GIOP_Invocation;
+
class TAO_Export TAO_ClientRequestInfo
: public virtual PortableInterceptor::ClientRequestInfo,
public virtual CORBA::LocalObject
{
public:
- TAO_ClientRequestInfo (const char * operation,
- IOP::ServiceContextList &service_context_list,
+ TAO_ClientRequestInfo (TAO_GIOP_Invocation *invocation,
CORBA::Object_ptr target);
virtual CORBA::ULong request_id (
@@ -155,12 +156,10 @@ public:
ACE_THROW_SPEC ((CORBA::SystemException));
protected:
+
/// Change the exception status.
void exception (CORBA::Exception *exception);
- void request_id (CORBA::ULong request_id);
- // Update the request id.
-
/// Set the flag that states whether or not a response is expected.
/// For example, no response is expected in a one-way operation.
void response_expected (CORBA::Boolean flag);
@@ -168,21 +167,16 @@ protected:
/// Set the status of the received reply.
void reply_status (int invoke_status);
-protected:
+ /// Extract the forward object reference from the
+ /// PortableInterceptor::ForwardRequest exception, and set the reply
+ /// status flag accordingly.
+ void forward_reference (PortableInterceptor::ForwardRequest &exc);
- CORBA::ULong request_id_;
- const char * operation_;
- Dynamic::ParameterList parameter_list_;
- Dynamic::ExceptionList exception_list_;
- Dynamic::ContextList context_list_;
- Dynamic::RequestContext request_context_;
+protected:
- // Needed to ensure no copy anywhere.
- IOP::ServiceContextList &service_context_list_;
+ TAO_GIOP_Invocation *invocation_;
- CORBA::Any result_val_;
CORBA::Object_var target_;
- CORBA::Object_var effective_target_;
CORBA::Exception *caught_exception_;
CORBA::Boolean response_expected_;
diff --git a/TAO/tao/ClientRequestInfo.inl b/TAO/tao/ClientRequestInfo.inl
index c019be5f189..50bd99d0a2c 100644
--- a/TAO/tao/ClientRequestInfo.inl
+++ b/TAO/tao/ClientRequestInfo.inl
@@ -7,16 +7,12 @@ TAO_ClientRequestInfo::exception (CORBA::Exception *exception)
{
if (CORBA::SystemException::_downcast (exception) != 0)
this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
- if (CORBA::UserException::_downcast (exception) != 0)
+ else if (CORBA::UserException::_downcast (exception) != 0)
this->reply_status_ = PortableInterceptor::USER_EXCEPTION;
- this->caught_exception_ = exception;
-}
+ // @@ Is it possible for both of the above downcasts to fail?
-ACE_INLINE void
-TAO_ClientRequestInfo::request_id (CORBA::ULong request_id)
-{
- this->request_id_ = request_id;
+ this->caught_exception_ = exception;
}
ACE_INLINE void
@@ -33,11 +29,11 @@ TAO_ClientRequestInfo::reply_status (int invoke_status)
case TAO_INVOKE_OK:
this->reply_status_ = PortableInterceptor::SUCCESSFUL;
break;
-// case TAO_INVOKE_FORWARD:
-// this->reply_status_ = PortableInterceptor::LOCATION_FORWARD;
-// break;
case TAO_INVOKE_RESTART:
- this->reply_status_ = PortableInterceptor::TRANSPORT_RETRY;
+ if (this->invocation_->received_location_forward ())
+ this->reply_status_ = PortableInterceptor::LOCATION_FORWARD;
+ else
+ this->reply_status_ = PortableInterceptor::TRANSPORT_RETRY;
break;
default:
// We should only get here if the invocation status is
@@ -48,21 +44,21 @@ TAO_ClientRequestInfo::reply_status (int invoke_status)
}
}
-// ACE_INLINE void
-// TAO_ClientRequestInfo::forward_reference (
-// PortableInterceptor::ForwardRequest &exc)
-// {
-// // Note that we're converting the ForwardRequest exception in to a
-// // LOCATION_FORWARD reply, so we do not set the exception status.
-// //
-// // The forward object reference is not handled here. Rather, it is
-// // handled by the TAO_GIOP_Invocation object so that its profiles
-// // can be added to the list of forward profiles.
+ACE_INLINE void
+TAO_ClientRequestInfo::forward_reference (
+ PortableInterceptor::ForwardRequest &exc)
+{
+ // Note that we're converting the ForwardRequest exception in to a
+ // LOCATION_FORWARD reply, so we do not set the exception status.
+ //
+ // The forward object reference is not handled here. Rather, it is
+ // handled by the TAO_GIOP_Invocation object so that its profiles
+ // can be added to the list of forward profiles.
-// if (exc.permanent)
-// this->reply_status_ =
-// PortableInterceptor::LOCATION_FORWARD_PERMANENT;
-// else
-// this->reply_status_ =
-// PortableInterceptor::LOCATION_FORWARD;
-// }
+ if (exc.permanent)
+ this->reply_status_ =
+ PortableInterceptor::LOCATION_FORWARD_PERMANENT;
+ else
+ this->reply_status_ =
+ PortableInterceptor::LOCATION_FORWARD;
+}
diff --git a/TAO/tao/DomainC.cpp b/TAO/tao/DomainC.cpp
index 8fbe3c3e111..80b7ae621de 100644
--- a/TAO/tao/DomainC.cpp
+++ b/TAO/tao/DomainC.cpp
@@ -19,6 +19,7 @@
#endif /* !defined INLINE */
#include "PortableInterceptor.h"
+#include "RequestInfo_Util.h"
// default constructor
CORBA_DomainManager::CORBA_DomainManager (void)
@@ -128,8 +129,7 @@ CORBA::Policy_ptr CORBA_DomainManager::get_domain_policy (
_tao_vfr (istub->orb_core ()->client_request_interceptors ());
CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy
- ri ("get_domain_policy",
- _tao_call.service_info (),
+ ri (&_tao_call,
this,
policy_type);
@@ -143,7 +143,6 @@ CORBA::Policy_ptr CORBA_DomainManager::get_domain_policy (
TAO_INTERCEPTOR_CHECK_RETURN (0);
TAO_INTERCEPTOR (
- ri.request_id (_tao_call.request_id ());
_tao_vfr.send_request (
&ri,
ACE_TRY_ENV
@@ -252,60 +251,72 @@ const char* CORBA_DomainManager::_interface_repository_id (void) const
#if (TAO_HAS_INTERCEPTORS == 1)
CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_GIOP_Invocation *_tao_invocation,
CORBA::Object *_tao_target,
CORBA::PolicyType &policy_type)
- : TAO_ClientRequestInfo (
- _tao_operation,
- _tao_service_context_list,
- _tao_target
- ),
+ : TAO_ClientRequestInfo (_tao_invocation, _tao_target),
policy_type_ (policy_type)
{}
Dynamic::ParameterList *
-CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::arguments (CORBA::Environment &)
+CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::arguments (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
// Generate the arg list on demand
- CORBA::ULong length = 0;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= this->policy_type_;
+ CORBA::ULong len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= this->policy_type_;
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
- return &this->parameter_list_;
+ return safe_parameter_list._retn ();
}
Dynamic::ExceptionList *
CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::exceptions (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the exception list on demand
- return 0;
+ // Generate the exception list on demand.
+ Dynamic::ExceptionList *exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ return exception_list;
}
CORBA::Any *
CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::result (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the result on demand :
- this->result_val_ <<= this->result_;
- return &this->result_val_;
+ // Generate the result on demand.
+ CORBA::Boolean tk_void_any = 0;
+ CORBA::Any *result_any =
+ TAO_RequestInfo_Util::make_any (tk_void_any, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_result_any = result_any;
+
+ (*result_any) <<= this->_result;
+
+ return safe_result_any._retn ();
}
void
CORBA_DomainManager::TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy::result (CORBA::Policy_ptr result)
{
// update the result
- this->result_ = result;
+ this->_result = result;
}
#endif /* TAO_HAS_INTERCEPTORS */
@@ -426,8 +437,7 @@ void CORBA_ConstructionPolicy::make_domain_manager (
);
CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager ri (
- "make_domain_manager",
- _tao_call.service_info (),
+ &_tao_call,
this,
object_type,
constr_policy,
@@ -444,7 +454,6 @@ void CORBA_ConstructionPolicy::make_domain_manager (
TAO_INTERCEPTOR_CHECK;
TAO_INTERCEPTOR (
- ri.request_id (_tao_call.request_id ());
_tao_vfr.send_request (
&ri,
ACE_TRY_ENV
@@ -554,63 +563,69 @@ const char* CORBA_ConstructionPolicy::_interface_repository_id (void) const
#if (TAO_HAS_INTERCEPTORS == 1) && (TAO_HAS_INTERFACE_REPOSITORY == 1)
CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_GIOP_Invocation *_tao_invocation,
CORBA::Object *_tao_target,
IR_InterfaceDef *object_type,
CORBA::Boolean &constr_policy,
CORBA::Environment &
)
- : TAO_ClientRequestInfo (
- _tao_operation,
- _tao_service_context_list,
- _tao_target
- ),
+ : TAO_ClientRequestInfo (_tao_invocation, _tao_target),
object_type_ (object_type),
constr_policy_ (constr_policy)
{}
Dynamic::ParameterList *
-CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::arguments (CORBA::Environment &)
+CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::arguments (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the arg list on demand
- CORBA::ULong length = 0;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= this->object_type_;
+ // Generate the arg list on demand.
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= CORBA::Any::from_boolean (this->constr_policy_ );
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
+ CORBA::ULong len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= this->object_type_;
- return &this->parameter_list_;
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
+ len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= CORBA::Any::from_boolean (this->constr_policy_ );
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
+
+ return safe_parameter_list._retn ();
}
Dynamic::ExceptionList *
CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::exceptions (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the exception list on demand
- return 0;
+ // Generate the exception list on demand.
+ Dynamic::ExceptionList *exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ return exception_list;
}
CORBA::Any *
CORBA_ConstructionPolicy::TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::result (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the result on demand :
- CORBA::TypeCode tc (CORBA::tk_void);
- this->result_val_.type (&tc);
+ // Generate the result on demand.
+ CORBA::Boolean tk_void_any = 1;
+ CORBA::Any *result_any =
+ TAO_RequestInfo_Util::make_any (tk_void_any, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
- return &this->result_val_;
+ return result_any;
}
#endif /* TAO_HAS_INTERCEPTORS && TAO_HAS_INTERFACE_REPOSITORY */
diff --git a/TAO/tao/DomainC.h b/TAO/tao/DomainC.h
index a0ce6326163..8b304c2c8bd 100644
--- a/TAO/tao/DomainC.h
+++ b/TAO/tao/DomainC.h
@@ -179,8 +179,7 @@ class TAO_Export CORBA_DomainManager : public virtual CORBA_Object
public:
friend class CORBA_DomainManager;
TAO_ClientRequest_Info_CORBA_DomainManager_get_domain_policy (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_GIOP_Invocation *_tao_invocation,
CORBA::Object *_tao_target,
CORBA::PolicyType& policy_type
);
@@ -213,7 +212,7 @@ class TAO_Export CORBA_DomainManager : public virtual CORBA_Object
CORBA::PolicyType &policy_type_;
void result (CORBA_Policy_ptr result);
// update the result
- CORBA_Policy_ptr result_;
+ CORBA_Policy_ptr _result;
};
#endif /* TAO_HAS_INTERCEPTORS */
@@ -341,8 +340,7 @@ private:
public:
friend class CORBA_ConstructionPolicy;
TAO_ClientRequest_Info_CORBA_ConstructionPolicy_make_domain_manager (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_GIOP_Invocation *_tao_invocation,
CORBA::Object *_tao_target,
IR_InterfaceDef *object_type,
CORBA::Boolean &constr_policy,
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp
index e1c14a907b2..a09f92202f4 100644
--- a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp
+++ b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp
@@ -1,20 +1,23 @@
-#include "tao/GIOP_Message_Generator_Parser_10.h"
-#include "tao/GIOP_Utils.h"
+// -*- C++ -*-
-#include "tao/GIOP_Message_Headers.h"
+#include "GIOP_Message_Generator_Parser_10.h"
+#include "GIOP_Utils.h"
-#include "tao/operation_details.h"
-#include "tao/CDR.h"
-#include "tao/Any.h"
-#include "tao/debug.h"
-#include "tao/OctetSeqC.h"
-#include "tao/Pluggable_Messaging_Utils.h"
-#include "tao/TAO_Server_Request.h"
-#include "tao/GIOP_Message_State.h"
+#include "GIOP_Message_Headers.h"
+
+#include "operation_details.h"
+#include "CDR.h"
+#include "Any.h"
+#include "debug.h"
+#include "OctetSeqC.h"
+#include "Pluggable_Messaging_Utils.h"
+#include "TAO_Server_Request.h"
+#include "GIOP_Message_State.h"
+#include "CORBA_String.h"
#if !defined (__ACE_INLINE__)
-# include "tao/GIOP_Message_Generator_Parser_10.inl"
+# include "GIOP_Message_Generator_Parser_10.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID(tao, GIOP_Message_Gen_Parser_10, "$Id$")
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 7facdf85453..87366e6ad1a 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -1,33 +1,32 @@
// $Id$
-
-#include "tao/Invocation.h"
-#include "tao/Principal.h"
-#include "tao/Stub.h"
-
-#include "tao/Timeprobe.h"
-#include "tao/Dynamic_Adapter.h"
-#include "tao/Object_KeyC.h"
-#include "tao/debug.h"
-#include "tao/Pluggable.h"
-#include "tao/Connector_Registry.h"
-#include "tao/Wait_Strategy.h"
-#include "tao/Transport_Mux_Strategy.h"
-#include "tao/Bind_Dispatcher_Guard.h"
-#include "tao/Endpoint.h"
-#include "tao/RT_Policy_i.h"
-#include "tao/Base_Connection_Property.h"
-#include "tao/Private_Connection_Descriptor.h"
-
-#include "tao/Messaging_Policy_i.h"
-#include "tao/GIOP_Utils.h"
-#include "tao/ORB_Core.h"
-#include "tao/Pluggable_Messaging_Utils.h"
+#include "Invocation.h"
+#include "Principal.h"
+#include "Stub.h"
+
+#include "Timeprobe.h"
+#include "Dynamic_Adapter.h"
+#include "Object_KeyC.h"
+#include "debug.h"
+#include "Pluggable.h"
+#include "Connector_Registry.h"
+#include "Wait_Strategy.h"
+#include "Transport_Mux_Strategy.h"
+#include "Bind_Dispatcher_Guard.h"
+#include "Endpoint.h"
+#include "RT_Policy_i.h"
+#include "Base_Connection_Property.h"
+#include "Private_Connection_Descriptor.h"
+
+#include "Messaging_Policy_i.h"
+#include "GIOP_Utils.h"
+#include "ORB_Core.h"
+#include "Pluggable_Messaging_Utils.h"
#include "ace/Dynamic_Service.h"
#if !defined (__ACE_INLINE__)
-# include "tao/Invocation.i"
+# include "Invocation.i"
#endif /* ! __ACE_INLINE__ */
ACE_RCSID(tao, Invocation, "$Id$")
@@ -97,7 +96,9 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (void)
max_wait_time_ (0),
ior_info_ (),
rt_context_initialized_ (0),
- restart_flag_ (0)
+ restart_flag_ (0),
+ forward_reference_ (),
+ received_location_forward_ (0)
{
}
@@ -128,7 +129,9 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (TAO_Stub *stub,
max_wait_time_ (0),
ior_info_ (),
rt_context_initialized_ (0),
- restart_flag_ (0)
+ restart_flag_ (0),
+ forward_reference_ (),
+ received_location_forward_ (0)
{
}
@@ -363,7 +366,6 @@ TAO_GIOP_Invocation::prepare_header (CORBA::Octet response_flags,
}
}
-
// Send request.
int
TAO_GIOP_Invocation::invoke (CORBA::Boolean is_roundtrip,
@@ -465,20 +467,17 @@ TAO_GIOP_Invocation::close_connection (void)
// Handle the GIOP Reply with status = LOCATION_FORWARD
// Replace the IIOP Profile.
-
int
TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
CORBA::Environment &ACE_TRY_ENV)
- ACE_THROW_SPEC ((CORBA::SystemException))
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
// It can be assumed that the GIOP header and the reply header
- // are already handled. Further it can be assumed that the
+ // are already handled. Further it can be assumed that the
// reply body contains an object reference to the new object.
// This object pointer will be now extracted.
- CORBA::Object_var object = 0;
-
- if ( (inp_stream >> object.inout ()) == 0)
+ if ((inp_stream >> this->forward_reference_.inout ()) == 0)
{
ACE_THROW_RETURN (CORBA::MARSHAL (),
TAO_INVOKE_EXCEPTION);
@@ -486,23 +485,33 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
// The object pointer has to be changed to a TAO_Stub pointer
// in order to obtain the profiles.
- TAO_Stub *stubobj = object->_stubobj ();
+ TAO_Stub *stubobj = this->forward_reference_->_stubobj ();
- if (stubobj == 0)
- {
- ACE_THROW_RETURN (CORBA::INTERNAL (),
- TAO_INVOKE_EXCEPTION);
- }
-
- // Modify the state as appropriate to include new forwarding profiles.
- this->endpoint_selector_->forward (this,
- stubobj->base_profiles (),
- ACE_TRY_ENV);
+ this->location_forward_i (stubobj, ACE_TRY_ENV);
ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
return TAO_INVOKE_RESTART;
}
+int
+TAO_GIOP_Invocation::location_forward (CORBA::Object_ptr forward,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (CORBA::is_nil (forward))
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (), TAO_INVOKE_EXCEPTION);
+
+ this->forward_reference_ = CORBA::Object::_duplicate (forward);
+
+ // The object pointer has to be changed to a TAO_Stub pointer
+ // in order to obtain the profiles.
+ TAO_Stub *stubobj = forward->_stubobj ();
+
+ this->location_forward_i (stubobj, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
+
+ return TAO_INVOKE_RESTART;
+}
CORBA::ULong
TAO_GIOP_Invocation::create_ior_info (void)
@@ -662,9 +671,10 @@ TAO_GIOP_Synch_Invocation::invoke_i (CORBA::Boolean is_locate_request,
TAO_Transport_Mux_Strategy *tms = this->transport_->tms ();
- TAO_Bind_Dispatcher_Guard dispatch_guard (this->op_details_.request_id(),
- &this->rd_,
- tms);
+ TAO_Bind_Dispatcher_Guard dispatch_guard (
+ this->op_details_.request_id (),
+ &this->rd_,
+ tms);
int &status = dispatch_guard.status ();
if (status == -1)
diff --git a/TAO/tao/Invocation.h b/TAO/tao/Invocation.h
index 11c4a834933..ec2920e712a 100644
--- a/TAO/tao/Invocation.h
+++ b/TAO/tao/Invocation.h
@@ -1,5 +1,4 @@
-// This may look like C, but it's really -*- C++ -*-
-
+// -*- C++ -*-
//=============================================================================
/**
* @file Invocation.h
@@ -27,32 +26,32 @@
#define TAO_INVOCATION_H
#include "ace/pre.h"
-#include "tao/CDR.h"
+#include "CDR.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "tao/Any.h"
-#include "tao/Synch_Reply_Dispatcher.h"
-#include "tao/TAOC.h"
-#include "tao/operation_details.h"
-#include "tao/target_specification.h"
-#include "tao/Invocation_Endpoint_Selectors.h"
+#include "Any.h"
+#include "Synch_Reply_Dispatcher.h"
+#include "TAOC.h"
+#include "operation_details.h"
+#include "target_specification.h"
+#include "Invocation_Endpoint_Selectors.h"
struct TAO_Exception_Data;
class TAO_Transport;
enum TAO_Invoke_Status
{
+ /// invoke() call successful.
TAO_INVOKE_OK,
- // invoke() call successful.
+ /// The request must be restarted, a temporary failure has ocurred.
TAO_INVOKE_RESTART,
- // The request must be restarted, a temporary failure has ocurred.
+ /// An exception was raised.
TAO_INVOKE_EXCEPTION
- // An exception was raised.
};
// ****************************************************************
@@ -63,14 +62,13 @@ enum TAO_Invoke_Status
* @brief Encapsulates common behavior for both oneway and twoway
* invocations.
*
- * This class connects (or lookups a connection from the cache)
- * to the remote server, builds the CDR stream for the Request,
- * send the CDR stream and expects the response and interprets
- * the incoming CDR stream.
+ * This class connects (or lookups a connection from the cache) to the
+ * remote server, builds the CDR stream for the Request, send the CDR
+ * stream and expects the response and interprets the incoming CDR
+ * stream.
*/
class TAO_Export TAO_GIOP_Invocation
{
-
friend class TAO_Endpoint_Selector_Factory;
friend class TAO_Default_Endpoint_Selector;
friend class TAO_Priority_Endpoint_Selector;
@@ -81,7 +79,7 @@ class TAO_Export TAO_GIOP_Invocation
friend class TAO_Client_Priority_Policy_Selector;
public:
- /// Default constructor. This should never get called, it is here
+ /// Default constructor. This should never get called, it is here
/// only to appease older versions of g++.
TAO_GIOP_Invocation (void);
@@ -104,78 +102,113 @@ public:
* Initialize the Request header.
* The <message_size> field of the GIOP header is left blank and
* must be filled later.
+ * @par
* The function only returns once a connection has been succesfully
* established *OR* all profiles have been tried. In that case it
* raises the CORBA::TRANSIENT exception.
*/
void prepare_header (CORBA::Octet response_flags,
- CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
/// Accessor to the request ServiceContextList. Only valid when
/// sending a request message.
IOP::ServiceContextList& service_info (void);
- /// Return the request id of this invocation.
+ /// Return the request id of this invocation.
CORBA::ULong request_id (void);
- /// Return the underlying output stream.
+ /// Return the name of the operation being invoked.
+ const char *operation (void);
+
+ /// Return the underlying output stream.
TAO_OutputCDR &out_stream (void);
// CORBA::Boolean restart_flag (void);
/// Set the value for the restart flag.
void restart_flag (CORBA::Boolean flag);
- /// resets the forwarding profile and behaves like we are fowarded
- /// (to the same server)
+ /// Resets the forwarding profile and behaves like we are fowarded
+ /// (to the same server).
int close_connection (void);
/// Establishes a connection to the remote server, initializes
/// the GIOP headers in the output CDR.
- void start (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ void start (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
- /// Dynamically allocate <inconsistent_policies_> PolicyList.
- void init_inconsistent_policies (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ /// Dynamically allocate \param inconsistent_policies_ PolicyList.
+ void init_inconsistent_policies (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
- /// Return PolicyList stored in <inconsistent_policies_> and give up
- /// its ownership. User must deallocate memory.
+ /// Return PolicyList stored in \param inconsistent_policies_ and
+ /// give up its ownership. User must deallocate memory.
CORBA::PolicyList *get_inconsistent_policies (void);
+ /**
+ * Add the given object reference to the list of forward profiles.
+ * This basically emulates a LOCATION_FORWARD reply from the
+ * server. It is needed by such things as the
+ * PortableInterceptor::ForwardRequest exception.
+ * @par
+ * The forward object reference can be retrieved by invoking the
+ * forward_reference() method in this class.
+ * It returns TAO_INVOKE_RESTART unless an exception is raised.
+ */
+ int location_forward (CORBA::Object_ptr forward,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the object reference returned in the LOCATION_FORWARD
+ /// reply. The return reference is only valid if the reply status
+ /// for the current reply is TAO_INVOKE_RESTART.
+ CORBA::Object_ptr forward_reference (void);
+
+ /// Returns true if a location forward was
+ CORBA::Boolean received_location_forward (void) const;
+
protected:
+
+ /// Sends the request, does not wait for the response.
/**
- * Sends the request, does not wait for the response.
* Returns TAO_INVOKE_RESTART if the write call failed and the
* request must be re-attempted.
+ * @par
* Notice that the same profile is tried again because it may be
* that the server closed the connection simply to release
* resources.
*/
int invoke (CORBA::Boolean is_roundtrip,
- CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
/**
* Helper method, the response for a Request or LocateRequest was a
* LOCATION_FORWARD or TAO_GIOP_OBJECT_FORWARD.
* In any case we must demarshal the object reference and setup the
- * profiles.
+ * profiles. The returned forward object reference can be retrieved
+ * by invoking the forward_reference() method in this class.
* It returns TAO_INVOKE_RESTART unless an exception is raised.
*/
int location_forward (TAO_InputCDR &inp_stream,
- CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Helper method that factors out code common to the
+ * location_forward() above, and adds the given object reference to
+ * the list of a forward profiles.
+ *
+ * The forward object reference can be retrieved by invoking the
+ * forward_reference() method in this class.
+ */
+ void location_forward_i (TAO_Stub *stubobj,
+ CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
/**
- * Create the IOP::IOR info. We will create the info atmost
- * once. Return index of the profile we are using to make the
- * invocation.
+ * Create the IOP::IOR info. We will create the info at most once.
+ * Return index of the profile we are using to make the invocation.
*/
CORBA::ULong create_ior_info (void);
@@ -184,33 +217,34 @@ protected:
* invocation target supports RTCORBA::CLIENT_PROPAGATED priority
* model.
*/
- void add_rt_service_context (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ());
+ void add_rt_service_context (CORBA_Environment &ACE_TRY_ENV);
protected:
- /// The object on which this invocation is going.
+
+ /// The object on which this invocation is going.
TAO_Stub *stub_;
/// Buffer used for both the output and input CDR streams, this is
- /// "safe" because we only one of the streams at a time.
- char buffer_ [ACE_CDR::DEFAULT_BUFSIZE];
+ /// "safe" because we only one of the streams at a time.
+ char buffer_[ACE_CDR::DEFAULT_BUFSIZE];
/// The relevant operation detail
- TAO_Operation_Details op_details_;
+ TAO_Operation_Details op_details_;
TAO_Target_Specification target_spec_;
/// Stream into which the response is placed.
TAO_OutputCDR out_stream_;
- /// The orb_core context where we make this invocation.
+ /// The orb_core context where we make this invocation.
TAO_ORB_Core* orb_core_;
- /// This invocation is using this transport, may change...
+ /// This invocation is using this transport.
+ /// @note may change...
TAO_Transport *transport_;
- /// Strategy for making decisions about which endpoint/profile to use
- /// for invocation.
+ /// Strategy for making decisions about which endpoint/profile to
+ /// use for invocation.
TAO_Invocation_Endpoint_Selector *endpoint_selector_;
/// Flag indicating whether <endpoint_selector_> has been
@@ -219,8 +253,8 @@ protected:
#if (TAO_HAS_RT_CORBA == 1)
- /// Store information used by <endpoint_selector_> for making
- /// endpoint selection decisions.
+ /// Store information used by endpoint_selector_ for making endpoint
+ /// selection decisions.
TAO_Endpoint_Selection_State endpoint_selection_state_;
#endif /* TAO_HAS_RT_CORBA == 1 */
@@ -228,53 +262,64 @@ protected:
/**
* If current effective policies cause the invocation to raise
* CORBA::INV_POLICY exception, the conflicting/problematic policies
- * are stored in this list. This is used by
- * <Object::_validate_connection> method to inform clients about
+ * are stored in this list. This is used by \param
+ * Object::_validate_connection method to inform clients about
* causes of invocation failure.
- *
- * Conflicting policies are only stored in this list if
- * <init_inconsistent_policies> method has been called prior to the
+ * @par
+ * Conflicting policies are only stored in this list if \param
+ * init_inconsistent_policies method has been called prior to the
* beginning of invocation. This saves extra work of conflicting
* policies 'logging' when it's not needed.
- *
*/
CORBA::PolicyList_var inconsistent_policies_;
- /// This invocation is using this profile.
+ /// This invocation is using this profile.
TAO_Profile *profile_;
- /// This invocation is using this endpoint from <profile_>.
+ /// This invocation is using this endpoint from \param profile_.
TAO_Endpoint *endpoint_;
- /// The timeout remaining for this request, it is initialized in
+ /// The timeout remaining for this request. It is initialized in
/// start() and updated as required.
+ //@{
ACE_Time_Value max_wait_time_value_;
ACE_Time_Value *max_wait_time_;
+ //@}
/**
- * The ior info. This would be needed for GIOP 1.2, as the clients
- * could receive an exception from the server asking for this
- * info. The exception that the client receives is
- * LOC_NEEDS_ADDRESSING_MODE. If we receive an exception we will
- * fill up this data atmost *once* and send it to the server.
+ * The ior info. This is needed for GIOP 1.2, as the clients could
+ * receive an exception from the server asking for this info. The
+ * exception that the client receives is LOC_NEEDS_ADDRESSING_MODE.
+ * If we receive an exception we will fill up this data at most
+ * *once* and send it to the server.
*/
IOP::IOR ior_info_;
/**
* Flag indicating whether RTCORBA-specific service context list
* processing has taken place. This is needed because
- * <prepare_header> may get called multiple times, but we only need
+ * prepare_header() may get called multiple times, but we only need
* to do the service context list processing once.
*/
int rt_context_initialized_;
/**
* This flag is turned on when the previous invocation on an
- * endpoint or a profile returned a TAO_INVOKE_RESTART. FT CORBA
+ * endpoint or a profile returned a TAO_INVOKE_RESTART. FT CORBA
* relies on this flag for guarenteeing unique id's during
* reinvocations.
*/
CORBA::Boolean restart_flag_;
+
+ /**
+ * Object reference returned in a LOCATION_FORWARD reply. This
+ * reference is only valid when the reply status is
+ * TAO_INVOKE_RESTART and
+ */
+ CORBA::Object_var forward_reference_;
+
+ /// Flag is true when a LOCATION_FORWARD reply is received.
+ CORBA::Boolean received_location_forward_;
};
// ****************************************************************
@@ -290,7 +335,8 @@ protected:
class TAO_Export TAO_GIOP_Synch_Invocation : public TAO_GIOP_Invocation
{
public:
- /// Default constructor. This should never get called, it is here
+
+ /// Default constructor. This should never get called, it is here
/// only to appease older versions of g++.
TAO_GIOP_Synch_Invocation (void);
@@ -304,13 +350,15 @@ public:
/// Destructor.
virtual ~TAO_GIOP_Synch_Invocation (void);
- /// Return the underlying input stream. Called by the stub to demarshal
- /// the results of the upcall into whatever return arguments there may be.
+ /// Return the underlying input stream. Called by the stub to
+ /// demarshal the results of the upcall into whatever return
+ /// arguments there may be.
TAO_InputCDR &inp_stream (void);
protected:
+
/// Implementation of the invoke() methods, handles the basic
- /// send/reply code and the system exceptions.
+ /// send/reply code and the system exceptions.
int invoke_i (CORBA::Boolean is_locate_request,
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
@@ -321,20 +369,21 @@ protected:
// ****************************************************************
+/**
+ * @class TAO_GIOP_Twoway_Invocation
+ *
+ * @brief Encapsulate a two-way invocation.
+ *
+ * Sends a two-way request, and expects the reply. This class
+ * connects (or lookups a connection from the cache) to the remote
+ * server, builds the CDR stream for the Request, send the CDR stream
+ * and expects the response and interprets the incoming CDR stream.
+ */
class TAO_Export TAO_GIOP_Twoway_Invocation
: public TAO_GIOP_Synch_Invocation
{
- // = TITLE
- // TAO_GIOP_Twoway_Invocation.
- //
- // = DESCRIPTION
- // Sends a two-way request, and expects the reply.
- // This class connects (or lookups a connection from the cache) to
- // the remote server, builds the CDR stream for the Request, send
- // the CDR stream and expects the response and interprets the
- // incoming CDR stream.
- //
public:
+
/// Constructor.
TAO_GIOP_Twoway_Invocation (TAO_Stub *stub,
const char *operation,
@@ -347,8 +396,7 @@ public:
/// Establishes a connection to the remote server, initializes
/// the GIOP headers in the output CDR.
- void start (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ void start (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
/**
@@ -359,23 +407,22 @@ public:
*/
int invoke (TAO_Exception_Data *excepts,
CORBA::ULong except_count,
- CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::Exception));
};
// ****************************************************************
+/**
+ * @class TAO_GIOP_Oneway_Invocation
+ *
+ * @brief Encapsulate a one-way invocation.
+ */
class TAO_Export TAO_GIOP_Oneway_Invocation
: public TAO_GIOP_Synch_Invocation
{
- // = TITLE
- // TAO_GIOP_Oneway_Invocation
- //
- // = DESCRIPTION
- // Sends a oneway request.
- //
public:
+
/// Constructor.
TAO_GIOP_Oneway_Invocation (TAO_Stub *stub,
const char *operation,
@@ -388,30 +435,32 @@ public:
/// Establishes a connection to the remote server, initializes
/// the GIOP headers in the output CDR.
- void start (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ void start (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
- /// Send request, without blocking for any response.
- int invoke (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ /// Send request, without blocking for any response.
+ int invoke (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
- /// Acessor for private member.
+ /// Accessor for private member.
TAO::SyncScope sync_scope (void);
+
private:
+
/// Our sync scope.
TAO::SyncScope sync_scope_;
};
// ****************************************************************
+/**
+ * @class TAO_GIOP_Locate_Request_Invocation
+ *
+ * @brief Sends a locate request message.
+ */
class TAO_Export TAO_GIOP_Locate_Request_Invocation
: public TAO_GIOP_Synch_Invocation
{
- // = TITLE
- // Sends a locate request.
- //
public:
/// Constructor.
TAO_GIOP_Locate_Request_Invocation (TAO_Stub *data,
@@ -422,20 +471,18 @@ public:
/// Establishes a connection to the remote server, initializes
/// the GIOP headers in the output CDR.
- void start (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ void start (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
- /// Send request, without blocking for any response.
- int invoke (CORBA_Environment &ACE_TRY_ENV =
- TAO_default_environment ())
+ /// Send request, without blocking for any response.
+ int invoke (CORBA_Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException));
};
// ****************************************************************
#if defined (__ACE_INLINE__)
-# include "tao/Invocation.i"
+# include "Invocation.i"
#endif /* __ACE_INLINE__ */
#include "ace/post.h"
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index b452cab7aa1..b4359574c51 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -1,7 +1,6 @@
-// This may look like C, but it's really -*- C++ -*-
+// -*- C++ -*-
//
// $Id$
-//
ACE_INLINE IOP::ServiceContextList &
TAO_GIOP_Invocation::service_info (void)
@@ -15,6 +14,12 @@ TAO_GIOP_Invocation::request_id (void)
return this->op_details_.request_id ();
}
+ACE_INLINE const char *
+TAO_GIOP_Invocation::operation (void)
+{
+ return this->op_details_.opname ();
+}
+
ACE_INLINE TAO_OutputCDR &
TAO_GIOP_Invocation::out_stream (void)
{
@@ -28,13 +33,30 @@ TAO_GIOP_Invocation::restart_flag (CORBA::Boolean flag)
this->restart_flag_ = flag;
}
+ACE_INLINE CORBA::Object_ptr
+TAO_GIOP_Invocation::forward_reference (void)
+{
+ return CORBA::Object::_duplicate (this->forward_reference_.in ());
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_GIOP_Invocation::received_location_forward (void) const
+{
+ return this->received_location_forward_;
+}
+
ACE_INLINE void
-TAO_GIOP_Invocation::init_inconsistent_policies (CORBA::Environment &ACE_TRY_ENV)
+TAO_GIOP_Invocation::init_inconsistent_policies (
+ CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_NEW_THROW_EX (this->inconsistent_policies_,
CORBA::PolicyList (0),
- CORBA::NO_MEMORY ());
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
}
ACE_INLINE CORBA::PolicyList *
@@ -43,6 +65,27 @@ TAO_GIOP_Invocation::get_inconsistent_policies (void)
return this->inconsistent_policies_._retn ();
}
+ACE_INLINE void
+TAO_GIOP_Invocation::location_forward_i (TAO_Stub *stubobj,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ /**
+ * Add the profiles in the given stub object to the list of forward
+ * profiles.
+ */
+ if (stubobj == 0)
+ ACE_THROW (CORBA::INTERNAL ());
+
+ // Modify the state as appropriate to include new forwarding profiles.
+ this->endpoint_selector_->forward (this,
+ stubobj->base_profiles (),
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ this->received_location_forward_ = 1;
+}
+
// ****************************************************************
ACE_INLINE
diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile
index 0d14974c6e7..540563603a5 100644
--- a/TAO/tao/Makefile
+++ b/TAO/tao/Makefile
@@ -164,6 +164,7 @@ ORB_CORE_FILES = \
operation_details \
PortableInterceptor \
ClientRequestInfo \
+ RequestInfo_Util \
PortableInterceptorC \
DynamicC \
OctetSeqC \
diff --git a/TAO/tao/Makefile.bor b/TAO/tao/Makefile.bor
index 95001571bc2..83e4b3fd7e2 100644
--- a/TAO/tao/Makefile.bor
+++ b/TAO/tao/Makefile.bor
@@ -146,6 +146,7 @@ OBJFILES = \
$(OBJDIR)\Remote_Object_Proxy_Impl.obj \
$(OBJDIR)\Reply_Dispatcher.obj \
$(OBJDIR)\Resource_Factory.obj \
+ $(OBJDIR)\RequestInfo_Util.obj \
$(OBJDIR)\RT_Current.obj \
$(OBJDIR)\RT_Mutex.obj \
$(OBJDIR)\RT_ORB.obj \
diff --git a/TAO/tao/PortableInterceptor.h b/TAO/tao/PortableInterceptor.h
index 32f4802e086..7de8a35d92c 100644
--- a/TAO/tao/PortableInterceptor.h
+++ b/TAO/tao/PortableInterceptor.h
@@ -1,4 +1,4 @@
-// This may look like C, but it's really -*- C++ -*-
+// -*- C++ -*-
//=============================================================================
/**
@@ -28,7 +28,7 @@
#include "ace/pre.h"
-#include "tao/corbafwd.h"
+#include "corbafwd.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -50,8 +50,8 @@
#if (TAO_HAS_INTERCEPTORS == 1)
-#include "tao/PortableInterceptorC.h"
-#include "tao/Interceptor_List.h"
+#include "PortableInterceptorC.h"
+#include "Interceptor_List.h"
/**
* @class TAO_ClientRequestInterceptor_Adapter
@@ -71,18 +71,18 @@ public:
~TAO_ClientRequestInterceptor_Adapter (void);
- //@{
- /// @name PortableInterceptor Client Side Interception Points
/**
+ * @name PortableInterceptor Client Side Interception Points
+ *
* Each of these methods corresponds to a client side interception
* point. There are no "intermediate" interception points on the
* client side, only "starting" and "ending" interception points.
*
* @todo
- * The "send_poll()" and "receive_other()" PortableInterceptor
- * interception points are missing.
+ * The "send_poll()" and "receive_other()" (for AMI)
+ * PortableInterceptor interception points are missing.
*/
-
+ //@{
/// This method implements one of the "starting" client side
/// interception points.
void send_request (PortableInterceptor::ClientRequestInfo_ptr ri,
@@ -117,10 +117,6 @@ private:
/// stack. This is used when unwinding the flow stack.
size_t stack_size_;
- /// Flag that denotes if an ending interception point has been
- /// called.
- int ending_intercept_called_;
-
};
/**
@@ -137,11 +133,11 @@ class TAO_Export TAO_ServerRequestInterceptor_Adapter
public:
TAO_ServerRequestInterceptor_Adapter (
- TAO_ServerRequestInterceptor_List::TYPE &interceptors);
+ TAO_ServerRequestInterceptor_List::TYPE &interceptors,
+ size_t &stack_size);
~TAO_ServerRequestInterceptor_Adapter (void);
- ///@{
/**
* @name PortableInterceptor Client Side Interception Points
*
@@ -152,15 +148,14 @@ public:
* The "receive_request_service_contexts()" and "send_other()"
* PortableInterceptor interception points are missing.
*/
- /**
- * This method implements the "starting" server side interception
- * point.
- *
- * @todo
- * The "starting" server side interception point should actually be
- * receive_request_service_contexts(). However, that interception
- * point hasn't been implemented yet.
- */
+ //@{
+ /// This method implements the "starting" server side interception
+ /// point.
+ void receive_request_service_contexts (
+ PortableInterceptor::ServerRequestInfo_ptr ri,
+ CORBA::Environment &);
+
+ /// This method an "intermediate" server side interception point.
void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
CORBA::Environment &);
@@ -173,6 +168,11 @@ public:
/// interception points.
void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri,
CORBA::Environment &);
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ void send_other (PortableInterceptor::ServerRequestInfo_ptr ri,
+ CORBA::Environment &);
//@}
private:
@@ -186,16 +186,12 @@ private:
/// The number of interceptors "pushed" onto the logical flow
/// stack. This is used when unwinding the flow stack.
- size_t stack_size_;
-
- /// Flag that denotes if an ending interception point has been
- /// called.
- int ending_intercept_called_;
+ size_t &stack_size_;
};
#if defined (__ACE_INLINE__)
-#include "tao/PortableInterceptor.i"
+#include "PortableInterceptor.i"
#endif /* defined INLINE */
#endif /* TAO_HAS_INTERCEPTORS */
diff --git a/TAO/tao/PortableInterceptor.i b/TAO/tao/PortableInterceptor.i
index f97ad7b8175..b9b755f61af 100644
--- a/TAO/tao/PortableInterceptor.i
+++ b/TAO/tao/PortableInterceptor.i
@@ -13,8 +13,8 @@ TAO_ClientRequestInterceptor_Adapter::TAO_ClientRequestInterceptor_Adapter
}
ACE_INLINE
-TAO_ClientRequestInterceptor_Adapter::~TAO_ClientRequestInterceptor_Adapter
- (void)
+TAO_ClientRequestInterceptor_Adapter::
+~TAO_ClientRequestInterceptor_Adapter (void)
{
}
@@ -24,15 +24,15 @@ send_request (PortableInterceptor::ClientRequestInfo_ptr ri,
CORBA::Environment &ACE_TRY_ENV)
{
// This method implements one of the "starting" client side
- // interception points.
+ // interception point.
for (size_t i = 0 ; i < this->len_; ++i)
{
this->interceptors_[i]->send_request (ri
TAO_ENV_ARG_PARAMETER);
ACE_CHECK;
- // The interception point completed successfully. Push the
- // interceptor on to the flow stack.
+ // The starting interception point completed successfully. Push
+ // the interceptor on to the flow stack.
++this->stack_size_;
}
@@ -138,45 +138,62 @@ receive_other (PortableInterceptor::ClientRequestInfo_ptr ri,
ACE_INLINE
TAO_ServerRequestInterceptor_Adapter::TAO_ServerRequestInterceptor_Adapter
- (TAO_ServerRequestInterceptor_List::TYPE &interceptors)
+ (TAO_ServerRequestInterceptor_List::TYPE &interceptors,
+ size_t &stack_size)
: interceptors_ (interceptors),
len_ (0),
- stack_size_ (0)
+ stack_size_ (stack_size)
{
this->len_ = interceptors.size ();
}
ACE_INLINE
-TAO_ServerRequestInterceptor_Adapter::~TAO_ServerRequestInterceptor_Adapter
- (void)
+TAO_ServerRequestInterceptor_Adapter::
+~TAO_ServerRequestInterceptor_Adapter (void)
{
}
ACE_INLINE void
TAO_ServerRequestInterceptor_Adapter::
+receive_request_service_contexts (
+ PortableInterceptor::ServerRequestInfo_ptr ri,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ // This method implements one of the "starting" server side
+ // interception point.
+ for (size_t i = 0 ; i < this->len_; ++i)
+ {
+ this->interceptors_[i]->receive_request_service_contexts (
+ ri
+ TAO_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // The starting interception point completed successfully. Push
+ // the interceptor on to the flow stack.
+ ++this->stack_size_;
+ }
+
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+}
+
+ACE_INLINE void
+TAO_ServerRequestInterceptor_Adapter::
receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
CORBA::Environment &ACE_TRY_ENV)
{
// This method implements an "intermediate" server side interception
- // point. Since it is a receiving server side interception point,
- // interceptors are invoked in the same order they were pushed on to
- // the flow stack.
+ // point. Interceptors are invoked in the same order they were
+ // pushed on to the flow stack.
- // @@ The receive_request_service_contexts() interception point
- // should be the starting one, so interceptors should only be
- // pushed on to the stack there. Once that interception point is
- // implemented, move the "stack pushing" code (i.e. the
- // "++this->stack_size_" there.
-
- for (size_t i = 0; i < this->len_; ++i)
+ for (size_t i = 0; i < this->stack_size_; ++i)
{
this->interceptors_[i]->receive_request (ri
TAO_ENV_ARG_PARAMETER);
ACE_CHECK;
- // The interception point completed successfully. Push the
- // interceptor on to the flow stack.
- ++this->stack_size_;
+ // Note that no interceptors are pushed on to or popped off of
+ // the flow stack in this interception point since it is an
+ // intermediate interception point.
}
ACE_UNUSED_ARG (ACE_TRY_ENV);
@@ -243,3 +260,34 @@ send_exception (PortableInterceptor::ServerRequestInfo_ptr ri,
ACE_UNUSED_ARG (ACE_TRY_ENV);
}
+
+ACE_INLINE void
+TAO_ServerRequestInterceptor_Adapter::
+send_other (PortableInterceptor::ServerRequestInfo_ptr ri,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ // This is an "ending" server side interception point so we only
+ // process the interceptors pushed on to the flow stack.
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending" server
+ // side interception point.
+
+ // Unwind the flow stack.
+ size_t len = this->stack_size_;
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor already
+ // invoked in this "ending" interception point from being
+ // invoked in another "ending" interception point.
+ --this->stack_size_;
+
+ this->interceptors_[this->stack_size_]->send_other (
+ ri
+ TAO_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+}
diff --git a/TAO/tao/PortableServer/DomainS.cpp b/TAO/tao/PortableServer/DomainS.cpp
index 19a296a1ef2..4475dca207b 100644
--- a/TAO/tao/PortableServer/DomainS.cpp
+++ b/TAO/tao/PortableServer/DomainS.cpp
@@ -17,6 +17,10 @@
#include "tao/Stub.h"
#include "tao/PortableInterceptor.h"
+#if TAO_HAS_INTERCEPTORS == 1
+#include "tao/RequestInfo_Util.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
#if !defined (__ACE_INLINE__)
#include "DomainS.i"
#endif /* !defined INLINE */
@@ -214,18 +218,16 @@ void POA_CORBA_DomainManager::get_domain_policy_skel (
#if (TAO_HAS_INTERCEPTORS == 1)
TAO_ServerRequestInterceptor_Adapter
- _tao_vfr (_tao_server_request.orb_core ()->server_request_interceptors ());
+ _tao_vfr (_tao_server_request.orb_core ()->server_request_interceptors (),
+ _tao_server_request.interceptor_count ());
// @@ CORBA::Object_var _tao_objref;
- POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy ri ("get_domain_policy",
-_tao_server_request.service_info () , policy_type ,
- ACE_TRY_ENV);
+ POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy ri (_tao_server_request, _tao_impl, policy_type, ACE_TRY_ENV);
// @@ _tao_objref = _tao_server_request.objref (ACE_TRY_ENV);
ACE_CHECK;
ACE_TRY
{
- ri.request_id (_tao_server_request.request_id ());
_tao_vfr.receive_request (&ri, ACE_TRY_ENV);
TAO_INTERCEPTOR_CHECK;
#endif /* TAO_HAS_INTERCEPTORS */
@@ -244,7 +246,7 @@ _tao_server_request.service_info () , policy_type ,
TAO_INTERCEPTOR_CHECK;
- #if (TAO_HAS_INTERCEPTORS == 1)
+#if (TAO_HAS_INTERCEPTORS == 1)
_tao_vfr.send_reply (&ri, ACE_TRY_ENV);
TAO_INTERCEPTOR_CHECK;
@@ -541,54 +543,74 @@ CORBA::Policy_ptr POA_CORBA__tao_direct_collocated_DomainManager::get_domain_pol
#if (TAO_HAS_INTERCEPTORS == 1)
-POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy (const char *_tao_operation,
-IOP::ServiceContextList &_tao_service_context_list,CORBA::PolicyType& policy_type,
+POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy
+(TAO_ServerRequest &_tao_server_request, POA_CORBA_DomainManager *tao_impl, CORBA::PolicyType& policy_type,
CORBA::Environment &)
- : TAO_ServerRequestInfo (_tao_operation, _tao_service_context_list),policy_type_ (policy_type)
+ : TAO_ServerRequestInfo (_tao_server_request),
+ _tao_impl (tao_impl),
+ policy_type_ (policy_type)
{}
Dynamic::ParameterList *
-POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::arguments (CORBA::Environment &)
+POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::arguments (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the arg list on demand
- CORBA::ULong length = 0;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= this->policy_type_;
+ // Generate the argument list on demand.
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
- return &this->parameter_list_;
+ CORBA::ULong len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= this->policy_type_;
+
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
+
+ return safe_parameter_list._retn ();
}
Dynamic::ExceptionList *
POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::exceptions (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the exception list on demand
- return 0;
+ // Generate the exception list on demand.
+ Dynamic::ExceptionList *exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ return exception_list;
}
CORBA::Any *
POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::result (
- CORBA::Environment &
+ CORBA::Environment &ACE_TRY_ENV
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
// Generate the result on demand.
- return &this->result_val_;
+ CORBA::Boolean tk_void_any = 0;
+ CORBA::Any *result_any =
+ TAO_RequestInfo_Util::make_any (0, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_result_any = result_any;
+
+ (*result_any) <<= this->_result;
+
+ return safe_result_any._retn ();
}
void
POA_CORBA_DomainManager::TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy::result (CORBA::Policy_ptr result)
- {
+{
// update the result
- this->result_ = result;
- }
+ this->_result = result;
+}
#endif /* TAO_HAS_INTERCEPTORS */
@@ -779,11 +801,11 @@ void POA_CORBA_ConstructionPolicy::make_domain_manager_skel (
#if (TAO_HAS_INTERCEPTORS == 1)
TAO_ServerRequestInterceptor_Adapter _tao_vfr (
- _tao_server_request.orb_core ()->server_request_interceptors ()
+ _tao_server_request.orb_core ()->server_request_interceptors (),
+ _tao_server_request.interceptor_count ()
);
POA_CORBA_ConstructionPolicy::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_make_domain_manager ri (
- "make_domain_manager",
- _tao_server_request.service_info (),
+ _tao_server_request,
object_type.in (),
constr_policy,
ACE_TRY_ENV
@@ -791,7 +813,6 @@ void POA_CORBA_ConstructionPolicy::make_domain_manager_skel (
ACE_TRY
{
- ri.request_id (_tao_server_request.request_id ());
_tao_vfr.receive_request (&ri, ACE_TRY_ENV);
TAO_INTERCEPTOR_CHECK;
#endif /* TAO_HAS_INTERCEPTORS */
@@ -1033,16 +1054,12 @@ void POA_CORBA__tao_thru_poa_collocated_ConstructionPolicy::make_domain_manager
#if (TAO_HAS_INTERCEPTORS == 1) && (TAO_HAS_INTERFACE_REPOSITORY == 1)
POA_CORBA_ConstructionPolicy::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_make_domain_manager::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_make_domain_manager (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ _tao_server_request,
IR_InterfaceDef *object_type,
CORBA::Boolean &constr_policy,
CORBA::Environment &
)
- : TAO_ServerRequestInfo (
- _tao_operation,
- _tao_service_context_list
- ),
+ : TAO_ServerRequestInfo (_tao_server_request),
object_type_ (object_type),
constr_policy_ (constr_policy)
{}
@@ -1052,18 +1069,23 @@ POA_CORBA_ConstructionPolicy::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_ma
ACE_THROW_SPEC ((CORBA::SystemException))
{
// Generate the arg list on demand
- CORBA::ULong length = 0;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= this->object_type_;
-
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
- length = this->parameter_list_.length ();
- this->parameter_list_.length (length + 1);
- this->parameter_list_[length].argument <<= CORBA::Any::from_boolean (this->constr_policy_);
- this->parameter_list_[length].mode = Dynamic::PARAM_IN;
-
- return &this->parameter_list_;
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
+ CORBA::ULong len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= this->object_type_;
+
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
+ len = parameter_list->length ();
+ parameter_list->length (len + 1);
+ (*parameter_list)[len].argument <<= CORBA::Any::from_boolean (this->constr_policy_);
+ (*parameter_list)[len].mode = Dynamic::PARAM_IN;
+
+ return safe_parameter_list._retn ();
}
Dynamic::ExceptionList *
@@ -1072,8 +1094,12 @@ POA_CORBA_ConstructionPolicy::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_ma
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the exception list on demand
- return 0;
+ // Generate the exception list on demand.
+ Dynamic::ExceptionList *exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ return exception_list;
}
@@ -1083,11 +1109,13 @@ POA_CORBA_ConstructionPolicy::TAO_ServerRequest_Info_CORBA_ConstructionPolicy_ma
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // Generate the result on demand
- CORBA::TypeCode tc (CORBA::tk_void);
- this->result_val_.type (&tc);
-
- return &this->result_val_;
+ // Generate the result on demand.
+ CORBA::Boolean tk_void_any = 1;
+ CORBA::Any *result_any =
+ TAO_RequestInfo_Util::make_any (tk_void_any, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ return result_any;
}
#endif /* TAO_HAS_INTERCEPTORS && TAO_HAS_INTERFACE_REPOSITORY */
diff --git a/TAO/tao/PortableServer/DomainS.h b/TAO/tao/PortableServer/DomainS.h
index 2ab51fcdd9d..85da242df77 100644
--- a/TAO/tao/PortableServer/DomainS.h
+++ b/TAO/tao/PortableServer/DomainS.h
@@ -101,17 +101,17 @@
#if (TAO_HAS_INTERCEPTORS == 1)
- // Generation of interceptors related RequestInfo classes per operation.
+ // Generation of interceptors related RequestInfo classes per operation.
// This needed to be able to store the arguments, exceptiosn, constexts
// and build the lists dynamically on demand so that unnecessary time overhead
// of building these lists when they arent used is avoided.
- class TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy : public TAO_ServerRequestInfo
+ class TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy : public TAO_ServerRequestInfo
{
public:
friend class POA_CORBA_DomainManager;
TAO_ServerRequest_Info_CORBA_DomainManager_get_domain_policy (
- const char * _tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_ServerRequest &_tao_server_request,
+ POA_CORBA_DomainManager *tao_impl,
CORBA::PolicyType& policy_type,
CORBA::Environment &ACE_TRY_ENV =
TAO_default_environment ()
@@ -145,7 +145,9 @@
CORBA::PolicyType &policy_type_;
void result (CORBA::Policy_ptr result);
// update the result
- CORBA::Policy_ptr result_;
+ CORBA::Policy_ptr _result;
+
+ POA_CORBA_DomainManager *_tao_impl;
};
#endif /* TAO_HAS_INTERCEPTORS */
@@ -391,8 +393,8 @@ public:
public:
friend class POA_CORBA_ConstructionPolicy;
TAO_ServerRequest_Info_CORBA_ConstructionPolicy_make_domain_manager (
- const char *_tao_operation,
- IOP::ServiceContextList &_tao_service_context_list,
+ TAO_ServerRequest &_tao_server_request,
+ POA_CORBA_ConstructionPolicy *tao_impl,
IR_InterfaceDef *object_type,
CORBA::Boolean &constr_policy,
CORBA::Environment &ACE_TRY_ENV =
@@ -426,6 +428,9 @@ public:
);
IR_InterfaceDef *object_type_;
CORBA::Boolean &constr_policy_;
+
+ TAO_Server_Request &_tao_server_request;
+ POA_CORBA_ConstructionPolicy *_tao_impl;
};
#endif /* TAO_HAS_INTERCEPTORS */
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index 2d5a5399d38..40633ea104f 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -4,6 +4,7 @@
#include "Object_Adapter.h"
#include "POA.h"
#include "Strategized_Object_Proxy_Broker.h"
+#include "ServerRequestInfo.h"
// -- ACE Include --
#include "ace/Auto_Ptr.h"
@@ -635,11 +636,65 @@ TAO_Object_Adapter::dispatch (TAO_ObjectKey &key,
return TAO_Adapter::DS_MISMATCHED_KEY;
}
- return this->dispatch_servant (key,
- request,
- context,
- forward_to,
- ACE_TRY_ENV);
+#if TAO_HAS_INTERCEPTORS == 1
+ TAO_ServerRequestInterceptor_Adapter sri_adapter (
+ this->orb_core_.server_request_interceptors (),
+ request.interceptor_count ());
+
+ TAO_ServerRequestInfo ri (request);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ int result = 0;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_TRY
+ {
+ // The receive_request_service_contexts() interception point
+ // must be invoked before the operation is dispatched to the
+ // servant.
+ sri_adapter.receive_request_service_contexts (&ri, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ result = this->dispatch_servant (key,
+ request,
+ context,
+ forward_to,
+ ACE_TRY_ENV);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_TRY_CHECK;
+
+ if (result == TAO_Adapter::DS_FORWARD)
+ {
+ ri.forward_reference (forward_to.ptr ());
+ sri_adapter.send_other (&ri,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ ri.forward_reference (exc);
+ sri_adapter.send_other (&ri,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ forward_to = CORBA::Object::_duplicate (exc.forward.in ());
+ return TAO_Adapter::DS_FORWARD;
+ }
+ ACE_CATCHANY
+ {
+ sri_adapter.send_exception (&ri,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ ACE_RE_THROW;
+ };
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (result);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ return result;
}
const char *
diff --git a/TAO/tao/PortableServer/ServerRequestInfo.cpp b/TAO/tao/PortableServer/ServerRequestInfo.cpp
index d14e21fbe9e..f9a3f202e3f 100644
--- a/TAO/tao/PortableServer/ServerRequestInfo.cpp
+++ b/TAO/tao/PortableServer/ServerRequestInfo.cpp
@@ -4,15 +4,19 @@
#include "ServerRequestInfo.h"
+#include "tao/TAO_Server_Request.h"
+
ACE_RCSID (PortableServer, ServerRequestInfo, "$Id$")
#if (TAO_HAS_INTERCEPTORS == 1)
+# if !defined (__ACE_INLINE__)
+# include "ServerRequestInfo.inl"
+# endif /* !__ACE_INLINE__ */
+
TAO_ServerRequestInfo::TAO_ServerRequestInfo (
- const char * operation,
- IOP::ServiceContextList &service_context_list)
- : operation_ (operation),
- service_context_list_ (service_context_list),
+ TAO_ServerRequest &server_request)
+ : server_request_ (server_request),
caught_exception_ (0),
reply_status_ (-1)
{
@@ -22,69 +26,73 @@ CORBA::ULong
TAO_ServerRequestInfo::request_id (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return this->request_id_;
+ return this->server_request_.request_id ();
}
char *
TAO_ServerRequestInfo::operation (CORBA::Environment &)
- ACE_THROW_SPEC ((CORBA::SystemException))
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
- return CORBA::string_dup (this->operation_);
+ return CORBA::string_dup (this->server_request_.operation ());
}
Dynamic::ParameterList *
-TAO_ServerRequestInfo::arguments (CORBA::Environment &)
- ACE_THROW_SPEC ((CORBA::SystemException))
+TAO_ServerRequestInfo::arguments (CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->parameter_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::ExceptionList *
-TAO_ServerRequestInfo::exceptions (CORBA::Environment &)
+TAO_ServerRequestInfo::exceptions (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->exception_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::ContextList *
-TAO_ServerRequestInfo::contexts (CORBA::Environment &)
+TAO_ServerRequestInfo::contexts (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->context_list_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
Dynamic::RequestContext *
-TAO_ServerRequestInfo::operation_context (CORBA::Environment &)
+TAO_ServerRequestInfo::operation_context (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return &this->request_context_;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
CORBA::Any *
-TAO_ServerRequestInfo::result (CORBA::Environment &)
+TAO_ServerRequestInfo::result (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return 0;
+ // @@ Need the minor code once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
}
CORBA::Boolean
-TAO_ServerRequestInfo::response_expected (CORBA::Environment &ACE_TRY_ENV)
+TAO_ServerRequestInfo::response_expected (CORBA::Environment &)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
- CORBA::SystemException::_tao_minor_code (
- TAO_DEFAULT_MINOR_CODE,
- ENOTSUP),
- CORBA::COMPLETED_NO),
- 0);
+ return this->server_request_.response_expected ();
}
# if TAO_HAS_CORBA_MESSAGING == 1
Messaging::SyncScope
-TAO_ServerRequestInfo::sync_scope (CORBA::Environment &)
+TAO_ServerRequestInfo::sync_scope (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- return 0;
+ if (this->server_request_.sync_with_server ())
+ return Messaging::SYNC_WITH_SERVER;
+
+ // @@ Need the minor once it becomes available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), -1);
}
#endif /* TAO_HAS_CORBA_MESSAGING */
@@ -104,17 +112,18 @@ TAO_ServerRequestInfo::forward_reference (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD
- || this->reply_status_ !=
+ && this->reply_status_ !=
PortableInterceptor::LOCATION_FORWARD_PERMANENT)
ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (),
CORBA::Object::_nil ());
-// // TAO_GIOP_Invocation::forward_reference() already duplicates the
-// // reference before returning it so there is no need to duplicate it
-// // here.
-// return this->invocation_->forward_reference ();
-
- return CORBA::Object::_nil ();
+ // We don't get the forward reference from the TAO_Server_Request
+ // object since it may not have been set there. For example, this
+ // is the case when a Servant Manager throws a
+ // PortableServer::ForwardRequest exception. As such, we only
+ // return the one stored in this object since it is explicitly set
+ // by the responsible request forwarding code.
+ return CORBA::Object::_duplicate (this->forward_reference_);
}
CORBA::Any *
@@ -137,10 +146,13 @@ TAO_ServerRequestInfo::get_request_service_context (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- CORBA::ULong len = this->service_context_list_.length ();
+ IOP::ServiceContextList &service_context_list =
+ this->server_request_.service_context ().service_info ();
+
+ CORBA::ULong len = service_context_list.length ();
for (CORBA::ULong i = 0; i < len; ++i)
- if (this->service_context_list_[i].context_id == id)
+ if (service_context_list[i].context_id == id)
{
IOP::ServiceContext *service_context = 0;
ACE_NEW_THROW_EX (service_context,
@@ -154,7 +166,7 @@ TAO_ServerRequestInfo::get_request_service_context (
IOP::ServiceContext_var safe_service_context = service_context;
- (*service_context) = this->service_context_list_[i];
+ (*service_context) = service_context_list[i];
return safe_service_context._retn ();
}
@@ -173,10 +185,13 @@ TAO_ServerRequestInfo::get_reply_service_context (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- CORBA::ULong len = this->service_context_list_.length ();
+ IOP::ServiceContextList &service_context_list =
+ this->server_request_.service_context ().service_info ();
+
+ CORBA::ULong len = service_context_list.length ();
for (CORBA::ULong i = 0; i < len; ++i)
- if (this->service_context_list_[i].context_id == id)
+ if (service_context_list[i].context_id == id)
{
IOP::ServiceContext *service_context = 0;
ACE_NEW_THROW_EX (service_context,
@@ -190,7 +205,7 @@ TAO_ServerRequestInfo::get_reply_service_context (
IOP::ServiceContext_var safe_service_context = service_context;
- (*service_context) = this->service_context_list_[i];
+ (*service_context) = service_context_list[i];
return safe_service_context._retn ();
}
@@ -211,6 +226,13 @@ CORBA::Any *
TAO_ServerRequestInfo::sending_exception (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION
+ && this->reply_status_ != PortableInterceptor::USER_EXCEPTION)
+ {
+ // @@ Need the minor code once it is available.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+ }
+
// The spec says that if it is a user exception which cant be inserted
// then the UNKNOWN exception needs to be thrown with minor code TBD_U.
@@ -246,6 +268,12 @@ CORBA::OctetSeq *
TAO_ServerRequestInfo::object_id (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+// if (this->object_id_.in () == 0)
+// {
+// // @@ Need the minor code once it is available.
+// ACE_THROW_RETURN (CORBA::NO_RESOURCES (), 0);
+// }
+
ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
CORBA::SystemException::_tao_minor_code (
TAO_DEFAULT_MINOR_CODE,
@@ -258,6 +286,12 @@ CORBA::OctetSeq *
TAO_ServerRequestInfo::adapter_id (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+// if (this->adapter_id_.in () == 0)
+// {
+// // @@ Need the minor code once it is available.
+// ACE_THROW_RETURN (CORBA::NO_RESOURCES (), 0);
+// }
+
ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
CORBA::SystemException::_tao_minor_code (
TAO_DEFAULT_MINOR_CODE,
@@ -271,12 +305,8 @@ TAO_ServerRequestInfo::target_most_derived_interface (
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
- CORBA::SystemException::_tao_minor_code (
- TAO_DEFAULT_MINOR_CODE,
- ENOTSUP),
- CORBA::COMPLETED_NO),
- 0);
+ // @@ Need the minor code once it is available.
+ ACE_THROW_RETURN (CORBA::NO_RESOURCES (), 0);
}
CORBA::Policy_ptr
@@ -302,16 +332,12 @@ TAO_ServerRequestInfo::set_slot (PortableInterceptor::SlotId,
}
CORBA::Boolean
-TAO_ServerRequestInfo::target_is_a (const char *,
+TAO_ServerRequestInfo::target_is_a (const char * /* id */,
CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
- CORBA::SystemException::_tao_minor_code (
- TAO_DEFAULT_MINOR_CODE,
- ENOTSUP),
- CORBA::COMPLETED_NO),
- 0);
+ // @@ Need the minor code once it is available.
+ ACE_THROW_RETURN (CORBA::NO_RESOURCES (), 0);
}
void
@@ -322,17 +348,20 @@ TAO_ServerRequestInfo::add_reply_service_context (
ACE_THROW_SPEC ((CORBA::SystemException))
{
// Copy the service context into the list.
- CORBA::ULong len = this->service_context_list_.length ();
+ IOP::ServiceContextList &service_context_list =
+ this->server_request_.service_context ().service_info ();
+
+ CORBA::ULong len = service_context_list.length ();
// First check if a service context with the same ID exists.
for (CORBA::ULong i = 0; i < len; ++i)
{
- if (this->service_context_list_[i].context_id ==
+ if (service_context_list[i].context_id ==
service_context.context_id)
{
if (replace)
{
- this->service_context_list_[i] = service_context;
+ service_context_list[i] = service_context;
return;
}
else
@@ -342,26 +371,9 @@ TAO_ServerRequestInfo::add_reply_service_context (
}
// No service context with the given ID exists so add one.
- this->service_context_list_.length (len + 1);
-
- this->service_context_list_[len] = service_context;
-}
-
-void
-TAO_ServerRequestInfo::exception (CORBA::Exception *exception)
-{
- if (CORBA::SystemException::_downcast (exception) != 0)
- this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
- if (CORBA::UserException::_downcast (exception) != 0)
- this->reply_status_ = PortableInterceptor::USER_EXCEPTION;
-
- this->caught_exception_ = exception;
-}
+ service_context_list.length (len + 1);
-void
-TAO_ServerRequestInfo::request_id (CORBA::ULong request_id)
-{
- this->request_id_ = request_id;
+ service_context_list[len] = service_context;
}
#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PortableServer/ServerRequestInfo.h b/TAO/tao/PortableServer/ServerRequestInfo.h
index f63cc154b1f..1a06b7aa818 100644
--- a/TAO/tao/PortableServer/ServerRequestInfo.h
+++ b/TAO/tao/PortableServer/ServerRequestInfo.h
@@ -1,25 +1,18 @@
// -*- C++ -*-
-//
-// $Id$
-
-//========================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// ServerRequestInfo.h
-//
-// = DESCRIPTION
-// This is the implementation of the
-// PortableInterceptor::ServerRequestInfo interface.
-//
-// = AUTHOR
-// Kirthika Parameswaran <kirthika@cs.wustl.edu>
-// Ossama Othman <ossama@uci.edu>
-//
-//=========================================================================
+//=============================================================================
+/**
+ * @file ServerRequestInfo.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the
+ * PortableInterceptor::ServerRequestInfo interface.
+ *
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
#ifndef TAO_SERVER_REQUEST_INFO_H
#define TAO_SERVER_REQUEST_INFO_H
@@ -47,13 +40,15 @@
#pragma warning(disable:4250)
#endif /* _MSC_VER */
+class TAO_ServerRequest;
+
+
class TAO_PortableServer_Export TAO_ServerRequestInfo
: public virtual PortableInterceptor::ServerRequestInfo,
public virtual CORBA::LocalObject
{
public:
- TAO_ServerRequestInfo (const char *operation,
- IOP::ServiceContextList &service_context_list);
+ TAO_ServerRequestInfo (TAO_ServerRequest &server_request);
virtual CORBA::ULong request_id (
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
@@ -101,7 +96,6 @@ class TAO_PortableServer_Export TAO_ServerRequestInfo
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
ACE_THROW_SPEC ((CORBA::SystemException)) ;
- // Probably the following methods should be delegated to the PICurrent
virtual CORBA::Any * get_slot (
PortableInterceptor::SlotId id,
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
@@ -118,17 +112,17 @@ class TAO_PortableServer_Export TAO_ServerRequestInfo
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
ACE_THROW_SPEC ((CORBA::SystemException));
+ /// This method causes problem since there is no trivial way to
+ /// extract the exception from the Any.
virtual CORBA::Any * sending_exception (
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
ACE_THROW_SPEC ((CORBA::SystemException));
- // This method causes problem since there is no trivial way to
- // extract the exception from the Any.
+ /// Note: This is TAO specific and was done to combat the previous
+ /// problem to some extent.
virtual CORBA::Exception * _sending_exception (
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
ACE_THROW_SPEC ((CORBA::SystemException));
- // Note: This is TAO specific and was done to combat the previous
- // problem to some extent.
virtual CORBA::OctetSeq * object_id (
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
@@ -165,25 +159,33 @@ class TAO_PortableServer_Export TAO_ServerRequestInfo
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ())
ACE_THROW_SPEC ((CORBA::SystemException));
- protected:
+public:
+
+ /// Change the exception status.
void exception (CORBA::Exception *exception);
- // Change the exception status.
- void request_id (CORBA::ULong request_id);
- // Update the request id.
+ /// Set the status of the received reply.
+ void reply_status (PortableInterceptor::ReplyStatus s);
- CORBA::ULong request_id_;
- const char * operation_;
- Dynamic::ParameterList parameter_list_;
- Dynamic::ExceptionList exception_list_;
- Dynamic::ContextList context_list_;
- Dynamic::RequestContext request_context_;
- CORBA::Object_var forward_reference_;
+ /// Extract the forward object reference from the
+ /// PortableInterceptor::ForwardRequest exception, and set the reply
+ /// status flag accordingly.
+ void forward_reference (PortableInterceptor::ForwardRequest &exc);
+
+ /// Set the forward reference associated with the current
+ /// LOCATION_FORWARD reply. This method is only invoked when a
+ /// PortableServer::ForwardRequest exception is thrown by a servant
+ /// manager.
+ void forward_reference (CORBA::Object_ptr obj);
- // Needed to ensure no copy anywhere.
- IOP::ServiceContextList &service_context_list_;
+protected:
+
+ /// Underlying request object that contains much of the information
+ /// encapsulated by this ServerRequestInfo class.
+ TAO_ServerRequest &server_request_;
+
+ CORBA::Object_var forward_reference_;
- CORBA::Any result_val_;
CORBA::OctetSeq_var object_id_;
CORBA::OctetSeq_var adapter_id_;
CORBA::Exception *caught_exception_;
@@ -191,6 +193,10 @@ class TAO_PortableServer_Export TAO_ServerRequestInfo
PortableInterceptor::ReplyStatus reply_status_;
};
+# if defined (__ACE_INLINE__)
+# include "ServerRequestInfo.inl"
+# endif /* __ACE_INLINE__ */
+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/TAO/tao/PortableServer/ServerRequestInfo.inl b/TAO/tao/PortableServer/ServerRequestInfo.inl
new file mode 100644
index 00000000000..994b8529519
--- /dev/null
+++ b/TAO/tao/PortableServer/ServerRequestInfo.inl
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// $Id$
+
+ACE_INLINE void
+TAO_ServerRequestInfo::exception (CORBA::Exception *exception)
+{
+ if (CORBA::SystemException::_downcast (exception) != 0)
+ this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
+ else if (CORBA::UserException::_downcast (exception) != 0)
+ this->reply_status_ = PortableInterceptor::USER_EXCEPTION;
+
+ // @@ Is it possible for both of the above downcasts to fail?
+
+ this->caught_exception_ = exception;
+}
+
+ACE_INLINE void
+TAO_ServerRequestInfo::reply_status (PortableInterceptor::ReplyStatus s)
+{
+ this->reply_status_ = s;
+}
+
+ACE_INLINE void
+TAO_ServerRequestInfo::forward_reference (
+ PortableInterceptor::ForwardRequest &exc)
+{
+ // Note that we're converting the ForwardRequest exception in to a
+ // LOCATION_FORWARD reply, so we do not set the exception status.
+
+ if (exc.permanent)
+ this->reply_status_ =
+ PortableInterceptor::LOCATION_FORWARD_PERMANENT;
+ else
+ this->reply_status_ =
+ PortableInterceptor::LOCATION_FORWARD;
+
+ this->forward_reference_ =
+ CORBA::Object::_duplicate (exc.forward.in ());
+}
+
+ACE_INLINE void
+TAO_ServerRequestInfo::forward_reference (CORBA::Object_ptr obj)
+{
+ // We only get here if a servant manager threw a
+ // PortableServer::ForwardRequest exception.
+
+ // LOCATION_FORWARD_PERMANENT is not supported by TAO, so assume
+ // that a LOCATION_FORWARD reply will be sent.
+ // @@ LOCATION_FORWARD_PERMANENT will apparently be dropped from
+ // future GIOP specifications.
+ this->reply_status_ = PortableInterceptor::LOCATION_FORWARD;
+
+ this->forward_reference_ = CORBA::Object::_duplicate (obj);
+}
diff --git a/TAO/tao/PortableServer/TAO_PortableServer.dsp b/TAO/tao/PortableServer/TAO_PortableServer.dsp
index 96282ecfaa3..863cd084f8b 100644
--- a/TAO/tao/PortableServer/TAO_PortableServer.dsp
+++ b/TAO/tao/PortableServer/TAO_PortableServer.dsp
@@ -426,6 +426,10 @@ SOURCE=.\RTPortableServerC.i
SOURCE=.\Servant_Base.i
# End Source File
+# Begin Source File
+
+SOURCE=.\ServerRequestInfo.inl
+# End Source File
# End Group
# Begin Group "Template Files"
diff --git a/TAO/tao/PortableServer/TAO_PortableServer_Static.dsp b/TAO/tao/PortableServer/TAO_PortableServer_Static.dsp
index 573e49817d9..47c96965968 100644
--- a/TAO/tao/PortableServer/TAO_PortableServer_Static.dsp
+++ b/TAO/tao/PortableServer/TAO_PortableServer_Static.dsp
@@ -163,6 +163,10 @@ SOURCE=.\RTPortableServerC.i
SOURCE=.\Servant_Base.i
# End Source File
+# Begin Source File
+
+SOURCE=.\ServerRequestInfo.inl
+# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/TAO/tao/RequestInfo_Util.cpp b/TAO/tao/RequestInfo_Util.cpp
new file mode 100644
index 00000000000..7c6c79976c1
--- /dev/null
+++ b/TAO/tao/RequestInfo_Util.cpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "RequestInfo_Util.h"
+#include "Any.h"
+#include "StringSeqC.h"
+
+ACE_RCSID (tao, RequestInfo_Util, "$Id$")
+
+Dynamic::ParameterList *
+TAO_RequestInfo_Util::make_parameter_list (CORBA::Environment &ACE_TRY_ENV)
+{
+ Dynamic::ParameterList *parameter_list = 0;
+ ACE_NEW_THROW_EX (parameter_list,
+ Dynamic::ParameterList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return parameter_list;
+}
+
+Dynamic::ExceptionList *
+TAO_RequestInfo_Util::make_exception_list (CORBA::Environment &ACE_TRY_ENV)
+{
+ Dynamic::ExceptionList *exception_list = 0;
+ ACE_NEW_THROW_EX (exception_list,
+ Dynamic::ExceptionList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return exception_list;
+}
+
+Dynamic::ContextList *
+TAO_RequestInfo_Util::make_context_list (CORBA::Environment &ACE_TRY_ENV)
+{
+ Dynamic::ContextList *context_list = 0;
+ ACE_NEW_THROW_EX (context_list,
+ Dynamic::ContextList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return context_list;
+}
+
+Dynamic::RequestContext *
+TAO_RequestInfo_Util::make_request_context (CORBA::Environment &ACE_TRY_ENV)
+{
+ Dynamic::RequestContext *request_context = 0;
+ ACE_NEW_THROW_EX (request_context,
+ Dynamic::RequestContext,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return request_context;
+}
+
+CORBA::Any *
+TAO_RequestInfo_Util::make_any (CORBA::Boolean tk_void_any,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ CORBA::Any *any = 0;
+
+ if (tk_void_any)
+ {
+ CORBA::TypeCode *tc = 0;
+ ACE_NEW_THROW_EX (tc,
+ CORBA::TypeCode (CORBA::tk_void),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::TypeCode_var safe_tc = tc;
+
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any (tc, ACE_TRY_ENV),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // The Any duplicates the TypeCode so there is no problem in
+ // allowing the TypeCode_var to decrement the reference count on
+ // the tk_void TypeCode.
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ }
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return any;
+}
diff --git a/TAO/tao/RequestInfo_Util.h b/TAO/tao/RequestInfo_Util.h
new file mode 100644
index 00000000000..040ec004c47
--- /dev/null
+++ b/TAO/tao/RequestInfo_Util.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file RequestInfo_Util.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_REQUEST_INFO_UTIL_H
+#define TAO_REQUEST_INFO_UTIL_H
+
+#include "ace/pre.h"
+
+#include "corbafwd.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "DynamicC.h"
+
+/**
+ * @class TAO_RequestInfo_Util
+ *
+ * @brief Helper class that provides methods useful for both
+ * PortableInterceptor::ClientRequestInfo and
+ * PortableInterceptor::ServerRequestInfo objects.
+ */
+class TAO_Export TAO_RequestInfo_Util
+{
+public:
+
+ /**
+ * @name Factory Methods
+ *
+ * These are methods called by TAO_{Client,Server}RequestInfo and
+ * their subclasses. Rather than having the same factory code in
+ * each subclass, we factor the common code in to this utility
+ * class.
+ */
+ //@{
+ static Dynamic::ParameterList * make_parameter_list (
+ CORBA::Environment &ACE_TRY_ENV);
+
+ static Dynamic::ExceptionList * make_exception_list (
+ CORBA::Environment &ACE_TRY_ENV);
+
+ static Dynamic::ContextList * make_context_list (
+ CORBA::Environment &ACE_TRY_ENV);
+
+ static Dynamic::RequestContext * make_request_context (
+ CORBA::Environment &ACE_TRY_ENV);
+
+ static CORBA::Any * make_any (CORBA::Boolean tk_void_any,
+ CORBA::Environment &ACE_TRY_ENV);
+ //@}
+
+};
+
+#include "ace/post.h"
+
+#endif /* TAO_REQUEST_INFO_UTIL_H */
diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp
index 6c1c016bc0c..2de73537430 100644
--- a/TAO/tao/TAO.dsp
+++ b/TAO/tao/TAO.dsp
@@ -2646,6 +2646,25 @@ SOURCE=.\Reply_Dispatcher.cpp
# End Source File
# Begin Source File
+SOURCE=.\RequestInfo_Util.cpp
+
+!IF "$(CFG)" == "TAO DLL - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "TAO DLL - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "TAO DLL - Win32 MFC Release"
+
+!ELSEIF "$(CFG)" == "TAO DLL - Win32 MFC Debug"
+
+!ELSEIF "$(CFG)" == "TAO DLL - Win32 Release"
+
+!ELSEIF "$(CFG)" == "TAO DLL - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\Resource_Factory.cpp
!IF "$(CFG)" == "TAO DLL - Win32 Alpha Release"
@@ -4027,6 +4046,10 @@ SOURCE=.\Reply_Dispatcher.h
# End Source File
# Begin Source File
+SOURCE=.\RequestInfo_Util.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Resource_Factory.h
# End Source File
# Begin Source File
diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp
index 9cd6284fded..39f52aad0e1 100644
--- a/TAO/tao/TAO_Server_Request.cpp
+++ b/TAO/tao/TAO_Server_Request.cpp
@@ -64,6 +64,9 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
is_dsi_ (0),
dsi_nvlist_align_ (0),
argument_flag_ (1)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
{
ACE_FUNCTION_TIMEPROBE (TAO_SERVER_REQUEST_START);
// No-op.
@@ -96,6 +99,9 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
is_dsi_ (0),
dsi_nvlist_align_ (0),
argument_flag_ (1)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
{
profile_.object_key (object_key);
parse_error = 0;
diff --git a/TAO/tao/TAO_Server_Request.h b/TAO/tao/TAO_Server_Request.h
index 09818972ee9..74e15982509 100644
--- a/TAO/tao/TAO_Server_Request.h
+++ b/TAO/tao/TAO_Server_Request.h
@@ -1,4 +1,4 @@
-// This may look like C, but it's really -*- C++ -*-
+// -*- C++ -*-
//=============================================================================
/**
@@ -10,9 +10,9 @@
* "Server Request" type.
*
*
- * @author Copyright 1994-1995 by Sun Microsystems, Inc.
- * @author Chris Cleeland.
- * @author Aniruddha Gokhale
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Chris Cleeland
+ * @author Aniruddha Gokhale
*/
//=============================================================================
@@ -21,17 +21,18 @@
#define TAO_GIOP_SERVER_REQUEST_H
#include "ace/pre.h"
-#include "tao/corbafwd.h"
+#include "corbafwd.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/SString.h"
-#include "tao/ORB.h"
-#include "tao/Tagged_Profile.h"
-#include "tao/OctetSeqC.h"
-#include "tao/Service_Context.h"
+
+#include "Tagged_Profile.h"
+#include "OctetSeqC.h"
+#include "Service_Context.h"
+#include "Object.h"
class TAO_Pluggable_Messaging;
class TAO_Transport;
@@ -40,7 +41,7 @@ class TAO_Transport;
* @class TAO_ServerRequest
*
* @brief Class representing a ServerRequest object.
- * DESCRIPTION
+ *
* Encapsulates CDR, transport and pluggable messaging
* components on the server side.
*/
@@ -69,8 +70,10 @@ public:
/// Destructor.
virtual ~TAO_ServerRequest (void);
- // = Request attributes.
-
+ /**
+ * @name Request attributes.
+ */
+ //@{
/// Return the operation name.
const char *operation (void) const;
@@ -83,8 +86,7 @@ public:
/// Return the legnth of the operation.
unsigned int operation_length (void) const;
-
- // = TAO extensions.
+ //@}
/// Return the underlying ORB.
CORBA::ORB_ptr orb (void);
@@ -123,20 +125,33 @@ public:
TAO_ObjectKey &object_key (void);
+ /**
+ * @todo These two methods should go away.
+ */
+ //@{
IOP::ServiceContextList &service_info (void);
void service_info (IOP::ServiceContextList &service_info);
- // @@ The above two should go away...
+ //@}
+ /// Return the TAO_Service_Context
TAO_Service_Context &service_context (void);
- // Return the TAO_Service_Context
+ /// Return the underlying transport
TAO_Transport *transport ();
- // Return the underlying transport
- // To handle System Exceptions at the lowest level,
- // a method returning the request_id_ is needed.
+ /// To handle System Exceptions at the lowest level, a method
+ /// returning the request_id_ is needed.
+ //@{
CORBA::ULong request_id (void);
void request_id (CORBA::ULong req);
+ //@}
+
+ /**
+ * Set the reference to the object the request should be forwarded
+ * to. This reference will only be used if set prior to calling
+ * init_reply().
+ */
+ void forward_location (CORBA::Object_ptr forward_reference);
/// Get the forward_location.
CORBA::Object_ptr forward_location (void);
@@ -147,9 +162,11 @@ public:
/// Set the exception type.
void exception_type (CORBA::ULong except_type);
- /// void requesting_principal (CORBA_Principal_ptr principal);
/// Set the requesting principal.
- /**** Deprecated in CORBA 2.4 *****/
+ /**
+ * @note Deprecated in CORBA 2.4
+ */
+ // void requesting_principal (CORBA_Principal_ptr principal);
/// Set the requesting principal
void requesting_principal (const CORBA_OctetSeq & principal);
@@ -171,6 +188,15 @@ public:
void argument_flag (CORBA::Boolean flag);
CORBA::Boolean argument_flag (void);
+#if TAO_HAS_INTERCEPTORS == 1
+ /// Return a reference to the number of interceptors pushed on to
+ /// the current interceptor flow stack. It is a reference since the
+ /// Portable Interceptor flow stack code must be able to modify this
+ /// value and use that value at a later time without being forced to
+ /// use TSS.
+ size_t &interceptor_count (void);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
private:
TAO_Pluggable_Messaging *mesg_base_;
@@ -212,15 +238,14 @@ private:
/// A pointer to the ORB Core for the context where the request was
/// created.
TAO_ORB_Core *orb_core_;
- // A pointer to the ORB Core for the context where the request was
- // created.
- //IOP::ServiceContextList service_info_;
- // The service context for the request (CORBA Reference?).
+ /// The service context for the request (CORBA Reference?).
+ // IOP::ServiceContextList service_info_;
+ /// Service Context info
TAO_Service_Context service_context_;
- // Service Context info
+ /// Unique identifier for a request.
CORBA::ULong request_id_;
/// The tagged profile that has the addressing information.
@@ -242,10 +267,16 @@ private:
* to the client.
*/
CORBA::Boolean argument_flag_;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// The number of interceptors pushed on to the current interceptor
+ /// flow stack.
+ size_t interceptor_count_;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
};
#if defined (__ACE_INLINE__)
-# include "tao/TAO_Server_Request.i"
+# include "TAO_Server_Request.i"
#endif /* __ACE_INLINE__ */
#include "ace/post.h"
diff --git a/TAO/tao/TAO_Server_Request.i b/TAO/tao/TAO_Server_Request.i
index 58235cdcbda..f757b1cc046 100644
--- a/TAO/tao/TAO_Server_Request.i
+++ b/TAO/tao/TAO_Server_Request.i
@@ -129,6 +129,13 @@ TAO_ServerRequest::profile (void)
return this->profile_;
}
+ACE_INLINE void
+TAO_ServerRequest::forward_location (CORBA::Object_ptr forward_reference)
+{
+ this->forward_location_ =
+ CORBA::Object::_duplicate (forward_reference);
+}
+
ACE_INLINE CORBA::Object_ptr
TAO_ServerRequest::forward_location (void)
{
@@ -170,3 +177,11 @@ TAO_ServerRequest::argument_flag (CORBA::Boolean flag)
{
this->argument_flag_ = flag;
}
+
+#if TAO_HAS_INTERCEPTORS == 1
+ACE_INLINE size_t &
+TAO_ServerRequest::interceptor_count (void)
+{
+ return this->interceptor_count_;
+}
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/TAO_Static.dsp b/TAO/tao/TAO_Static.dsp
index f98b91c293b..c521a63734b 100644
--- a/TAO/tao/TAO_Static.dsp
+++ b/TAO/tao/TAO_Static.dsp
@@ -635,6 +635,10 @@ SOURCE=.\Reply_Dispatcher.h
# End Source File
# Begin Source File
+SOURCE=.\RequestInfo_Util.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Resource_Factory.h
# End Source File
# Begin Source File
@@ -1931,6 +1935,10 @@ SOURCE=.\Reply_Dispatcher.cpp
# End Source File
# Begin Source File
+SOURCE=.\RequestInfo_Util.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Resource_Factory.cpp
# End Source File
# Begin Source File