diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-02-05 20:06:18 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-02-05 20:06:18 +0000 |
commit | 88dc5a291c5e35273953dfaa3a7d5079fb759b75 (patch) | |
tree | 3268833ef0d95afccce4f3349ce91a4e70781be6 | |
parent | 9c2fa3261306f844f05a977d3c50f409af6355df (diff) | |
download | ATCD-88dc5a291c5e35273953dfaa3a7d5079fb759b75.tar.gz |
ChangeLogTag:Mon Feb 05 11:53:56 2001 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 69 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trading_Loader.cpp | 33 | ||||
-rw-r--r-- | TAO/tao/Interceptor_List.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 11 | ||||
-rw-r--r-- | TAO/tao/PortableInterceptor.pidl | 12 | ||||
-rw-r--r-- | TAO/tao/Profile.i | 1 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp | 7 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp | 11 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Benchmark/client.cpp | 18 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp | 335 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Benchmark/server.cpp | 23 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Dynamic/client.cpp | 19 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp | 200 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Dynamic/server.cpp | 22 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h | 8 |
16 files changed, 507 insertions, 267 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 2b346666e67..2c66572d9b0 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,72 @@ +Mon Feb 05 11:53:56 2001 Ossama Othman <ossama@uci.edu> + + * tao/PortableInterceptor.pidl: + Removed backslashes from comments. Some compilers cannot handle + them. + + * tao/Interceptor_List.cpp (add_interceptor): + + Removed comment about duplicating the interceptor reference + passed in to the method. The code does the right thing by + duplicating the reference. + + * tao/ORB_Core.cpp (create_stub_object): + + Removed useless call to TAO_Profile::the_stub(). It sets the + TAO_Stub pointer associated with the profile, yet the stub hasn't + been initialized at this point in the code. The stub pointer is + set in each profile in the TAO_Stub constructor anyway. + + (init): + + Added missing ACE_CHECK_RETURN after call to RT_ORB_init(). + + * tao/Profile.i (TAO_Profile): + + Initialize the stub_ pointer member to zero in the base member + initializer list. Previously it was not initialized. + + * orbsvcs/orbsvcs/Naming/Naming_Loader.cpp (init): + + Added missing ACE_TRY_CHECK after call to ORB_init(). + + * orbsvcs/orbsvcs/Trader/Trading_Loader.cpp (TAO_Trading_Loader): + + Fallback on IP address if hostname lookup fails. + + (init): + + Fixed mismatched ACE_CHECK_RETURN inside ACE_TRY block. + ACE_TRY_CHECK is the proper macro. + + (bootstrap_to_federation): + + Added missing CORBA::Environment argument and the accompanying + ACE_CHECK_RETURN to the resolve_initial_references() call. + + * tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp + (post_init): + * tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp + (post_init): + * tests/Portable_Interceptors/Benchmark/interceptors.cpp: + * tests/Portable_Interceptors/Dynamic/interceptors.cpp: + * tests/Portable_Interceptors/Dynamic/client.cpp (main): + + Fixed memory leaks. + + Added missing ACE_CHECKs. + + * tests/Portable_Interceptors/Dynamic/server.cpp (main): + + Added missing ACE_TRY_CHECKs. + + Fixed mismatched use of ACE_CHECK_RETURN within an ACE_TRY + block. + + * tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h: + + Corrected class description. + Mon Feb 5 09:12:00 2001 Ossama Othman <ossama@uci.edu> * docs/Options.html: diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp index a203e3c1e8d..1e434b76c1d 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Loader.cpp @@ -37,12 +37,12 @@ TAO_Naming_Loader::init (int argc, char *argv[]) // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, ACE_TRY_ENV); + ACE_TRY_CHECK; // This function call initializes the Naming Service CORBA::Object_var object = this->create_object (orb.in (), argc, argv, ACE_TRY_ENV); ACE_TRY_CHECK; - } ACE_CATCHANY { diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trading_Loader.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trading_Loader.cpp index 74a27ebc6c6..1c0701fecfc 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trading_Loader.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trading_Loader.cpp @@ -26,17 +26,28 @@ TAO_Trading_Loader::TAO_Trading_Loader (void) ior_output_file_ (0), bootstrapper_ (0) { - char *trader_name = - CORBA::string_alloc (MAXHOSTNAMELEN + 10); + char *trader_name = CORBA::string_alloc (MAXHOSTNAMELEN + 10); if (trader_name != 0) { // The trader name is the concatenation of the local host name // and the server's process id. - char host_name[MAXHOSTNAMELEN]; + char host_name[MAXHOSTNAMELEN + 1]; ACE_INET_Addr localhost ((u_short) 0); - localhost.get_host_name (host_name, - MAXHOSTNAMELEN); + if (localhost.get_host_name (host_name, + sizeof (host_name) != 0)) + { + const char *tmp = addr.get_host_addr (); + if (tmp == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\n\nTAO Trading Service (%P|%t) ") + ACE_TEXT ("TAO_Trading_Loader ") + ACE_TEXT ("- %p\n\n"), + ACE_TEXT ("cannot determine hostname"))); + else + ACE_OS::strcpy (host_name, tmp); + } + ACE_OS::sprintf (trader_name, "%s_%ld", host_name, @@ -70,7 +81,7 @@ TAO_Trading_Loader::init (int argc, char *argv[]) this->orb_manager_.init (argc, argv, ACE_TRY_ENV); - ACE_CHECK_RETURN (-1); + ACE_TRY_CHECK; CORBA::ORB_var orb = this->orb_manager_.orb (); @@ -84,7 +95,7 @@ TAO_Trading_Loader::init (int argc, char *argv[]) ACE_CATCHANY { // @@ Should we log this??? - // return -1; + return -1; } ACE_ENDTRY; return 0; @@ -189,8 +200,7 @@ TAO_Trading_Loader::create_object (CORBA::ORB_ptr orb_ptr, // Create a Trader Object and set its Service Type Repository. auto_ptr<TAO_Trader_Factory::TAO_TRADER> auto_trader (TAO_Trader_Factory::create_trader (argc, argv)); - this->trader_ = - auto_trader; + this->trader_ = auto_trader; TAO_Support_Attributes_i &sup_attr = this->trader_->support_attributes (); @@ -237,7 +247,7 @@ TAO_Trading_Loader::create_object (CORBA::ORB_ptr orb_ptr, else this->init_multicast_server (); - return 0; + return CORBA::Object::_nil (); } int @@ -251,7 +261,8 @@ TAO_Trading_Loader::bootstrap_to_federation (CORBA::Environment &ACE_TRY_ENV) ACE_DEBUG ((LM_DEBUG, "*** Bootstrapping to another Trading Service.\n")); CORBA::Object_var trading_obj = - orb->resolve_initial_references ("TradingService"); + orb->resolve_initial_references ("TradingService", ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); if (CORBA::is_nil (trading_obj.in ())) ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/tao/Interceptor_List.cpp b/TAO/tao/Interceptor_List.cpp index fa010b87450..b69b6b5ed11 100644 --- a/TAO/tao/Interceptor_List.cpp +++ b/TAO/tao/Interceptor_List.cpp @@ -128,7 +128,6 @@ TAO_ClientRequestInterceptor_List::add_interceptor ( ACE_TRY_ENV); ACE_CHECK; - // @@ Should we duplicate the reference here? this->interceptors_[index] = PortableInterceptor::ClientRequestInterceptor::_duplicate (interceptor); } @@ -175,7 +174,6 @@ TAO_ServerRequestInterceptor_List::add_interceptor ( ACE_TRY_ENV); ACE_CHECK; - // @@ Should we duplicate the reference here? this->interceptors_[index] = PortableInterceptor::ServerRequestInterceptor::_duplicate (interceptor); } @@ -224,7 +222,6 @@ TAO_IORInterceptor_List::add_interceptor ( ACE_TRY_ENV); ACE_CHECK; - // @@ Should we duplicate the reference here? this->interceptors_[index] = PortableInterceptor::IORInterceptor::_duplicate (interceptor); } diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 2d4aa73212a..551336efed7 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -258,6 +258,8 @@ TAO_ORB_Core::~TAO_ORB_Core (void) #endif /* TAO_HAS_RT_CORBA == 1 */ delete this->transport_sync_strategy_; + + ACE_DEBUG ((LM_DEBUG, "******************** YESH! ***************\n")); } int @@ -1085,8 +1087,11 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) this->has_shutdown_ = 0; #if (TAO_HAS_RT_CORBA == 1) - // check RT ORB options - if (this->RT_ORB_init (argc, argv, ACE_TRY_ENV) != 0) + // Check RT ORB options. + int rt_result = this->RT_ORB_init (argc, argv, ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (rt_result != 0) return -1; #endif /* TAO_HAS_RT_CORBA */ @@ -1575,6 +1580,7 @@ TAO_ORB_Core::root_poa (CORBA::Environment &ACE_TRY_ENV) this->root_poa_ = poa_adapter->root (); this->adapter_registry_.insert (poa_adapter, ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); return CORBA::Object::_duplicate (this->root_poa_.in ()); } @@ -1668,7 +1674,6 @@ TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key, { // Get the ith profile profile = mp.get_profile (i); - profile->the_stub (stub); profile->policies (policy_list); } } diff --git a/TAO/tao/PortableInterceptor.pidl b/TAO/tao/PortableInterceptor.pidl index 1d0d0d08cfa..766e604acae 100644 --- a/TAO/tao/PortableInterceptor.pidl +++ b/TAO/tao/PortableInterceptor.pidl @@ -8,12 +8,12 @@ // The command used to generate code is: // // tao_idl -// -Ge 1 \ -// -DCORBA3 \ -// -Wb,export_macro=TAO_Export \ -// -Wb,export_include="tao/corbafwd.h" \ -// -Wb,pre_include="ace/pre.h" \ -// -Wb,post_include="ace/post.h" \ +// -Ge 1 +// -DCORBA3 +// -Wb,export_macro=TAO_Export +// -Wb,export_include="tao/corbafwd.h" +// -Wb,pre_include="ace/pre.h" +// -Wb,post_include="ace/post.h" // PortableInterceptor.pidl // // Patches for changes to the generated code are available in the diff --git a/TAO/tao/Profile.i b/TAO/tao/Profile.i index 0d6abd3d5a6..5fa01edfba2 100644 --- a/TAO/tao/Profile.i +++ b/TAO/tao/Profile.i @@ -7,6 +7,7 @@ TAO_Profile::TAO_Profile (CORBA::ULong tag, const TAO_GIOP_Version &version) : version_ (version), are_policies_parsed_ (0), + stub_ (0), policy_list_ (0), tag_ (tag), orb_core_ (orb_core), diff --git a/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp index ae671ae281c..7a1d81fa95e 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp @@ -68,10 +68,7 @@ Client_ORBInitializer::post_init ( PortableInterceptor::ClientRequestInterceptor_var interceptor = tmp; - info->add_client_request_interceptor (interceptor.in () - TAO_ENV_ARG_PARAMETER); + info->add_client_request_interceptor (interceptor.in (), + ACE_TRY_ENV); ACE_CHECK; - - // Transfer ownership to the ORB. - (void) interceptor._retn (); } diff --git a/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp index 57b0c5c7974..7c0e609f4a5 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/Server_ORBInitializer.cpp @@ -7,7 +7,9 @@ #include "Interceptor_Type.h" #include "interceptors.h" -ACE_RCSID (Benchmark, Server_ORBInitializer, "$Id$") +ACE_RCSID (Benchmark, + Server_ORBInitializer, + "$Id$") Server_ORBInitializer::Server_ORBInitializer (int interceptor_type) : interceptor_type_ (interceptor_type) @@ -68,10 +70,7 @@ Server_ORBInitializer::post_init ( PortableInterceptor::ServerRequestInterceptor_var interceptor = tmp; - info->add_server_request_interceptor (interceptor.in () - TAO_ENV_ARG_PARAMETER); + info->add_server_request_interceptor (interceptor.in (), + ACE_TRY_ENV); ACE_CHECK; - - // Transfer ownership to the ORB. - (void) interceptor._retn (); } diff --git a/TAO/tests/Portable_Interceptors/Benchmark/client.cpp b/TAO/tests/Portable_Interceptors/Benchmark/client.cpp index 2c194ab5411..a525fe587a0 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/client.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/client.cpp @@ -8,7 +8,9 @@ #include "ace/Get_Opt.h" #include "ace/OS.h" -ACE_RCSID (Benchmark, client, "$Id$") +ACE_RCSID (Benchmark, + client, + "$Id$") const char *ior = "file://test.ior"; int niterations = 5; @@ -49,8 +51,8 @@ void run_test (Test_Interceptors::Secure_Vault_ptr server, CORBA::Environment &ACE_TRY_ENV) { - int i=0; - const char user [BUFSIZ] = "root"; + int i = 0; + const char user[] = "root"; Marker marker; ACE_Throughput_Stats throughput; @@ -150,9 +152,9 @@ run_test (Test_Interceptors::Secure_Vault_ptr server, ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i)); } + marker.dump_stats ("update records method ", gsf, 3); ACE_CHECK; - } @@ -196,9 +198,6 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; - // Transfer ownership to the ORB. - (void) initializer._retn (); - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -211,7 +210,8 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; Test_Interceptors::Secure_Vault_var server = - Test_Interceptors::Secure_Vault::_narrow (object.in (), ACE_TRY_ENV); + Test_Interceptors::Secure_Vault::_narrow (object.in (), + ACE_TRY_ENV); ACE_TRY_CHECK; if (CORBA::is_nil (server.in ())) @@ -236,7 +236,7 @@ main (int argc, char *argv[]) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Catched exception:"); + "Caught exception:"); return 1; } ACE_ENDTRY; diff --git a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp b/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp index 23d438499d6..c4a74028a82 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp @@ -2,7 +2,9 @@ #include "interceptors.h" -ACE_RCSID(Benchmark, interceptors, "$Id$") +ACE_RCSID (Benchmark, + interceptors, + "$Id$") const CORBA::ULong request_ctx_id = 0xdead; //const CORBA::ULong reply_ctx_id = 0xbeef; // Never used. @@ -49,18 +51,23 @@ Vault_Client_Request_Interceptor::send_poll ( void Vault_Client_Request_Interceptor::send_request ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { - if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0) + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) { - // MAke the context to send the context to the target + // Make the context to send the context to the target. IOP::ServiceContext sc; sc.context_id = request_ctx_id; - const char passwd [20] = "root123"; - CORBA::ULong string_len = ACE_OS::strlen (passwd) + 1; + const char passwd[] = "root123"; + CORBA::ULong string_len = sizeof (passwd) + 1; CORBA::Octet *buf = 0; ACE_NEW (buf, CORBA::Octet [string_len]); @@ -69,30 +76,43 @@ Vault_Client_Request_Interceptor::send_request ( sc.context_data.replace (string_len, string_len, buf, 1); // Add this context to the service context list. - ri->add_request_service_context (sc, 0); + ri->add_request_service_context (sc, 0, ACE_TRY_ENV); + ACE_CHECK; } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + Test_Interceptors::Secure_Vault::Record *record; CORBA::Long id; - paramlist[0].argument >>= id; - paramlist[1].argument >>= record; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; } } void Vault_Client_Request_Interceptor::receive_reply ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { CORBA::Long result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } } @@ -108,14 +128,14 @@ Vault_Client_Request_Interceptor::receive_other ( void Vault_Client_Request_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr rinfo + PortableInterceptor::ClientRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { TAO_ENV_ARG_DEFN; - CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV); + CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV); ACE_CHECK; CORBA::TypeCode_var tc = any->type (); @@ -124,11 +144,14 @@ Vault_Client_Request_Interceptor::receive_exception ( ACE_CHECK; CORBA::String_var exception_id = - rinfo->received_exception_id (ACE_TRY_ENV); + ri->received_exception_id (ACE_TRY_ENV); + ACE_CHECK; if (ACE_OS::strcmp (id, exception_id.in ()) != 0) - ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n", - id, exception_id.in ())); + ACE_ERROR ((LM_ERROR, + "Mismatched exception IDs: %s != %s\n", + id, + exception_id.in ())); } @@ -163,6 +186,16 @@ Vault_Server_Request_Interceptor::name (TAO_ENV_SINGLE_ARG_DECL_NOT_USED) } void +Vault_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void Vault_Server_Request_Interceptor::receive_request ( PortableInterceptor::ServerRequestInfo_ptr ri TAO_ENV_ARG_DECL) @@ -171,52 +204,57 @@ Vault_Server_Request_Interceptor::receive_request ( { TAO_ENV_ARG_DEFN; - if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0) - { + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; - IOP::ServiceId id = request_ctx_id; - IOP::ServiceContext *sc = ri->get_request_service_context (id); + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) + { + IOP::ServiceId id = request_ctx_id; + IOP::ServiceContext_var sc = + ri->get_request_service_context (id, ACE_TRY_ENV); + ACE_CHECK; - if (sc == 0) - ACE_THROW (CORBA::NO_MEMORY ()); + const char *buf = + ACE_reinterpret_cast (const char *, + sc->context_data.get_buffer ()); - const char *buf = ACE_reinterpret_cast (const char *, - sc->context_data.get_buffer ()); - if (ACE_OS::strcmp (buf, "root123") != 0) - ACE_THROW (CORBA::NO_PERMISSION ()); + if (ACE_OS::strcmp (buf, "root123") != 0) + ACE_THROW (CORBA::NO_PERMISSION ()); } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + Test_Interceptors::Secure_Vault::Record *record; CORBA::Long id; - paramlist[0].argument >>= id; - paramlist[1].argument >>= record; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; } } void -Vault_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void Vault_Server_Request_Interceptor::send_reply ( PortableInterceptor::ServerRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { CORBA::Long result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } } @@ -286,25 +324,31 @@ Vault_Client_Request_Context_Interceptor::send_poll ( void Vault_Client_Request_Context_Interceptor::send_request ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { + TAO_ENV_ARG_DEFN; + // MAke the context to send the context to the target IOP::ServiceContext sc; sc.context_id = request_ctx_id; - const char passwd [20] = "root123"; - CORBA::ULong string_len = ACE_OS::strlen (passwd) + 1; + const char passwd[] = "root123"; + CORBA::ULong string_len = sizeof (passwd) + 1; CORBA::Octet *buf = 0; - ACE_NEW (buf, - CORBA::Octet [string_len]); + ACE_NEW_THROW_EX (buf, + CORBA::Octet [string_len], + CORBA::NO_MEMORY ()); + ACE_CHECK; + ACE_OS::strcpy (ACE_reinterpret_cast (char *, buf), passwd); sc.context_data.replace (string_len, string_len, buf, 1); // Add this context to the service context list. - ri->add_request_service_context (sc, 0); + ri->add_request_service_context (sc, 0, ACE_TRY_ENV); + ACE_CHECK; } void @@ -328,14 +372,14 @@ Vault_Client_Request_Context_Interceptor::receive_reply ( void Vault_Client_Request_Context_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr rinfo + PortableInterceptor::ClientRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { TAO_ENV_ARG_DEFN; - CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV); + CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV); ACE_CHECK; CORBA::TypeCode_var tc = any->type (); @@ -344,11 +388,14 @@ Vault_Client_Request_Context_Interceptor::receive_exception ( ACE_CHECK; CORBA::String_var exception_id = - rinfo->received_exception_id (ACE_TRY_ENV); + ri->received_exception_id (ACE_TRY_ENV); + ACE_CHECK; if (ACE_OS::strcmp (id, exception_id.in ()) != 0) - ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n", - id, exception_id.in ())); + ACE_ERROR ((LM_ERROR, + "Mismatched exception IDs %s != %s\n", + id, + exception_id.in ())); } @@ -384,6 +431,16 @@ Vault_Server_Request_Context_Interceptor::name ( } void +Vault_Server_Request_Context_Interceptor::receive_request_service_contexts( + PortableInterceptor::ServerRequestInfo_ptr + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + // Do nothing +} + +void Vault_Server_Request_Context_Interceptor::receive_request ( PortableInterceptor::ServerRequestInfo_ptr ri TAO_ENV_ARG_DECL) @@ -393,28 +450,18 @@ Vault_Server_Request_Context_Interceptor::receive_request ( TAO_ENV_ARG_DEFN; IOP::ServiceId id = request_ctx_id; - IOP::ServiceContext *sc = ri->get_request_service_context (id); - - if (sc == 0) - ACE_THROW (CORBA::NO_MEMORY ()); + IOP::ServiceContext_var sc = + ri->get_request_service_context (id, ACE_TRY_ENV); + ACE_CHECK; const char *buf = ACE_reinterpret_cast (const char *, sc->context_data.get_buffer ()); + if (ACE_OS::strcmp (buf, "root123") !=0) ACE_THROW (CORBA::NO_PERMISSION ()); } void -Vault_Server_Request_Context_Interceptor::receive_request_service_contexts( - PortableInterceptor::ServerRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Do nothing -} - -void Vault_Server_Request_Context_Interceptor::send_reply ( PortableInterceptor::ServerRequestInfo_ptr TAO_ENV_ARG_DECL_NOT_USED) @@ -487,46 +534,71 @@ Vault_Client_Request_Dynamic_Interceptor::send_poll ( void Vault_Client_Request_Dynamic_Interceptor::send_request ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { - if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0) + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + const char *user; - paramlist[0].argument >>= user; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= user; } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_CHECK); + ACE_CHECK; + Test_Interceptors::Secure_Vault::Record *record; CORBA::Long id; - paramlist[0].argument >>= id; - paramlist[1].argument >>= record; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; } } void Vault_Client_Request_Dynamic_Interceptor::receive_reply ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_ENV_ARG_DEFN; - if (ACE_OS::strcmp (ri->operation (), "ready") == 0) + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "ready") == 0) { CORBA::Short result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { CORBA::Long result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } } @@ -542,14 +614,14 @@ Vault_Client_Request_Dynamic_Interceptor::receive_other ( void Vault_Client_Request_Dynamic_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr rinfo + PortableInterceptor::ClientRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { TAO_ENV_ARG_DEFN; - CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV); + CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV); ACE_CHECK; CORBA::TypeCode_var tc = any->type (); @@ -558,11 +630,14 @@ Vault_Client_Request_Dynamic_Interceptor::receive_exception ( ACE_CHECK; CORBA::String_var exception_id = - rinfo->received_exception_id (ACE_TRY_ENV); + ri->received_exception_id (ACE_TRY_ENV); + ACE_CHECK; if (ACE_OS::strcmp (id, exception_id.in ()) != 0) - ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n", - id, exception_id.in ())); + ACE_ERROR ((LM_ERROR, + "Mismatched exception IDs %s != %s\n", + id, + exception_id.in ())); } @@ -600,24 +675,39 @@ Vault_Server_Request_Dynamic_Interceptor::name ( void Vault_Server_Request_Dynamic_Interceptor::receive_request ( PortableInterceptor::ServerRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { - if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0) + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "authenticate") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + const char *user; - paramlist[0].argument >>= user; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= user; } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + Test_Interceptors::Secure_Vault::Record *record; CORBA::Long id; - paramlist[0].argument >>= id; - paramlist[1].argument >>= record; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= id; + paramlist[i].argument >>= record; } } @@ -634,22 +724,30 @@ Vault_Server_Request_Dynamic_Interceptor::receive_request_service_contexts( void Vault_Server_Request_Dynamic_Interceptor::send_reply ( PortableInterceptor::ServerRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_ENV_ARG_DEFN; - if (ACE_OS::strcmp (ri->operation (), "ready") == 0) + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + if (ACE_OS::strcmp (op.in (), "ready") == 0) { CORBA::Short result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } - if (ACE_OS::strcmp (ri->operation (), "update_records") == 0) + if (ACE_OS::strcmp (op.in (), "update_records") == 0) { CORBA::Long result; - CORBA_Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; } } @@ -664,10 +762,10 @@ Vault_Server_Request_Dynamic_Interceptor::send_exception ( void Vault_Server_Request_Dynamic_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) + PortableInterceptor::ServerRequestInfo_ptr + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) { // Do Nothing } @@ -744,14 +842,14 @@ Vault_Client_Request_NOOP_Interceptor::receive_reply ( void Vault_Client_Request_NOOP_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr rinfo + PortableInterceptor::ClientRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { TAO_ENV_ARG_DEFN; - CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV); + CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV); ACE_CHECK; CORBA::TypeCode_var tc = any->type (); @@ -760,11 +858,14 @@ Vault_Client_Request_NOOP_Interceptor::receive_exception ( ACE_CHECK; CORBA::String_var exception_id = - rinfo->received_exception_id (ACE_TRY_ENV); + ri->received_exception_id (ACE_TRY_ENV); + ACE_CHECK; if (ACE_OS::strcmp (id, exception_id.in ()) != 0) - ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n", - id, exception_id.in ())); + ACE_ERROR ((LM_ERROR, + "Mismatched exception IDs %s != %s\n", + id, + exception_id.in ())); } diff --git a/TAO/tests/Portable_Interceptors/Benchmark/server.cpp b/TAO/tests/Portable_Interceptors/Benchmark/server.cpp index 4c65fb7d6fa..50fbc18e35e 100644 --- a/TAO/tests/Portable_Interceptors/Benchmark/server.cpp +++ b/TAO/tests/Portable_Interceptors/Benchmark/server.cpp @@ -56,9 +56,6 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; - // Transfer ownership to the ORB. - (void) initializer._retn (); - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -67,7 +64,8 @@ main (int argc, char *argv[]) return 1; CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); + orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), @@ -89,23 +87,25 @@ main (int argc, char *argv[]) PortableServer::ObjectId_var id = root_poa->activate_object (&server_impl, ACE_TRY_ENV); - ACE_CHECK_RETURN (0); + ACE_TRY_CHECK; CORBA::Object_var test_obj = root_poa->id_to_reference (id.in (), ACE_TRY_ENV); - ACE_CHECK_RETURN (0); + ACE_TRY_CHECK; Test_Interceptors::Secure_Vault_var server = Test_Interceptors::Secure_Vault::_narrow (test_obj.in (), - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_TRY_CHECK; CORBA::String_var ior = orb->object_to_string (server.in (), ACE_TRY_ENV); ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Test_Interceptors::Secure_Vault: <%s>\n", ior.in ())); + ACE_DEBUG ((LM_DEBUG, + "Test_Interceptors::Secure_Vault: <%s>\n", + ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) @@ -120,8 +120,9 @@ main (int argc, char *argv[]) ACE_OS::fclose (output_file); } - if (orb->run () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); + orb->run (ACE_TRY_ENV); + ACE_TRY_CHECK; + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); root_poa->destroy (1, 1, ACE_TRY_ENV); @@ -130,7 +131,7 @@ main (int argc, char *argv[]) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Catched exception:"); + "Caught exception:"); return 1; } ACE_ENDTRY; diff --git a/TAO/tests/Portable_Interceptors/Dynamic/client.cpp b/TAO/tests/Portable_Interceptors/Dynamic/client.cpp index 05aecfa1233..edb75f81cb8 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/client.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/client.cpp @@ -5,7 +5,9 @@ #include "interceptors.h" #include "Echo_Client_ORBInitializer.h" -ACE_RCSID(Dynamic, client, "$Id$") +ACE_RCSID (Dynamic, + client, + "$Id$") const char *ior = "file://test.ior"; @@ -46,10 +48,12 @@ run_test (Test_Interceptors::Visual_ptr server, result = server->calculate (one, two, ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, - "result=%d\n", + "result = %d\n", result)); - ACE_CHECK; + ACE_TRY { @@ -70,7 +74,7 @@ run_test (Test_Interceptors::Visual_ptr server, } ACE_CATCH (CORBA::INV_OBJREF, sysex) { - ACE_DEBUG ((LM_DEBUG, "Caught Inv_Objref\n")); + ACE_DEBUG ((LM_DEBUG, "Caught CORBA::INV_OBJREF\n")); } ACE_ENDTRY; } @@ -80,7 +84,6 @@ main (int argc, char *argv[]) { ACE_TRY_NEW_ENV { -#if TAO_HAS_INTERCEPTORS == 1 PortableInterceptor::ORBInitializer_ptr temp_initializer = PortableInterceptor::ORBInitializer::_nil (); @@ -94,10 +97,6 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; - /// Transfer ownership to the ORB. - (void) orb_initializer._retn (); -#endif /* TAO_HAS_INTERCEPTORS == 1 */ - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -129,7 +128,7 @@ main (int argc, char *argv[]) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Catched exception:"); + "Caught exception:"); return 1; } ACE_ENDTRY; diff --git a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp b/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp index be3921e9fb6..9d5350be6e8 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/interceptors.cpp @@ -2,10 +2,10 @@ #include "interceptors.h" +ACE_RCSID (Dynamic, + interceptors, + "$Id$") -ACE_RCSID(Interceptors, interceptors, "$Id$") - -#if (TAO_HAS_INTERCEPTORS == 1) //const CORBA::ULong request_ctx_id = 0xdead; //const CORBA::ULong reply_ctx_id = 0xbeef; const char *request_msg = "The Echo_Request_Interceptor request message"; @@ -54,20 +54,30 @@ Echo_Client_Request_Interceptor::send_poll ( void Echo_Client_Request_Interceptor::send_request ( PortableInterceptor::ClientRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, "Echo_Client_Request_Interceptor::send_request from " "\"%s\"\n", - ri->operation ())); + op.in ())); - if (ACE_OS::strcmp (ri->operation (), "normal") == 0) + if (ACE_OS::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param; - (paramlist)[0].argument >>= param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; ACE_DEBUG ((LM_DEBUG, "The arg is %d\n", @@ -77,13 +87,20 @@ Echo_Client_Request_Interceptor::send_request ( void Echo_Client_Request_Interceptor::receive_other ( - PortableInterceptor::ClientRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) + PortableInterceptor::ClientRequestInfo_ptr ri + TAO_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) { - // Do nothing + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "Echo_Client_Request_Interceptor::receive_other " + "from \"%s\"\n", + op.in ())); } void @@ -92,28 +109,47 @@ Echo_Client_Request_Interceptor::receive_reply ( TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, "Echo_Client_Request_Interceptor::receive_reply " "from \"%s\"\n", - ri->operation (TAO_ENV_SINGLE_ARG_PARAMETER))); - if (ACE_OS::strcmp (ri->operation (), "normal") == 0) + op.in ())); + + if (ACE_OS::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param; - (paramlist)[0].argument >>= param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; ACE_DEBUG ((LM_DEBUG, "The arg is %d\n", param)); } - if (ACE_OS::strcmp (ri->operation (), "calculate") == 0) + if (ACE_OS::strcmp (op.in (), "calculate") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param1, param2, result; - (paramlist)[0].argument >>= param1; - (paramlist)[1].argument >>= param2; - CORBA::Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= param1; + paramlist[i].argument >>= param2; + + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; ACE_DEBUG ((LM_DEBUG, "The result of calculate is %d + %d = %d\n", @@ -125,23 +161,24 @@ Echo_Client_Request_Interceptor::receive_reply ( void Echo_Client_Request_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr rinfo + PortableInterceptor::ClientRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { - CORBA::String_var operation = - rinfo->operation (TAO_ENV_SINGLE_ARG_PARAMETER); + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); ACE_CHECK; ACE_DEBUG ((LM_DEBUG, "Echo_Client_Request_Interceptor::received_exception " "from \"%s\"\n", - operation.in ())); + op.in ())); CORBA::String_var exception_id = - rinfo->received_exception_id (TAO_ENV_SINGLE_ARG_PARAMETER); + ri->received_exception_id (ACE_TRY_ENV); ACE_CHECK; ACE_DEBUG ((LM_DEBUG, @@ -180,21 +217,40 @@ Echo_Server_Request_Interceptor::name (TAO_ENV_SINGLE_ARG_DECL_NOT_USED) } void +Echo_Server_Request_Interceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void Echo_Server_Request_Interceptor::receive_request ( PortableInterceptor::ServerRequestInfo_ptr ri TAO_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, "Echo_Server_Request_Interceptor::receive_request from \"%s\"\n", - ri->operation ())); + op.in ())); - if (ACE_OS::strcmp (ri->operation (), "normal") == 0) + if (ACE_OS::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param; - (paramlist)[0].argument >>= param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; ACE_DEBUG ((LM_DEBUG, "The arg is %d\n", @@ -202,38 +258,61 @@ Echo_Server_Request_Interceptor::receive_request ( } + CORBA::String_var tmdi = + ri->target_most_derived_interface (ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, + "Target most derived interface: %s\n", + tmdi.in ())); } void Echo_Server_Request_Interceptor::send_reply ( PortableInterceptor::ServerRequestInfo_ptr ri - TAO_ENV_ARG_DECL_NOT_USED) + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_ENV_ARG_DEFN; + + CORBA::String_var op = ri->operation (ACE_TRY_ENV); + ACE_CHECK; + ACE_DEBUG ((LM_DEBUG, "Echo_Server_Request_Interceptor::send_reply from \"%s\"\n", - ri->operation ())); + op.in ())); - if (ACE_OS::strcmp (ri->operation (), "normal") == 0) + if (ACE_OS::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param; - (paramlist)[0].argument >>= param; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i].argument >>= param; ACE_DEBUG ((LM_DEBUG, "The arg is %d\n", param)); } - if (ACE_OS::strcmp (ri->operation (), "calculate") == 0) + if (ACE_OS::strcmp (op.in (), "calculate") == 0) { - Dynamic::ParameterList paramlist = *(ri->arguments ()); + Dynamic::ParameterList_var paramlist = + ri->arguments (ACE_TRY_ENV); + ACE_CHECK; + CORBA::Long param1, param2, result = 0; - (paramlist)[0].argument >>= param1; - (paramlist)[1].argument >>= param2; + CORBA::ULong i = 0; // index -- explicitly used to avoid + // overloaded operator ambiguity. + paramlist[i++].argument >>= param1; + paramlist[i].argument >>= param2; - CORBA::Any result_any = *(ri->result ()); - result_any >>= result; + CORBA::Any_var result_any = ri->result (ACE_TRY_ENV); + ACE_CHECK; + + (result_any.in ()) >>= result; ACE_DEBUG ((LM_DEBUG, "The result of calculate is %d + %d = %d\n", @@ -245,25 +324,24 @@ Echo_Server_Request_Interceptor::send_reply ( void Echo_Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr rinfo + PortableInterceptor::ServerRequestInfo_ptr ri TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { TAO_ENV_ARG_DEFN; - CORBA::String_var operation = - rinfo->operation (ACE_TRY_ENV); + CORBA::String_var op = ri->operation (ACE_TRY_ENV); ACE_CHECK; ACE_DEBUG ((LM_DEBUG, "Echo_Server_Request_Interceptor::send_exception " "from \"%s\"\n", - operation.in ())); + op.in ())); CORBA::Any_var any = - rinfo->sending_exception (ACE_TRY_ENV); + ri->sending_exception (ACE_TRY_ENV); ACE_CHECK; CORBA::TypeCode_var type = any->type (); @@ -277,29 +355,11 @@ Echo_Server_Request_Interceptor::send_exception ( } void -Echo_Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - PortableInterceptor::ForwardRequest - )) -{ - // Do nothing -} - -void Echo_Server_Request_Interceptor::send_other ( PortableInterceptor::ServerRequestInfo_ptr - TAO_ENV_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - PortableInterceptor::ForwardRequest - )) + TAO_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) { // Do Nothing } - -#endif /* (TAO_HAS_INTERCEPTORS == 1) */ diff --git a/TAO/tests/Portable_Interceptors/Dynamic/server.cpp b/TAO/tests/Portable_Interceptors/Dynamic/server.cpp index 9a781a28a81..7ac5b662972 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/server.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/server.cpp @@ -5,7 +5,9 @@ #include "interceptors.h" #include "Echo_Server_ORBInitializer.h" -ACE_RCSID(Dynamic, server, "$Id$") +ACE_RCSID (Dynamic, + server, + "$Id$") const char *ior_output_file = 0; @@ -39,7 +41,6 @@ main (int argc, char *argv[]) { ACE_TRY_NEW_ENV { -#if TAO_HAS_INTERCEPTORS == 1 PortableInterceptor::ORBInitializer_ptr temp_initializer = PortableInterceptor::ORBInitializer::_nil (); @@ -53,16 +54,14 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; - /// Transfer ownership to the ORB. - (void) orb_initializer._retn (); -#endif /* TAO_HAS_INTERCEPTORS == 1 */ - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; CORBA::Object_var poa_object = - orb->resolve_initial_references ("RootPOA"); + orb->resolve_initial_references ("RootPOA", ACE_TRY_ENV); + ACE_TRY_CHECK; + if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), @@ -87,12 +86,12 @@ main (int argc, char *argv[]) PortableServer::ObjectId_var id = root_poa->activate_object (&server_impl, ACE_TRY_ENV); - ACE_CHECK_RETURN (0); + ACE_TRY_CHECK; CORBA::Object_var test_obj = root_poa->id_to_reference (id.in (), ACE_TRY_ENV); - ACE_CHECK_RETURN (0); + ACE_TRY_CHECK; Test_Interceptors::Visual_var server = Test_Interceptors::Visual::_narrow (test_obj.in (), @@ -118,8 +117,9 @@ main (int argc, char *argv[]) ACE_OS::fclose (output_file); } - if (orb->run () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); + orb->run (ACE_TRY_ENV); + ACE_TRY_CHECK; + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); root_poa->destroy (1, 1, ACE_TRY_ENV); diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h index aa8e3a9a2d6..f9238e40361 100644 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h +++ b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h @@ -37,10 +37,10 @@ * * @brief Simple concrete client request interceptor. * - * This is a test IOR interceptor that embeds a tagged component in an - * IOR. That tagged component will then be verified on the client - * side to ensure that IOR interceptor support is functioning - * properly. + * This is a test client request interceptor that extracts a tagged + * component that should have been embedded in the server IOR by an + * IOR interceptor. It displays the contents of that tagged + * component. */ class FOO_ClientRequestInterceptor : public virtual PortableInterceptor::ClientRequestInterceptor, |