diff options
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp | 110 | ||||
-rw-r--r-- | TAO/tao/Abstract_Servant_Base.h | 4 | ||||
-rw-r--r-- | TAO/tao/LocalObject.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/LocalObject.h | 5 | ||||
-rw-r--r-- | TAO/tao/Object.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/Object.h | 5 | ||||
-rw-r--r-- | TAO/tao/Object_Proxy_Broker.h | 3 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Active_Object_Map.h | 6 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp | 58 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h | 4 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Servant_Base.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Servant_Base.h | 5 | ||||
-rw-r--r-- | TAO/tao/Remote_Object_Proxy_Broker.cpp | 26 | ||||
-rw-r--r-- | TAO/tao/Remote_Object_Proxy_Broker.h | 3 | ||||
-rw-r--r-- | TAO/tests/OctetSeq/client.cpp | 13 |
19 files changed, 295 insertions, 9 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index ba282dc67b1..1009ec187fe 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -807,6 +807,11 @@ be_interface::gen_operation_table (const char *flat_name, this->skel_count_++; + *os << "{\"_repository_id\", &" << skeleton_class_name + << "::_repository_id_skel, 0}," << be_nl; + + this->skel_count_++; + *os << "};" << be_nl << be_nl; *os << "static const CORBA::Long _tao_" << flat_name << "_optable_size = sizeof (ACE_Hash_Map_Entry<const char *," @@ -962,6 +967,11 @@ be_interface::gen_operation_table (const char *flat_name, this->skel_count_++; + *os << "_repository_id,&" + << skeleton_class_name + << "::_repository_id_skel, 0" << be_nl; + this->skel_count_++; + // Input to the gperf is ready. Run gperf and get things // done. This method also unlinks the temp file that we used // for the gperf. @@ -2452,7 +2462,7 @@ be_interface::session_component_child (void) idl_bool be_interface::is_event_consumer (void) { - return + return this->pd_n_inherits == 1 && ACE_OS::strcmp (this->pd_inherits[0]->full_name (), "Components::EventConsumerBase") == 0; diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp index 1eefb3798e3..ae3e62931aa 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp @@ -202,6 +202,14 @@ be_visitor_component_sh::visit_component (be_component *node) << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; + // Add a skeleton for our _repository_id method. + *os << "static void _repository_id_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + // Add the dispatch method. *os << "virtual void _dispatch (" << be_idt << be_idt_nl << "TAO_ServerRequest &req," << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp index 7b27398cf57..d19c33e49f0 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp @@ -89,7 +89,7 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) base->compute_full_name ("AMH_", "", buf); amh_name += buf; // buf was allocated by ACE_OS::strdup, so we need to use free - // instead of delete. + // instead of delete. ACE_OS::free (buf); if (i != 0) @@ -161,6 +161,14 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; + // Add a skeleton for our _repository_id method. + *os << "static void _repository_id_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *obj," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + // Add the dispatch method. *os << "virtual void _dispatch (" << be_idt << be_idt_nl << "TAO_ServerRequest &req," << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index cee91dbb35b..54d2c0482dd 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -161,7 +161,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) *os << class_name.c_str () << " (const " << class_name.c_str () << "& rhs);" << be_nl << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; - + if (node->is_event_consumer ()) { *os << "// Default implementation of CIAO-specific operation," << be_nl @@ -214,6 +214,15 @@ be_visitor_interface_sh::visit_interface (be_interface *node) << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; + // Add a skeleton for our _repository_id method. + *os << "static void _repository_id_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add the dispatch method. *os << "virtual void _dispatch (" << be_idt << be_idt_nl << "TAO_ServerRequest & req," << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index b5592a4a1e5..e4aa54eb7a8 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -389,6 +389,114 @@ be_visitor_interface_ss::visit_interface (be_interface *node) } + // Generate code for the _repository_id skeleton. + { + auto_ptr<AST_String> s ( + idl_global->gen ()->create_string ( + idl_global->gen ()->create_expr ((idl_uns_long) 0, + AST_Expression::EV_ulong))); + + // @@ Cheat a little by placing a space before the operation name + // to prevent the IDL compiler from interpreting the leading + // underscore as an IDL escape. + Identifier op_name (ACE_OS::strdup (" _repository_id")); + UTL_ScopedName scoped_name (&op_name, 0); + be_operation repository_id (s.get (), + AST_Operation::OP_noflags, + &scoped_name, + node->is_local (), + node->is_abstract ()); + repository_id.set_defined_in (node); + + ACE_CString repository_id_upcall_command_name = + "_repository_id_" + ACE_CString (node_local_name) + "_Upcall_Command" ; + + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit (&repository_id, + full_skel_name, + repository_id_upcall_command_name.c_str ()); + + *os << "void " << full_skel_name + << "::_repository_id_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest & server_request, " << be_nl + << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl + << "void * servant" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_uidt_nl; + *os << "{" << be_idt_nl; + + // Generate exception list. + be_visitor_operation_exceptlist_ss exception_list (this->ctx_); + exception_list.visit_operation (&repository_id); + + be_visitor_operation_ss op_visitor (this->ctx_); + + *os << "TAO::SArg_Traits< "; + + op_visitor.gen_arg_template_param_name (&repository_id, + s.get (), + os); + + *os << ">::ret_val retval;"; + + op_visitor.gen_skel_body_arglist (&repository_id, + os); + + *os << be_nl << be_nl + << "TAO::Argument * const args[] =" << be_idt_nl + << "{" << be_idt_nl + << "&retval" + << be_uidt_nl + << "};" << be_uidt_nl << be_nl; + + *os << "static size_t const nargs = 1;" << be_nl << be_nl; + + // Get the right object implementation. + *os << full_skel_name << " * const impl =" << be_idt_nl + << "static_cast<" + << full_skel_name << " *> (servant);" + << be_uidt_nl; + + // Upcall_Command instantiation. + *os << be_nl + << repository_id_upcall_command_name.c_str() << " command (" + << be_idt_nl << "impl"; + + if (!repository_id.void_return_type () + || repository_id.argument_count () > 0) + { + // server_request.operation_details () will be non-zero in the + // thru-POA collocation case. Use them if available. + *os << "," << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + *os << "server_request.operation_details ()," << be_nl; + + *os << "args"; + } + + *os << ");" << be_uidt_nl << be_nl; + + *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl + << "upcall_wrapper.upcall (server_request" << be_nl + << " , args" << be_nl + << " , nargs" << be_nl + << " , command" + << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl + << " , servant_upcall" << be_nl + << " , exceptions" << be_nl + << " , nexceptions" + << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl + << " ACE_ENV_ARG_PARAMETER);" << be_nl + << "ACE_CHECK;" << be_nl; + + this->generate_send_reply (os); + + *os << be_uidt_nl + << "}" << be_nl << be_nl; + + } + *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; @@ -590,7 +698,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "{" << be_idt_nl; *os << "return \"" << node->repoID () << "\";" << be_uidt_nl; *os << "}"; - + if (node->is_event_consumer ()) { *os << be_nl << be_nl diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index cc90e58c7c7..bb2339518ec 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -95,6 +95,10 @@ public: virtual CORBA::Object_ptr _get_component ( ACE_ENV_SINGLE_ARG_DECL) = 0; + /// Default @c_repository_id + virtual char * _repository_id ( + ACE_ENV_SINGLE_ARG_DECL) = 0; + //@{ /** * @name Reference Counting Operations diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp index 2295556f9ed..39d370f23be 100644 --- a/TAO/tao/LocalObject.cpp +++ b/TAO/tao/LocalObject.cpp @@ -138,6 +138,14 @@ CORBA::LocalObject::_get_component (ACE_ENV_SINGLE_ARG_DECL) 0); } +char * +CORBA::LocalObject::_repository_id (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8, + CORBA::COMPLETED_NO), + 0); +} + CORBA::InterfaceDef_ptr CORBA::LocalObject::_get_interface (ACE_ENV_SINGLE_ARG_DECL) { diff --git a/TAO/tao/LocalObject.h b/TAO/tao/LocalObject.h index 7e7c8e59349..e7c3c8dce70 100644 --- a/TAO/tao/LocalObject.h +++ b/TAO/tao/LocalObject.h @@ -89,6 +89,11 @@ namespace CORBA ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ); + /// Get the repository id. + virtual char * _repository_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ); + virtual void _create_request (CORBA::Context_ptr ctx, const char * operation, CORBA::NVList_ptr arg_list, diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 7982927cca4..37c9a8008bc 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -508,6 +508,13 @@ CORBA::Object::_get_component (ACE_ENV_SINGLE_ARG_DECL) ACE_ENV_ARG_PARAMETER); } +char* +CORBA::Object::_repository_id (ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_OBJECT_IOR_EVALUATE_RETURN; + return this->proxy_broker_->_repository_id (this + ACE_ENV_ARG_PARAMETER); +} #endif /* TAO_HAS_MINIMUM_CORBA */ diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index 051065a4931..cad1d111e00 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -173,6 +173,11 @@ namespace CORBA ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ); + /// Get the repository id. + virtual char * _repository_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ); + // DII operations to create a request. // // The mapping for create_request is split into two forms, diff --git a/TAO/tao/Object_Proxy_Broker.h b/TAO/tao/Object_Proxy_Broker.h index de46ccee6e1..1d1e35f0c1a 100644 --- a/TAO/tao/Object_Proxy_Broker.h +++ b/TAO/tao/Object_Proxy_Broker.h @@ -72,6 +72,9 @@ namespace TAO virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target ACE_ENV_ARG_DECL) = 0; + virtual char * _repository_id (CORBA::Object_ptr target + ACE_ENV_ARG_DECL) = 0; + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; } diff --git a/TAO/tao/PortableServer/Active_Object_Map.h b/TAO/tao/PortableServer/Active_Object_Map.h index c595ad40c44..9cc254b555a 100644 --- a/TAO/tao/PortableServer/Active_Object_Map.h +++ b/TAO/tao/PortableServer/Active_Object_Map.h @@ -16,14 +16,12 @@ #include /**/ "ace/pre.h" -#include "portableserver_export.h" +#include "Key_Adapters.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Key_Adapters.h" - #include "ace/Map_T.h" #include "tao/Server_Strategy_Factory.h" #include "Servant_Base.h" @@ -42,7 +40,7 @@ struct TAO_Active_Object_Map_Entry; * * Implementation to be used by the POA. */ -class TAO_PortableServer_Export TAO_Active_Object_Map +class TAO_Active_Object_Map { public: diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp index a7ae6c96578..b42eb4c6d23 100644 --- a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp +++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp @@ -19,6 +19,64 @@ ACE_RCSID (PortableServer, namespace TAO { + char * + Collocated_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target + ACE_ENV_ARG_DECL) + { + TAO_Stub *stub = target->_stubobj (); + char * _tao_retval = 0; + + ACE_TRY + { + // Which collocation strategy should we use? + if (stub != 0 && + stub->servant_orb_var ()->orb_core () + ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA) + { + TAO::Portable_Server::Servant_Upcall servant_upcall ( + stub->servant_orb_var ()->orb_core () + ); + + CORBA::Object_var forward_to; + servant_upcall.prepare_for_upcall ( + stub->profile_in_use ()->object_key (), + "_repository_id", + forward_to.out () + ACE_ENV_ARG_PARAMETER + ); + ACE_TRY_CHECK; + + _tao_retval = + servant_upcall.servant ()->_repository_id ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); + ACE_TRY_CHECK; + } + // Direct collocation strategy is used. + else if (target->_servant () != 0) + { + _tao_retval = + target->_servant ()->_repository_id ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); + ACE_TRY_CHECK; + } + } + ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex) + { + // Ignore this exception. + } + ACE_CATCHANY + { + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (_tao_retval); + + return _tao_retval; + } + + CORBA::Boolean Collocated_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target, const char *type_id diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h index 67ff38055c0..4e56080e9bc 100644 --- a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h +++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h @@ -58,6 +58,10 @@ namespace TAO virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target ACE_ENV_ARG_DECL); + + virtual char * _repository_id (CORBA::Object_ptr target + ACE_ENV_SINGLE_ARG_DECL); + #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 6b8c57945d8..7554888a09e 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -121,6 +121,12 @@ TAO_ServantBase::_get_component (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) return CORBA::Object::_nil (); } +char * +TAO_ServantBase::_repository_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) +{ + return CORBA::string_dup (this->_interface_repository_id ()); +} + int TAO_ServantBase::_find (const char *opname, TAO_Skeleton& skelfunc, diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 3b1366ee9a4..4a3551cee74 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -87,6 +87,11 @@ public: ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ); + /// Get the repository id. + virtual char * _repository_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ); + /// This is an auxiliary method for _this() and _narrow(). virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL); diff --git a/TAO/tao/Remote_Object_Proxy_Broker.cpp b/TAO/tao/Remote_Object_Proxy_Broker.cpp index 0cb98e0f718..e1ebf834e09 100644 --- a/TAO/tao/Remote_Object_Proxy_Broker.cpp +++ b/TAO/tao/Remote_Object_Proxy_Broker.cpp @@ -14,6 +14,30 @@ ACE_RCSID (tao, namespace TAO { + char * + Remote_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target + ACE_ENV_ARG_DECL) + { + TAO::Arg_Traits< ::CORBA::Char *>::ret_val _tao_retval; + + TAO::Argument *_tao_signature [] = + { + &_tao_retval + }; + + TAO::Invocation_Adapter _tao_call (target, + _tao_signature, + 1, + "_repository_id", + 14, + 0); + + _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (_tao_retval.excp ()); + + return _tao_retval.retn (); + } + CORBA::Boolean Remote_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target, const char *type_id @@ -89,7 +113,7 @@ namespace TAO ACE_CHECK_RETURN (_tao_retval.excp ()); return _tao_retval.retn (); -} + } CORBA::InterfaceDef_ptr Remote_Object_Proxy_Broker::_get_interface (CORBA::Object_ptr target diff --git a/TAO/tao/Remote_Object_Proxy_Broker.h b/TAO/tao/Remote_Object_Proxy_Broker.h index ed94ddd4473..9541b56abdb 100644 --- a/TAO/tao/Remote_Object_Proxy_Broker.h +++ b/TAO/tao/Remote_Object_Proxy_Broker.h @@ -59,6 +59,9 @@ namespace TAO virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target ACE_ENV_ARG_DECL); + + virtual char * _repository_id (CORBA::Object_ptr target + ACE_ENV_ARG_DECL); #endif /* TAO_HAS_MINIMUM_CORBA == 0 */ }; diff --git a/TAO/tests/OctetSeq/client.cpp b/TAO/tests/OctetSeq/client.cpp index b8163e4babf..8bc55689db4 100644 --- a/TAO/tests/OctetSeq/client.cpp +++ b/TAO/tests/OctetSeq/client.cpp @@ -4,6 +4,7 @@ #include "ace/ACE.h" #include "testC.h" #include "ace/OS_NS_time.h" +#include "ace/OS_NS_string.h" ACE_RCSID(OctetSeq, client, "$Id$") @@ -81,6 +82,18 @@ main (int argc, char *argv[]) 1); } + CORBA::String_var repository_id = + server->_repository_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (ACE_OS::strcmp (repository_id.in (), "IDL:Test/Database:1.0") != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Repository id is wrong <%s>\n", + repository_id.in ()), + 1); + } + if (seed == 0) { seed = ACE_OS::time (0); |