diff options
| author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-08-13 15:47:20 +0000 |
|---|---|---|
| committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-08-13 15:47:20 +0000 |
| commit | d86939f8e188671a6226b24e0957d984050c0ed6 (patch) | |
| tree | e58de7d2e0d317204ee79bd0578e51c93bf58ea8 /DevGuideExamples | |
| parent | e55d9214407ea472e418f9852cb58dddab0c83f5 (diff) | |
| download | ATCD-d86939f8e188671a6226b24e0957d984050c0ed6.tar.gz | |
Diffstat (limited to 'DevGuideExamples')
237 files changed, 15578 insertions, 0 deletions
diff --git a/DevGuideExamples/AMH/AMH.mpc b/DevGuideExamples/AMH/AMH.mpc new file mode 100644 index 00000000000..c18e3368bb1 --- /dev/null +++ b/DevGuideExamples/AMH/AMH.mpc @@ -0,0 +1,41 @@ +// $Id$ + +project(*idl): taoidldefaults, amh { + idlflags += -Wb,pch_include=amh_pch.h + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, amh { + exename = MessengerServer + after += *idl + Source_Files { + AMH_Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +// This project doesn't really require AMH, but since they +// are in the same directory and share the generated idl code +// it has to be there. +project(*Client): taoclient, amh { + exename = MessengerClient + after += *idl + Source_Files { + MessengerC.cpp + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/AMH/AMH_Messenger_i.cpp b/DevGuideExamples/AMH/AMH_Messenger_i.cpp new file mode 100644 index 00000000000..0aeb5afe0ec --- /dev/null +++ b/DevGuideExamples/AMH/AMH_Messenger_i.cpp @@ -0,0 +1,39 @@ +#include "amh_pch.h" +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "AMH_Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +AMH_Messenger_i::AMH_Messenger_i (void) +{ +} + +// Implementation skeleton destructor +AMH_Messenger_i::~AMH_Messenger_i (void) +{ +} + +void +AMH_Messenger_i::send_message ( + DevGuide::AMH_MessengerResponseHandler_ptr _tao_rh, + const char * user_name, + const char * subject, + const char * message + ) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::String_var inout_message_arg = + CORBA::string_dup("Thanks for the message."); + CORBA::Boolean result = true; + + _tao_rh->send_message(result,inout_message_arg.inout ()); +} diff --git a/DevGuideExamples/AMH/AMH_Messenger_i.h b/DevGuideExamples/AMH/AMH_Messenger_i.h new file mode 100644 index 00000000000..150ff7059a3 --- /dev/null +++ b/DevGuideExamples/AMH/AMH_Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef AMH_MESSENGER_I_H_ +#define AMH_MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class AMH_Messenger_i +class AMH_Messenger_i : public virtual POA_DevGuide::AMH_Messenger +{ +public: + //Constructor + AMH_Messenger_i (void); + + //Destructor + virtual ~AMH_Messenger_i (void); + + virtual void send_message ( + DevGuide::AMH_MessengerResponseHandler_ptr _tao_rh, + const char * user_name, + const char * subject, + const char * message + ); +}; + + +#endif /* AMH_MESSENGERI_H_ */ diff --git a/DevGuideExamples/AMH/Messenger.idl b/DevGuideExamples/AMH/Messenger.idl new file mode 100644 index 00000000000..55d4aba1c5e --- /dev/null +++ b/DevGuideExamples/AMH/Messenger.idl @@ -0,0 +1,13 @@ +// $Id$ + +// Messenger.idl + +module DevGuide +{ + interface Messenger + { + boolean send_message(in string user_name, + in string subject, + inout string message); + }; +}; diff --git a/DevGuideExamples/AMH/MessengerClient.cpp b/DevGuideExamples/AMH/MessengerClient.cpp new file mode 100644 index 00000000000..c6145c5bad4 --- /dev/null +++ b/DevGuideExamples/AMH/MessengerClient.cpp @@ -0,0 +1,72 @@ +// $Id$ + +#include "amh_pch.h" + +#include "ace/Get_Opt.h" +#include "MessengerC.h" +#include <iostream> + +ACE_TString ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.optarg; + break; + + case '?': + default: + std::cerr << "usage: " << argv[0] << " -k <ior>" << std::endl; + return -1; + break; + } + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args(argc, argv) != 0) { + return 1; + } + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object(ior.c_str()); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + DevGuide::Messenger_var messenger = + DevGuide::Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var msg = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", msg.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << msg.in() << std::endl; + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/AMH/MessengerServer.cpp b/DevGuideExamples/AMH/MessengerServer.cpp new file mode 100644 index 00000000000..fce26c51fb6 --- /dev/null +++ b/DevGuideExamples/AMH/MessengerServer.cpp @@ -0,0 +1,77 @@ +// $Id$ + +#include "amh_pch.h" + +#include "ace/Get_Opt.h" +#include "AMH_Messenger_i.h" +#include <iostream> +#include <fstream> + +ACE_TString ior_output_file; + +int +parse_args(int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts(argc, argv, ACE_TEXT("o:")); + int c; + + while((c = get_opts()) != -1) + switch(c) + { + case 'o': + ior_output_file = get_opts.optarg; + break; + break; + case '?': + default: + std::cerr << "usage: " << argv[0] << "-o <iorfile>" << std::endl; + return -1; + break; + } + // Indicates sucessful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args(argc, argv) != 0) { + return 1; + } + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a servant. + PortableServer::Servant_var<AMH_Messenger_i> servant = new AMH_Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = poa->activate_object( servant.in() ); + obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( obj.in() ); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file.c_str())); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file Messenger.ior" << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/AMH/Messenger_i.cpp b/DevGuideExamples/AMH/Messenger_i.cpp new file mode 100644 index 00000000000..175b4ac3e22 --- /dev/null +++ b/DevGuideExamples/AMH/Messenger_i.cpp @@ -0,0 +1,35 @@ +#include "amh_pch.h" +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::string_free(message); + message = CORBA::string_dup("Thanks for the message."); + return true; +} diff --git a/DevGuideExamples/AMH/Messenger_i.h b/DevGuideExamples/AMH/Messenger_i.h new file mode 100644 index 00000000000..8783559712b --- /dev/null +++ b/DevGuideExamples/AMH/Messenger_i.h @@ -0,0 +1,37 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/AMH/README b/DevGuideExamples/AMH/README new file mode 100644 index 00000000000..3a21e06275a --- /dev/null +++ b/DevGuideExamples/AMH/README @@ -0,0 +1,45 @@ +// $Id$ + +File: DevGuideExamples/GettingStarted/README + + +This directory contains a CORBA example illustrating a simple client and +a server with a Interface Messenger. The Messenger Interface has +an operation for sending a message (send_message). The MessengerClient +will send a message which is displayed by the MessengerServer when +received. The MessengerClient will then confirm that the message has +been sent successfully. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/AMH/amh_pch.cpp b/DevGuideExamples/AMH/amh_pch.cpp new file mode 100644 index 00000000000..1217d4e0504 --- /dev/null +++ b/DevGuideExamples/AMH/amh_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "amh_pch.h" diff --git a/DevGuideExamples/AMH/amh_pch.h b/DevGuideExamples/AMH/amh_pch.h new file mode 100644 index 00000000000..fe6d2628083 --- /dev/null +++ b/DevGuideExamples/AMH/amh_pch.h @@ -0,0 +1,12 @@ +// $Id$ + +#ifndef PCH_H +#define PCH_H + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/AMH/run_test.pl b/DevGuideExamples/AMH/run_test.pl new file mode 100755 index 00000000000..f5859b6315a --- /dev/null +++ b/DevGuideExamples/AMH/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->GetStderrLog(); +$client->GetStderrLog(); + +$server->DeleteFile($server_iorfile); +$client->DeleteFile($client_iorfile); + +exit $status; diff --git a/DevGuideExamples/AMH_AMI/AMH_AMI.mpc b/DevGuideExamples/AMH_AMI/AMH_AMI.mpc new file mode 100644 index 00000000000..1f9756ac1ee --- /dev/null +++ b/DevGuideExamples/AMH_AMI/AMH_AMI.mpc @@ -0,0 +1,57 @@ +// $Id$ + +project(*idl): taoidldefaults, amh, ami { + idlflags += -Wb,pch_include=amh_ami_pch.h + IDL_Files { + middle.idl + inner.idl + } + custom_only = 1 +} + +project(*Client): taoclient, messaging { + after += *idl + IDL_Files { + } + + Source_Files { + middleC.cpp + client.cpp + } + // To avoid link errors with SunCC 5.[34], put this project's + // object files (and resulting SunWS_cache directory) in a different + // location than the default. + verbatim(gnuace, macros) { + VDIR = $(if $(ARCH),$(ARCH)/).obj/AMH_AMI_Client/ + } +} + +project(*Middle_Server): messaging, taoserver, amh { + after += *idl + exename = middle_server + IDL_Files { + } + + Source_Files { + middleS.cpp + middleC.cpp + innerS.cpp + innerC.cpp + middle_i.cpp + middle_server.cpp + inner_cb.cpp + } +} + +project(*Inner_Server): messaging, taoserver, ami { + after += *idl + exename = inner_server + IDL_Files { + } + Source_Files { + innerS.cpp + innerC.cpp + inner_i.cpp + inner_server.cpp + } +} diff --git a/DevGuideExamples/AMH_AMI/README b/DevGuideExamples/AMH_AMI/README new file mode 100644 index 00000000000..4c9bf5aa5e7 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/README @@ -0,0 +1,55 @@ +// $Id$ + +File: DevGuideExamples/AMH_AMI/README + +The example in this directory demonstrates how AMH can be coupled with +AMI to create very efficient and scalable middle components for +multi-tier applications. In this case, a client connects to a middle +server which in turn is connected to an inner server. the client +submits a question to the middle server, which forwards the question +on to the inner server. The inner server then waits a few seconds, to +simulate a busy process, then replies. The reply is handled +asynchronously by the middle server, using AMI, then forwarded to the +original client using AMH. Neither the client nor the inner server are +aware of the asynchronous nature of the middle server. + +The inner server has a single startup option, -crash. When supplied, +the server will induce an exception when invoked, rather than +returning the answer. + +The middle server also has a single option, -no_AMH. When run in this +mode, the IOR it publishes will refer to an object that does not use +AMH and AMI. This allows you to compare the behavior and source code +for these two modes of operation. + +How to Run +---------- + +Start the inner server (writes inner.ior) : +------------------ +./inner_server [-crash] + + +Then start the middle server (writes middle.ior): +------------------ +./middle_server [-no_AMH] + +Finally, run the client: +------------------ +./client + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl diff --git a/DevGuideExamples/AMH_AMI/amh_ami_pch.cpp b/DevGuideExamples/AMH_AMI/amh_ami_pch.cpp new file mode 100644 index 00000000000..4931b9c9efe --- /dev/null +++ b/DevGuideExamples/AMH_AMI/amh_ami_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "amh_ami_pch.h" diff --git a/DevGuideExamples/AMH_AMI/amh_ami_pch.h b/DevGuideExamples/AMH_AMI/amh_ami_pch.h new file mode 100644 index 00000000000..fe6d2628083 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/amh_ami_pch.h @@ -0,0 +1,12 @@ +// $Id$ + +#ifndef PCH_H +#define PCH_H + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/AMH_AMI/client.cpp b/DevGuideExamples/AMH_AMI/client.cpp new file mode 100644 index 00000000000..d5912c43c4f --- /dev/null +++ b/DevGuideExamples/AMH_AMI/client.cpp @@ -0,0 +1,78 @@ +// $Id$ + +#include "amh_ami_pch.h" +#include "ace/Get_Opt.h" +#include "middleC.h" + +#include <iostream> + +const ACE_TCHAR *ior_file = ACE_TEXT ("file://middle.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior_file> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Asynch_Except_Demo object's IOR. + CORBA::Object_var obj = orb->string_to_object(ACE_TEXT_ALWAYS_CHAR(ior_file)); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get middle IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Asycnh_Except_Demo object reference. + Middle_var mid = Middle::_narrow( obj.in() ); + if( CORBA::is_nil( mid.in() ) ) { + std::cerr << "IOR was not an middle object reference." << std::endl; + return 1; + } + + CORBA::String_var question = + CORBA::string_dup ("How much wood would a woodchuck chuck, if a woodchuck could chuck wood?"); + + std::cout << "Question is: " << question.in() << std::endl; + + + // trigger the exception via AMI call + CORBA::String_var answer = + mid->get_the_answer (question.in()); + + std::cout << "Answer is: " << answer.in() << std::endl; + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/AMH_AMI/inner.idl b/DevGuideExamples/AMH_AMI/inner.idl new file mode 100644 index 00000000000..7e0b6693b96 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner.idl @@ -0,0 +1,9 @@ +// $Id$ + +// file: inner.idl + + +interface Inner +{ + string answer (in string question); +}; diff --git a/DevGuideExamples/AMH_AMI/inner_cb.cpp b/DevGuideExamples/AMH_AMI/inner_cb.cpp new file mode 100644 index 00000000000..68f7bb4b63c --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner_cb.cpp @@ -0,0 +1,62 @@ +// $Id$ + +#include "amh_ami_pch.h" +#include "inner_cb.h" +#include <iostream> +// Implementation skeleton constructor +Inner_callback_i::Inner_callback_i (PortableServer::POA_ptr p, + AMH_MiddleResponseHandler_ptr rh) + : poa_(PortableServer::POA::_duplicate (p)), + response_handler_ (AMH_MiddleResponseHandler::_duplicate (rh)) +{ +} + +// Implementation skeleton destructor +Inner_callback_i::~Inner_callback_i (void) +{ + std::cout << "Inner_callback_i destroying" << std::endl; + +} + +void +Inner_callback_i::answer (const char * ami_return_val) +{ + std::cout << "Inner_callback_i::answer called, return_val = " + << ami_return_val << std::endl; + this->response_handler_->get_the_answer (ami_return_val); + + std::cout << "inner_callback_i deactivating self" << std::endl; + PortableServer::ObjectId_var oid = this->poa_->servant_to_id(this); + this->poa_->deactivate_object (oid.in()); +} + +void +Inner_callback_i::answer_excep (Messaging::ExceptionHolder* excep_holder) +{ + // Here, we need to extract the exception from this holder, and package + // it in another so the AMH response handler may forward it on. + try + { + excep_holder->raise_exception(); + } + catch(const CORBA::Exception& ex) + { + CORBA::Exception *local_ex = ex._tao_duplicate(); + AMH_MiddleExceptionHolder amh_excep_holder (local_ex); + this->response_handler_->get_the_answer_excep (&amh_excep_holder); + } + catch(...) + { + std::cout + << "inner_callback_i::answer_excep got an unknown exception" + << std::endl; + + CORBA::Exception *unknown_ex = new CORBA::UNKNOWN; + AMH_MiddleExceptionHolder amh_excep_holder (unknown_ex); + this->response_handler_->get_the_answer_excep (&amh_excep_holder); + } + + std::cout << "inner_callback_i deactivating self" << std::endl; + PortableServer::ObjectId_var oid = this->poa_->servant_to_id(this); + this->poa_->deactivate_object (oid.in()); +} diff --git a/DevGuideExamples/AMH_AMI/inner_cb.h b/DevGuideExamples/AMH_AMI/inner_cb.h new file mode 100644 index 00000000000..92745ba5001 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner_cb.h @@ -0,0 +1,29 @@ +// $Id$ + +// -*- C++ -*- +#ifndef INNER_CB_H +#define INNER_CB_H + +#include "innerS.h" +#include "middleC.h" + +class Inner_callback_i : public virtual POA_AMI_InnerHandler +{ +public: + //Constructor + Inner_callback_i (PortableServer::POA_ptr p, + AMH_MiddleResponseHandler_ptr rh); + + //Destructor + virtual ~Inner_callback_i(void); + + virtual void answer (const char * ami_return_val); + + virtual void answer_excep (Messaging::ExceptionHolder * excep_holder); + +private: + PortableServer::POA_var poa_; + AMH_MiddleResponseHandler_var response_handler_; +}; + +#endif diff --git a/DevGuideExamples/AMH_AMI/inner_i.cpp b/DevGuideExamples/AMH_AMI/inner_i.cpp new file mode 100644 index 00000000000..c1c696ecbc2 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner_i.cpp @@ -0,0 +1,31 @@ +#include "amh_ami_pch.h" +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "inner_i.h" +#include "ace/OS.h" + +Inner_i::Inner_i (int d) + : divisor_ (d) +{ +} + +char * +Inner_i::answer (const char * question) +{ + ACE_UNUSED_ARG (question); // doesn't matter + + CORBA::String_var answer = + CORBA::string_dup ("I didn't know dogs could talk!"); + + int delay = 5/this->divisor_; // throw exception if divisor = 0 + + ACE_OS::sleep(delay); // make the caller wait a bit + return answer._retn(); +} diff --git a/DevGuideExamples/AMH_AMI/inner_i.h b/DevGuideExamples/AMH_AMI/inner_i.h new file mode 100644 index 00000000000..04de36a7679 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner_i.h @@ -0,0 +1,33 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef AMH_INNER_I_H_ +#define AMH_INNER_I_H_ + +#include "innerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Inner_i : public virtual POA_Inner +{ +public: + // ctor takes a 1 to delay and return string, a 0 to crash + Inner_i (int d); + + // will either return a string after a brief delay, or crash + virtual char * answer (const char *question); + +private: + int divisor_; +}; + + +#endif /* AMH_INNER_H_ */ diff --git a/DevGuideExamples/AMH_AMI/inner_server.cpp b/DevGuideExamples/AMH_AMI/inner_server.cpp new file mode 100644 index 00000000000..a72479629a3 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/inner_server.cpp @@ -0,0 +1,88 @@ +// $Id$ + +#include "amh_ami_pch.h" + +#include "inner_i.h" +#include "ace/SString.h" +#include "ace/OS_String.h" +#include "ace/Get_Opt.h" +#include <iostream> +#include <fstream> + +int dont_crash = 1; + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("inner.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("c:o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'c': + dont_crash = 0; + break; + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile> " + "-c " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a servant. + PortableServer::Servant_var<Inner_i> servant = new Inner_i(dont_crash); + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = poa->activate_object( servant.in() ); + obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( obj.in() ); + ACE_CString iorname (ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + std::ofstream iorFile (iorname.c_str()); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to " << iorname << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/AMH_AMI/middle.idl b/DevGuideExamples/AMH_AMI/middle.idl new file mode 100644 index 00000000000..a81f96ee214 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/middle.idl @@ -0,0 +1,8 @@ +// $Id$ + +// file: middle.idl + +interface Middle +{ + string get_the_answer (in string question); +}; diff --git a/DevGuideExamples/AMH_AMI/middle_i.cpp b/DevGuideExamples/AMH_AMI/middle_i.cpp new file mode 100644 index 00000000000..2b9d192bfcd --- /dev/null +++ b/DevGuideExamples/AMH_AMI/middle_i.cpp @@ -0,0 +1,59 @@ +#include "amh_ami_pch.h" +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "middle_i.h" +#include "inner_cb.h" + +#include <iostream> +// Implementation skeleton constructor +Asynch_Middle_i::Asynch_Middle_i (PortableServer::POA_ptr poa, + Inner_ptr inner) + : poa_ (PortableServer::POA::_duplicate(poa)), + inner_ (Inner::_duplicate(inner)) +{ +} + +void +Asynch_Middle_i::get_the_answer (AMH_MiddleResponseHandler_ptr _tao_rh, + const char * question) +{ + // The callback handler servant instance holds on to a reference to the + // AMH response handler. That way, it can forward the reply back to the + // originial client after getting the reply from the inner server. + PortableServer::ServantBase_var servant = new Inner_callback_i(this->poa_.in(), + _tao_rh); + PortableServer::ObjectId_var objid = + this->poa_->activate_object(servant.in()); + CORBA::Object_var obj = this->poa_->id_to_reference (objid.in()); + + AMI_InnerHandler_var cb = AMI_InnerHandler::_narrow(obj.in()); + + // forward the request on to the inner server, with the callback handler + // reference. + this->inner_->sendc_answer (cb.in(),question); + + // nothing else to do. Our client will block until the callback handler + // forwards the reply. +} + + +//------------------------------------------------------------------------ + +// Implementation skeleton constructor +Middle_i::Middle_i (Inner_ptr inner) + : inner_ (Inner::_duplicate(inner)) +{ +} + +char * +Middle_i::get_the_answer ( const char * question ) +{ + return inner_->answer (question); +} diff --git a/DevGuideExamples/AMH_AMI/middle_i.h b/DevGuideExamples/AMH_AMI/middle_i.h new file mode 100644 index 00000000000..4ad565afb6b --- /dev/null +++ b/DevGuideExamples/AMH_AMI/middle_i.h @@ -0,0 +1,44 @@ +/* -*- C++ -*- $Id$ */ + +#ifndef MIDDLE_I_H_ +#define MIDDLE_I_H_ + +#include "middleS.h" +#include "innerC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Asynch_Middle_i : public virtual POA_AMH_Middle +{ +public: + //Constructor + Asynch_Middle_i (PortableServer::POA_ptr poa, Inner_ptr inner); + + virtual void get_the_answer (AMH_MiddleResponseHandler_ptr _tao_rh, + const char * question); + +private: + PortableServer::POA_var poa_; + Inner_var inner_; +}; + +// This version of the implementation does not use AMH, It is supplied for +// comparison. Either this or the asynch version may be used to serve +// "Middle" objects. +class Middle_i : public virtual POA_Middle +{ +public: + //Constructor + Middle_i (Inner_ptr inner); + + virtual char * get_the_answer (const char * question); + +private: + PortableServer::POA_var poa_; + Inner_var inner_; +}; + + +#endif /* MIDDLE_I_H_ */ diff --git a/DevGuideExamples/AMH_AMI/middle_server.cpp b/DevGuideExamples/AMH_AMI/middle_server.cpp new file mode 100644 index 00000000000..4a76ade1f0e --- /dev/null +++ b/DevGuideExamples/AMH_AMI/middle_server.cpp @@ -0,0 +1,108 @@ +// $Id$ + +#include "amh_ami_pch.h" + +#include "middle_i.h" +#include "ace/OS_String.h" +#include "ace/Get_Opt.h" +#include <iostream> +#include <fstream> + +int use_synch = 0; + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("middle.ior"); +const ACE_TCHAR *ior_input_file = ACE_TEXT ("file://inner.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:i:n")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case 'i': + ior_input_file = get_opts.opt_arg (); + break; + case 'n': + use_synch = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <ior_output_file> " + "-i <ior_input_file> " + "-n" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + obj = orb->string_to_object(ior_input_file); + Inner_var peer = + Inner::_narrow(obj.in()); + if (CORBA::is_nil(peer.in())) + { + std::cerr << "Could not initialize peer object reference" << std::endl; + ACE_OS::exit (1); + } + + // create either a synchronous or AMH_based servant depending on command + // line arguement. + PortableServer::ServantBase_var servant; + if (use_synch) + servant = new Middle_i (peer.in()); + else + servant = new Asynch_Middle_i(poa.in(), peer.in()); + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = poa->activate_object(servant.in()); + obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( obj.in() ); + + ACE_CString iorname(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + std::ofstream iorFile (iorname.c_str()); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to " << iorname << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/AMH_AMI/run_test.pl b/DevGuideExamples/AMH_AMI/run_test.pl new file mode 100755 index 00000000000..1e73cf21dc8 --- /dev/null +++ b/DevGuideExamples/AMH_AMI/run_test.pl @@ -0,0 +1,120 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $in_server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $md_server = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $inner_ior = "inner.ior"; +my $middle_ior = "middle.ior"; + +# Files which used by inner_server +my $in_server_inner_ior = $in_server->LocalFile ($inner_ior); +$in_server->DeleteFile($inner_ior); + +# Files which used by middle server +my $md_server_inner_ior = $md_server->LocalFile ($inner_ior); +my $md_server_middle_ior = $md_server->LocalFile ($middle_ior); +$md_server->DeleteFile($inner_ior); +$md_server->DeleteFile($middle_ior); + +# Files which used by inner_server +my $client_iorfile = $client->LocalFile ($middle_ior); +$client->DeleteFile($middle_ior); + +$IS = $in_server->CreateProcess ("inner_server", + "-ORBdebuglevel $debug_level " . + "-o $in_server_inner_ior"); + +$MD = $md_server->CreateProcess ("middle_server", + "-ORBdebuglevel $debug_level " . + "-o $md_server_middle_ior " . + "-i file://$md_server_inner_ior"); + +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); + +$server_status = $IS->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($in_server->WaitForFileTimed ($inner_ior, + $in_server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$in_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} + +if ($in_server->GetFile ($inner_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$in_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} +if ($md_server->PutFile ($inner_ior) == -1) { + print STDERR "ERROR: cannot set file <$md_server_inner_ior>\n"; + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} + +$server_status = $MD->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($md_server->WaitForFileTimed ($middle_ior, + $md_server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$md_server_middle_ior>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} + +if ($md_server->GetFile ($middle_ior) == -1) { + print STDERR "ERROR: cannot retrieve file <$md_server_middle_ior>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} +if ($client->PutFile ($middle_ior) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $MD->Kill (); $MD->TimedWait (1); + $IS->Kill (); $IS->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 30); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$IS->Kill (); +$MD->Kill (); + +$in_server->DeleteFile($inner_ior); +$md_server->DeleteFile($inner_ior); +$md_server->DeleteFile($middle_ior); +$client->DeleteFile($middle_ior); + +exit $status; diff --git a/DevGuideExamples/BiDirectionalGIOP/BiDirectionalGIOP.mpc b/DevGuideExamples/BiDirectionalGIOP/BiDirectionalGIOP.mpc new file mode 100644 index 00000000000..65fd05368de --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/BiDirectionalGIOP.mpc @@ -0,0 +1,38 @@ +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Wb,pch_include=bidir_giop_pch.h + IDL_Files { + simple.idl + callback.idl + } + custom_only = 1 +} + +project(*Server): taoexe, portableserver, avoids_minimum_corba, bidir_giop, avoids_corba_e_micro { + exename = server + after += *idl + Source_Files { + callbackC.cpp + simpleC.cpp + simpleS.cpp + simple_i.cpp + server.cpp + } + IDL_Files { + } +} + +project(*Client): taoexe, portableserver, avoids_minimum_corba, bidir_giop, avoids_corba_e_micro { + exename = client + after += *idl + Source_Files { + simpleC.cpp + callbackC.cpp + callbackS.cpp + callback_i.cpp + client.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/BiDirectionalGIOP/README b/DevGuideExamples/BiDirectionalGIOP/README new file mode 100644 index 00000000000..de7ea54bb3b --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/README @@ -0,0 +1,29 @@ +// $Id$ + +This example is a copy of the $TAO_ROOT/test/BiDirerectional test +but it does not use ACE_TRY/ENVIRONMENT macros. + +This example exercises the birectional GIOP connection +implementation in TAO. + +Start like this: + +$ server -o <file.ior> -i <no_iterations> +$ client -k file://<file.ior> + +The server starts up writing the IOR to the file. The client then +starts up, creates its own object and passes the reference to the +server. Then it invokes a method on the server to indicate that it is +ready for callback. The server then callsback the client on the same +connection <no_iterations> times. If the server creates a new +connection the server will crash itself. + +Each time the client recieves a callback, it outputs: +Callback method called. + + + + + + + diff --git a/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.cpp b/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.cpp new file mode 100644 index 00000000000..81730edc1f9 --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "bidir_giop_pch.h" diff --git a/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.h b/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.h new file mode 100644 index 00000000000..9b28ecbd8ad --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/bidir_giop_pch.h @@ -0,0 +1,17 @@ +// $Id$ + +#ifndef BIDIR_GIOP_PCH_H +#define BIDIR_GIOP_PCH_H + +// See the Devguide chapter on Getting Started With Visual C++ for +// more information on how to correctly use precompiled headers. +// Currently only Windows VC++ defines USING_PCH so this file +// is effectively empty for other platforms. + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/BiDirectionalGIOP/callback.idl b/DevGuideExamples/BiDirectionalGIOP/callback.idl new file mode 100644 index 00000000000..b36b1182bde --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/callback.idl @@ -0,0 +1,12 @@ +// $Id$ + +interface Callback +{ + // A safe way to shutdown the client, using either clean shutdowns + // or "catastrophic failures". + oneway void shutdown(); + + // A simple remote call + void callback_method(); +}; + diff --git a/DevGuideExamples/BiDirectionalGIOP/callback_i.cpp b/DevGuideExamples/BiDirectionalGIOP/callback_i.cpp new file mode 100644 index 00000000000..25dee372b33 --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/callback_i.cpp @@ -0,0 +1,28 @@ +// $Id$ + +#include "bidir_giop_pch.h" + +#include "callback_i.h" +#include <iostream> + +Callback_i::Callback_i (CORBA::ORB_ptr orb) +: orb_(CORBA::ORB::_duplicate(orb)) +{ +} + +Callback_i::~Callback_i (void) +{ +} + +void Callback_i::shutdown () +{ + std::cout << "Performing clean shutdown." << std::endl; + CORBA::Boolean wait = false; + orb_->shutdown(wait); +} + +void Callback_i::callback_method () +{ + std::cout << "Callback method called." << std::endl; +} + diff --git a/DevGuideExamples/BiDirectionalGIOP/callback_i.h b/DevGuideExamples/BiDirectionalGIOP/callback_i.h new file mode 100644 index 00000000000..b7623dd1829 --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/callback_i.h @@ -0,0 +1,24 @@ +// $Id$ + +#ifndef CALLBACKI_H_ +#define CALLBACKI_H_ + +#include "callbackS.h" + +class Callback_i : public virtual POA_Callback +{ +public: + Callback_i (CORBA::ORB_ptr orb); + + virtual ~Callback_i (void); + + virtual void shutdown (void); + + virtual void callback_method (void); + +private: + CORBA::ORB_var orb_; +}; + + +#endif /* CALLBACKI_H_ */ diff --git a/DevGuideExamples/BiDirectionalGIOP/client.cpp b/DevGuideExamples/BiDirectionalGIOP/client.cpp new file mode 100644 index 00000000000..369dc556de1 --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/client.cpp @@ -0,0 +1,100 @@ +// $Id$ + +#include "bidir_giop_pch.h" + +#include "callback_i.h" +#include "simpleC.h" + +#include "ace/Get_Opt.h" +#include "tao/BiDir_GIOP/BiDirGIOP.h" + +#include <iostream> + +ACE_TString ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.optarg; + break; + + case '?': + default: + std::cerr << "usage: " << argv[0] << " -k <ior>" << std::endl; + return -1; + break; + } + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + + try { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) { + return 1; + } + + // Create a bidirectional POA + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in()); + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(); + // Policies for the childPOA to be created. + CORBA::PolicyList policies(1); + policies.length(1); + CORBA::Any pol; + pol <<= BiDirPolicy::BOTH; + policies[0] = + orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, pol); + // Create POA as child of RootPOA with the above policies. This POA + // will receive request in the same connection in which it sent + // the request + PortableServer::POA_var poa = root_poa->create_POA("bidirPOA", poa_manager.in(), policies); + // Creation of bidirPOA is over. Destroy the Policy objects. + for (CORBA::ULong i = 0; i < policies.length (); ++i) { + policies[i]->destroy (); + } + poa_manager->activate (); + + // get server object + obj = orb->string_to_object(ior.c_str()); + Simple_var server = Simple::_narrow (obj.in()); + + PortableServer::Servant_var<Callback_i> callback_svt = new Callback_i(orb.in()); + + // Register and activate callback servant + PortableServer::ObjectId_var id = poa->activate_object(callback_svt.in()); + obj = poa->id_to_reference(id.in()); + Callback_var callback = Callback::_narrow(obj.in()); + + server->callback_object (callback.in()); + + CORBA::Long r = server->test_method(1); // Tell the server to call us back. + if (r != 0) { + std::cout << "unexpected result = " << r << std::endl; + } + + orb->run(); + + CORBA::Boolean etherealize = true, wait = true; + poa->destroy(etherealize, wait); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught CORBA::Exception: " << std::endl << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/BiDirectionalGIOP/run_test.pl b/DevGuideExamples/BiDirectionalGIOP/run_test.pl new file mode 100755 index 00000000000..3202a675d6f --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "test.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile -i 100"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->GetStderrLog(); +$client->GetStderrLog(); + +$server->DeleteFile($server_iorfile); +$client->DeleteFile($client_iorfile); + +exit $status; diff --git a/DevGuideExamples/BiDirectionalGIOP/server.cpp b/DevGuideExamples/BiDirectionalGIOP/server.cpp new file mode 100644 index 00000000000..1d5164c621f --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/server.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "bidir_giop_pch.h" + +#include "simple_i.h" +#include "callbackC.h" + +#include "ace/Get_Opt.h" +#include "tao/BiDir_GIOP/BiDirGIOP.h" +#include <iostream> +#include <fstream> + +ACE_TString ior_output_file; +int callback_count = 10; + +int +parse_args(int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts(argc, argv, ACE_TEXT("o:i:")); + int c; + + while((c = get_opts()) != -1) + switch(c) + { + case 'o': + ior_output_file = get_opts.optarg; + break; + case 'i': + callback_count = ACE_OS::atoi(get_opts.optarg); + break; + case '?': + default: + std::cerr << "usage: " << argv[0] << "-o <iorfile> -i <no_iterations>" << std::endl; + return -1; + break; + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args(argc, argv) != 0) { + return 1; + } + + // Create a bidirectional POA + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in()); + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager(); + // Policies for the childPOA to be created. + CORBA::PolicyList policies(1); + policies.length(1); + CORBA::Any pol; + pol <<= BiDirPolicy::BOTH; + policies[0] = + orb->create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, pol); + // Create POA as child of RootPOA with the above policies. This POA + // will receive request in the same connection in which it sent + // the request + PortableServer::POA_var poa = root_poa->create_POA("bidirPOA", poa_manager.in(), policies); + // Creation of bidirPOA is over. Destroy the Policy objects. + for (CORBA::ULong i = 0; i < policies.length (); ++i) { + policies[i]->destroy (); + } + poa_manager->activate (); + + PortableServer::Servant_var<Simple_i> svt = new Simple_i(orb.in(), callback_count); + + // Register and activate Simple servant + PortableServer::ObjectId_var id = poa->activate_object(svt.in()); + obj = poa->id_to_reference(id.in()); + Simple_var server = Simple::_narrow(obj.in()); + + CORBA::String_var ior = orb->object_to_string(server.in()); + if (ior_output_file != ACE_TEXT("")) { + std::ofstream outfile(ACE_TEXT_ALWAYS_CHAR(ior_output_file.c_str())); + outfile << ior.in(); + } + std::cout << "Activated as " << ior.in() << std::endl; + + // Our own special orb->run() that knows how to callback clients + while (true) { + + // returns 1 as soon as it has successfully called back. + if (svt->call_client()) { + break; + } + + // We don't want to check for work pending, because we really want + // to simulate a normal orb->run() while adding the ability to call + // our routine which calls back to the client. + orb->perform_work(); + } + + std::cout << "Event loop finished." << std::endl; + + CORBA::Boolean etherealize = true, wait = true; + poa->destroy(etherealize, wait); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught CORBA::Exception: " << std::endl << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/BiDirectionalGIOP/simple.idl b/DevGuideExamples/BiDirectionalGIOP/simple.idl new file mode 100644 index 00000000000..cb98b3cadeb --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/simple.idl @@ -0,0 +1,16 @@ +// $Id$ + +#include "callback.idl" + +interface Simple +{ + // Just call a method on the server, + long test_method(in boolean do_callback); + + // send the callback object to the server + void callback_object(in Callback cb); + + // A safe way to shutdown the server, it is a oneway function so we + // will never get a COMM_FAILURE error + oneway void shutdown(); +}; diff --git a/DevGuideExamples/BiDirectionalGIOP/simple_i.cpp b/DevGuideExamples/BiDirectionalGIOP/simple_i.cpp new file mode 100644 index 00000000000..e93e0e8b78b --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/simple_i.cpp @@ -0,0 +1,70 @@ +// $Id$ + +#include "bidir_giop_pch.h" + +#include "simple_i.h" + +#include "tao/ORB_Core.h" +#include "tao/Transport_Cache_Manager.h" +#include "tao/Thread_Lane_Resources.h" + +#include <iostream> + +Simple_i::Simple_i (CORBA::ORB_ptr orb, int callback_count) +: orb_(CORBA::ORB::_duplicate(orb)) +, ready_for_callback_(0) +, callback_count_(callback_count) +, callback_(0) +{ +} + +Simple_i::~Simple_i (void) +{ +} + +CORBA::Long Simple_i::test_method (CORBA::Boolean do_callback) +{ + if (do_callback) { + ready_for_callback_ = 1; + } + return 0; +} + +void Simple_i::callback_object (Callback_ptr cb) +{ + callback_ = Callback::_duplicate(cb); +} + +void Simple_i::shutdown () +{ + CORBA::Boolean wait = false; + orb_->shutdown(wait); +} + +int +Simple_i::call_client() +{ + if (ready_for_callback_) { + + ready_for_callback_ = 0; + + for (int times = 0; times < callback_count_; ++times) { + + callback_->callback_method(); + + if (orb_->orb_core()->lane_resources().transport_cache().current_size() > 1) + { + std::cerr << "The connection cache has grown. " + << "BiDirection did not work. aborting..." << std::endl; + ACE_OS::abort(); // Should probably define and throw a UserException + } + } + + callback_->shutdown(); + + return 1; + } + + return 0; +} + diff --git a/DevGuideExamples/BiDirectionalGIOP/simple_i.h b/DevGuideExamples/BiDirectionalGIOP/simple_i.h new file mode 100644 index 00000000000..8d6c0aecc40 --- /dev/null +++ b/DevGuideExamples/BiDirectionalGIOP/simple_i.h @@ -0,0 +1,39 @@ +// $Id$ + +#ifndef SIMPLEI_H_ +#define SIMPLEI_H_ + +#include "simpleS.h" + +class Simple_i : public virtual POA_Simple +{ +public: + Simple_i (CORBA::ORB_ptr orb, int iterations); + + virtual ~Simple_i (void); + +virtual CORBA::Long test_method ( + CORBA::Boolean do_callback + ); + +virtual void callback_object ( + Callback_ptr cb + ); + +virtual void shutdown ( + + ); + + /// Not part of the CORBA interface. This method is called + /// by our special orb event loop in server main(). + int call_client(); + +private: + CORBA::ORB_var orb_; + int ready_for_callback_; + int callback_count_; + Callback_var callback_; +}; + + +#endif /* SIMPLEI_H_ */ diff --git a/DevGuideExamples/ChangeLogs/ChangeLog-08 b/DevGuideExamples/ChangeLogs/ChangeLog-08 new file mode 100644 index 00000000000..f2cdd3b32b1 --- /dev/null +++ b/DevGuideExamples/ChangeLogs/ChangeLog-08 @@ -0,0 +1,1496 @@ +Thu Oct 23 06:47:54 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * devguide_examples.lst: + Removed, merged this file into the main test lists + +Thu Oct 23 06:39:54 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * AMH_AMI/middle_server.cpp + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp + * ImplRepo/IORTable/MessengerClient.cpp + * NamingService/corbaloc_Messenger/MessengerClient.cpp + * NamingService/corbaname_Messenger/MessengerClient.cpp + * NamingService/Naming_Server/NamingTask.cpp + * NamingService/Naming_Server/NamingTask.h + wchar fixes + +Wed Oct 22 17:47:54 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * AMH_AMI/middle_server.cpp: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/NamingTask.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + + Fix fuzz errors by using ACE_OS:: functions instead of the naked/raw ones. + +Wed Oct 22 16:45:07 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * ValueTypes/Notify/Event.idl: + + Fixed fuzz errors. When including files from ACE/TAO/CIAO, use "" instead of <>. + + Example: #include <ace/OS.h> was changed to "ace/OS.h" + +Wed Oct 22 16:17:58 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.h: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Consumer_i.h: + * EventServices/OMG_TypedEC/Messenger_i.h: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.h: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.h: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.h: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + * NamingService/Naming_Client/MessengerClient.cpp: + * NamingService/Naming_Client/MessengerServer.cpp: + * NamingService/Naming_Context_Ext/MessengerClient.cpp: + * NamingService/Naming_Context_Ext/MessengerServer.cpp: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/NamingTask.cpp: + * NamingService/corbaloc_Messenger/MessengerClient.cpp: + * NamingService/corbaloc_Messenger/MessengerServer.cpp: + * NamingService/corbaname_Messenger/MessengerClient.cpp: + * NamingService/corbaname_Messenger/MessengerServer.cpp: + * NotifyService/EventSequence/EventSequenceConsumer_i.h: + * NotifyService/EventSequence/EventSequenceSupplier_i.h: + * NotifyService/EventSequence/MessengerClient.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NotifyService/EventSequence/MessengerServer.cpp: + * NotifyService/EventSequence/Messenger_i.h: + * NotifyService/EventSequence/Messenger_i.cpp: + * NotifyService/Filtering/MessengerClient.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Filtering/Messenger_i.h: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Filtering/StructuredEventConsumer_i.h: + * NotifyService/Filtering/StructuredEventSupplier_i.h: + * NotifyService/Messenger/MessengerClient.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.h: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.h: + * NotifyService/Messenger/StructuredEventSupplier_i.h: + * NotifyService/OfferSubscriptions/MessengerClient.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.h: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h: + * NotifyService/QoSProperties/MessengerClient.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/QoSProperties/Messenger_i.h: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/QoSProperties/StructuredEventConsumer_i.h: + * NotifyService/QoSProperties/StructuredEventSupplier_i.h: + * NotifyService/RTNotify/MessengerClient.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/RTNotify/MessengerServer.cpp: + * NotifyService/RTNotify/Messenger_i.h: + * NotifyService/RTNotify/Messenger_i.cpp: + * NotifyService/RTNotify/StructuredEventConsumer_i.h: + * NotifyService/RTNotify/StructuredEventSupplier_i.h: + * NotifyService/SupplierSideNC/MessengerClient.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + * NotifyService/SupplierSideNC/Messenger_i.h: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.h: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.h: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/PICurrent/ClientInitializer.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * Security/ParticipatingApp/Messenger_i.h: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + Fixed fuzz errors. When including files from ACE/TAO/CIAO, use "" instead of <>. + + Example: #include <ace/OS.h> was changed to "ace/OS.h" + +Wed Oct 22 15:56:27 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * AMH/amh_pch.h: + * AMH_AMI/amh_ami_pch.h: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/server.cpp: + * BiDirectionalGIOP/simple_i.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp: + * GettingStarted/started_pch.h: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/MessengerServer.cpp: + * InterfaceRepo/IFRBrowser.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/GracefulShutdown/MessengerShutdownTimer.h: + * NamingService/Naming_Server/MessengerTask.h: + * NamingService/Naming_Server/NamingTask.h: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/EventSequenceSupplier_i.cpp: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Filtering/StructuredEventSupplier_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/StructuredEventSupplier_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/StructuredEventSupplier_i.cpp: + * NotifyService/RTNotify/StructuredEventConsumer_i.cpp: + * NotifyService/RTNotify/StructuredEventSupplier_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * RTCORBA/MessengerClient.cpp: + * RTCORBA/MessengerServer.cpp: + * RTCORBA/Messenger_i.h: + * RTCORBA/common.h: + * ValueTypes/Bank/_pch.h: + * ValueTypes/Bank/server.cpp: + * ValueTypes/Messenger/Message_i.h: + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/_pch.h: + * ValueTypes/Notify/Event_i.h: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + Fixed fuzz errors. When including files from ACE/TAO/CIAO, use "" instead of <>. + + Example: #include <ace/OS.h> was changed to "ace/OS.h" + +Wed Oct 22 15:42:56 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * AMH_AMI/inner_i.cpp: + * AMH_AMI/middle_server.cpp: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/server.cpp: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + * ImplRepo/IORTable/MessengerClient.cpp: + * InterfaceRepo/IFRBrowser.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.cpp: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/Messenger_i.cpp: + * Messaging/RelativeRoundtripTimeout/Messenger_i.cpp: + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.h: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/GracefulShutdown/MessengerShutdownTimer.h: + * Multithreading/ThreadPerConnection/Messenger_i.cpp: + * Multithreading/ThreadPool/MessengerServer.cpp: + * Multithreading/ThreadPool/Messenger_i.cpp: + * NamingService/Naming_Server/MessengerTask.h: + * NamingService/Naming_Server/NamingMessenger.cpp: + * NamingService/Naming_Server/NamingTask.h: + * NamingService/Naming_Server/NamingTask.cpp: + * NotifyService/EventSequence/Messenger_i.h: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/RTNotify/Messenger_i.cpp: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/PICurrent/Messenger_i.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * RTCORBA/Messenger_i.cpp: + * Security/ParticipatingApp/Messenger_i.cpp: + * Security/PolicyControllingApp/MessengerClient.cpp: + * SmartProxies/Logger_i.h: + * SmartProxies/Logger_i.cpp: + * ValueTypes/Bank/server.cpp: + * ValueTypes/Notify/supplier.cpp: + + Fixed fuzz errors. When including files from ACE/TAO/CIAO, use "" instead of <>. + + Example: #include <ace/OS.h> was changed to "ace/OS.h" + +Wed Oct 22 15:25:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * NotifyService/Messenger/Messenger.mpc: + + Renamed to avoid name clash. + + * NotifyService/Messenger/NotifyService_Messenger.mpc: + +Wed Oct 22 15:05:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * Multithreading/ThreadPerConnection/ThreadPerConnection.mpc: + + Fixed project name length fuzz warnings. + +Wed Oct 22 14:39:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * NamingService/Naming_Client/Messenger_i.cpp: + + Fixed tabs found fuzz errors. + +Wed Oct 22 14:00:46 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * DevGuideExamples.mwc: + * ImplRepo/Activator/run_test.pl: + * InterfaceRepo/IFRBrowser.cpp: + * InterfaceRepo/InterfaceRepo.mpc: + * InterfaceRepo/run_test.pl: + * NotifyService/RTNotify/Priorities.h: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + * Security/ParticipatingApp/ParticipatingApp.mpc: + * Security/ParticipatingApp/run_test.pl: + * Security/PolicyControllingApp/PolicyControllingApp.mpc: + * Security/PolicyControllingApp/run_test.pl: + * Security/SecurityUnawareApp/SecurityUnawareApp.mpc: + * Security/SecurityUnawareApp/run_test.pl: + * SmartProxies/Logger.idl: + + Fixed fuzz error by adding "// $Id $" to the top of each file. + +Wed Oct 22 13:24:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NamingService/Naming_Server/NamingMessenger.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + + Fixed Lack of ACE_TMAIN fuzz errors. + +Wed Oct 22 13:01:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * LocalObjects/ServantLocator/MessengerLocator_i.h: + * NotifyService/Filtering/Messenger_i.h: + * NotifyService/OfferSubscriptions/Messenger_i.h: + * NotifyService/SupplierSideNC/Messenger_i.h: + * PortableInterceptors/Auth/ClientInitializer.h: + * LocalObjects/Messenger/Messenger.idl: + * LocalObjects/ServantLocator/Messenger.idl: + * Security/ParticipatingApp/Messenger.idl: + + Fixed tabs found fuzz errors. + +Wed Oct 22 12:52:00 UTC 2008 Simon Massey <sma at prismtech dot com> + + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/RTNotify/Messenger_i.cpp: + * NamingService/Naming_Client/Messenger_i.cpp: + * Security/PolicyControllingApp/MessengerClient.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + + Fixed tabs found fuzz errors. + +Wed Oct 22 09:00:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * AMH_AMI/inner_cb.h + * AMH_AMI/inner_i.h + * AMH_AMI/middle_i.h + Removed deprecated PortableServer::RefCountServantBase + +Wed Oct 22 08:57:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * LocalObjects/Messenger/MessengerServer.cpp + * LocalObjects/ServantLocator/MessengerClient.cpp + * LocalObjects/ServantLocator/MessengerServer.cpp + * Messaging/AMIcallback/MessengerClient.cpp + * Messaging/AMIcallback/MessengerServer.cpp + * Messaging/RelativeRoundtripTimeout/MessengerServer.cpp + * NotifyService/EventSequence/MessengerServer.cpp + * NotifyService/Messenger/MessengerServer.cpp + * NotifyService/OfferSubscriptions/MessengerServer.cpp + * NotifyService/QoSProperties/MessengerServer.cpp + * NotifyService/RTNotify/MessengerServer.cpp + * NotifyService/SupplierSideNC/MessengerServer.cpp + * SmartProxies/LoggerServer.cpp + ACE_TMAIN changes + +Wed Oct 22 08:53:00 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> + + * CIAO: + Moved to the CIAO distribution + +Tue Oct 21 23:33:19 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * EventServices/OMG_TypedEC/Consumer_i.h: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/OMG_TypedEC/Messenger_i.h: + * EventServices/OMG_TypedEC/Messenger_i.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.h: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.h: + * EventServices/RTEC_Basic/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.h: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.h: + * EventServices/RTEC_Filter/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + * ImplRepo/IORTable/Messenger_i.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * LocalObjects/Messenger/Messenger_i.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.h: + * LocalObjects/ServantLocator/MessengerLocator_i.cpp: + * Messaging/AMIcallback/MessengerHandler.h: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/Messenger_i.h: + * Messaging/AMIcallback/Messenger_i.cpp: + * Messaging/RelativeRoundtripTimeout/Messenger_i.h: + * Multithreading/GracefulShutdown/Messenger_i.h: + * Multithreading/GracefulShutdown/Messenger_i.cpp: + * Multithreading/Reactive/Messenger_i.h: + * Multithreading/Reactive/Messenger_i.cpp: + * Multithreading/ThreadPerConnection/Messenger_i.h: + * Multithreading/ThreadPerConnection/Messenger_i.cpp: + * Multithreading/ThreadPool/Messenger_i.h: + * Multithreading/ThreadPool/Messenger_i.cpp: + * NamingService/Naming_Context_Ext/Messenger_i.h: + * NamingService/Naming_Context_Ext/Messenger_i.cpp: + * NamingService/Naming_Server/Messenger_i.h: + * NamingService/Naming_Server/Messenger_i.cpp: + * NotifyService/EventSequence/EventSequenceConsumer_i.h: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/EventSequenceSupplier_i.h: + * NotifyService/EventSequence/EventSequenceSupplier_i.cpp: + * NotifyService/EventSequence/Messenger_i.h: + * NotifyService/EventSequence/Messenger_i.cpp: + * NotifyService/Filtering/Messenger_i.h: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Filtering/StructuredEventConsumer_i.h: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Filtering/StructuredEventSupplier_i.h: + * NotifyService/Filtering/StructuredEventSupplier_i.cpp: + * NotifyService/Messenger/Messenger_i.h: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.h: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/StructuredEventSupplier_i.h: + * NotifyService/Messenger/StructuredEventSupplier_i.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.h: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp: + * NotifyService/QoSProperties/Messenger_i.h: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/QoSProperties/StructuredEventConsumer_i.h: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/StructuredEventSupplier_i.h: + * NotifyService/QoSProperties/StructuredEventSupplier_i.cpp: + * NotifyService/RTNotify/Messenger_i.h: + * NotifyService/RTNotify/Messenger_i.cpp: + * NotifyService/RTNotify/StructuredEventConsumer_i.h: + * NotifyService/RTNotify/StructuredEventConsumer_i.cpp: + * NotifyService/RTNotify/StructuredEventSupplier_i.h: + * NotifyService/RTNotify/StructuredEventSupplier_i.cpp: + * NotifyService/SupplierSideNC/Messenger_i.h: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.h: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.h: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp: + * Security/ParticipatingApp/Messenger_i.h: + * Security/ParticipatingApp/Messenger_i.cpp: + * Security/PolicyControllingApp/Messenger_i.h: + * Security/PolicyControllingApp/Messenger_i.cpp: + * Security/SecurityUnawareApp/Messenger_i.h: + * Security/SecurityUnawareApp/Messenger_i.cpp: + * SmartProxies/Smart_Messenger_Proxy.h: + * SmartProxies/Smart_Messenger_Proxy.cpp: + * ValueTypes/Messenger/Messenger_i.h: + * ValueTypes/Messenger/Messenger_i.cpp: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + Fixed fuzz errors by removing exception specifications. + +Tue Oct 21 22:50:24 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * AMH/AMH.mpc: + * AMH/Messenger.idl: + * AMH/MessengerClient.cpp: + * AMH/MessengerServer.cpp: + * AMH/README: + * AMH/amh_pch.h: + * AMH/amh_pch.cpp: + * AMH/run_test.pl: + * AMH_AMI/AMH_AMI.mpc: + * AMH_AMI/README: + * AMH_AMI/amh_ami_pch.h: + * AMH_AMI/amh_ami_pch.cpp: + * AMH_AMI/client.cpp: + * AMH_AMI/inner.idl: + * AMH_AMI/inner_cb.h: + * AMH_AMI/inner_cb.cpp: + * AMH_AMI/inner_server.cpp: + * AMH_AMI/middle.idl: + * AMH_AMI/middle_server.cpp: + * AMH_AMI/run_test.pl: + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * BiDirectionalGIOP/README: + * BiDirectionalGIOP/bidir_giop_pch.h: + * BiDirectionalGIOP/bidir_giop_pch.cpp: + * BiDirectionalGIOP/callback.idl: + * BiDirectionalGIOP/callback_i.h: + * BiDirectionalGIOP/callback_i.cpp: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/run_test.pl: + * BiDirectionalGIOP/server.cpp: + * BiDirectionalGIOP/simple.idl: + * BiDirectionalGIOP/simple_i.h: + * BiDirectionalGIOP/simple_i.cpp: + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.h: + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + * EventServices/OMG_Basic/OMG_Basic.mpc: + * EventServices/OMG_Basic/README: + * EventServices/OMG_Basic/run_test.pl: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc: + * EventServices/OMG_SupplierSideEC/README: + * EventServices/OMG_SupplierSideEC/run_test.pl: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Consumer_i.h: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/OMG_TypedEC/Messenger.idl: + * EventServices/OMG_TypedEC/OMG_TypedEC.mpc: + * EventServices/OMG_TypedEC/README: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/OMG_TypedEC/run_test.pl: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.h: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.h: + * EventServices/RTEC_Basic/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Basic/README: + * EventServices/RTEC_Basic/RTEC_Basic.mpc: + * EventServices/RTEC_Basic/run_test.pl: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Federated/README: + * EventServices/RTEC_Federated/RTEC_Federated.mpc: + * EventServices/RTEC_Federated/run_test.pl: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.h: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.h: + * EventServices/RTEC_Filter/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Filter/README: + * EventServices/RTEC_Filter/RTEC_Filter.mpc: + * EventServices/RTEC_Filter/run_test.pl: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/README: + * EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + * EventServices/RTEC_MCast_Federated/run_test.pl: + * GettingStarted/GettingStarted.mpc: + * GettingStarted/Messenger.idl: + * GettingStarted/MessengerClient.cpp: + * GettingStarted/MessengerServer.cpp: + * GettingStarted/README: + * GettingStarted/run_test.pl: + * GettingStarted/started_pch.h: + * GettingStarted/started_pch.cpp: + * ImplRepo/Basic/ImplRepo_Basic.mpc: + * ImplRepo/Basic/Messenger.idl: + * ImplRepo/Basic/MessengerClient.cpp: + * ImplRepo/Basic/MessengerServer.cpp: + * ImplRepo/Basic/Messenger_i.h: + * ImplRepo/Basic/Messenger_i.cpp: + * ImplRepo/Basic/run_test.pl: + * ImplRepo/IORTable/ImplRepo_IORTable.mpc: + * ImplRepo/IORTable/Messenger.idl: + * ImplRepo/IORTable/MessengerClient.cpp: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/IORTable/Messenger_i.h: + * ImplRepo/IORTable/Messenger_i.cpp: + * ImplRepo/IORTable/run_test.pl: + * ImplRepo/ImplRepo.mpc: + * ImplRepo/Messenger.idl: + * ImplRepo/MessengerClient.cpp: + * ImplRepo/MessengerServer.cpp: + * ImplRepo/README: + * ImplRepo/run_test.pl: + * LocalObjects/Messenger/Messenger.idl: + * LocalObjects/Messenger/Messenger.mpc: + * LocalObjects/Messenger/MessengerServer.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * LocalObjects/Messenger/Messenger_i.cpp: + * LocalObjects/Messenger/run_test.pl: + * LocalObjects/ServantLocator/Messenger.idl: + * LocalObjects/ServantLocator/MessengerClient.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.h: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * LocalObjects/ServantLocator/ServantLocator.mpc: + * LocalObjects/ServantLocator/run_test.pl: + * Messaging/AMIcallback/AMIcallback.mpc: + * Messaging/AMIcallback/Messenger.idl: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.h: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/AMIcallback/README: + * Messaging/AMIcallback/run_test.pl: + * Messaging/RelativeRoundtripTimeout/Messenger.idl: + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerServer.cpp: + * Messaging/RelativeRoundtripTimeout/README: + * Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc: + * Messaging/RelativeRoundtripTimeout/run_test.pl: + * Multithreading/GracefulShutdown/GracefulShutdown.mpc: + * Multithreading/GracefulShutdown/Messenger.idl: + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/GracefulShutdown/README: + * Multithreading/GracefulShutdown/run_test.pl: + * Multithreading/Reactive/Messenger.idl: + * Multithreading/Reactive/MessengerClient.cpp: + * Multithreading/Reactive/MessengerServer.cpp: + * Multithreading/Reactive/README: + * Multithreading/Reactive/Reactive.mpc: + * Multithreading/Reactive/run_test.pl: + * Multithreading/ThreadPerConnection/Messenger.idl: + * Multithreading/ThreadPerConnection/MessengerClient.cpp: + * Multithreading/ThreadPerConnection/MessengerServer.cpp: + * Multithreading/ThreadPerConnection/README: + * Multithreading/ThreadPerConnection/ThreadPerConnection.mpc: + * Multithreading/ThreadPerConnection/run_test.pl: + * Multithreading/ThreadPool/Messenger.idl: + * Multithreading/ThreadPool/MessengerClient.cpp: + * Multithreading/ThreadPool/MessengerServer.cpp: + * Multithreading/ThreadPool/README: + * Multithreading/ThreadPool/ThreadPool.mpc: + * Multithreading/ThreadPool/run_test.pl: + * NamingService/Messenger/Messenger.idl: + * NamingService/Messenger/Messenger.mpc: + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + * NamingService/Messenger/README: + * NamingService/Messenger/run_test.pl: + * NamingService/Naming_Client/Messenger.idl: + * NamingService/Naming_Client/MessengerClient.cpp: + * NamingService/Naming_Client/MessengerServer.cpp: + * NamingService/Naming_Client/Naming_Client.mpc: + * NamingService/Naming_Client/README: + * NamingService/Naming_Client/run_test.pl: + * NamingService/Naming_Context_Ext/Messenger.idl: + * NamingService/Naming_Context_Ext/MessengerClient.cpp: + * NamingService/Naming_Context_Ext/MessengerServer.cpp: + * NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc: + * NamingService/Naming_Context_Ext/README: + * NamingService/Naming_Context_Ext/run_test.pl: + * NamingService/Naming_Server/Messenger.idl: + * NamingService/Naming_Server/MessengerTask.h: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/NamingMessenger.cpp: + * NamingService/Naming_Server/NamingTask.h: + * NamingService/Naming_Server/NamingTask.cpp: + * NamingService/Naming_Server/Naming_Server.mpc: + * NamingService/Naming_Server/README: + * NamingService/Naming_Server/run_test.pl: + * NamingService/corbaloc_Messenger/Messenger.idl: + * NamingService/corbaloc_Messenger/MessengerClient.cpp: + * NamingService/corbaloc_Messenger/MessengerServer.cpp: + * NamingService/corbaloc_Messenger/README: + * NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc: + * NamingService/corbaloc_Messenger/run_test.pl: + * NamingService/corbaname_Messenger/Messenger.idl: + * NamingService/corbaname_Messenger/MessengerClient.cpp: + * NamingService/corbaname_Messenger/MessengerServer.cpp: + * NamingService/corbaname_Messenger/README: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + * NamingService/corbaname_Messenger/run_test.pl: + * NotifyService/EventSequence/EventSequence.mpc: + * NotifyService/EventSequence/EventSequenceConsumer_i.h: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/EventSequenceSupplier_i.h: + * NotifyService/EventSequence/EventSequenceSupplier_i.cpp: + * NotifyService/EventSequence/Messenger.idl: + * NotifyService/EventSequence/MessengerClient.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NotifyService/EventSequence/MessengerServer.cpp: + * NotifyService/EventSequence/Messenger_i.h: + * NotifyService/EventSequence/Messenger_i.cpp: + * NotifyService/EventSequence/README: + * NotifyService/EventSequence/run_test.pl: + * NotifyService/Filtering/Filtering.mpc: + * NotifyService/Filtering/Messenger.idl: + * NotifyService/Filtering/MessengerClient.cpp: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Filtering/Messenger_i.h: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Filtering/README: + * NotifyService/Filtering/StructuredEventConsumer_i.h: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Filtering/StructuredEventSupplier_i.h: + * NotifyService/Filtering/StructuredEventSupplier_i.cpp: + * NotifyService/Filtering/run_test.pl: + * NotifyService/Messenger/Messenger.idl: + * NotifyService/Messenger/Messenger.mpc: + * NotifyService/Messenger/MessengerClient.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.h: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/README: + * NotifyService/Messenger/StructuredEventConsumer_i.h: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/StructuredEventSupplier_i.h: + * NotifyService/Messenger/StructuredEventSupplier_i.cpp: + * NotifyService/Messenger/run_test.pl: + * NotifyService/OfferSubscriptions/Messenger.idl: + * NotifyService/OfferSubscriptions/MessengerClient.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.h: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/OfferSubscriptions.mpc: + * NotifyService/OfferSubscriptions/README: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp: + * NotifyService/OfferSubscriptions/run_test.pl: + * NotifyService/QoSProperties/Messenger.idl: + * NotifyService/QoSProperties/MessengerClient.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/QoSProperties/Messenger_i.h: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/QoSProperties/QoSProperties.mpc: + * NotifyService/QoSProperties/README: + * NotifyService/QoSProperties/StructuredEventConsumer_i.h: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/StructuredEventSupplier_i.h: + * NotifyService/QoSProperties/StructuredEventSupplier_i.cpp: + * NotifyService/QoSProperties/run_test.pl: + * NotifyService/RTNotify/Messenger.idl: + * NotifyService/RTNotify/MessengerClient.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/RTNotify/MessengerServer.cpp: + * NotifyService/RTNotify/Messenger_i.h: + * NotifyService/RTNotify/Messenger_i.cpp: + * NotifyService/RTNotify/README: + * NotifyService/RTNotify/RTNotify.mpc: + * NotifyService/RTNotify/StructuredEventConsumer_i.h: + * NotifyService/RTNotify/StructuredEventConsumer_i.cpp: + * NotifyService/RTNotify/StructuredEventSupplier_i.h: + * NotifyService/RTNotify/StructuredEventSupplier_i.cpp: + * NotifyService/RTNotify/run_test.pl: + * NotifyService/SupplierSideNC/Messenger.idl: + * NotifyService/SupplierSideNC/MessengerClient.cpp: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/Messenger_i.h: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * NotifyService/SupplierSideNC/README: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.h: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.h: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp: + * NotifyService/SupplierSideNC/SupplierSideNC.mpc: + * NotifyService/SupplierSideNC/run_test.pl: + * PortableInterceptors/Auth/Auth.mpc: + * PortableInterceptors/Auth/ClientInitializer.h: + * PortableInterceptors/Auth/ClientInitializer.cpp: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/Messenger.idl: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/Auth/README: + * PortableInterceptors/Auth/ServerInitializer.h: + * PortableInterceptors/Auth/ServerInitializer.cpp: + * PortableInterceptors/Auth/ServerInterceptor.h: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/Auth/run_test.pl: + * PortableInterceptors/IOR/ClientInitializer.h: + * PortableInterceptors/IOR/ClientInitializer.cpp: + * PortableInterceptors/IOR/ClientInterceptor.h: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/IOR/IOR.mpc: + * PortableInterceptors/IOR/Messenger.idl: + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/IOR/Messenger_i.h: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/README: + * PortableInterceptors/IOR/ServerIORInterceptor.h: + * PortableInterceptors/IOR/ServerIORInterceptor.cpp: + * PortableInterceptors/IOR/ServerInitializer.h: + * PortableInterceptors/IOR/ServerInitializer.cpp: + * PortableInterceptors/IOR/ServerInterceptor.h: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/IOR/run_test.pl: + * PortableInterceptors/PICurrent/ClientInitializer.h: + * PortableInterceptors/PICurrent/ClientInitializer.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.h: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/Messenger.idl: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent/PICurrent.mpc: + * PortableInterceptors/PICurrent/README: + * PortableInterceptors/PICurrent/ServerInitializer.h: + * PortableInterceptors/PICurrent/ServerInitializer.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.h: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/run_test.pl: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.h: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger.idl: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/PICurrent_NameService.mpc: + * PortableInterceptors/PICurrent_NameService/README: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.h: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/run_test.pl: + * PortableInterceptors/SimpleCodec/ClientInitializer.h: + * PortableInterceptors/SimpleCodec/ClientInitializer.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.h: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + * PortableInterceptors/SimpleCodec/Messenger.idl: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.h: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/README: + * PortableInterceptors/SimpleCodec/ServerInitializer.h: + * PortableInterceptors/SimpleCodec/ServerInitializer.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.h: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/SimpleCode.mpc: + * PortableInterceptors/SimpleCodec/run_test.pl: + * RTCORBA/Messenger.idl: + * RTCORBA/MessengerClient.cpp: + * RTCORBA/MessengerServer.cpp: + * RTCORBA/Messenger_i.cpp: + * RTCORBA/README: + * RTCORBA/RTCORBA.mpc: + * RTCORBA/common.h: + * RTCORBA/common.cpp: + * RTCORBA/run_test.pl: + * SmartProxies/LoggerServer.cpp: + * SmartProxies/Logger_i.h: + * SmartProxies/Logger_i.cpp: + * SmartProxies/Messenger.idl: + * SmartProxies/MessengerClient.cpp: + * SmartProxies/MessengerServer.cpp: + * SmartProxies/README: + * SmartProxies/SmartProxies.mpc: + * SmartProxies/Smart_Messenger_Proxy.h: + * SmartProxies/Smart_Messenger_Proxy.cpp: + * SmartProxies/run_test.pl: + * ValueTypes/Bank/README: + * ValueTypes/Bank/_pch.h: + * ValueTypes/Bank/_pch.cpp: + * ValueTypes/Bank/bank.idl: + * ValueTypes/Bank/bank.mpc: + * ValueTypes/Bank/client.cpp: + * ValueTypes/Bank/run_test.pl: + * ValueTypes/Bank/server.cpp: + * ValueTypes/Messenger/Message_i.h: + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/Messenger.idl: + * ValueTypes/Messenger/MessengerClient.cpp: + * ValueTypes/Messenger/MessengerServer.cpp: + * ValueTypes/Messenger/Messenger_i.h: + * ValueTypes/Messenger/Messenger_i.cpp: + * ValueTypes/Messenger/README: + * ValueTypes/Messenger/ValueTypes.mpc: + * ValueTypes/Messenger/_pch.h: + * ValueTypes/Messenger/_pch.cpp: + * ValueTypes/Messenger/run_test.pl: + * ValueTypes/Notify/Event.idl: + * ValueTypes/Notify/Event_i.h: + * ValueTypes/Notify/Notify.mpc: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/readme.txt: + * ValueTypes/Notify/run_test.pl: + * ValueTypes/Notify/supplier.cpp: + + Add "// $Id $" to the top of each file to address fuzz errors. + +Tue Oct 21 20:59:59 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com> + + * BiDirectionalGIOP/simple_i.h: + * BiDirectionalGIOP/simple_i.cpp: + * CIAO/Messenger/Administrator_exec_i.h: + * CIAO/Messenger/Administrator_exec_i.cpp: + * CIAO/Messenger/History_exec_i.h: + * CIAO/Messenger/History_exec_i.cpp: + * CIAO/Messenger/Messenger_exec_i.h: + * CIAO/Messenger/Messenger_exec_i.cpp: + * CIAO/Messenger/Publication_exec_i.h: + * CIAO/Messenger/Publication_exec_i.cpp: + * CIAO/Messenger/Receiver_exec_i.h: + * CIAO/Messenger/Receiver_exec_i.cpp: + * CIAO/Messenger/Runnable_exec_i.h: + * CIAO/Messenger/Runnable_exec_i.cpp: + * CIAO/Messenger/StaticDAnCE/StaticDAnCEApp.cpp: + * ImplRepo/IORTable/Messenger_i.h: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/Messenger_i.h: + * PortableInterceptors/Auth/Messenger_i.cpp: + * PortableInterceptors/Auth/ServerInitializer.h: + * PortableInterceptors/Auth/ServerInitializer.cpp: + * PortableInterceptors/Auth/ServerInterceptor.h: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/ClientInitializer.h: + * PortableInterceptors/IOR/ClientInitializer.cpp: + * PortableInterceptors/IOR/ClientInterceptor.h: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/IOR/Messenger_i.h: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/ServerIORInterceptor.h: + * PortableInterceptors/IOR/ServerIORInterceptor.cpp: + * PortableInterceptors/IOR/ServerInitializer.h: + * PortableInterceptors/IOR/ServerInitializer.cpp: + * PortableInterceptors/IOR/ServerInterceptor.h: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger_i.h: + * PortableInterceptors/PICurrent_NameService/Messenger_i.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.h: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ClientInitializer.h: + * PortableInterceptors/SimpleCodec/ClientInitializer.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.h: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.h: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/ServerInitializer.h: + * PortableInterceptors/SimpleCodec/ServerInitializer.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.h: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * Security/SecurityUnawareApp/MessengerI.cpp: + * ValueTypes/Bank/server.cpp: + + Remove exception specifications from the code. It has fallen out of favor. + +Wed Apr 23 13:09:22 UTC 2008 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Disable the RTCORBA example for minimum CORBA and the like. + +Fri Apr 18 14:06:47 UTC 2008 Adam Mitz <mitza@ociweb.com> + + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + + Also excluded the Bidir client from CORBA/e micro. + +Thu Apr 17 22:43:37 UTC 2008 Adam Mitz <mitza@ociweb.com> + + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * ImplRepo/Basic/ImplRepo_Basic.mpc: + * ImplRepo/IORTable/ImplRepo_IORTable.mpc: + * ImplRepo/ImplRepo.mpc: + * devguide_examples.lst: + + Excluded these from CORBA/e Micro builds. + +Wed Apr 9 14:44:33 UTC 2008 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_Federated/supplier.conf: + + Fixed a problem where the last line was continued with a backslash. + +Fri Apr 4 11:55:44 UTC 2008 Chad Elliott <elliott_c@ociweb.com> + + * Messaging/AMIcallback/Messenger_i.cpp: + + Remove vc8 warning about conversion from time_t to smaller type. + +Mon Feb 25 17:28:59 UTC 2008 Ciju John <johnc at ociweb dot com> + + * PortableInterceptors/IOR/run_test.pl: + Additional timeout for monitoring service ior. + + * EventServices/RTEC_Federated/supplier.conf: + Add block flushing and exclusive TransportMuxing + strategies. Adding these fixes scoreboard failures. + +Wed Sep 19 17:24:25 UTC 2007 Ciju John <johnc at ociweb dot com> + + * Security/SecurityUnawareApp/MessengerClient.cpp: + * Security/SecurityUnawareApp/run_test.pl: + Fix app to mask expected exception. Also test script doesn't + exit on expected failure. + +Tue Dec 18 23:28:01 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * CIAO/Messenger/StaticDAnCE/run_test.pl: + * CIAO/Messenger/descriptors/run_test.pl: + + Using PerlACE::Process to determine the real path to NodeApplication + since it may need to be modified by -ExeSubDir. + +Thu Oct 25 14:48:21 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Receiver.mpc: + * CIAO/Messenger/StaticDAnCE/Messenger_StaticDAnCE.mpc: + + Added "requires += cidl" to all projects that did not already have + it. This prevents the CIAO examples from being built when there is + no CIAO library built. + +Wed Oct 24 22:05:08 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * CIAO/Messenger/StaticDAnCE: + * CIAO/Messenger/StaticDAnCE/Messenger_StaticDAnCE.mpc: + * CIAO/Messenger/StaticDAnCE/README.txt: + * CIAO/Messenger/StaticDAnCE/StaticDAnCEApp.cpp: + * CIAO/Messenger/StaticDAnCE/plan.h: + * CIAO/Messenger/StaticDAnCE/run_test.pl: + + Added a new example that builds on the CIAO/Messenger example but + runs one of the four nodes statically (no dlopen, etc.). + +Wed Oct 24 19:08:46 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + * CIAO/Messenger/Administrator_exec_i.h: + * CIAO/Messenger/Administrator_exec_i.cpp: + * CIAO/Messenger/History_exec_i.h: + * CIAO/Messenger/History_exec_i.cpp: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Messenger_exec_i.h: + * CIAO/Messenger/Messenger_exec_i.cpp: + * CIAO/Messenger/Publication_exec_i.h: + * CIAO/Messenger/Publication_exec_i.cpp: + * CIAO/Messenger/Receiver.mpc: + * CIAO/Messenger/Receiver_exec_i.h: + * CIAO/Messenger/Receiver_exec_i.cpp: + * CIAO/Messenger/Runnable_exec_i.h: + * CIAO/Messenger/Runnable_exec_i.cpp: + * CIAO/Messenger/descriptors/Application-flattened.cdp: + * CIAO/Messenger/descriptors/ApplicationNodeMap.dat: + * CIAO/Messenger/descriptors/README_15a: + * CIAO/Messenger/descriptors/run_test.pl: + + Ported the CIAO example to TAO 1.5a (CIAO 0.5a). + +Fri Oct 19 20:56:50 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * Multithreading/GracefulShutdown/GracefulShutdown.mpc: + * NotifyService/Filtering/Filtering.mpc: + + Added exename to account for the wchar changes (ACE_TMAIN). + + * devguide_examples.lst: + + Added the CIAO example, which is only run with -Config CIAO. + +Thu Oct 11 16:45:44 2007 ciju john <john_c@ociweb.com> + + Importing entry from $TAO_ROOT/OCIChangeLog + Wed Sep 19 17:24:25 UTC 2007 Ciju John <johnc at ociweb dot com> + * Security/SecurityUnawareApp/MessengerClient.cpp: + * Security/SecurityUnawareApp/run_test.pl: + Fix app to mask expected exception. Also test script doesn't + exit on expected failure. + +Tue Oct 9 16:20:46 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/server.cpp: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.h: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/RTNotify/Messenger_i.cpp: + * SmartProxies/Logger_i.h: + * SmartProxies/Logger_i.cpp: + * ValueTypes/Notify/consumer.cpp: + + Fixes for ACE_USES_WCHAR builds. + +Mon Jul 23 14:17:47 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * LocalObjects/ServantLocator/ServantLocator.mpc: + + Exclude this example from CORBA/e Compact and Micro builds. + +Fri Jun 15 21:54:31 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + + Changed code to match the new enumeration name in the IDL. + +Mon Jun 4 11:58:54 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + + Updated address server implementation to be consistent with the + interface. + +Thu May 10 11:44:16 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * NamingService/Naming_Server/MessengerTask.cpp: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + + Replaced the old ACE_.*_cast with the corresponding C++ style + cast. + +Fri Apr 27 13:15:11 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Disable the PortableInterceptors examples if interceptors are + disabled. + +Fri Apr 27 13:12:00 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * PortableInterceptors/Auth/Auth.mpc: + * PortableInterceptors/IOR/IOR.mpc: + * PortableInterceptors/PICurrent/PICurrent.mpc: + * PortableInterceptors/PICurrent_NameService/PICurrent_NameService.mpc: + * PortableInterceptors/SimpleCodec/SimpleCode.mpc: + + Added interceptors to the inheritence list for the clients. + +Wed Mar 21 14:48:47 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * AMH_AMI/run_test.pl: + * BiDirectionalGIOP/run_test.pl: + * EventServices/RTEC_Basic/run_test.pl: + * EventServices/RTEC_Federated/run_test.pl: + * EventServices/RTEC_Filter/run_test.pl: + * EventServices/RTEC_MCast_Federated/run_test.pl: + * ImplRepo/run_test.pl: + * Messaging/AMIcallback/run_test.pl: + * NamingService/Naming_Context_Ext/run_test.pl: + * NamingService/corbaloc_Messenger/run_test.pl: + * PortableInterceptors/Auth/run_test.pl: + * PortableInterceptors/IOR/run_test.pl: + * PortableInterceptors/PICurrent/run_test.pl: + * PortableInterceptors/PICurrent_NameService/run_test.pl: + * PortableInterceptors/SimpleCodec/run_test.pl: + * SmartProxies/run_test.pl: + * ValueTypes/Bank/run_test.pl: + * ValueTypes/Messenger/run_test.pl: + + Increase timeouts to allow these to run on slower machines. + +Tue Feb 27 12:17:34 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * PortableInterceptors/PICurrent_NameService/run_test.pl: + + I introduced a bug into this script. The MessengerServer does + not create an IOR file, just wait 1 second before starting the + client. + +Tue Feb 20 12:30:37 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * PortableInterceptors/Auth/run_test.pl: + * PortableInterceptors/IOR/run_test.pl: + * PortableInterceptors/PICurrent/run_test.pl: + * PortableInterceptors/PICurrent_NameService/run_test.pl: + * PortableInterceptors/SimpleCodec/run_test.pl: + + Modified these tests to wait for the IOR file and then a half + second before starting the client. On slower machines, the client + could get a TRANSIENT exception by invoking a method on the server + before it's ready. + +Mon Feb 19 15:23:44 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * ImplRepo/run_test.pl: + * LocalObjects/ServantLocator/run_test.pl: + * Messaging/AMIcallback/run_test.pl: + * Messaging/RelativeRoundtripTimeout/run_test.pl: + * NamingService/Messenger/run_test.pl: + * NamingService/Naming_Client/run_test.pl: + * NamingService/Naming_Context_Ext/run_test.pl: + * NamingService/Naming_Server/run_test.pl: + * NamingService/corbaloc_Messenger/run_test.pl: + * NamingService/corbaname_Messenger/run_test.pl: + * NotifyService/EventSequence/run_test.pl: + * NotifyService/Filtering/run_test.pl: + * NotifyService/Messenger/run_test.pl: + * NotifyService/OfferSubscriptions/run_test.pl: + * NotifyService/QoSProperties/run_test.pl: + * NotifyService/RTNotify/run_test.pl: + * NotifyService/SupplierSideNC/run_test.pl: + * PortableInterceptors/Auth/run_test.pl: + * PortableInterceptors/IOR/run_test.pl: + * PortableInterceptors/PICurrent/run_test.pl: + * PortableInterceptors/PICurrent_NameService/run_test.pl: + * PortableInterceptors/SimpleCodec/run_test.pl: + * RTCORBA/run_test.pl: + * Security/ParticipatingApp/run_test.pl: + * Security/PolicyControllingApp/run_test.pl: + * Security/SecurityUnawareApp/run_test.pl: + * SmartProxies/run_test.pl: + + Changed the return value check on SpawnWaitKill() from == -1 to != + 0 to catch process failures instead of just process timeouts. + +Thu Feb 15 12:23:31 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * ValueTypes/Bank/bank.mpc: + + With my rename from Wed Feb 14 14:29:40 UTC 2007, I forgot to + change the clients 'after' setting. + +Wed Feb 14 16:23:31 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * PortableInterceptors/PICurrent/ClientInitializer.h: + * PortableInterceptors/PICurrent/ClientInitializer.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.h: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + + Moved the setting of the PICurrent slot data to after the ORB and + PICurrent object are initialized. + +Wed Feb 14 14:29:40 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + + Include either tao/PI_Server/PI_Server.h or tao/PI/PI.h to ensure + that the PI_Server or PI libraries are actually linked into the + executable when statically linking. + +Wed Feb 14 14:03:26 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + The ImplRepo test can no longer be run in a static build since the + ImR_Client library must be dynamically loaded in. It is part of + the PortableServer library in TAO 1.4a. + +Tue Feb 13 13:05:57 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Administrator_exec_i.h: + * CIAO/Messenger/Administrator_exec_i.cpp: + * CIAO/Messenger/History_exec_i.h: + * CIAO/Messenger/History_exec_i.cpp: + * CIAO/Messenger/Messenger_exec_i.h: + * CIAO/Messenger/Messenger_exec_i.cpp: + * CIAO/Messenger/Publication_exec_i.h: + * CIAO/Messenger/Publication_exec_i.cpp: + * CIAO/Messenger/Receiver_exec_i.h: + * CIAO/Messenger/Receiver_exec_i.cpp: + * CIAO/Messenger/Runnable_exec_i.h: + * CIAO/Messenger/Runnable_exec_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * PortableInterceptors/IOR/ServerIORInterceptor.h: + * PortableInterceptors/IOR/ServerIORInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + + Removed the ACE exception macros. + + * EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc: + * ValueTypes/Bank/bank.mpc: + + Modified these project names so that they can be included in the + entire TAO workspace. + +Mon Feb 12 14:46:17 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * AMH_AMI/AMH_AMI.mpc: + + Re-arranged the generated source files so that they are at the + beginning (like MPC would do if it were automatically generating + the list of source files). This is required for template + instantiation to work properly for Visual Age 6.0. + +Thu Feb 8 14:32:40 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * LocalObjects/ServantLocator/ServantLocator.mpc: + + Added the anytypecode base project for compatibility with this + change to TAO (see $TAO_ROOT/OCIChangeLog). + Thu Feb 8 14:28:06 UTC 2007 Adam Mitz <mitza@ociweb.com> + +Mon Feb 5 22:51:25 UTC 2007 Adam Mitz <mitza@ociweb.com> + + * ValueTypes/Notify/Event.idl: + * ValueTypes/Notify/Event_i.h: + + Replaced a custom typedef for sequence<long> with CORBA::LongSeq. + Using the type provided by the C++ mapping spec is simpler and it + avoids a lingering problem with Visual C++ and DLL exports with + templates. + +Fri Feb 2 02:54:02 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + + Added requires += cidl so that these projects will not be built if + cidl is not available. + +Thu Feb 1 19:00:50 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/CIAO.mwc: + + Removed an unnecessary -includes. + + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Receiver.mpc: + + Removed requires += exceptions. + +Thu Feb 1 18:49:47 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * ChangeLogs/ChangeLog-1.4a: + * readme.txt: + * AMH/AMH.mpc: + * AMH_AMI/AMH_AMI.mpc: + * AMH_AMI/inner_cb.cpp: + * AMH_AMI/inner_cb.h: + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + * EventServices/OMG_Basic/OMG_Basic.mpc: + * EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Messenger_i.cpp: + * EventServices/OMG_TypedEC/Messenger_i.h: + * EventServices/OMG_TypedEC/OMG_TypedEC.mpc: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/RTEC_Basic/RTEC_Basic.mpc: + * EventServices/RTEC_Federated/RTEC_Federated.mpc: + * EventServices/RTEC_Filter/RTEC_Filter.mpc: + * EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * GettingStarted/GettingStarted.mpc: + * ImplRepo/ImplRepo.mpc: + * ImplRepo/Basic/ImplRepo_Basic.mpc: + * ImplRepo/IORTable/ImplRepo_IORTable.mpc: + * InterfaceRepo/IFRBrowser.cpp: + * InterfaceRepo/InterfaceRepo.mpc: + * LocalObjects/Messenger/Messenger.mpc: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * LocalObjects/ServantLocator/ServantLocator.mpc: + * Messaging/AMIcallback/AMIcallback.mpc: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerHandler.h: + * Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc: + * Multithreading/GracefulShutdown/GracefulShutdown.mpc: + * Multithreading/Reactive/Reactive.mpc: + * Multithreading/ThreadPerConnection/ThreadPerConnection.mpc: + * Multithreading/ThreadPool/ThreadPool.mpc: + * NamingService/Messenger/Messenger.mpc: + * NamingService/Naming_Client/Naming_Client.mpc: + * NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc: + * NamingService/Naming_Server/Naming_Server.mpc: + * NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + * NotifyService/EventSequence/EventSequence.mpc: + * NotifyService/Filtering/Filtering.mpc: + * NotifyService/Messenger/Messenger.mpc: + * NotifyService/OfferSubscriptions/OfferSubscriptions.mpc: + * NotifyService/QoSProperties/QoSProperties.mpc: + * NotifyService/RTNotify/RTNotify.mpc: + * NotifyService/SupplierSideNC/SupplierSideNC.mpc: + * PortableInterceptors/Auth/Auth.mpc: + * PortableInterceptors/Auth/ClientInitializer.h: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/Auth/ServerInitializer.h: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/Auth/ServerInterceptor.h: + * PortableInterceptors/IOR/ClientInitializer.h: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/IOR/ClientInterceptor.h: + * PortableInterceptors/IOR/IOR.mpc: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/ServerInitializer.h: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/IOR/ServerInterceptor.h: + * PortableInterceptors/PICurrent/ClientInitializer.h: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.h: + * PortableInterceptors/PICurrent/PICurrent.mpc: + * PortableInterceptors/PICurrent/ServerInitializer.h: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.h: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.h: + * PortableInterceptors/PICurrent_NameService/PICurrent_NameService.mpc: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.h: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.h: + * PortableInterceptors/SimpleCodec/ClientInitializer.h: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.h: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/ServerInitializer.h: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.h: + * PortableInterceptors/SimpleCodec/SimpleCode.mpc: + * RTCORBA/RTCORBA.mpc: + * Security/ParticipatingApp/ParticipatingApp.mpc: + * Security/PolicyControllingApp/PolicyControllingApp.mpc: + * Security/SecurityUnawareApp/SecurityUnawareApp.mpc: + * SmartProxies/SmartProxies.mpc: + * ValueTypes/Bank/bank.mpc: + * ValueTypes/Bank/server.cpp: + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/ValueTypes.mpc: + * ValueTypes/Notify/Notify.mpc: + + Brought over the TAO 1.4a DevGuideExamples and updated them for + TAO 1.5a. diff --git a/DevGuideExamples/ChangeLogs/ChangeLog-1.4a b/DevGuideExamples/ChangeLogs/ChangeLog-1.4a new file mode 100644 index 00000000000..9d8258884a5 --- /dev/null +++ b/DevGuideExamples/ChangeLogs/ChangeLog-1.4a @@ -0,0 +1,1932 @@ +Tue Jan 23 17:06:25 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Don't run examples that require threads if the ST configuration is + supplied. + +Tue Jan 23 17:00:34 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * AMH/MessengerClient.cpp: + * AMH/MessengerServer.cpp: + * AMH_AMI/client.cpp: + * AMH_AMI/inner_cb.cpp: + * AMH_AMI/inner_server.cpp: + * AMH_AMI/middle_server.cpp: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/server.cpp: + * CIAO/Messenger/Administrator_Client.cpp: + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * GettingStarted/MessengerClient.cpp: + * GettingStarted/MessengerServer.cpp: + * ImplRepo/Basic/MessengerClient.cpp: + * ImplRepo/Basic/MessengerServer.cpp: + * ImplRepo/IORTable/MessengerClient.cpp: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/MessengerClient.cpp: + * ImplRepo/MessengerServer.cpp: + * InterfaceRepo/IFRBrowser.cpp: + * LocalObjects/Messenger/MessengerServer.cpp: + * LocalObjects/ServantLocator/MessengerClient.cpp: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerServer.cpp: + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/Reactive/MessengerClient.cpp: + * Multithreading/Reactive/MessengerServer.cpp: + * Multithreading/ThreadPerConnection/MessengerClient.cpp: + * Multithreading/ThreadPerConnection/MessengerServer.cpp: + * Multithreading/ThreadPool/MessengerClient.cpp: + * Multithreading/ThreadPool/MessengerServer.cpp: + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + * NamingService/Naming_Client/MessengerClient.cpp: + * NamingService/Naming_Client/MessengerServer.cpp: + * NamingService/Naming_Context_Ext/MessengerClient.cpp: + * NamingService/Naming_Context_Ext/MessengerServer.cpp: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/NamingTask.cpp: + * NamingService/corbaloc_Messenger/MessengerClient.cpp: + * NamingService/corbaloc_Messenger/MessengerServer.cpp: + * NamingService/corbaname_Messenger/MessengerClient.cpp: + * NamingService/corbaname_Messenger/MessengerServer.cpp: + * NotifyService/EventSequence/MessengerClient.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NotifyService/EventSequence/MessengerServer.cpp: + * NotifyService/Filtering/MessengerClient.cpp: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Messenger/MessengerClient.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/MessengerServer.cpp: + * NotifyService/OfferSubscriptions/MessengerClient.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + * NotifyService/QoSProperties/MessengerClient.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/RTNotify/MessengerClient.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/RTNotify/MessengerServer.cpp: + * NotifyService/SupplierSideNC/MessengerClient.cpp: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * PortableInterceptors/Auth/ClientInitializer.cpp: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * RTCORBA/MessengerClient.cpp: + * RTCORBA/MessengerServer.cpp: + * Security/ParticipatingApp/MessengerClient.cpp: + * Security/ParticipatingApp/MessengerServer.cpp: + * Security/PolicyControllingApp/MessengerClient.cpp: + * Security/PolicyControllingApp/MessengerServer.cpp: + * Security/SecurityUnawareApp/MessengerClient.cpp: + * Security/SecurityUnawareApp/MessengerServer.cpp: + * SmartProxies/LoggerServer.cpp: + * SmartProxies/MessengerClient.cpp: + * SmartProxies/MessengerServer.cpp: + * ValueTypes/Bank/client.cpp: + * ValueTypes/Messenger/MessengerClient.cpp: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + Catch exceptions as const. + +Tue Jan 23 13:16:24 UTC 2007 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.h: + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.h: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.h: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/run_test.pl: + + Moved the disconnect_push_supplier() call to happen before the ORB + is shut down. There should be no communication related calls on + servants after shutdown() is called on the ORB. + + * devguide_examples.lst: + + Re-enabled the Security/ParticipatingApp example. It was + temporarily disabled in March of 2005, but runs properly now. + + * devguide_client.mpb: + * devguide_example.mpb: + * devguide_server.mpb: + + Removed these files. They were not used by any of the examples. + +Sat Dec 23 18:42:18 UTC 2006 Steve Totten <totten_s@ociweb.com> + + * DevGuideExamples/NamingService/Naming_Server/Naming_Server.mpc: + Added "requires += threads" as this server + specifically calls activate on an ACE_Task. Thanks + to Rich Seibel <seibel_r@ociweb.com> for pointing + this out. + +Thu Aug 3 16:56:13 UTC 2006 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + + Removed an unused parameter warning. + +Tue Aug 1 15:52:53 UTC 2006 Ciju John <johnc@ociweb.com> + + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + + The host name part was being set incorrectly. + +Fri Jul 14 12:11:13 UTC 2006 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + + Added an implementation for get_ip_address() which was added in + the commit to TAO 1.4a on Wed Jul 12 21:56:32 UTC 2006. + + * EventServices/RTEC_MCast_Federated/run_test.pl: + + If the TAO_ROOT environment variable isn't set, create it from + $ACE_ROOT/TAO. + +Fri Apr 21 16:16:46 2006 Ciju John <john_c@ociweb.com> + + * devguide_examples.lst: + + Restored the RTEC_MCast_Federated to the nightly list. + +Fri Apr 21 16:00:01 2006 Ciju John <john_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated : + + Restored the DevGuideExample deleted in entry + Fri Apr 7 15:30:11 2006 Ciju John <john_c@ociweb.com> + +Fri Apr 7 15:30:11 2006 Ciju John <john_c@ociweb.com> + + * devguide_examples.lst + + Commented out RTEC_MCast_Federated example. + + * EventServices/RTEC_MCast_Federated + + Remove DevGuide example. + +Tue Mar 7 13:11:30 UTC 2006 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/OMG_Basic/OMG_Basic.mpc: + * EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc: + * EventServices/OMG_TypedEC/OMG_TypedEC.mpc: + * NamingService/Messenger/Messenger.mpc: + * NamingService/Naming_Client/Naming_Client.mpc: + * NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc: + * NamingService/Naming_Server/Naming_Server.mpc: + * NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + + Empty parent project names are no longer accepted (and ignored) by + MPC. + +Thu Feb 2 13:41:47 2006 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Added the !NO_EXCEPTIONS to the RTCORBA example. + +Mon Jan 23 13:14:49 2006 Chad Elliott <elliott_c@ociweb.com> + + * NotifyService/RTNotify/run_test.pl: + + Increased the timeout for the messenger server for slower loading + machines. + +Mon Jan 23 06:28:43 2006 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Modified to not run the InterfaceRepo test on a minimum corba + build. + +Fri Jan 20 06:39:59 2006 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Modified the settings for + PortableInterceptors/PICurrent/run_test.pl by adding !MINIMUM as + is done for all of the other PortableInterceptors tests. + + I also added !DISABLE_INTERCEPTORS to all the Security tests as + both the TAO_Security library and TAO_SSLIOP library require + interceptors. + +Tue Jan 17 09:00:33 2006 Chad Elliott <elliott_c@ociweb.com> + + * InterfaceRepo/IFRBrowser.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * PortableInterceptors/Auth/ClientInitializer.h: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/IOR/ClientInitializer.h: + * PortableInterceptors/IOR/ClientInterceptor.h: + * PortableInterceptors/PICurrent/ClientInitializer.h: + * PortableInterceptors/PICurrent/ClientInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.h: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.h: + * PortableInterceptors/SimpleCodec/ClientInitializer.h: + * PortableInterceptors/SimpleCodec/ClientInterceptor.h: + * ValueTypes/Messenger/MessengerClient.cpp: + + Modified these files to use correct reference counting which + cleans up a few memory leaks. + +Fri Nov 18 14:56:08 USMST 2005 Yan Dai <dai_y@ociweb.com> + + * DevGuideExamples/ValueTypes/Notify/supplier.cpp: + * DevGuideExamples/ValueTypes/Notify/run_test.pl: + * DevGuideExamples/ValueTypes/Notify/consumer.cpp: + + Made the test create event channel instead of getting from + EventChannelFactory since current Notify_Service implementation + does not create a default event channel when -NoNameSvc is + specified. + +Wed Nov 9 14:54:08 2005 Don Busch <busch_d@ociweb.com> + + * CIAO/Messenger/Administrator_Client.cpp + * CIAO/Messenger/Administrator_Client_IDL2.cpp + * CIAO/Messenger/Administrator_Client_IDL3.cpp + * CIAO/Messenger/Administrator_Client_IDL2.mpc + * CIAO/Messenger/Administrator_Client_IDL3.mpc + + Fixed both of these clients so they build properly + without conflicting with each other. The + Administrator_Client_IDL2.mpc client is a good example + of how to build an IDL3-to-IDL2 client. + +Fri Sep 23 14:54:08 2005 Wallace Zhang <zhang_w@ociweb.com> + + * AMH_AMI/middle_i.h: + * AMH_AMI/middle_i.cpp: + + Changed a couple of passing parameter names to match the dev guide. + +Fri Sep 23 14:24:34 2005 Wallace Zhang <zhang_w@ociweb.com> + + * Multithreading/ThreadPerConnection/server.conf: + + Corrected a typo. + +Fri Sep 23 14:17:29 2005 Wallace Zhang <zhang_w@ociweb.com> + + * InterfaceRepo/IFRBrowser.cpp: + + Changed two variable types from unsigned int to CORBA::ULong. + +Fri Sep 23 14:08:19 2005 Wallace Zhang <zhang_w@ociweb.com> + + * NamingService/Naming_Server/NamingTask.h: + + Changed the NamingTask to inherit from ACE_Task<ACE_MT_SYNCH> + since it is a two-threaded application. + +Fri Sep 23 13:58:13 2005 Wallace Zhang <zhang_w@ociweb.com> + + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + + Changed to use more meaningful variable name and added + more comments to match the dev guide. + +Fri Sep 23 13:35:05 2005 Wallace Zhang <zhang_w@ociweb.com> + + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + + Explicitly set the disjunction group be 1 to match + the dev guide. + + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + + Fixed a typo in a comment. + +Fri Sep 23 13:05:32 2005 Wallace Zhang <zhang_w@ociweb.com> + + * InterfaceRepo/IFRBrowser.cpp: + + Added a default case to a switch statment + to match the dev guide. + +Fri Sep 23 12:42:31 2005 Wallace Zhang <zhang_w@ociweb.com> + + * ImplRepo/Basic/MessengerServer.cpp: + + Changed the way of creating policy list to match the + dev guide. + +Fri Sep 23 10:33:04 2005 Chris Cleeland <cleeland_c@ociweb.com> + + * AMH_AMI/inner_server.cpp: + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + + Fixed a few instance where the script I used to convert from + <ace/streams.h> to <iostream> left out a newline after the + changed line. This should fix compile problems on the + scoreboard. + +Fri Sep 23 02:22:38 2005 Steve Totten <totten_s@ociweb.com> + + * ValueTypes/Messenger/MessengerClient.cpp: + * ImplRepo/IORTable/MessengerClient.cpp: + * ImplRepo/Basic/MessengerClient.cpp: + + Added "CORBA::" to "is_nil()". + +Thu Sep 22 14:54:20 2005 Chris Cleeland <cleeland_c@ociweb.com> + + I think it would have been easier to list the files that didn't + change... + + * AMH/AMH.mpc: + * AMH_AMI/AMH_AMI.mpc: + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Receiver.mpc: + * EventServices/OMG_Basic/OMG_Basic.mpc: + * EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc: + * EventServices/OMG_TypedEC/OMG_TypedEC.mpc: + * EventServices/RTEC_Basic/RTEC_Basic.mpc: + * EventServices/RTEC_Federated/RTEC_Federated.mpc: + * EventServices/RTEC_Filter/RTEC_Filter.mpc: + * EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc: + * GettingStarted/GettingStarted.mpc: + * ImplRepo/Basic/ImplRepo_Basic.mpc: + * ImplRepo/IORTable/ImplRepo_IORTable.mpc: + * ImplRepo/ImplRepo.mpc: + * InterfaceRepo/InterfaceRepo.mpc: + * LocalObjects/Messenger/Messenger.mpc: + * LocalObjects/ServantLocator/ServantLocator.mpc: + * Messaging/AMIcallback/AMIcallback.mpc: + * Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc: + * Multithreading/GracefulShutdown/GracefulShutdown.mpc: + * Multithreading/Reactive/Reactive.mpc: + * Multithreading/ThreadPerConnection/ThreadPerConnection.mpc: + * Multithreading/ThreadPool/ThreadPool.mpc: + * NamingService/Messenger/Messenger.mpc: + * NamingService/Naming_Client/Naming_Client.mpc: + * NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc: + * NamingService/Naming_Server/Naming_Server.mpc: + * NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + * NotifyService/EventSequence/EventSequence.mpc: + * NotifyService/Filtering/Filtering.mpc: + * NotifyService/Messenger/Messenger.mpc: + * NotifyService/OfferSubscriptions/OfferSubscriptions.mpc: + * NotifyService/QoSProperties/QoSProperties.mpc: + * NotifyService/RTNotify/RTNotify.mpc: + * NotifyService/SupplierSideNC/SupplierSideNC.mpc: + * PortableInterceptors/Auth/Auth.mpc: + * PortableInterceptors/IOR/IOR.mpc: + * PortableInterceptors/PICurrent/PICurrent.mpc: + * PortableInterceptors/PICurrent_NameService/PICurrent_NameService.mpc: + * PortableInterceptors/SimpleCodec/SimpleCode.mpc: + * RTCORBA/RTCORBA.mpc: + * Security/ParticipatingApp/ParticipatingApp.mpc: + * Security/PolicyControllingApp/PolicyControllingApp.mpc: + * Security/SecurityUnawareApp/SecurityUnawareApp.mpc: + * SmartProxies/SmartProxies.mpc: + * ValueTypes/Bank/bank.mpc: + * ValueTypes/Messenger/ValueTypes.mpc: + * ValueTypes/Notify/Notify.mpc: + + Removed reference to the devguide_server and devguide_client + base projects. Since one of the goals for our dev guide + examples is to provide hallmark examples of how to write code + and projects, and we document the mpc files in the book itself, + it didn't seem correct to use base projects that the user + herself would not end up using. + + Note that if we decide, at some point, to add an example of + creating your own base project to the MPC chapter, we could then + re-introduce devguide-specific base projects. + + * AMH/AMH_Messenger_i.cpp: + * AMH/MessengerClient.cpp: + * AMH/MessengerServer.cpp: + * AMH/Messenger_i.cpp: + + * AMH_AMI/client.cpp: + * AMH_AMI/inner_cb.cpp: + * AMH_AMI/inner_server.cpp: + * AMH_AMI/middle_i.cpp: + * AMH_AMI/middle_server.cpp: + + * BiDirectionalGIOP/server.cpp: + + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Messenger_i.cpp: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + * GettingStarted/MessengerClient.cpp: + * GettingStarted/MessengerServer.cpp: + * GettingStarted/Messenger_i.cpp: + + * ImplRepo/Basic/MessengerClient.cpp: + * ImplRepo/Basic/MessengerServer.cpp: + * ImplRepo/Basic/Messenger_i.cpp: + + * ImplRepo/IORTable/MessengerClient.cpp: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/IORTable/Messenger_i.cpp: + + * ImplRepo/MessengerClient.cpp: + * ImplRepo/MessengerServer.cpp: + * ImplRepo/Messenger_i.cpp: + + + * LocalObjects/Messenger/MessengerServer.cpp: + + * LocalObjects/ServantLocator/MessengerClient.cpp: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * LocalObjects/ServantLocator/Messenger_i.cpp: + + * Messaging/AMIcallback/Messenger.idl: + * Messaging/AMIcallback/MessengerHandler.h: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/AMIcallback/Messenger_i.h: + * Messaging/AMIcallback/Messenger_i.cpp: + + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerServer.cpp: + + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/GracefulShutdown/Messenger_i.cpp: + + * Multithreading/Reactive/MessengerClient.cpp: + * Multithreading/Reactive/MessengerServer.cpp: + * Multithreading/Reactive/Messenger_i.cpp: + + * Multithreading/ThreadPerConnection/MessengerClient.cpp: + * Multithreading/ThreadPerConnection/MessengerServer.cpp: + * Multithreading/ThreadPerConnection/Messenger_i.cpp: + + * Multithreading/ThreadPool/MessengerClient.cpp: + * Multithreading/ThreadPool/MessengerServer.cpp: + * Multithreading/ThreadPool/Messenger_i.cpp: + + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + * NamingService/Messenger/Messenger_i.cpp: + + * NamingService/Naming_Client/MessengerClient.cpp: + * NamingService/Naming_Client/MessengerServer.cpp: + * NamingService/Naming_Client/Messenger_i.cpp: + + * NamingService/Naming_Context_Ext/MessengerClient.cpp: + * NamingService/Naming_Context_Ext/MessengerServer.cpp: + * NamingService/Naming_Context_Ext/Messenger_i.cpp: + + * NamingService/Naming_Server/Messenger_i.cpp: + + * NamingService/corbaloc_Messenger/MessengerClient.cpp: + * NamingService/corbaloc_Messenger/MessengerServer.cpp: + * NamingService/corbaloc_Messenger/Messenger_i.cpp: + + * NamingService/corbaname_Messenger/MessengerClient.cpp: + * NamingService/corbaname_Messenger/MessengerServer.cpp: + * NamingService/corbaname_Messenger/Messenger_i.cpp: + + * NotifyService/EventSequence/MessengerClient.cpp: + * NotifyService/EventSequence/MessengerServer.cpp: + + * NotifyService/Filtering/MessengerClient.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + + * NotifyService/Messenger/MessengerClient.cpp: + * NotifyService/Messenger/MessengerServer.cpp: + + * NotifyService/OfferSubscriptions/MessengerClient.cpp: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + + * NotifyService/QoSProperties/MessengerClient.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + + * NotifyService/RTNotify/MessengerClient.cpp: + * NotifyService/RTNotify/MessengerServer.cpp: + + * NotifyService/SupplierSideNC/MessengerClient.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/ServerIORInterceptor.cpp: + + * PortableInterceptors/PICurrent/ClientInitializer.cpp: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent/run_test.pl: + + * PortableInterceptors/PICurrent_NameService/ClientInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + + * RTCORBA/MessengerClient.cpp: + * RTCORBA/MessengerServer.cpp: + * RTCORBA/Messenger_i.cpp: + + * Security/ParticipatingApp/MessengerServer.cpp: + * Security/ParticipatingApp/Messenger_i.cpp: + + * Security/PolicyControllingApp/MessengerClient.cpp: + * Security/PolicyControllingApp/MessengerServer.cpp: + * Security/PolicyControllingApp/Messenger_i.cpp: + + * Security/SecurityUnawareApp/MessengerClient.cpp: + * Security/SecurityUnawareApp/MessengerServer.cpp: + * Security/SecurityUnawareApp/Messenger_i.cpp: + + * SmartProxies/LoggerServer.cpp: + * SmartProxies/MessengerClient.cpp: + * SmartProxies/MessengerServer.cpp: + * SmartProxies/Messenger_i.cpp: + + * ValueTypes/Bank/client.cpp: + * ValueTypes/Bank/server.cpp: + + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/MessengerClient.cpp: + * ValueTypes/Messenger/MessengerServer.cpp: + * ValueTypes/Messenger/Messenger_i.h: + * ValueTypes/Messenger/Messenger_i.cpp: + + * ValueTypes/Notify/Event_i.h: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + General synchronization of actual source code with code + published in the book. Sometimes the book's expresion of + the idea won, while sometimes others won. In places where + the code remains different, it's because the differences + didn't lend substantially to the educational value of the + example in the book, but lent significantly to the efficacy + of the actual code. + + Now that the world seems to have caught up to standards, I + replaced ACE_ASSERT() usage with throwing exceptions defined + the C++ standard, and changed usage of ACE's streams to use + the actual standard streams. + + Removed "using namespace..." shorthand syntax, as this also + conflicts with the idea that the code should be consistent + between the book and the actual code. + +Wed Sep 14 08:46:46 2005 Justin Michel <michel_j@ociweb.com> + + * devguide_examples.lst: + + Missing ':' between test and config options. + +Tue Sep 13 10:31:23 2005 Justin Michel <michel_j@ociweb.com> + + * devguide_examples.lst: + + Prevent the tests from running for exceptions=0 builds. + +Wed Aug 31 17:12:59 2005 Chris Cleeland <cleeland_c@ociweb.com> + + * Security/ParticipatingApp/MessengerServer.cpp: + * Security/ParticipatingApp/Messenger_i.h: + * Security/ParticipatingApp/Messenger_i.cpp: + + Removed references to now-obsolete SecurityLevel1 and + SecurityLevel2 "Current" objects. + + * Security/ParticipatingApp/ParticipatingApp.mpc: + * Security/PolicyControllingApp/PolicyControllingApp.mpc: + + Updated to use the ssliop base project. + +Wed Aug 31 12:03:40 2005 Chad Elliott <elliott_c@ociweb.com> + + * BiDirectionalGIOP/bidir_giop_pch.cpp: + + Added a pch cpp file since vc8 requires it in order to use + precompiled headers. + +Wed Aug 31 11:30:49 2005 Justin Michel <michel_j@ociweb.com> + + * SmartProxies/SmartProxies.mpc: + + One of the projects was incorrectly compiling IDL, which caused + a problem on nmake builds. Other platforms worked due to the + random order in which projects are built. + +Wed Aug 24 16:46:13 2005 Justin Michel <michel_j@ociweb.com> + + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + + Changed the project to derive from ciao_client. This simplifies the mpc, and + prevents the project from being built when ciao is disabled. + +Wed Aug 24 12:52:02 2005 Wallace Zhang <zhang_w@ociweb.com> + + * CIAO/Messenger/descriptors/run_test.pl: + + Delete one redundant line for creating CIAO_ROOT variable. + +Wed Aug 24 12:22:56 2005 Wallace Zhang <zhang_w@ociweb.com> + + * CIAO/Messenger/Administrator_Client.cpp: + * CIAO/Messenger/Administrator_Client_IDL2.mpc: + * CIAO/Messenger/Administrator_Client_IDL3.mpc: + + This is to test the tao_idl3_to_idl2 compiler. Don Busch provided + the three files. I made some changes to Administrator_Client_IDL2.mpc + to let it work within CIAO. + + * CIAO/Messenger/Administrator_exec_i.cpp: + + Added an EXIT option to the interactive user interface. + + * CIAO/Messenger/descriptors/ApplicationNodeMap.dat: + + Changed port number. There was a confliction of use of port number + 10000 in my system. Now I changed it to 11000 (22000,33000,44000). + + * CIAO/Messenger/descriptors/admin.dat: + + This file contains the input data for I/O redirection. + + * CIAO/Messenger/descriptors/run_test.pl: + + Add this perl script to automatically test this example. + + For more information, please refer to [RT 5889]. + +Wed Aug 17 14:18:54 2005 Steve Totten <totten_s@ociweb.com> + + * readme.txt: + Added instructions for generating solution/project files for vc71. + +Tue Aug 2 07:48:22 2005 Chad Elliott <elliott_c@ociweb.com> + + * ValueTypes/Bank/bank.mpc: + * ValueTypes/Bank/server.cpp: + + Fixed build errors due to incorrect 'after' usage and missing + throw specs. + +Mon Aug 1 16:40:04 2005 Justin Michel <michel_j@ociweb.com> + + * ValueTypes/Bank/README: + * ValueTypes/Bank/_pch.h: + * ValueTypes/Bank/_pch.cpp: + * ValueTypes/Bank/bank.idl: + * ValueTypes/Bank/bank.mpc: + * ValueTypes/Bank/client.cpp: + * ValueTypes/Bank/run_test.pl: + * ValueTypes/Bank/server.cpp: + + A new example that's simpler than the Messenger example + in some ways. + + * ValueTypes/Messenger/Message_i.h: + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/Messenger.idl: + * ValueTypes/Messenger/MessengerClient.cpp: + * ValueTypes/Messenger/MessengerServer.cpp: + + Removed use of factory, as this functionality is now + demonstrated with the Bank example. + + * ValueTypes/Notify/Event.idl: + * ValueTypes/Notify/Event_i.h: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/supplier.cpp: + + Removed some exception macros. + Use ACE_DEBUG instead of cout for better multithreading/multiprocess + behavior. + + * devguide_examples.lst: + + Added the Bank example. + +Mon Aug 1 15:45:11 2005 Wallace Zhang <zhang_w@ociweb.com> + + * devguide_examples.lst: + + Enable the EventServices/OMG_TypedEC/run_test.pl + +Wed Jul 27 12:50:45 2005 Justin Michel <michel_j@ociweb.com> + + * devguide_examples.lst: + + Add the new example to the list. + +Wed Jul 27 12:38:01 2005 Justin Michel <michel_j@ociweb.com> + + * ValueTypes/Notify/Event.idl: + * ValueTypes/Notify/Event_i.h: + * ValueTypes/Notify/Notify.mpc: + * ValueTypes/Notify/consumer.cpp: + * ValueTypes/Notify/notify.conf: + * ValueTypes/Notify/readme.txt: + * ValueTypes/Notify/run_test.pl: + * ValueTypes/Notify/supplier.cpp: + + A new example, showing how to use valuetypes with the + notification service. + +Mon Jul 25 09:21:31 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH/AMH_Messenger_i.cpp: + + Use the inout() method on the String_var. + +Mon Jul 18 12:01:17 2005 Chad Elliott <elliott_c@ociweb.com> + + * SmartProxies/MessengerClient.cpp: + + Added a catch for ... since a constructor can throw an integer + exception. + + * SmartProxies/SmartProxies.mpc: + + Updated to remove smart_proxies from the LoggerServer project and + ensure that the client is built after the server and the logger. + +Wed Jul 6 10:40:42 2005 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/MessengerServer.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.h: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/EventSequenceSupplier_i.cpp: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Filtering/StructuredEventSupplier_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/StructuredEventSupplier_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/StructuredEventSupplier_i.cpp: + * NotifyService/RTNotify/StructuredEventConsumer_i.cpp: + * NotifyService/RTNotify/StructuredEventSupplier_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp: + + Modifications to go along with the skeleton refactoring merge. + +Tue May 31 15:19:38 2005 Chris Cleeland <cleeland_c@ociweb.com> + + * Security/ParticipatingApp/MessengerClient.cpp: + + Added line continuation characters into the strings in the + sample service configuration files. Without them, some + preprocessors were getting confused. + + * Security/ParticipatingApp/run_test.pl: + + Increased the time to wait for the IOR file to show up. + +Tue May 10 10:15:40 2005 Justin Michel <michel_j@ociweb.com> + + * ImplRepo/IORTable/MessengerServer.cpp: + + Missing .in() on String_vars causes warnings on some compilers. + +Fri May 6 09:21:37 2005 Justin Michel <michel_j@ociweb.com> + + * CIAO/CIAO.mwc: + * CIAO/Messenger/Messenger.mwc: + + Removed unwanted vcproj, sln, and mwc files. + Added a new ciao feature to allow disabling all CIAO mpc generation. + +Fri Apr 29 10:20:17 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + + Add a separate ORB thread to this test to avoid deadlocks between + the two supplier processes. + +Thu Apr 28 10:30:17 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + Remove separate ORB thread as it is no longer needed. + + * EventServices/RTEC_MCast_Federated/run_test.pl: + + Modify test to remove redirection as it was causing the EchoEventSuppliers + to not be killed. Also changed the ports to random ports to avoid collisions. + +Wed Apr 27 15:20:58 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + Clean up this file for the new devguide. + +Mon Apr 25 15:24:51 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/README: + * EventServices/RTEC_MCast_Federated/run_test.pl: + + Improve the timing of this test. It was previously based on sleep() + calls in the perl script and supplier code. + +Mon Apr 25 14:04:35 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_Federated/run_test.pl: + * EventServices/RTEC_Federated/supplier.conf: + + Try to alleviate some deadlocking issues with IIOP Gateway on + some platforms. + +Fri Apr 22 11:56:42 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/SupplierMain.cpp: + + Another compiler warning removed. + +Fri Apr 22 11:51:20 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/Consumer_i.cpp: + + Get rid of unused parameter warning. + +Fri Apr 22 09:55:58 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/README: + * EventServices/RTEC_Federated/run_test.pl: + + Fix this example so that it actually federates event channels. + +Thu Apr 21 21:28:42 2005 Paul Calabrese <calabrese_p@ociweb.com> + + + * EventServices/OMG_Basic/ExceptionUtil.h: + * EventServices/OMG_SupplierSideEC/ExceptionUtil.h: + * EventServices/RTEC_Basic/ExceptionUtil.h: + * EventServices/RTEC_Federated/ExceptionUtil.h: + * EventServices/RTEC_Filter/ExceptionUtil.h: + * EventServices/RTEC_MCast_Federated/ExceptionUtil.h: + + Removed these unused files. + +Thu Apr 21 21:17:48 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Consumer_i.h: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/OMG_TypedEC/Messenger.idl: + * EventServices/OMG_TypedEC/Messenger_i.h: + * EventServices/OMG_TypedEC/Messenger_i.cpp: + * EventServices/OMG_TypedEC/README: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + + Cosmetic updates for DevGuide. + +Thu Apr 21 15:37:43 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/README: + + Convert commands to use *IOR environment variables. + +Thu Apr 21 14:56:15 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/README: + + Add a README for this example. + +Thu Apr 21 13:43:58 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_TypedEC/ConsumerMain.cpp: + * EventServices/OMG_TypedEC/Consumer_i.h: + * EventServices/OMG_TypedEC/Consumer_i.cpp: + * EventServices/OMG_TypedEC/Messenger.idl: + * EventServices/OMG_TypedEC/Messenger_i.h: + * EventServices/OMG_TypedEC/Messenger_i.cpp: + * EventServices/OMG_TypedEC/OMG_TypedEC.mpc: + * EventServices/OMG_TypedEC/SupplierMain.cpp: + * EventServices/OMG_TypedEC/run_test.pl: + + Add a new example using typed event channels. + +Wed Apr 20 15:22:14 2005 Don Busch <busch_d@ociweb.com> + + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.cpp: + + Added std:: prefix to cout, cerr, endl. + Changed message.inout() to message.in() in client. + Changed exception handlling to use try/catch and orb->shutdown() in + MessengerHandler to correct error. + + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + + Changed SET/ADD_OVERRIDE usage to match DevGuide + +Fri Apr 15 12:30:02 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + Rename naming_client variables for readability. + +Tue Apr 5 06:48:00 2005 Chad Elliott <elliott_c@ociweb.com> + + * ImplRepo/Basic/Messenger_i.h: + * ImplRepo/Basic/Messenger_i.cpp: + * ImplRepo/IORTable/Messenger_i.h: + * ImplRepo/IORTable/Messenger_i.cpp: + + Added throw specs to match the base class. + +Mon Apr 4 15:54:56 2005 Justin Michel <michel_j@ociweb.com> + + * ImplRepo/Activator/run_test.pl: + * ImplRepo/Basic/ImplRepo_Basic.mpc: + * ImplRepo/Basic/Messenger.idl: + * ImplRepo/Basic/MessengerClient.cpp: + * ImplRepo/Basic/MessengerServer.cpp: + * ImplRepo/Basic/Messenger_i.h: + * ImplRepo/Basic/Messenger_i.cpp: + * ImplRepo/Basic/run_test.pl: + * ImplRepo/IORTable/ImplRepo_IORTable.mpc: + * ImplRepo/IORTable/Messenger.idl: + * ImplRepo/IORTable/MessengerClient.cpp: + * ImplRepo/IORTable/MessengerServer.cpp: + * ImplRepo/IORTable/Messenger_i.h: + * ImplRepo/IORTable/Messenger_i.cpp: + * ImplRepo/IORTable/run_test.pl: + + Add samples corresponding to the new devguide ImR chapter. + +Fri Apr 1 08:55:43 2005 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Added a !NO_IFR configuration to the IFR related test. + The IFR_Service will not run on MacOS X unless TAO is built + statically due to gcc's in ability to deal with template + instantiated singletons correctly. + +Thu Mar 31 13:18:21 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * NotifyService/RTNotify/Messenger.idl: + * NotifyService/RTNotify/MessengerClient.cpp: + * NotifyService/RTNotify/MessengerConsumer.cpp: + * NotifyService/RTNotify/MessengerServer.cpp: + * NotifyService/RTNotify/Messenger_i.h: + * NotifyService/RTNotify/Messenger_i.cpp: + * NotifyService/RTNotify/Priorities.h: + * NotifyService/RTNotify/README: + * NotifyService/RTNotify/RTNotify.mpc: + * NotifyService/RTNotify/StructuredEventConsumer_i.h: + * NotifyService/RTNotify/StructuredEventConsumer_i.cpp: + * NotifyService/RTNotify/StructuredEventSupplier_i.h: + * NotifyService/RTNotify/StructuredEventSupplier_i.cpp: + * NotifyService/RTNotify/notify.conf: + * NotifyService/RTNotify/nsclient.conf: + * NotifyService/RTNotify/run_test.pl: + * devguide_examples.lst: + + Add a a new DevGuide example for RT Notification. + +Wed Mar 30 07:59:23 2005 Chad Elliott <elliott_c@ociweb.com> + + * ValueTypes/Messenger/run_test.pl: + + Increase the timeout for slower machines. + +Wed Mar 30 11:04:12 2005 Justin Michel <michel_j@ociweb.com> + + * ImplRepo/MessengerServer.cpp: + + Update all examples to use _tao_poa_downcast() instead of + RTTI, because I think it's slightly easier to read. Note: The files + still have to include tao/PortableServer/POA.h. + +Tue Mar 29 17:07:14 2005 Justin Michel <michel_j@ociweb.com> + + * ImplRepo/MessengerServer.cpp: + * ImplRepo/run_test.pl: + + Many fixes and some minor new features in the ImR. + Eliminates most of the known bugs and design flaws. + PER_CLIENT activation now works correctly. + Added a new version of id_to_reference() to TAO_POA that takes + an additional parameter to allow specifying direct or indirect + binding. + +Tue Mar 29 10:28:24 2005 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + Clone the endpoint before passing it to the + TAO_ECG_UDP_{Sender,Receiver}::init() method. + +Mon Mar 28 09:18:54 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Receiver.mpc: + + Added the *_svnt libraries to the *_exec projects. + +Mon Mar 28 08:44:59 2005 Chad Elliott <elliott_c@ociweb.com> + + * NotifyService/SupplierSideNC/Messenger_i.cpp: + + The static initialization trick doesn't work with static builds + either. + +Mon Mar 28 08:22:09 2005 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Temporarily disable the ParticipatingApp Security example until it + is re-written. + +Mon Mar 28 07:49:32 2005 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + The RTCORBA example does not run in static builds. + +Mon Mar 28 07:46:13 2005 Chad Elliott <elliott_c@ociweb.com> + + * NotifyService/SupplierSideNC/Messenger_i.cpp: + + Added an include of the CosNotification library initializer header + to work around static construction issues on SunOS and MacOS X. + + * NotifyService/SupplierSideNC/run_test.pl: + + Removed a Kill() call on a non-existent Process Object. + +Mon Mar 28 07:29:00 2005 Chad Elliott <elliott_c@ociweb.com> + + * NamingService/Naming_Context_Ext/run_test.pl: + * NamingService/corbaname_Messenger/run_test.pl: + + Wait for the ns ior file to avoid timing issues. + + * Security/ParticipatingApp/run_test.pl: + + Use the right Process object when killing the server. + +Fri Mar 25 08:45:55 2005 Chad Elliott <elliott_c@ociweb.com> + + * ImplRepo/run_test.pl: + + Increased the timeout for the implrepo.ior. + +Fri Mar 25 08:16:15 2005 Chad Elliott <elliott_c@ociweb.com> + + * devguide_examples.lst: + + Added a list that can be used with auto_run_tests.pl. + We can maintain this separately from the other test lists and + bring it forward to new releases of TAO. + +Fri Mar 25 06:15:27 2005 Chad Elliott <elliott_c@ociweb.com> + + * Security/ParticipatingApp/Messenger_i.cpp: + + Added #include of ace/OS_NS_string.h to get ACE_OS::memcpy. + +Fri Mar 18 10:43:38 2005 Paul Calabrese <calabrese_p@ociweb.com> + + * NotifyService/EventSequence/run_test.pl: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/run_test.pl: + * NotifyService/Messenger/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.h: + * NotifyService/Messenger/StructuredEventSupplier_i.h: + * NotifyService/Messenger/run_test.pl: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + * NotifyService/OfferSubscriptions/run_test.pl: + * NotifyService/QoSProperties/run_test.pl: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/run_test.pl: + + Clean up the examples including: + - Fix problems with the run_test.pl scripts + - Enforce some consistency across these examples + - Make some changes to more directly reflect the code in the DevGuide + - Fix some spelling errors + - Remove some unneeded code + +Thu Mar 17 09:02:18 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Messenger_exec_i.cpp: + + Reordered the initialization list to avoid build warnings from + gcc. + +Mon Mar 7 07:26:00 2005 Chad Elliott <elliott_c@ociweb.com> + + * Messaging/AMIcallback/AMIcallback.mpc: + + Work around the internal compiler error on Linux Itanium with g++ + 2.96. + +Fri Mar 4 06:22:14 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Receiver_exec_i.cpp: + + Added a missing n to make a \n. + +Thu Mar 3 06:34:44 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/History_exec_i.h: + + Added a space between < and :: to avoid build problems with gcc + 3.4.2, again. + +Tue Mar 1 06:19:43 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Receiver.mpc: + + Made this project require 'cidl'. + +Mon Feb 28 11:05:34 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/History_exec.h: + + Added a space between < and :: to avoid build problems with gcc + 3.4.2. + +Mon Feb 28 08:35:04 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Administrator.mpc: + * CIAO/Messenger/Messenger.mpc: + * CIAO/Messenger/Receiver.mpc: + + Made these projects require 'cidl'. + +Mon Feb 28 06:21:01 2005 Chad Elliott <elliott_c@ociweb.com> + + * CIAO/Messenger/Messenger.mwc: + + Removed this file. It is not a valid mwc file and does not + provide the necessary include paths even if it were valid. + +Fri Feb 18 11:51:44 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH_AMI/AMH_AMI.mpc: + + Added a 'verbatim' section to set the VDIR for the gnuace project + type. This will alleviate link errors due to implicit template + instantiation deficiencies. + +Tue Feb 15 07:01:41 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH_AMI/AMH_AMI.mpc: + + Corrected build ordering and added an empty IDL_Files section for + the client. + + * AMH_AMI/middle_i.cpp: + + Removed build warnings from gcc. + +Tue Feb 15 06:22:53 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH_AMI/AMH_AMI.mpc: + * AMH_AMI/amh_ami_pch.h: + * AMH_AMI/inner_cb.cpp: + + Fixed precompiled header compile problems. + +Mon Feb 14 16:47:12 2005 Steve Totten <totten_s@ociweb.com> + + * AMH_AMI/AMH_AMI.mpc: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + Fixed clash between duplicate case-insensitive project names + "client" in these two project files because they appear in + the same workspace (DevGuideExamples.mwc). Used the + wildcard "*" in all the project names to make sure they are + unique. + +Mon Feb 14 13:21:51 2005 Phil Mesnier <mesnier_p@ociweb.com> + + * AMH_AMI/*: + + A new example for the AMH chapter of the devguide. This is a + duplicate log entry for the TAO/OCIChangeLog tag: + Mon Feb 14 11:25:15 2005 Phil Mesnier <mesnier_p@ociweb.com> + + +Mon Feb 14 11:25:15 2005 Phil Mesnier <mesnier_p@ociweb.com> + + * AMH_AMI/*: + + This is a new example used to reinforce concepts in the new AMH + chapter of the dev guide. + +Fri Feb 4 08:47:10 2005 Chad Elliott <elliott_c@ociweb.com> + + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/Messenger_i.cpp: + + Changed OS_NS_time.h to OS_NS_sys_time.h. + +Thu Feb 3 07:42:31 2005 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.cpp: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/Messenger_i.cpp: + * Messaging/RelativeRoundtripTimeout/Messenger_i.cpp: + * NamingService/Naming_Server/NamingTask.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + + Added various ACE includes for non-debug windows builds. + +Wed Feb 2 13:35:36 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH/amh_pch.h: + * BiDirectionalGIOP/bidir_giop_pch.h: + * GettingStarted/started_pch.h: + * ValueTypes/Messenger/_pch.h: + + Removed tao/Invocation.h from these precompiled header files. + +Fri Jan 21 07:00:42 2005 Chad Elliott <elliott_c@ociweb.com> + + * AMH/AMH.mpc: + + The client project doesn't really require AMH, but since the + server and client are in the same directory and share the + generated idl code it has to inherit from amh. + +Wed Jan 19 15:46:42 MST 2005 Trevor Fields <fields_t@ociweb.com> + + * BiDirectionalGIOP/callback_i.cpp: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/simple_i.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * InterfaceRepo/IFRBrowser.cpp: + * LocalObjects/Messenger/Messenger_i.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.cpp: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/RelativeRoundtripTimeout/Messenger_i.cpp: + * Multithreading/GracefulShutdown/MessengerServer.h: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/NamingTask.cpp: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NotifyService/EventSequence/Messenger_i.cpp: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * PortableInterceptors/Auth/ClientInitializer.cpp: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/Messenger_i.cpp: + * PortableInterceptors/Auth/ServerInitializer.cpp: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/IOR/ClientInitializer.cpp: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/Messenger_i.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger_i.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * SmartProxies/Logger_i.cpp: + * SmartProxies/Smart_Messenger_Proxy.cpp: + Added missing std:: prefix on the iostreams. + +Tue Jan 11 10:05:36 2005 Phil Mesnier <mesnier_p@ociweb.com> + + * AMH/*: + + Added new example directory for code related to new AMH chapter + of TAO 1.4a book. + +Mon Jan 10 07:51:16 2005 Chad Elliott <elliott_c@ociweb.com> + + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + + Put back the registration with the reactor which was accidentally + removed. + + * EventServices/RTEC_MCast_Federated/run_test.pl: + + Increased the timeout for the first supplier. + +Mon Jan 10 07:14:37 2005 Chad Elliott <elliott_c@ociweb.com> + + * BiDirectionalGIOP/BiDirectionalGIOP.mpc: + * BiDirectionalGIOP/README: + * BiDirectionalGIOP/bidir_giop_pch.h: + * BiDirectionalGIOP/callback.idl: + * BiDirectionalGIOP/callback_i.h: + * BiDirectionalGIOP/callback_i.cpp: + * BiDirectionalGIOP/client.cpp: + * BiDirectionalGIOP/run_test.pl: + * BiDirectionalGIOP/server.cpp: + * BiDirectionalGIOP/simple.idl: + * BiDirectionalGIOP/simple_i.h: + * BiDirectionalGIOP/simple_i.cpp: + * DevGuideExamples.mwc: + * EventServices/OMG_Basic/.cvsignore: + * EventServices/OMG_Basic/EchoEventConsumerMain.cpp: + * EventServices/OMG_Basic/EchoEventConsumer_i.h: + * EventServices/OMG_Basic/EchoEventConsumer_i.cpp: + * EventServices/OMG_Basic/EchoEventSupplierMain.cpp: + * EventServices/OMG_Basic/ExceptionUtil.h: + * EventServices/OMG_Basic/OMG_Basic.mpc: + * EventServices/OMG_Basic/README: + * EventServices/OMG_Basic/run_test.pl: + * EventServices/OMG_SupplierSideEC/.cvsignore: + * EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h: + * EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp: + * EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp: + * EventServices/OMG_SupplierSideEC/ExceptionUtil.h: + * EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc: + * EventServices/OMG_SupplierSideEC/README: + * EventServices/OMG_SupplierSideEC/run_test.pl: + * EventServices/RTEC_Basic/.cvsignore: + * EventServices/RTEC_Basic/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Basic/EchoEventConsumer_i.h: + * EventServices/RTEC_Basic/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Basic/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Basic/EchoEventSupplier_i.h: + * EventServices/RTEC_Basic/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Basic/ExceptionUtil.h: + * EventServices/RTEC_Basic/README: + * EventServices/RTEC_Basic/RTEC_Basic.mpc: + * EventServices/RTEC_Basic/run_test.pl: + * EventServices/RTEC_Federated/.cvsignore: + * EventServices/RTEC_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Federated/ExceptionUtil.h: + * EventServices/RTEC_Federated/README: + * EventServices/RTEC_Federated/RTEC_Federated.mpc: + * EventServices/RTEC_Federated/run_test.pl: + * EventServices/RTEC_Federated/supplier.conf: + * EventServices/RTEC_Filter/.cvsignore: + * EventServices/RTEC_Filter/EchoEventConsumerMain.cpp: + * EventServices/RTEC_Filter/EchoEventConsumer_i.h: + * EventServices/RTEC_Filter/EchoEventConsumer_i.cpp: + * EventServices/RTEC_Filter/EchoEventSupplierMain.cpp: + * EventServices/RTEC_Filter/EchoEventSupplier_i.h: + * EventServices/RTEC_Filter/EchoEventSupplier_i.cpp: + * EventServices/RTEC_Filter/ExceptionUtil.h: + * EventServices/RTEC_Filter/README: + * EventServices/RTEC_Filter/RTEC_Filter.mpc: + * EventServices/RTEC_Filter/ec.conf: + * EventServices/RTEC_Filter/run_test.pl: + * EventServices/RTEC_MCast_Federated/.cvsignore: + * EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h: + * EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp: + * EventServices/RTEC_MCast_Federated/ExceptionUtil.h: + * EventServices/RTEC_MCast_Federated/README: + * EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.h: + * EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp: + * EventServices/RTEC_MCast_Federated/run_test.pl: + * EventServices/RTEC_MCast_Federated/supplier.conf: + * GettingStarted/GettingStarted.mpc: + * GettingStarted/Messenger.idl: + * GettingStarted/MessengerClient.cpp: + * GettingStarted/MessengerServer.cpp: + * GettingStarted/Messenger_i.h: + * GettingStarted/Messenger_i.cpp: + * GettingStarted/README: + * GettingStarted/run_test.pl: + * GettingStarted/started_pch.h: + * GettingStarted/started_pch.cpp: + * ImplRepo/ImplRepo.mpc: + * ImplRepo/Messenger.idl: + * ImplRepo/MessengerClient.cpp: + * ImplRepo/MessengerServer.cpp: + * ImplRepo/Messenger_i.h: + * ImplRepo/Messenger_i.cpp: + * ImplRepo/README: + * ImplRepo/run_test.pl: + * InterfaceRepo/IFRBrowser.cpp: + * InterfaceRepo/InterfaceRepo.mpc: + * InterfaceRepo/run_test.pl: + * InterfaceRepo/test.idl: + * LocalObjects/Messenger/Messenger.idl: + * LocalObjects/Messenger/Messenger.mpc: + * LocalObjects/Messenger/MessengerServer.cpp: + * LocalObjects/Messenger/Messenger_i.h: + * LocalObjects/Messenger/Messenger_i.cpp: + * LocalObjects/Messenger/run_test.pl: + * LocalObjects/ServantLocator/Messenger.idl: + * LocalObjects/ServantLocator/MessengerClient.cpp: + * LocalObjects/ServantLocator/MessengerLocator_i.h: + * LocalObjects/ServantLocator/MessengerLocator_i.cpp: + * LocalObjects/ServantLocator/MessengerServer.cpp: + * LocalObjects/ServantLocator/Messenger_i.h: + * LocalObjects/ServantLocator/Messenger_i.cpp: + * LocalObjects/ServantLocator/ServantLocator.mpc: + * LocalObjects/ServantLocator/run_test.pl: + * Messaging/AMIcallback/AMIcallback.mpc: + * Messaging/AMIcallback/Messenger.idl: + * Messaging/AMIcallback/MessengerClient.cpp: + * Messaging/AMIcallback/MessengerHandler.h: + * Messaging/AMIcallback/MessengerHandler.cpp: + * Messaging/AMIcallback/MessengerServer.cpp: + * Messaging/AMIcallback/Messenger_i.h: + * Messaging/AMIcallback/Messenger_i.cpp: + * Messaging/AMIcallback/README: + * Messaging/AMIcallback/run_test.pl: + * Messaging/RelativeRoundtripTimeout/Messenger.idl: + * Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: + * Messaging/RelativeRoundtripTimeout/MessengerServer.cpp: + * Messaging/RelativeRoundtripTimeout/Messenger_i.h: + * Messaging/RelativeRoundtripTimeout/Messenger_i.cpp: + * Messaging/RelativeRoundtripTimeout/README: + * Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc: + * Messaging/RelativeRoundtripTimeout/run_test.pl: + * Multithreading/GracefulShutdown/GracefulShutdown.mpc: + * Multithreading/GracefulShutdown/Messenger.idl: + * Multithreading/GracefulShutdown/MessengerClient.cpp: + * Multithreading/GracefulShutdown/MessengerServer.h: + * Multithreading/GracefulShutdown/MessengerServer.cpp: + * Multithreading/GracefulShutdown/MessengerShutdownTimer.h: + * Multithreading/GracefulShutdown/MessengerShutdownTimer.cpp: + * Multithreading/GracefulShutdown/Messenger_i.h: + * Multithreading/GracefulShutdown/Messenger_i.cpp: + * Multithreading/GracefulShutdown/README: + * Multithreading/GracefulShutdown/run_test.pl: + * Multithreading/README: + * Multithreading/Reactive/Messenger.idl: + * Multithreading/Reactive/MessengerClient.cpp: + * Multithreading/Reactive/MessengerServer.cpp: + * Multithreading/Reactive/Messenger_i.h: + * Multithreading/Reactive/Messenger_i.cpp: + * Multithreading/Reactive/README: + * Multithreading/Reactive/Reactive.mpc: + * Multithreading/Reactive/run_test.pl: + * Multithreading/Reactive/svc.conf: + * Multithreading/ThreadPerConnection/Messenger.idl: + * Multithreading/ThreadPerConnection/MessengerClient.cpp: + * Multithreading/ThreadPerConnection/MessengerServer.cpp: + * Multithreading/ThreadPerConnection/Messenger_i.h: + * Multithreading/ThreadPerConnection/Messenger_i.cpp: + * Multithreading/ThreadPerConnection/README: + * Multithreading/ThreadPerConnection/ThreadPerConnection.mpc: + * Multithreading/ThreadPerConnection/run_test.pl: + * Multithreading/ThreadPerConnection/server.conf: + * Multithreading/ThreadPool/Messenger.idl: + * Multithreading/ThreadPool/MessengerClient.cpp: + * Multithreading/ThreadPool/MessengerServer.cpp: + * Multithreading/ThreadPool/Messenger_i.h: + * Multithreading/ThreadPool/Messenger_i.cpp: + * Multithreading/ThreadPool/README: + * Multithreading/ThreadPool/ThreadPool.mpc: + * Multithreading/ThreadPool/run_test.pl: + * NamingService/Messenger/Messenger.idl: + * NamingService/Messenger/Messenger.mpc: + * NamingService/Messenger/MessengerClient.cpp: + * NamingService/Messenger/MessengerServer.cpp: + * NamingService/Messenger/Messenger_i.h: + * NamingService/Messenger/Messenger_i.cpp: + * NamingService/Messenger/README: + * NamingService/Messenger/run_test.pl: + * NamingService/Naming_Client/.cvsignore: + * NamingService/Naming_Client/Messenger.idl: + * NamingService/Naming_Client/MessengerClient.cpp: + * NamingService/Naming_Client/MessengerServer.cpp: + * NamingService/Naming_Client/Messenger_i.h: + * NamingService/Naming_Client/Messenger_i.cpp: + * NamingService/Naming_Client/Naming_Client.mpc: + * NamingService/Naming_Client/README: + * NamingService/Naming_Client/run_test.pl: + * NamingService/Naming_Context_Ext/Messenger.idl: + * NamingService/Naming_Context_Ext/MessengerClient.cpp: + * NamingService/Naming_Context_Ext/MessengerServer.cpp: + * NamingService/Naming_Context_Ext/Messenger_i.h: + * NamingService/Naming_Context_Ext/Messenger_i.cpp: + * NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc: + * NamingService/Naming_Context_Ext/README: + * NamingService/Naming_Context_Ext/run_test.pl: + * NamingService/Naming_Server/Messenger.idl: + * NamingService/Naming_Server/MessengerTask.h: + * NamingService/Naming_Server/MessengerTask.cpp: + * NamingService/Naming_Server/Messenger_i.h: + * NamingService/Naming_Server/Messenger_i.cpp: + * NamingService/Naming_Server/NamingMessenger.cpp: + * NamingService/Naming_Server/NamingTask.h: + * NamingService/Naming_Server/NamingTask.cpp: + * NamingService/Naming_Server/Naming_Server.mpc: + * NamingService/Naming_Server/README: + * NamingService/Naming_Server/run_test.pl: + * NamingService/corbaloc_Messenger/Messenger.idl: + * NamingService/corbaloc_Messenger/MessengerClient.cpp: + * NamingService/corbaloc_Messenger/MessengerServer.cpp: + * NamingService/corbaloc_Messenger/Messenger_i.h: + * NamingService/corbaloc_Messenger/Messenger_i.cpp: + * NamingService/corbaloc_Messenger/README: + * NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc: + * NamingService/corbaloc_Messenger/run_test.pl: + * NamingService/corbaname_Messenger/Messenger.idl: + * NamingService/corbaname_Messenger/MessengerClient.cpp: + * NamingService/corbaname_Messenger/MessengerServer.cpp: + * NamingService/corbaname_Messenger/Messenger_i.h: + * NamingService/corbaname_Messenger/Messenger_i.cpp: + * NamingService/corbaname_Messenger/README: + * NamingService/corbaname_Messenger/corbaname_Messenger.mpc: + * NamingService/corbaname_Messenger/run_test.pl: + * NotifyService/EventSequence/EventSequence.mpc: + * NotifyService/EventSequence/EventSequenceConsumer_i.h: + * NotifyService/EventSequence/EventSequenceConsumer_i.cpp: + * NotifyService/EventSequence/EventSequenceSupplier_i.h: + * NotifyService/EventSequence/EventSequenceSupplier_i.cpp: + * NotifyService/EventSequence/Messenger.idl: + * NotifyService/EventSequence/MessengerClient.cpp: + * NotifyService/EventSequence/MessengerConsumer.cpp: + * NotifyService/EventSequence/MessengerServer.cpp: + * NotifyService/EventSequence/Messenger_i.h: + * NotifyService/EventSequence/Messenger_i.cpp: + * NotifyService/EventSequence/README: + * NotifyService/EventSequence/run_test.pl: + * NotifyService/Filtering/Filtering.mpc: + * NotifyService/Filtering/Messenger.idl: + * NotifyService/Filtering/MessengerClient.cpp: + * NotifyService/Filtering/MessengerConsumer.cpp: + * NotifyService/Filtering/MessengerServer.cpp: + * NotifyService/Filtering/Messenger_i.h: + * NotifyService/Filtering/Messenger_i.cpp: + * NotifyService/Filtering/README: + * NotifyService/Filtering/StructuredEventConsumer_i.h: + * NotifyService/Filtering/StructuredEventConsumer_i.cpp: + * NotifyService/Filtering/StructuredEventSupplier_i.h: + * NotifyService/Filtering/StructuredEventSupplier_i.cpp: + * NotifyService/Filtering/run_test.pl: + * NotifyService/Messenger/Messenger.idl: + * NotifyService/Messenger/Messenger.mpc: + * NotifyService/Messenger/MessengerClient.cpp: + * NotifyService/Messenger/MessengerConsumer.cpp: + * NotifyService/Messenger/MessengerServer.cpp: + * NotifyService/Messenger/Messenger_i.h: + * NotifyService/Messenger/Messenger_i.cpp: + * NotifyService/Messenger/README: + * NotifyService/Messenger/StructuredEventConsumer_i.h: + * NotifyService/Messenger/StructuredEventConsumer_i.cpp: + * NotifyService/Messenger/StructuredEventSupplier_i.h: + * NotifyService/Messenger/StructuredEventSupplier_i.cpp: + * NotifyService/Messenger/run_test.pl: + * NotifyService/OfferSubscriptions/Messenger.idl: + * NotifyService/OfferSubscriptions/MessengerClient.cpp: + * NotifyService/OfferSubscriptions/MessengerConsumer.cpp: + * NotifyService/OfferSubscriptions/MessengerServer.cpp: + * NotifyService/OfferSubscriptions/Messenger_i.h: + * NotifyService/OfferSubscriptions/Messenger_i.cpp: + * NotifyService/OfferSubscriptions/OfferSubscriptions.mpc: + * NotifyService/OfferSubscriptions/README: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h: + * NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h: + * NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp: + * NotifyService/OfferSubscriptions/run_test.pl: + * NotifyService/QoSProperties/Messenger.idl: + * NotifyService/QoSProperties/MessengerClient.cpp: + * NotifyService/QoSProperties/MessengerConsumer.cpp: + * NotifyService/QoSProperties/MessengerServer.cpp: + * NotifyService/QoSProperties/Messenger_i.h: + * NotifyService/QoSProperties/Messenger_i.cpp: + * NotifyService/QoSProperties/QoSProperties.mpc: + * NotifyService/QoSProperties/README: + * NotifyService/QoSProperties/StructuredEventConsumer_i.h: + * NotifyService/QoSProperties/StructuredEventConsumer_i.cpp: + * NotifyService/QoSProperties/StructuredEventSupplier_i.h: + * NotifyService/QoSProperties/StructuredEventSupplier_i.cpp: + * NotifyService/QoSProperties/run_test.pl: + * NotifyService/SupplierSideNC/Messenger.idl: + * NotifyService/SupplierSideNC/MessengerClient.cpp: + * NotifyService/SupplierSideNC/MessengerConsumer.cpp: + * NotifyService/SupplierSideNC/MessengerServer.cpp: + * NotifyService/SupplierSideNC/MessengerSupplier.cpp: + * NotifyService/SupplierSideNC/Messenger_i.h: + * NotifyService/SupplierSideNC/Messenger_i.cpp: + * NotifyService/SupplierSideNC/README: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.h: + * NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.h: + * NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp: + * NotifyService/SupplierSideNC/SupplierSideNC.mpc: + * NotifyService/SupplierSideNC/run_test.pl: + * PortableInterceptors/Auth/Auth.mpc: + * PortableInterceptors/Auth/ClientInitializer.h: + * PortableInterceptors/Auth/ClientInitializer.cpp: + * PortableInterceptors/Auth/ClientInterceptor.h: + * PortableInterceptors/Auth/ClientInterceptor.cpp: + * PortableInterceptors/Auth/Messenger.idl: + * PortableInterceptors/Auth/MessengerClient.cpp: + * PortableInterceptors/Auth/MessengerServer.cpp: + * PortableInterceptors/Auth/Messenger_i.h: + * PortableInterceptors/Auth/Messenger_i.cpp: + * PortableInterceptors/Auth/README: + * PortableInterceptors/Auth/ServerInitializer.h: + * PortableInterceptors/Auth/ServerInitializer.cpp: + * PortableInterceptors/Auth/ServerInterceptor.h: + * PortableInterceptors/Auth/ServerInterceptor.cpp: + * PortableInterceptors/Auth/run_test.pl: + * PortableInterceptors/IOR/ClientInitializer.h: + * PortableInterceptors/IOR/ClientInitializer.cpp: + * PortableInterceptors/IOR/ClientInterceptor.h: + * PortableInterceptors/IOR/ClientInterceptor.cpp: + * PortableInterceptors/IOR/IOR.mpc: + * PortableInterceptors/IOR/Messenger.idl: + * PortableInterceptors/IOR/MessengerClient.cpp: + * PortableInterceptors/IOR/MessengerServer.cpp: + * PortableInterceptors/IOR/Messenger_i.h: + * PortableInterceptors/IOR/Messenger_i.cpp: + * PortableInterceptors/IOR/README: + * PortableInterceptors/IOR/ServerIORInterceptor.h: + * PortableInterceptors/IOR/ServerIORInterceptor.cpp: + * PortableInterceptors/IOR/ServerInitializer.h: + * PortableInterceptors/IOR/ServerInitializer.cpp: + * PortableInterceptors/IOR/ServerInterceptor.h: + * PortableInterceptors/IOR/ServerInterceptor.cpp: + * PortableInterceptors/IOR/run_test.pl: + * PortableInterceptors/PICurrent/ClientInitializer.h: + * PortableInterceptors/PICurrent/ClientInitializer.cpp: + * PortableInterceptors/PICurrent/ClientInterceptor.h: + * PortableInterceptors/PICurrent/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent/Messenger.idl: + * PortableInterceptors/PICurrent/MessengerClient.cpp: + * PortableInterceptors/PICurrent/MessengerServer.cpp: + * PortableInterceptors/PICurrent/Messenger_i.h: + * PortableInterceptors/PICurrent/Messenger_i.cpp: + * PortableInterceptors/PICurrent/PICurrent.mpc: + * PortableInterceptors/PICurrent/README: + * PortableInterceptors/PICurrent/ServerInitializer.h: + * PortableInterceptors/PICurrent/ServerInitializer.cpp: + * PortableInterceptors/PICurrent/ServerInterceptor.h: + * PortableInterceptors/PICurrent/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent/run_test.pl: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.h: + * PortableInterceptors/PICurrent_NameService/ClientInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ClientInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger.idl: + * PortableInterceptors/PICurrent_NameService/MessengerClient.cpp: + * PortableInterceptors/PICurrent_NameService/MessengerServer.cpp: + * PortableInterceptors/PICurrent_NameService/Messenger_i.h: + * PortableInterceptors/PICurrent_NameService/Messenger_i.cpp: + * PortableInterceptors/PICurrent_NameService/PICurrent_NameService.mpc: + * PortableInterceptors/PICurrent_NameService/README: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.h: + * PortableInterceptors/PICurrent_NameService/ServerInitializer.cpp: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.h: + * PortableInterceptors/PICurrent_NameService/ServerInterceptor.cpp: + * PortableInterceptors/PICurrent_NameService/run_test.pl: + * PortableInterceptors/SimpleCodec/ClientInitializer.h: + * PortableInterceptors/SimpleCodec/ClientInitializer.cpp: + * PortableInterceptors/SimpleCodec/ClientInterceptor.h: + * PortableInterceptors/SimpleCodec/ClientInterceptor.cpp: + * PortableInterceptors/SimpleCodec/Messenger.idl: + * PortableInterceptors/SimpleCodec/MessengerClient.cpp: + * PortableInterceptors/SimpleCodec/MessengerServer.cpp: + * PortableInterceptors/SimpleCodec/Messenger_i.h: + * PortableInterceptors/SimpleCodec/Messenger_i.cpp: + * PortableInterceptors/SimpleCodec/README: + * PortableInterceptors/SimpleCodec/ServerInitializer.h: + * PortableInterceptors/SimpleCodec/ServerInitializer.cpp: + * PortableInterceptors/SimpleCodec/ServerInterceptor.h: + * PortableInterceptors/SimpleCodec/ServerInterceptor.cpp: + * PortableInterceptors/SimpleCodec/SimpleCode.mpc: + * PortableInterceptors/SimpleCodec/run_test.pl: + * RTCORBA/Messenger.idl: + * RTCORBA/MessengerClient.cpp: + * RTCORBA/MessengerServer.cpp: + * RTCORBA/Messenger_i.h: + * RTCORBA/Messenger_i.cpp: + * RTCORBA/README: + * RTCORBA/RTCORBA.mpc: + * RTCORBA/common.h: + * RTCORBA/common.cpp: + * RTCORBA/run_test.pl: + * RTCORBA/svc.conf: + * Security/ParticipatingApp/Messenger.idl: + * Security/ParticipatingApp/MessengerClient.cpp: + * Security/ParticipatingApp/MessengerServer.cpp: + * Security/ParticipatingApp/Messenger_i.h: + * Security/ParticipatingApp/Messenger_i.cpp: + * Security/ParticipatingApp/ParticipatingApp.mpc: + * Security/ParticipatingApp/README: + * Security/ParticipatingApp/cacert.pem: + * Security/ParticipatingApp/client.conf: + * Security/ParticipatingApp/clientcert.pem: + * Security/ParticipatingApp/clientkey.pem: + * Security/ParticipatingApp/run_test.pl: + * Security/ParticipatingApp/server.conf: + * Security/ParticipatingApp/servercert.pem: + * Security/ParticipatingApp/serverkey.pem: + * Security/PolicyControllingApp/Messenger.idl: + * Security/PolicyControllingApp/MessengerClient.cpp: + * Security/PolicyControllingApp/MessengerServer.cpp: + * Security/PolicyControllingApp/Messenger_i.h: + * Security/PolicyControllingApp/Messenger_i.cpp: + * Security/PolicyControllingApp/PolicyControllingApp.mpc: + * Security/PolicyControllingApp/README: + * Security/PolicyControllingApp/cacert.pem: + * Security/PolicyControllingApp/client.conf: + * Security/PolicyControllingApp/client1.conf: + * Security/PolicyControllingApp/clientcert.pem: + * Security/PolicyControllingApp/clientkey.pem: + * Security/PolicyControllingApp/run_test.pl: + * Security/PolicyControllingApp/server.conf: + * Security/PolicyControllingApp/server1.conf: + * Security/PolicyControllingApp/servercert.pem: + * Security/PolicyControllingApp/serverkey.pem: + * Security/SecurityUnawareApp/Messenger.idl: + * Security/SecurityUnawareApp/MessengerClient.cpp: + * Security/SecurityUnawareApp/MessengerI.cpp: + * Security/SecurityUnawareApp/MessengerServer.cpp: + * Security/SecurityUnawareApp/Messenger_i.h: + * Security/SecurityUnawareApp/Messenger_i.cpp: + * Security/SecurityUnawareApp/README: + * Security/SecurityUnawareApp/SecurityUnawareApp.mpc: + * Security/SecurityUnawareApp/cacert.pem: + * Security/SecurityUnawareApp/client.conf: + * Security/SecurityUnawareApp/client1.conf: + * Security/SecurityUnawareApp/clientcert.pem: + * Security/SecurityUnawareApp/clientkey.pem: + * Security/SecurityUnawareApp/run_test.pl: + * Security/SecurityUnawareApp/server.conf: + * Security/SecurityUnawareApp/servercert.pem: + * Security/SecurityUnawareApp/serverkey.pem: + * SmartProxies/Logger.idl: + * SmartProxies/LoggerServer.cpp: + * SmartProxies/Logger_i.h: + * SmartProxies/Logger_i.cpp: + * SmartProxies/Messenger.idl: + * SmartProxies/MessengerClient.cpp: + * SmartProxies/MessengerServer.cpp: + * SmartProxies/Messenger_i.h: + * SmartProxies/Messenger_i.cpp: + * SmartProxies/README: + * SmartProxies/SmartProxies.mpc: + * SmartProxies/Smart_Messenger_Proxy.h: + * SmartProxies/Smart_Messenger_Proxy.cpp: + * SmartProxies/run_test.pl: + * ValueTypes/Messenger/Message_i.h: + * ValueTypes/Messenger/Message_i.cpp: + * ValueTypes/Messenger/Messenger.idl: + * ValueTypes/Messenger/MessengerClient.cpp: + * ValueTypes/Messenger/MessengerServer.cpp: + * ValueTypes/Messenger/Messenger_i.h: + * ValueTypes/Messenger/Messenger_i.cpp: + * ValueTypes/Messenger/README: + * ValueTypes/Messenger/ValueTypes.mpc: + * ValueTypes/Messenger/_pch.h: + * ValueTypes/Messenger/_pch.cpp: + * ValueTypes/Messenger/run_test.pl: + * devguide_client.mpb: + * devguide_example.mpb: + * devguide_server.mpb: + * readme.txt: + + Brought over the TAO 1.3a DevGuideExamples and updated them for + TAO 1.4a. diff --git a/DevGuideExamples/DevGuideExamples.mwc b/DevGuideExamples/DevGuideExamples.mwc new file mode 100644 index 00000000000..b07eebca11d --- /dev/null +++ b/DevGuideExamples/DevGuideExamples.mwc @@ -0,0 +1,4 @@ +// $Id$ + +workspace { +} diff --git a/DevGuideExamples/GettingStarted/GettingStarted.mpc b/DevGuideExamples/GettingStarted/GettingStarted.mpc new file mode 100644 index 00000000000..40b2da5838d --- /dev/null +++ b/DevGuideExamples/GettingStarted/GettingStarted.mpc @@ -0,0 +1,37 @@ +// $Id$ + +project(*idl): taoidldefaults { + idlflags += -Wb,pch_include=started_pch.h + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/GettingStarted/Messenger.idl b/DevGuideExamples/GettingStarted/Messenger.idl new file mode 100644 index 00000000000..f58cb4e25aa --- /dev/null +++ b/DevGuideExamples/GettingStarted/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/GettingStarted/MessengerClient.cpp b/DevGuideExamples/GettingStarted/MessengerClient.cpp new file mode 100644 index 00000000000..3f41a9b2e3b --- /dev/null +++ b/DevGuideExamples/GettingStarted/MessengerClient.cpp @@ -0,0 +1,74 @@ +// $Id$ + +#include "started_pch.h" + +#include "MessengerC.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object( ior ); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var msg = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", msg.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << msg.in() << std::endl; + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/GettingStarted/MessengerServer.cpp b/DevGuideExamples/GettingStarted/MessengerServer.cpp new file mode 100644 index 00000000000..15ee01f543d --- /dev/null +++ b/DevGuideExamples/GettingStarted/MessengerServer.cpp @@ -0,0 +1,79 @@ +// $Id$ + +#include "started_pch.h" + +#include "Messenger_i.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a servant. + PortableServer::Servant_var<Messenger_i> servant = new Messenger_i(); + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = poa->activate_object( servant.in() ); + obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( obj.in() ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + + return 0; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + } + + return 1; +} diff --git a/DevGuideExamples/GettingStarted/Messenger_i.cpp b/DevGuideExamples/GettingStarted/Messenger_i.cpp new file mode 100644 index 00000000000..2e6a819f7d2 --- /dev/null +++ b/DevGuideExamples/GettingStarted/Messenger_i.cpp @@ -0,0 +1,36 @@ +#include "started_pch.h" +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean +Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::string_free(message); + message = CORBA::string_dup("Thanks for the message."); + return true; +} + diff --git a/DevGuideExamples/GettingStarted/Messenger_i.h b/DevGuideExamples/GettingStarted/Messenger_i.h new file mode 100644 index 00000000000..4af885c4b50 --- /dev/null +++ b/DevGuideExamples/GettingStarted/Messenger_i.h @@ -0,0 +1,36 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message); +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/GettingStarted/README b/DevGuideExamples/GettingStarted/README new file mode 100644 index 00000000000..3a21e06275a --- /dev/null +++ b/DevGuideExamples/GettingStarted/README @@ -0,0 +1,45 @@ +// $Id$ + +File: DevGuideExamples/GettingStarted/README + + +This directory contains a CORBA example illustrating a simple client and +a server with a Interface Messenger. The Messenger Interface has +an operation for sending a message (send_message). The MessengerClient +will send a message which is displayed by the MessengerServer when +received. The MessengerClient will then confirm that the message has +been sent successfully. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/GettingStarted/run_test.pl b/DevGuideExamples/GettingStarted/run_test.pl new file mode 100755 index 00000000000..bdc4548b9b4 --- /dev/null +++ b/DevGuideExamples/GettingStarted/run_test.pl @@ -0,0 +1,74 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/GettingStarted/started_pch.cpp b/DevGuideExamples/GettingStarted/started_pch.cpp new file mode 100644 index 00000000000..c2c8b943b32 --- /dev/null +++ b/DevGuideExamples/GettingStarted/started_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "started_pch.h" diff --git a/DevGuideExamples/GettingStarted/started_pch.h b/DevGuideExamples/GettingStarted/started_pch.h new file mode 100644 index 00000000000..fe6d2628083 --- /dev/null +++ b/DevGuideExamples/GettingStarted/started_pch.h @@ -0,0 +1,12 @@ +// $Id$ + +#ifndef PCH_H +#define PCH_H + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/LocalObjects/Messenger/Messenger.idl b/DevGuideExamples/LocalObjects/Messenger/Messenger.idl new file mode 100644 index 00000000000..c081d4e7d6c --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +local interface Messenger +{ + boolean send_message (in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/LocalObjects/Messenger/Messenger.mpc b/DevGuideExamples/LocalObjects/Messenger/Messenger.mpc new file mode 100644 index 00000000000..df7e7ecddd0 --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/Messenger.mpc @@ -0,0 +1,23 @@ +// $Id$ + +project(LocalObject*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(LocalObject*Server): taoserver { + exename = MessengerServer + after += LocalObject*idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/LocalObjects/Messenger/MessengerServer.cpp b/DevGuideExamples/LocalObjects/Messenger/MessengerServer.cpp new file mode 100644 index 00000000000..ca25998b65b --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/MessengerServer.cpp @@ -0,0 +1,28 @@ +// $Id$ + +#include "Messenger_i.h" +#include <iostream> +int ACE_TMAIN (int, ACE_TCHAR **) +{ + try { + // Construct a Messenger object and use it "as if" it's a corba object. + // Put it into CORBA object reference + // comparable to activation, narrow, etc. + Messenger_var messenger(new Messenger_i); + + // Send a message the the Messenger object. + CORBA::String_var message = CORBA::string_dup ("Hello!"); + messenger->send_message("TAO User", "TAO Test", message.inout()); + + // Print the Messenger's reply. + std::cout << "Reply: " << message.in() << std::endl; + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught CORBA::Exception : " << ex << std::endl; + return 1; + } + + return 0; +} + + diff --git a/DevGuideExamples/LocalObjects/Messenger/Messenger_i.cpp b/DevGuideExamples/LocalObjects/Messenger/Messenger_i.cpp new file mode 100644 index 00000000000..27d02a450dc --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/Messenger_i.cpp @@ -0,0 +1,30 @@ +// $Id$ + +#include "Messenger_i.h" +#include <iostream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::string_free(message); + message = CORBA::string_dup("Thanks for the message."); + return true; + +} + diff --git a/DevGuideExamples/LocalObjects/Messenger/Messenger_i.h b/DevGuideExamples/LocalObjects/Messenger/Messenger_i.h new file mode 100644 index 00000000000..92d6825db32 --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/Messenger_i.h @@ -0,0 +1,32 @@ +// $Id$ + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" +#include "tao/LocalObject.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual Messenger, + public virtual ::CORBA::LocalObject +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/LocalObjects/Messenger/run_test.pl b/DevGuideExamples/LocalObjects/Messenger/run_test.pl new file mode 100755 index 00000000000..877c4fe6398 --- /dev/null +++ b/DevGuideExamples/LocalObjects/Messenger/run_test.pl @@ -0,0 +1,27 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- +# +# $Id$ + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $status = 0; + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +$SV = $server->CreateProcess ("MessengerServer"); + +$SV->Spawn (); + +$process_status = $SV->WaitKill ($server->ProcessStartWaitInterval()); + +if ($process_status != 0) { + print STDERR "ERROR: server returned $process_status\n"; + $status = 1; +} + +exit $status; diff --git a/DevGuideExamples/LocalObjects/ServantLocator/Messenger.idl b/DevGuideExamples/LocalObjects/ServantLocator/Messenger.idl new file mode 100644 index 00000000000..63a282a1850 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message (in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp b/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp new file mode 100644 index 00000000000..8eb8b435997 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/MessengerClient.cpp @@ -0,0 +1,71 @@ +// $Id$ + +#include "MessengerC.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + // Initialize the ORB + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Converts the contents of the file to an object reference + CORBA::Object_var obj = orb->string_to_object (ior); + if (CORBA::is_nil (obj.in())) { + std::cerr << "Nill Messenger reference" << std::endl; + return 1; + } + + // Narrow the object reference to a Messenger object reference + Messenger_var messenger = Messenger::_narrow(obj.in()); + if (CORBA::is_nil (messenger.in())) { + std::cerr << "Not a Messenger object reference" << std::endl; + return 1; + } + + // Create a message and send it to the Messenger + CORBA::String_var message = CORBA::string_dup("Hello!"); + messenger->send_message ("TAO User", "TAO Test", message.inout()); + + orb->destroy(); + std::cout << "Message was sent" << std::endl; + } + catch(const CORBA::Exception& ex) { + std::cerr << "Client Caught a CORBA exception: " << ex << std::endl; + return 1; + } + std::cout << "Message was sent" << std::endl; + return 0; +} diff --git a/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.cpp b/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.cpp new file mode 100644 index 00000000000..876fc1e4ac3 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.cpp @@ -0,0 +1,54 @@ +// $Id$ + +#include "MessengerLocator_i.h" +#include "Messenger_i.h" + +#include "ace/SString.h" +#include <iostream> + +Messenger_Locator_i::Messenger_Locator_i() +{ +} + +PortableServer::Servant +Messenger_Locator_i::preinvoke (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr, + const char *, + void * & cookie ) +{ + // Get the ObjectId in string format. + CORBA::String_var oid_str = PortableServer::ObjectId_to_string (oid); + + std::cout << "preinvoke called..." << oid_str << std::endl; + + // Check if the ObjectId is valid. + ACE_CString cstr(oid_str.in()); + if (cstr == "Messenger") { + // Create the required servant + PortableServer::ServantBase_var servant = new Messenger_i (); + + // Set a flag so that we know to delete it in postinvoke(). + cookie = (void *)1; + + return servant._retn(); + } + else { + throw CORBA::OBJECT_NOT_EXIST (); + } +} + +void +Messenger_Locator_i::postinvoke (const PortableServer::ObjectId &, + PortableServer::POA_ptr, + const char *, + void * cookie, + PortableServer::Servant servant) +{ + + std::cout << "postinvoke called..." << std::endl; + + // Delete the servant as it is no longer needed. + if (cookie != 0) { + delete servant; + } +} diff --git a/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.h b/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.h new file mode 100644 index 00000000000..c2dc71e773e --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/MessengerLocator_i.h @@ -0,0 +1,30 @@ +// $Id$ + +#ifndef MESSENGER_LOCATOR_I_H +#define MESSENGER_LOCATOR_I_H + +#include "tao/corba.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/ServantLocatorC.h" + +class Messenger_Locator_i : public PortableServer::ServantLocator, + public CORBA::LocalObject +{ + public: + Messenger_Locator_i(); + + // Preinvoke function + virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + const char * operation, + void * & cookie); + + // Postinvoke function + virtual void postinvoke (const PortableServer::ObjectId & oid, + PortableServer::POA_ptr poa, + const char * operation, + void * cookie, + PortableServer::Servant servant); +}; + +#endif diff --git a/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp b/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp new file mode 100644 index 00000000000..01f8018f71b --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp @@ -0,0 +1,110 @@ +// $Id$ + +#include "MessengerLocator_i.h" +#include "MessengerC.h" + +#include "tao/AnyTypeCode/TypeCode.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + // Initialize the ORB + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get a reference to the POA + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var rootPOA = PortableServer::POA::_narrow (obj.in()); + + // Active the POA Manager + PortableServer::POAManager_var mgr = rootPOA->the_POAManager(); + mgr->activate(); + + // Create the policies and assign them for the child POA + CORBA::PolicyList policies(3); + policies.length(3); + + policies[0] = rootPOA->create_id_assignment_policy(PortableServer::USER_ID); + policies[1] = rootPOA->create_request_processing_policy(PortableServer::USE_SERVANT_MANAGER); + policies[2] = rootPOA->create_servant_retention_policy(PortableServer::NON_RETAIN); + + // Create the POA with these policies + PortableServer::POA_var childPOA = rootPOA->create_POA("childPOA", mgr.in(), policies); + + // Destroy the policy objects + for (CORBA::ULong i = 0; i != policies.length(); ++i) { + policies[i]->destroy(); + } + + // Create our Messenger's ServantLocator. + PortableServer::ServantLocator_var locator = new Messenger_Locator_i; + + // Set the Servant Manager with the childPOA. + childPOA->set_servant_manager(locator.in()); + + // Get the object id for the user-created ID in the childPOA. + PortableServer::ObjectId_var child_oid = PortableServer::string_to_ObjectId("Messenger"); + + // Create the object without creating a servant. + CORBA::Object_var messenger_obj = + childPOA->create_reference_with_id(child_oid.in(), ::_tc_Messenger->id()); + + // Put the object reference into an IOR string + CORBA::String_var str = orb->object_to_string(messenger_obj.in()); + + // Write the IOR string to a file + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); // Throws exception if there's a problem. + iorFile << str.in(); + iorFile.close(); + + std::cout << "IOR written to the file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests from clients. + orb->run(); + + // Release resources + rootPOA->destroy(true,true); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Server Caught a CORBA::Exception: " << ex << std::endl; + return 1; + } + + return 0; +} + + diff --git a/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.cpp b/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.cpp new file mode 100644 index 00000000000..dce1646bb24 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.cpp @@ -0,0 +1,45 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) + { + } + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean +Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + return true; +} + diff --git a/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.h b/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.h new file mode 100644 index 00000000000..9af2c134dc2 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/Messenger_i.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message); +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/LocalObjects/ServantLocator/ServantLocator.mpc b/DevGuideExamples/LocalObjects/ServantLocator/ServantLocator.mpc new file mode 100644 index 00000000000..e1b7628f933 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/ServantLocator.mpc @@ -0,0 +1,36 @@ +// $Id$ + +project(*idl): taoidldefaults, anytypecode { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, anytypecode, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + MessengerLocator_i.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoexe, anytypecode, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl b/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl new file mode 100755 index 00000000000..4936c559c31 --- /dev/null +++ b/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl @@ -0,0 +1,75 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +# start MessengerServer +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Messaging/AMIcallback/AMIcallback.mpc b/DevGuideExamples/Messaging/AMIcallback/AMIcallback.mpc new file mode 100644 index 00000000000..519ebd794eb --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/AMIcallback.mpc @@ -0,0 +1,28 @@ +// $Id$ + +project(*Server): messaging, taoexe, portableserver, ami { + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } +} + +project(*Client): messaging, taoexe, portableserver, ami { + Source_Files { + MessengerHandler.cpp + MessengerClient.cpp + } + verbatim(gnuace, local) { + ## Using the -g option causes an internal compiler error with g++ 2.96 + ## on Linux Itanium when compiling MessengerHandler.cpp. + ifeq ($(CXX), g++) + ifeq ($(findstring 2.96, $(CXX_VERSION)), 2.96) + ifeq ($(shell uname -s), Linux) + ifeq ($(shell uname -m), ia64) + DCFLAGS = -O0 + endif + endif + endif + endif + } +} diff --git a/DevGuideExamples/Messaging/AMIcallback/Messenger.idl b/DevGuideExamples/Messaging/AMIcallback/Messenger.idl new file mode 100644 index 00000000000..17f625393f0 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/Messenger.idl @@ -0,0 +1,17 @@ +// $Id$ + +// Messenger.idl + +exception MessengerUnableToSendMessage +{ +}; + +interface Messenger +{ + + boolean send_message(in string user_name, + in string subject, + inout string message, + out long time_sent) + raises (MessengerUnableToSendMessage); +}; diff --git a/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp b/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp new file mode 100644 index 00000000000..9ede1f8097b --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp @@ -0,0 +1,132 @@ +// $Id$ + +#include "MessengerC.h" +#include "MessengerHandler.h" + +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_time.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://MessengerServer.ior"); +bool automated = false; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:a:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case 'a': + automated = !(ACE_OS::atoi(get_opts.opt_arg ()) == 0); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " -k <ior>" + " -a <automated>" + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object(ior); + if (CORBA::is_nil(obj.in())) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + // Narrow + Messenger_var messenger = Messenger::_narrow(obj.in()); + if (CORBA::is_nil(messenger.in())) { + std::cerr << "Argument is not a Messenger reference" << std::endl; + return 1; + } + + // Get reference to Root POA. + obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + // Activate POA manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Register an AMI handler for the Messenger interface + PortableServer::Servant_var<MessengerHandler> servant = + new MessengerHandler(orb.in()); + PortableServer::ObjectId_var oid = poa->activate_object(servant.in()); + obj = poa->id_to_reference(oid.in()); + AMI_MessengerHandler_var handler = AMI_MessengerHandler::_narrow(obj.in()); + + CORBA::String_var user = CORBA::string_alloc(81); + CORBA::String_var subject = CORBA::string_alloc(81); + CORBA::String_var message = CORBA::string_alloc(81); + + if (! automated) { + std::cout << "Enter user name -->"; + std::cin.getline(user, 81); + + std::cout << "Enter subject -->"; + std::cin.getline(subject, 81); + + std::cout << "Enter message -->"; + std::cin.getline(message, 81); + } else { + user = CORBA::string_dup("TestUser"); + subject = CORBA::string_dup("TestSubject"); + message = CORBA::string_dup("Have a nice day."); + } + + // Record the time the request was made. + ACE_Time_Value time_sent = ACE_OS::gettimeofday(); + + messenger->sendc_send_message(handler.in(), user.in(), subject.in(), message.in()); + + // Do some work to prove that we can send the message asynchronously, do some work, + // then come back later and retrieve the results. + for (int i = 0; i < 10; ++i) { + ACE_OS::printf("."); + ACE_OS::sleep(ACE_Time_Value(0, 10 * 1000)); + } + + // Our simple servant will exit as soon as it receives the results. + orb->run(); + + if (servant->message_was_sent()) + { + // Note : We can't use the + ACE_Time_Value delay = ACE_OS::gettimeofday() - time_sent; + std::cout << std::endl << "Reply Delay = " << delay.msec() << "ms" << std::endl; + } + + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA::Exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.cpp b/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.cpp new file mode 100644 index 00000000000..60c8dac7e12 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.cpp @@ -0,0 +1,56 @@ +// $Id$ + +#include "MessengerHandler.h" +#include "ace/OS_NS_time.h" +#include <iostream> + +// Implementation skeleton constructor +MessengerHandler::MessengerHandler (CORBA::ORB_ptr orb) +: time_(0) +, orb_(CORBA::ORB::_duplicate(orb)) +{ +} + +// Implementation skeleton destructor +MessengerHandler::~MessengerHandler (void) +{ +} + +void MessengerHandler::send_message ( + CORBA::Boolean ami_return_val, + const char * message, + CORBA::Long time + ) +{ + if (ami_return_val) + { + time_ = time; + time_t t = time_; + const ACE_TCHAR * time_str = ACE_OS::ctime(&t); + if (time_str != 0) { + std::cout << std::endl << "Message sent at " << + ACE_TEXT_ALWAYS_CHAR (time_str) << std::endl; + } + std::cout << "Content of message: " << message << std::endl; + } + else + { + std::cerr << "Error: Message was not sent." << std::endl; + } + // Our simple test just shuts down after sending one message. + orb_->shutdown(false); +} + +void MessengerHandler::send_message_excep (Messaging::ExceptionHolder* excep_holder) +{ + // We'll print an error message and shut down the orb + try + { + excep_holder->raise_exception(); + } + catch(const CORBA::Exception& ex) + { + std::cerr << "A CORBA Exception was thrown: " << ex << std::endl; + } + orb_->shutdown(false); +} diff --git a/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.h b/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.h new file mode 100644 index 00000000000..986654f44d4 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/MessengerHandler.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef MESSENGERHANDLER_H +#define MESSENGERHANDLER_H + +#include "MessengerS.h" + +class MessengerHandler : public virtual POA_AMI_MessengerHandler +{ +public: + //Constructor + MessengerHandler (CORBA::ORB_ptr orb); + + //Destructor + virtual ~MessengerHandler (void); + +virtual void send_message ( + CORBA::Boolean ami_return_val, + const char * message, + CORBA::Long time + ); + +virtual void send_message_excep ( + Messaging::ExceptionHolder * excep_holder + ); + + + int message_was_sent() + { + return time_ > 0; + } + +private: + CORBA::Long time_; + CORBA::ORB_var orb_; +}; + +#endif diff --git a/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp b/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp new file mode 100644 index 00000000000..9dc1a81ebdf --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp @@ -0,0 +1,92 @@ +// $Id$ + +#include "Messenger_i.h" +#include <fstream> +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("MessengerServer.ior"); +unsigned int seconds_to_wait = 0; +CORBA::Boolean servant_throws_exception = false; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:e:t:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case 'e': + servant_throws_exception = true; + std::cout << "Messenger_i::send_message() will throw an exception." << std::endl; + break; + case 't': + seconds_to_wait = ACE_OS::atoi(get_opts.opt_arg ()); + std::cout << "Messenger_i::send_message() will wait " + << seconds_to_wait << " seconds" << std::endl; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " -o <iorfile>" + " -e" + " -t <seconds_to_wait>" + "\n", + argv [0]), + -1); + } + + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get reference to Root POA. + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + // Activate POA manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> servant = new + Messenger_i(seconds_to_wait, servant_throws_exception); + + // Write its stringified reference to stdout + PortableServer::ObjectId_var oid = poa->activate_object(servant.in()); + obj = poa->id_to_reference(oid.in()); + Messenger_var messenger = Messenger::_narrow(obj.in()); + CORBA::String_var str = orb->object_to_string(messenger.in()); + std::ofstream fout(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + fout << str.in() << std::endl; + fout.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA::Exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Messaging/AMIcallback/Messenger_i.cpp b/DevGuideExamples/Messaging/AMIcallback/Messenger_i.cpp new file mode 100644 index 00000000000..73cf55fb336 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/Messenger_i.cpp @@ -0,0 +1,59 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_time.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (unsigned int seconds_to_wait, + CORBA::Boolean throw_exception) + : seconds_to_wait_(seconds_to_wait) + , throw_exception_(throw_exception) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message, + CORBA::Long_out time_sent + ) +{ + if (throw_exception_) + { + std::cout << "Throwing MessengerUnableToSendMessage exception." << std::endl; + throw MessengerUnableToSendMessage(); + } + + std::cout << "Write a letter to " << user_name << " as follows:" << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Dear " << user_name << ',' << std::endl; + std::cout << message << std::endl; + + if (seconds_to_wait_ > 0) + { + std::cout << "Waiting for " << seconds_to_wait_ << " seconds..." << std::flush; + ACE_OS::sleep(seconds_to_wait_); + std::cout << " Done waiting" << std::endl; + } + + // Record the time the message was sent + time_sent = static_cast<CORBA::Long> (ACE_OS::gettimeofday().sec()); + + // We will assume the message has been sent, so return true + return true; +} + + diff --git a/DevGuideExamples/Messaging/AMIcallback/Messenger_i.h b/DevGuideExamples/Messaging/AMIcallback/Messenger_i.h new file mode 100644 index 00000000000..2cc2587c3eb --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/Messenger_i.h @@ -0,0 +1,50 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_IMPL_H_ +#define MESSENGER_IMPL_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (unsigned int seconds_to_wait = 0, + CORBA::Boolean throw_exception = 0); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message, + CORBA::Long_out time_sent + ); + +private: + // Specify an amount of time to wait inside + // send_message in order illustrate AMI callback usage + unsigned int seconds_to_wait_; + + // Force an exception to be thrown to test client-side + // exception handling + CORBA::Boolean throw_exception_; + +}; + + + +#endif /* MESSENGER_IMPL_H_ */ diff --git a/DevGuideExamples/Messaging/AMIcallback/README b/DevGuideExamples/Messaging/AMIcallback/README new file mode 100644 index 00000000000..74eaecb5e42 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/README @@ -0,0 +1,41 @@ +// $Id$ + +CORBA Messaging + + +File: DevGuideExamples/Messaging/AMIcallback/README + + +This directory contains an example illustrating the Asynchronous +Method Invocation (AMI) feature of TAO. This feature permits +requests to be made that do not require a client to block while +waiting for a reply from a server. + +This example is based on the Messenger example in GettingStarted +directory. A message is send by MessengerClient and displayed by +MessengerServer. The server responds to provide confirmation +that the message was received. The delay for this exchange of +messages is then displayed. + + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl diff --git a/DevGuideExamples/Messaging/AMIcallback/run_test.pl b/DevGuideExamples/Messaging/AMIcallback/run_test.pl new file mode 100755 index 00000000000..b1e9d721a76 --- /dev/null +++ b/DevGuideExamples/Messaging/AMIcallback/run_test.pl @@ -0,0 +1,74 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "MessengerServer.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile -a 1"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger.idl b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger.idl new file mode 100644 index 00000000000..e2b13b5a3e4 --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp new file mode 100644 index 00000000000..a4f9437effa --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp @@ -0,0 +1,109 @@ +// $Id$ + +#include "MessengerC.h" +#include "tao/TimeBaseC.h" +#include "tao/Messaging/Messaging.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://MessengerServer.ior"); +long msecs = 0; // the RelativeRoundtripTimeout value + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:t:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case 't': + msecs = ACE_OS::atoi(get_opts.opt_arg ()); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "-t <msec> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) +{ + try { + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object(ior); + if (CORBA::is_nil(obj.in())) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + Messenger_var messenger = Messenger::_narrow(obj.in()); + ACE_ASSERT(! CORBA::is_nil(messenger.in())); + + obj = orb->resolve_initial_references("ORBPolicyManager"); + CORBA::PolicyManager_var policy_manager = CORBA::PolicyManager::_narrow(obj.in()); + ACE_ASSERT(! CORBA::is_nil(policy_manager.in())); + obj = orb->resolve_initial_references("PolicyCurrent"); + CORBA::PolicyCurrent_var policy_current = CORBA::PolicyCurrent::_narrow (obj.in()); + ACE_ASSERT(! CORBA::is_nil(policy_current.in())); + + // TimeT is in 10ths of a microsecond (10000 == 1.0e-3 * 1.0e7). + if (msecs <= 0) { + std::cout << "Enter relative roundtrip timeout in milliseconds -->"; + std::cin >> msecs; + } + TimeBase::TimeT relative_rt_timeout = msecs * 10000; + + CORBA::Any relative_rt_timeout_as_any; + relative_rt_timeout_as_any <<= relative_rt_timeout; + CORBA::PolicyList policy_list(1); + policy_list.length(1); + policy_list[0] = + orb->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, + relative_rt_timeout_as_any); + + // We demonstrate setting the policy at each of three levels. In practice, + // you would only need to set the policy for one of these. + // Set timeouts for the whole orb. + policy_manager->set_policy_overrides(policy_list, CORBA::ADD_OVERRIDE); + // Set timeouts for the current thread. + policy_current->set_policy_overrides(policy_list, CORBA::ADD_OVERRIDE); + // Set timeouts for the messenger object. + obj = messenger->_set_policy_overrides(policy_list, CORBA::SET_OVERRIDE); + messenger = Messenger::_narrow(obj.in()); + ACE_ASSERT(! CORBA::is_nil(messenger.in())); + + policy_list[0]->destroy(); + policy_list[0] = CORBA::Policy::_nil(); + + CORBA::String_var message = CORBA::string_dup("Hello!"); + + try { + messenger->send_message ("TAO User", "TAO Test", message.inout()); + std::cerr << "ERROR: Message did not timeout." << std::endl; + } catch(const CORBA::TIMEOUT&) { + std::cout << "Message Timed out as expected." << std::endl; + } + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp new file mode 100644 index 00000000000..c9162bf77d2 --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp @@ -0,0 +1,78 @@ +// $Id$ + +#include "Messenger_i.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("MessengerServer.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get reference to Root POA. + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + // Activate POA manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = + new Messenger_i; + + // Write its stringified reference to a file + PortableServer::ObjectId_var oid = poa->activate_object(messenger_servant.in()); + obj = poa->id_to_reference(oid.in()); + Messenger_var messenger = Messenger::_narrow(obj.in()); + CORBA::String_var str = orb->object_to_string(messenger.in()); + std::ofstream fout(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + fout << str.in() << std::endl; + fout.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA::Exception " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.cpp b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.cpp new file mode 100644 index 00000000000..c3a4a30c219 --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.cpp @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include "ace/OS_NS_unistd.h" +#include <iostream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message) +{ + // Force a delay in the reply in order to test the Relative Roundtrip Timeout Policy + ACE_OS::sleep(ACE_Time_Value(0, 100 * 1000)); + + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + + return true; +} + diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.h b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.h new file mode 100644 index 00000000000..98be27c4cdd --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/README b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/README new file mode 100644 index 00000000000..50214efaeba --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/README @@ -0,0 +1,42 @@ +// $Id$ + +CORBA Messaging + + +File: DevGuideExamples/Messaging/RelativeRoundtripTimeout/README + + +This directory contains an example illustrating the relative +round trip timeout policy defined in CORBA Messaging. + +At each request invocation on the server, the client checks +against a user-specified timout value. If the time spent since +the start of the request exceeds the timeout value, a CORBA::TIMEOUT +exception is raised. + +This example is based on the Messenger example in GettingStarted +directory. + + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc new file mode 100644 index 00000000000..d130dc8a43e --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/RelativeRoundtripTimeout.mpc @@ -0,0 +1,37 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, messaging { + exename = MessengerClient + after += *idl + Source_Files { + MessengerC.cpp + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl new file mode 100755 index 00000000000..385085ed030 --- /dev/null +++ b/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl @@ -0,0 +1,75 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "MessengerServer.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +my $client_timeout_msec = 20; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile -t $client_timeout_msec"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/GracefulShutdown.mpc b/DevGuideExamples/Multithreading/GracefulShutdown/GracefulShutdown.mpc new file mode 100644 index 00000000000..174cf26332f --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/GracefulShutdown.mpc @@ -0,0 +1,37 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(Multithreading*Server): taoserver { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + MessengerShutdownTimer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(Multithreading*Client): taoclient { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/Messenger.idl b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger.idl new file mode 100644 index 00000000000..f598ee0d2b0 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger.idl @@ -0,0 +1,13 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); + + oneway void shutdown(); +}; + diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp new file mode 100644 index 00000000000..5c5aef8f034 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerClient.cpp @@ -0,0 +1,85 @@ +// $Id$ + +#include "MessengerC.h" +#include "ace/Get_Opt.h" +#include <iostream> + +int call_shutdown = 0; +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int parse_args (int argc, ACE_TCHAR* argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:x")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case 'x': + call_shutdown = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k <ior> " + "-x - call shutdown on server\n", + argv[0]), + -1); + + } + } + return 0; +} + +int ACE_TMAIN( int argc, ACE_TCHAR* argv[] ) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + // Parse arguments. + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object(ior); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << message.in() << std::endl; + + // Shutdown server? + if (call_shutdown == 1) + { + messenger->shutdown(); + orb->perform_work(); + } + + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp new file mode 100644 index 00000000000..b249ddc8228 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp @@ -0,0 +1,224 @@ +// $Id$ + +#include "MessengerServer.h" +#include "Messenger_i.h" +#include "MessengerShutdownTimer.h" +#include "ace/Get_Opt.h" +#include "ace/Reactor.h" +#include "tao/ORB_Core.h" +#include <iostream> +#include <fstream> + +ACE_TString ior_output_file = ACE_TEXT ("test.ior"); + +// By default, shutdown when client calls Messenger::shutdown(). +MessengerServer::ShutdownMethod s_method = MessengerServer::s_client_call; + +int loop_iterations; +int timeout; + +// Constructor. +MessengerServer::MessengerServer (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) + , monitor_(0) +{ +} + +// Destructor. +MessengerServer::~MessengerServer () +{ + if (monitor_ != 0) + delete monitor_; + orb_->destroy (); +} + +// run the ORB's event loop continuously +void MessengerServer::run () +{ + std::cout << "Running the ORB event loop continuously..." << std::endl; + orb_->run (); + std::cout << "Finished running the ORB." << std::endl; +} + +// run the ORB's event loop for some number of seconds +void MessengerServer::run (int seconds) +{ + std::cout << "Running the ORB event loop for " << seconds + << " seconds..." << std::endl; + ACE_Time_Value tv ((long)seconds, 0); + orb_->run (tv); + std::cout << "Finished running the ORB." << std::endl; +} + +// handle ORB events in a polling loop for some number of iterations +void MessengerServer::poll (int iterations) +{ + std::cout << "Polling for ORB events for " << iterations + << " iterations..." << std::endl; + int x = iterations; + do + { + std::cout << "iteration: " << iterations - x << std::endl; + ACE_Time_Value tv (1,0); + orb_->perform_work (tv); + } + while ((--x > 0) && (orb_->orb_core ()->has_shutdown() == 0)); + std::cout << "Finished running the ORB." << std::endl; +} + +// schedule a shutdown timer with the ORB's reactor to timeout +// after some seconds +void MessengerServer::schedule_shutdown_timer (int seconds) +{ + // Create a shutdown timer. + std::cout << "Creating shutdown timer" << std::endl; + MessengerShutdownTimer * timer = new MessengerShutdownTimer (orb_.in()); + + // Schedule the timer to shutdown the ORB, with no repeat. + ACE_Time_Value tv ((long)seconds, 0); + std::cout << "Scheduling shutdown timer" << std::endl; + orb_->orb_core ()->reactor ()->schedule_timer ( + timer, // handler : ACE_Event_Handler * + 0, // args : void * + tv // relative timeout value : ACE_Time_Value & + ); +} + +// spawn thread to monitor console and shutdown on console input +void MessengerServer::shutdown_on_console_input () +{ + // Spawn a thread to monitor console and shutdown on console input. + monitor_ = new MessengerServer::ConsoleMonitor (orb_.in()); + monitor_->activate (); + std::cout << "Enter any input on keyboard to shut down ORB..." << std::endl; +} + +// parse arguments +int MessengerServer::parse_args (int argc, ACE_TCHAR* argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("xp:t:cr:o:")); + int c; + + while ((c = get_opts ()) != -1) + { + switch (c) + { + case 'x': + s_method = MessengerServer::s_client_call; + break; + case 'p': + s_method = MessengerServer::s_polling_loop; + loop_iterations = ACE_OS::atoi(get_opts.opt_arg()); + break; + case 't': + s_method = MessengerServer::s_timer; + timeout = ACE_OS::atoi(get_opts.opt_arg()); + break; + case 'c': + s_method = MessengerServer::s_console_input; + break; + case 'o': + ior_output_file = get_opts.optarg; + break; + case 'r': + s_method = MessengerServer::s_run_time_value; + timeout = ACE_OS::atoi(get_opts.opt_arg()); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-x (default) - shutdown on client invocation\n" + "-p <n> - use polling loop for <n> iterations\n" + "-t <n> - schedule timer for <n> seconds\n" + "-o <iorfile>\n" + "-c - shutdown on console input\n" + "-r <n> - run ORB for <n> seconds\n", + argv[0]), + -1); + + } + } + return 0; +} + + +// ------------------------------------------------------------------ +// main +// ------------------------------------------------------------------ + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + // Create a MessengerServer object. + MessengerServer * server = new MessengerServer (orb.in()); + ACE_Auto_Ptr<MessengerServer> safe_ptr (server); + + // Parse arguments to determine how we should shutdown. + if (server->parse_args (argc, argv) != 0) + return 1; + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a servant. + Messenger_i messenger_servant (orb.in()); + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( &messenger_servant ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR (ior_output_file.c_str ())); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << + ACE_TEXT_ALWAYS_CHAR (ior_output_file.c_str ()) << std::endl; + + switch (s_method) + { + // shutdown on client invocation + case MessengerServer::s_client_call: + std::cout << "Will shutdown on client invocation." << std::endl; + server->run (); + break; + + // shutdown after some iterations through loop + case MessengerServer::s_polling_loop: + server->poll (loop_iterations); + break; + + // schedule a timer to shutdown + case MessengerServer::s_timer: + server->schedule_shutdown_timer (timeout); + server->run (); + break; + + // shutdown on console input + case MessengerServer::s_console_input: + server->shutdown_on_console_input (); + server->run (); + break; + + // use CORBA::ORB::run() with time value + case MessengerServer::s_run_time_value: + server->run (timeout); + break; + } + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.h b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.h new file mode 100644 index 00000000000..bd769b65ce7 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.h @@ -0,0 +1,74 @@ +/* -*- C++ -*- $Id$ */ + +#ifndef MESSENGERSERVER_H_ +#define MESSENGERSERVER_H_ + +#include "MessengerS.h" +#include "ace/Task.h" +#include <iostream> + +//Class MessengerServer +class MessengerServer +{ +public: + //Constructor + MessengerServer (CORBA::ORB_ptr orb); + + //Destructor + virtual ~MessengerServer (void); + + // parse arguments + int parse_args (int argc, ACE_TCHAR* argv[]); + + // run the ORB's event loop continuously + void run (); + + // run the ORB's event loop for some number of seconds + void run (int seconds); + + // handle ORB events in a polling loop for some number of iterations + void poll (int iterations); + + // schedule a shutdown timer with the ORB's reactor to timeout + // after some seconds + void schedule_shutdown_timer (int seconds); + + // spawn thread to monitor console and shutdown on console input + void shutdown_on_console_input (); + + enum ShutdownMethod { + s_client_call, // shutdown on client invocation + s_polling_loop, // shutdown after some iterations through loop + s_timer, // schedule a timer to shutdown + s_console_input, // shutdown on console input + s_run_time_value // use CORBA::ORB::run() with time value + }; + + // Task to monitor console input. + class ConsoleMonitor : public ACE_Task_Base + { + public: + ConsoleMonitor (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) + { + } + + virtual int svc() + { + char c; + std::cin.get (c); + orb_->shutdown (true); + return 0; + } + private: + CORBA::ORB_var orb_; + }; + +private: + + CORBA::ORB_var orb_; + ConsoleMonitor * monitor_; + +}; + +#endif /* MESSENGERSERVER_H_ */ diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.cpp b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.cpp new file mode 100644 index 00000000000..2672ea53671 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.cpp @@ -0,0 +1,17 @@ +/* -*- C++ -*- $Id$ */ + +#include "MessengerShutdownTimer.h" + +MessengerShutdownTimer::MessengerShutdownTimer (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) +{ +} + +int MessengerShutdownTimer::handle_timeout ( + const ACE_Time_Value &, + const void*) +{ + ACE_DEBUG((LM_DEBUG, "In MessengerShutdownTimer::handle_timeout\n")); + orb_->shutdown (false); + return 0; +} diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.h b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.h new file mode 100644 index 00000000000..ae0cb97e37d --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/MessengerShutdownTimer.h @@ -0,0 +1,24 @@ +/* -*- C++ -*- $Id$ */ + +#ifndef MESSENGERSHUTDOWNTIMER_H_ +#define MESSENGERSHUTDOWNTIMER_H_ + +#include "ace/Event_Handler.h" +#include "tao/corba.h" + +class MessengerShutdownTimer : public ACE_Event_Handler +{ +public: + // Constructor + MessengerShutdownTimer (CORBA::ORB_ptr orb); + + virtual int handle_timeout ( + const ACE_Time_Value & current_time, + const void * act); + +private: + CORBA::ORB_var orb_; +}; + + +#endif /* MESSENGERSHUTDOWNTIMER_H_ */ diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.cpp b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.cpp new file mode 100644 index 00000000000..1843bc73b98 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.cpp @@ -0,0 +1,40 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::string_free(message); + message = CORBA::string_dup("Thanks for the message."); + return true; +} + +void Messenger_i::shutdown () +{ + orb_->shutdown(false); +} diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.h b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.h new file mode 100644 index 00000000000..3a2dff83972 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/Messenger_i.h @@ -0,0 +1,42 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (CORBA::ORB_ptr orb); + + //Destructor + virtual ~Messenger_i (void); + + virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + + virtual void shutdown (); + +private: + CORBA::ORB_var orb_; + +}; + +#endif /* MESSENGER_I_H_ */ diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/README b/DevGuideExamples/Multithreading/GracefulShutdown/README new file mode 100644 index 00000000000..0998bbfe167 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/README @@ -0,0 +1,65 @@ +// $Id$ + +File: DevGuideExamples/Multithreading/GracefulShutdown/README + +This directory contains a CORBA example illustrating a simple client +and a server with an interface Messenger. This example extends the +Getting Started example to show various techniques for gracefully +shutting down a TAO server. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer [options] + +where [options] can be one of the following: + + -x - (default) shutdown the ORB when the client invokes the + Messenger::shutdown() operation + + -p <n> - use non-blocking ORB operations in a polling loop to shutdown + after <n> iterations + + -t <n> - schedule a timer with the ORB's reactor to shutdown in + <n> seconds + + -r <n> - use the overloaded version of CORBA::ORB::run() that takes + an ACE_Time_Value parameter indicating how long run() + should process events before returning, where <n> is the + number of seconds the ORB will run. + + -c - spawn a separate thread to shutdown the ORB on any + input from the console (terminal) + + + +To start the client: +------------------ +./MessengerClient [-x] + +where -x indicates the client will invoke Messenger::shutdown() +on the server to shut it down. + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl b/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl new file mode 100755 index 00000000000..a6c5964fc80 --- /dev/null +++ b/DevGuideExamples/Multithreading/GracefulShutdown/run_test.pl @@ -0,0 +1,312 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +my $hostname = $server->HostName (); +my $server_args = "-ORBdebuglevel $debug_level " . + "-ORBListenEndpoints iiop://$hostname -o $server_iorfile"; + +$SV = $server->CreateProcess ("MessengerServer", + $server_args . " -x"); +$CL = $client->CreateProcess ("MessengerClient", + "-k file://$client_iorfile -x"); + +# ------------------------------------------------------------------- +# Test 1: Shutdown on client invocation +# ------------------------------------------------------------------- + +print STDOUT "\n\nTest 1: Shutdown on client invocation.\n"; +print STDOUT "Running MessengerServer...\n"; + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status if ($status != 0); + +# ------------------------------------------------------------------- +# Test 2: Shutdown after <n> iterations through polling loop +# ------------------------------------------------------------------- + +my $iter = 10; +print STDOUT "\n\nTest 2: Shutdown after <$iter> iterations through polling loop.\n"; +print STDOUT "Running MessengerServer...\n"; + +$SV->Arguments ($server_args . " -p " . $iter); +$CL->Arguments ("-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $iter); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status if ($status != 0); + +# ------------------------------------------------------------------- +# Test 3: Schedule a timer with the ORB's reactor to shutdown. +# in <n> seconds +# ------------------------------------------------------------------- + +my $sec = 10; +print STDOUT "\n\nTest 3: Schedule a timer with the ORB's reactor to shutdown in <$sec> seconds.\n"; +print STDOUT "Running MessengerServer...\n"; + +$SV->Arguments ($server_args . " -t " . $sec); +$CL->Arguments ("-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $sec); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status if ($status != 0); + +# ------------------------------------------------------------------- +# Test 4: Use the overloaded version of CORBA::ORB::run() that takes +# an ACE_Time_Value parameter indicating how long run() +# should process events before returning. +# ------------------------------------------------------------------- + +print STDOUT "\n\nTest 4: Use the overloaded version of CORBA::ORB::run()\n"; +print STDOUT "that takes an ACE_Time_Value parameter indicating how long\n"; +print STDOUT "run() should process events before returning (<$sec> seconds).\n"; +print STDOUT "Running MessengerServer...\n"; + +$SV->Arguments ($server_args . " -r " . $sec); +$CL->Arguments ("-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + $sec); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status if ($status != 0); + +# ------------------------------------------------------------------- +# Test 5: Spawn a separate thread to shutdown the ORB on any +# input from the console (terminal) +# ------------------------------------------------------------------- + +print STDOUT "\n\nTest 5: Spawn a separate thread to shutdown the ORB on any input from the console (terminal).\n"; +print STDOUT "Running MessengerServer...\n"; + +$SV->Arguments ($server_args . " -c "); +$CL->Arguments ("-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +print STDOUT "Enter any input to shutdown MessengerServer...\n"; +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Multithreading/README b/DevGuideExamples/Multithreading/README new file mode 100644 index 00000000000..33afe107074 --- /dev/null +++ b/DevGuideExamples/Multithreading/README @@ -0,0 +1,21 @@ +File: DevGuideExamples/Multithreading/README + + +This directory contains subdirectories containing CORBA examples +illustrating TAO's various concurrency models: + +Reactive + + Contains an example of a single-threaded server that uses the + reactive concurrency model. + +ThreadPerConnection + + Contains an example of a multithreaded server that uses the + thread-per-connection concurrency model. + +ThreadPool + + Contains an example of a multithreaded server that provides a pool + of threads for concurrent processing of client requests. + diff --git a/DevGuideExamples/Multithreading/Reactive/Messenger.idl b/DevGuideExamples/Multithreading/Reactive/Messenger.idl new file mode 100644 index 00000000000..f58cb4e25aa --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp b/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp new file mode 100644 index 00000000000..124a3dcffdb --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp @@ -0,0 +1,73 @@ +// $Id$ + +#include "MessengerC.h" +#include <iostream> +#include "ace/Get_Opt.h" + +ACE_RCSID(Hello, client, "$Id$") + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object( ior ); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << message.in() << std::endl; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp b/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp new file mode 100644 index 00000000000..8b300719e91 --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp @@ -0,0 +1,77 @@ +// $Id$ + +#include "Messenger_i.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a servant. + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/Reactive/Messenger_i.cpp b/DevGuideExamples/Multithreading/Reactive/Messenger_i.cpp new file mode 100644 index 00000000000..4fae956687b --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/Messenger_i.cpp @@ -0,0 +1,34 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) +{ + std::cout << "Message from: " << user_name << std::endl; + std::cout << "Subject: " << subject << std::endl; + std::cout << "Message: " << message << std::endl; + CORBA::string_free(message); + message = CORBA::string_dup("Thanks for the message."); + return true; +} diff --git a/DevGuideExamples/Multithreading/Reactive/Messenger_i.h b/DevGuideExamples/Multithreading/Reactive/Messenger_i.h new file mode 100644 index 00000000000..98be27c4cdd --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/Multithreading/Reactive/README b/DevGuideExamples/Multithreading/Reactive/README new file mode 100644 index 00000000000..e061c5582fd --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/README @@ -0,0 +1,50 @@ +// $Id$ + +File: DevGuideExamples/Multithreading/Reactive/README + + +This directory contains a CORBA example illustrating a simple client and +a server with an interface Messenger. The Messenger interface has +an operation for sending a message (send_message). The MessengerClient +will send a message which is displayed by the MessengerServer when +received. The MessengerClient will then confirm that the message has +been sent successfully. + +This version of the MessengerServer illustrates the single-threaded +reactive concurrency model for servers as described in the +Multithreading with TAO chapter. The svc.conf file shows run time +configuration options for optimizing single-threaded TAO applications. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/Multithreading/Reactive/Reactive.mpc b/DevGuideExamples/Multithreading/Reactive/Reactive.mpc new file mode 100644 index 00000000000..95fd2b9ada5 --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/Reactive.mpc @@ -0,0 +1,36 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(Multithreading*Server): taoserver, avoids_minimum_corba { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(Multithreading*Client): taoclient, avoids_minimum_corba { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/Multithreading/Reactive/run_test.pl b/DevGuideExamples/Multithreading/Reactive/run_test.pl new file mode 100755 index 00000000000..5ba202b6a1e --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/run_test.pl @@ -0,0 +1,78 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $hostname = $server->HostName(); +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $server_iorfile ". + "-ORBListenEndpoints iiop://$hostname"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); + +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Multithreading/Reactive/svc.conf b/DevGuideExamples/Multithreading/Reactive/svc.conf new file mode 100644 index 00000000000..3cd02504e29 --- /dev/null +++ b/DevGuideExamples/Multithreading/Reactive/svc.conf @@ -0,0 +1,4 @@ +# svc.conf file for single-threaded reactive server. +static Server_Strategy_Factory "-ORBConcurrency reactive -ORBPOALock null" +dynamic Advanced_Resource_Factory Service_Object * TAO_Strategies:_make_TAO_Advanced_Resource_Factory () "-ORBReactorType select_st -ORBInputCDRAllocator null" +static Client_Strategy_Factory "-ORBProfileLock null -ORBClientConnectionHandler st" diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger.idl b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger.idl new file mode 100644 index 00000000000..f58cb4e25aa --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp b/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp new file mode 100644 index 00000000000..b4269742a43 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerClient.cpp @@ -0,0 +1,71 @@ +// $Id$ + +#include "MessengerC.h" +#include "ace/Get_Opt.h" +#include <iostream> + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object(ior); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << message.in() << std::endl; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp b/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp new file mode 100644 index 00000000000..ec9426a9ad5 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/MessengerServer.cpp @@ -0,0 +1,84 @@ +// $Id$ + +#include "Messenger_i.h" +#include "ace/Get_Opt.h" +#include <iostream> +#include <fstream> + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + if (parse_args (argc, argv) != 0) + return 1; + + // Create a servant. + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + + // Output the IOR to the <ior_output_file> + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s\n", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", str.in ()); + ACE_OS::fclose (output_file); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR (ior_output_file) << std::endl; + + // Accept requests from clients. + orb->run(); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.cpp b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.cpp new file mode 100644 index 00000000000..f5699cb9686 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.cpp @@ -0,0 +1,39 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include "ace/Thread.h" +#include <iostream> + +#include <sstream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char* /*user_name*/, + const char* /*subject*/, + char *& message + ) +{ + CORBA::string_free(message); + + std::ostringstream ostr; + ostr << "Message handled on thread " << ACE_Thread::self(); + message = CORBA::string_dup(ostr.str().c_str()); + return true; +} + diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.h b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.h new file mode 100644 index 00000000000..98be27c4cdd --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/README b/DevGuideExamples/Multithreading/ThreadPerConnection/README new file mode 100644 index 00000000000..2ac572efae3 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/README @@ -0,0 +1,73 @@ +// $Id$ + +File: DevGuideExamples/Multithreading/ThreadPerConnection/README + + +This directory contains a CORBA example illustrating a simple client and +a server with an interface Messenger. This example is based on the +Getting Started example, but adds concurrent request processing +capabilities to the server using the thread-per-connection concurrency +model. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer -ORBSvcConf server.conf + + +To start the client: +------------------ +./MessengerClient + + +Tip: +---- +Run several clients simultaneously against the server. Each client +should establish a separate connection to the server and each client's +requests should be handled on a separate thread in the server. To +verify this, the server returns the thread ID that handled the request +in the reply message that is printed by the client. + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + +Here is sample output from the Perl script: + +Starting MessengerServer +IOR written to file Messenger.ior + + +Starting 4 MessengerClients. +Each client should get a new connection +and its own thread in the server. + +Reply: Message handled on thread 992 +Reply: Message handled on thread 1952 +Reply: Message handled on thread 1676 +Reply: Message handled on thread 1016 + + +NOTE: + + Since the Perl script starts several clients simultaneously, output + may become garbled since each client writes its output to stdout. + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/ThreadPerConnection.mpc b/DevGuideExamples/Multithreading/ThreadPerConnection/ThreadPerConnection.mpc new file mode 100644 index 00000000000..eb38a354b26 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/ThreadPerConnection.mpc @@ -0,0 +1,36 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(Multi*Server): taoserver { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(Multi*Client): taoclient, anytypecode { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl b/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl new file mode 100755 index 00000000000..3c8b6d058ce --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/run_test.pl @@ -0,0 +1,171 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $client4 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; + +my $iorbase = "server.ior"; +my $svcbase = "server$PerlACE::svcconf_ext"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $server_svcfile = $server->LocalFile ($svcbase); +my $client1_iorfile = $client1->LocalFile ($iorbase); +my $client2_iorfile = $client2->LocalFile ($iorbase); +my $client3_iorfile = $client3->LocalFile ($iorbase); +my $client4_iorfile = $client4->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); + +my $hostname = $server->HostName (); + +$SV = $server->CreateProcess ("MessengerServer", + "-ORBdebuglevel $debug_level " . + "-ORBSvcConf $server_svcfile " . + "-ORBListenEndpoints iiop://$hostname " . + "-o $server_iorfile"); +$CL1 = $client1->CreateProcess ("MessengerClient", "-k file://$client1_iorfile"); +$CL2 = $client2->CreateProcess ("MessengerClient", "-k file://$client2_iorfile"); +$CL3 = $client3->CreateProcess ("MessengerClient", "-k file://$client3_iorfile"); +$CL4 = $client4->CreateProcess ("MessengerClient", "-k file://$client4_iorfile"); + +print STDOUT "Starting MessengerServer\n"; +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client1->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client1_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client2->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client2_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client3->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client3_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client4->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client4_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +print STDOUT "\n\nStarting 4 MessengerClients.\n"; +print STDOUT "Each client should get a new connection ". + "and its own thread in the server.\n\n"; + +$client_status = $CL1->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL2->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + exit 1; +} + +$client_status = $CL3->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + exit 1; +} + +$client_status = $CL4->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + exit 1; +} + +$client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$SV->Kill (); + +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/Multithreading/ThreadPerConnection/server.conf b/DevGuideExamples/Multithreading/ThreadPerConnection/server.conf new file mode 100644 index 00000000000..3b6d80259ef --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPerConnection/server.conf @@ -0,0 +1,2 @@ +# server.conf file for thread-per-connection server. +static Server_Strategy_Factory "-ORBConcurrency thread-per-connection -ORBThreadPerConnectionTimeout 1000" diff --git a/DevGuideExamples/Multithreading/ThreadPool/Messenger.idl b/DevGuideExamples/Multithreading/ThreadPool/Messenger.idl new file mode 100644 index 00000000000..f58cb4e25aa --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/Messenger.idl @@ -0,0 +1,10 @@ +// $Id$ + +// Messenger.idl + +interface Messenger +{ + boolean send_message(in string user_name, + in string subject, + inout string message); +}; diff --git a/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp b/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp new file mode 100644 index 00000000000..b4269742a43 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/MessengerClient.cpp @@ -0,0 +1,71 @@ +// $Id$ + +#include "MessengerC.h" +#include "ace/Get_Opt.h" +#include <iostream> + +const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Read and destringify the Messenger object's IOR. + CORBA::Object_var obj = orb->string_to_object(ior); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Could not get Messenger IOR." << std::endl; + return 1; + } + + // Narrow the IOR to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "IOR was not a Messenger object reference." << std::endl; + return 1; + } + + // Send a message the the Messenger object. + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + + // Print the Messenger's reply. + std::cout << "Reply: " << message.in() << std::endl; + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp b/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp new file mode 100644 index 00000000000..2097b73a3a3 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/MessengerServer.cpp @@ -0,0 +1,108 @@ +// $Id$ + +#include "Messenger_i.h" +#include "ace/Get_Opt.h" +#include <iostream> +#include <fstream> +// 1. Define a "task" class for implenting the thread pool threads. +#include "ace/Task.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class ORB_Task : public ACE_Task_Base +{ +public: + ORB_Task (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate(orb)) { } + virtual ~ORB_Task () { } + virtual int svc () + { + this->orb_->run(); + return 0; + } +private: + CORBA::ORB_var orb_; +}; + +// 2. Establish the number of threads. +static const int nthreads = 4; + +int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + //Get reference to the RootPOA. + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate the POAManager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + if (parse_args (argc, argv) != 0) + return 1; + + // Create a servant. + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR (ior_output_file)); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << + ACE_TEXT_ALWAYS_CHAR (ior_output_file) << std::endl; + + // 3. Create and activate threads for the thread pool. + ORB_Task task (orb.in()); + int retval = task.activate (THR_NEW_LWP | THR_JOINABLE, nthreads); + if (retval != 0) { + std::cerr << "Failed to activate " << nthreads << " threads." << std::endl; + return 1; + } + + // 4. Wait for threads to finish. + task.wait(); + + // Clean up. + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.cpp b/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.cpp new file mode 100644 index 00000000000..f5699cb9686 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.cpp @@ -0,0 +1,39 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include "ace/Thread.h" +#include <iostream> + +#include <sstream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char* /*user_name*/, + const char* /*subject*/, + char *& message + ) +{ + CORBA::string_free(message); + + std::ostringstream ostr; + ostr << "Message handled on thread " << ACE_Thread::self(); + message = CORBA::string_dup(ostr.str().c_str()); + return true; +} + diff --git a/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.h b/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.h new file mode 100644 index 00000000000..98be27c4cdd --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/Multithreading/ThreadPool/README b/DevGuideExamples/Multithreading/ThreadPool/README new file mode 100644 index 00000000000..fd353365383 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/README @@ -0,0 +1,76 @@ +// $Id$ + +File: DevGuideExamples/Multithreading/ThreadPool/README + + +This directory contains a CORBA example illustrating a simple client +and a server with an interface Messenger. This example is based on the +Getting Started example, but adds concurrent request processing +capabilities to the server using the thread pool concurrency model. +The server creates 4 threads for the thread pool. + + +How to Run +---------- + +To start the server : +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + +Tip: +---- +Run several clients simultaneously against the server. Some client +requests should be handled by separate threads in the server. To +verify this, the server returns the thread ID that handled the request +in the reply message that is printed by the client. You may see the +same thread used to handle multiple requests, but it is unlikely that +the same thread will be used to handle all of the requests. + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + +Here is sample output from the Perl script: + +Starting MessengerServer +IOR written to file Messenger.ior + + +Starting 9 MessengerClients. +The server should use different threads to handle requests. + +Reply: Message handled on thread 1620 +Reply: Message handled on thread 1620 +Reply: Message handled on thread 1620 +Reply: Message handled on thread 1868 +Reply: Message handled on thread 1592 +Reply: Message handled on thread 1868 +Reply: Message handled on thread 1300 +Reply: Message handled on thread 1620 +Reply: Message handled on thread 1620 + +NOTE: + + Since the Perl script starts several clients simultaneously, output + may become garbled since each client writes its output to stdout. + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/Multithreading/ThreadPool/ThreadPool.mpc b/DevGuideExamples/Multithreading/ThreadPool/ThreadPool.mpc new file mode 100644 index 00000000000..592f197b521 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/ThreadPool.mpc @@ -0,0 +1,36 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(Multithreading*Server): taoserver, avoids_minimum_corba { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(Multithreading*Client): taoclient, anytypecode, avoids_minimum_corba { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/Multithreading/ThreadPool/run_test.pl b/DevGuideExamples/Multithreading/ThreadPool/run_test.pl new file mode 100755 index 00000000000..a3fb0021480 --- /dev/null +++ b/DevGuideExamples/Multithreading/ThreadPool/run_test.pl @@ -0,0 +1,322 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; +my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n"; +my $client4 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n"; +my $client5 = PerlACE::TestTarget::create_target (6) || die "Create target 6 failed\n"; +my $client6 = PerlACE::TestTarget::create_target (7) || die "Create target 7 failed\n"; +my $client7 = PerlACE::TestTarget::create_target (8) || die "Create target 8 failed\n"; +my $client8 = PerlACE::TestTarget::create_target (9) || die "Create target 9 failed\n"; +my $client9 = PerlACE::TestTarget::create_target (10) || die "Create target 10 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client1_iorfile = $client1->LocalFile ($iorbase); +my $client2_iorfile = $client2->LocalFile ($iorbase); +my $client3_iorfile = $client3->LocalFile ($iorbase); +my $client4_iorfile = $client4->LocalFile ($iorbase); +my $client5_iorfile = $client5->LocalFile ($iorbase); +my $client6_iorfile = $client6->LocalFile ($iorbase); +my $client7_iorfile = $client7->LocalFile ($iorbase); +my $client8_iorfile = $client8->LocalFile ($iorbase); +my $client9_iorfile = $client9->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); +$client5->DeleteFile($iorbase); +$client6->DeleteFile($iorbase); +$client7->DeleteFile($iorbase); +$client8->DeleteFile($iorbase); +$client9->DeleteFile($iorbase); + +my $hostname = $server->HostName (); + +$SV = $server->CreateProcess ("MessengerServer", + "-ORBdebuglevel $debug_level " . + "-ORBListenEndpoints iiop://$hostname " . + "-o $server_iorfile"); +$CL1 = $client1->CreateProcess ("MessengerClient", "-k file://$client1_iorfile"); +$CL2 = $client2->CreateProcess ("MessengerClient", "-k file://$client2_iorfile"); +$CL3 = $client3->CreateProcess ("MessengerClient", "-k file://$client3_iorfile"); +$CL4 = $client4->CreateProcess ("MessengerClient", "-k file://$client4_iorfile"); +$CL5 = $client5->CreateProcess ("MessengerClient", "-k file://$client5_iorfile"); +$CL6 = $client6->CreateProcess ("MessengerClient", "-k file://$client6_iorfile"); +$CL7 = $client7->CreateProcess ("MessengerClient", "-k file://$client7_iorfile"); +$CL8 = $client8->CreateProcess ("MessengerClient", "-k file://$client8_iorfile"); +$CL9 = $client9->CreateProcess ("MessengerClient", "-k file://$client9_iorfile"); + +print STDOUT "Starting MessengerServer\n"; +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client1->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client1_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client2->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client2_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client3->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client3_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client4->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client4_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client5->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client5_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client6->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client6_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client7->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client7_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client8->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client8_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} +if ($client9->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client9_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +print STDOUT "\n\nStarting 9 MessengerClients.\n"; +print STDOUT "The server should use different threads to handle requests.\n\n"; + +$client_status = $CL1->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL2->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + exit 1; +} + +$client_status = $CL3->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + exit 1; +} + +$client_status = $CL4->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + exit 1; +} + +$client_status = $CL5->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + exit 1; +} + +$client_status = $CL6->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + exit 1; +} + +$client_status = $CL7->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + exit 1; +} + +$client_status = $CL8->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + $CL7->Kill (); $CL7->TimedWait (1); + exit 1; +} + +$client_status = $CL9->Spawn (); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $SV->Kill (); $SV->TimedWait (1); + $CL1->Kill (); $CL1->TimedWait (1); + $CL2->Kill (); $CL2->TimedWait (1); + $CL3->Kill (); $CL3->TimedWait (1); + $CL4->Kill (); $CL4->TimedWait (1); + $CL5->Kill (); $CL5->TimedWait (1); + $CL6->Kill (); $CL6->TimedWait (1); + $CL7->Kill (); $CL7->TimedWait (1); + $CL8->Kill (); $CL8->TimedWait (1); + exit 1; +} + +$client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL5->WaitKill ($client5->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL6->WaitKill ($client6->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL7->WaitKill ($client7->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL8->WaitKill ($client8->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$client_status = $CL9->WaitKill ($client9->ProcessStopWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$SV->Kill (); + +$server->DeleteFile($iorbase); +$client1->DeleteFile($iorbase); +$client2->DeleteFile($iorbase); +$client3->DeleteFile($iorbase); +$client4->DeleteFile($iorbase); +$client5->DeleteFile($iorbase); +$client6->DeleteFile($iorbase); +$client7->DeleteFile($iorbase); +$client8->DeleteFile($iorbase); +$client9->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/PortableInterceptors/Auth/Auth.mpc b/DevGuideExamples/PortableInterceptors/Auth/Auth.mpc new file mode 100644 index 00000000000..654ada76322 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/Auth.mpc @@ -0,0 +1,40 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, pi_server, avoids_minimum_corba { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + ServerInitializer.cpp + ServerInterceptor.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, avoids_minimum_corba, interceptors { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + ClientInitializer.cpp + ClientInterceptor.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.cpp b/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.cpp new file mode 100644 index 00000000000..2311df25b71 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#include "ClientInitializer.h" +#include "ClientInterceptor.h" +#include <iostream> + +ClientInitializer::ClientInitializer (void) +{ +} + +void +ClientInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ClientInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) +{ + + // Create and register the request interceptors. + PortableInterceptor::ClientRequestInterceptor_ptr ci = + PortableInterceptor::ClientRequestInterceptor::_nil (); + + try + { + ci = new ClientInterceptor(); + } + catch(...) + { + std::cerr << "Exception ocurred creating ClientInterceptor" << std::endl; + } + + PortableInterceptor::ClientRequestInterceptor_var ci_interceptor = + ci; + + info->add_client_request_interceptor (ci_interceptor.in ()); +} + diff --git a/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.h b/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.h new file mode 100644 index 00000000000..7169cbef5a9 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ClientInitializer.h @@ -0,0 +1,20 @@ +// $Id$ + +#ifndef CLIENTINITIALIZER_H +#define CLIENTINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" + +class ClientInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ +public: + ClientInitializer (void); + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.cpp b/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.cpp new file mode 100644 index 00000000000..0a383f256c1 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.cpp @@ -0,0 +1,88 @@ +// $Id$ + +#include "ClientInterceptor.h" +#include "tao/OctetSeqC.h" +#include "tao/PI/ClientRequestInfo.h" +#include "ace/OS_NS_string.h" +#include <iostream> + +const CORBA::ULong service_ctx_id = 0xdeed; + +ClientInterceptor:: +ClientInterceptor (void) + : myname_ ("Client_Authentication_Interceptor") +{ + std::cout << "Calling ClientInterceptor constructor." << std::endl; +} + +ClientInterceptor::~ClientInterceptor (void) +{ +} + +char * +ClientInterceptor::name () +{ + std::cout << "Calling ClientInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ClientInterceptor::destroy () +{ +} + +void +ClientInterceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr) +{ + std::cout << "Calling send_poll()." << std::endl; +} + + +void +ClientInterceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + std::cout << "Calling send_request()." << std::endl; + + IOP::ServiceContext sc; + sc.context_id = service_ctx_id; + + const char user_name[] = "Ron Klein"; + std::cout << "User's Name: " << user_name << std::endl; + CORBA::ULong string_len = sizeof (user_name) + 1; + CORBA::Octet *buf = 0; + + buf = new CORBA::Octet [string_len]; + + ACE_OS::strcpy (reinterpret_cast<char*> (buf), user_name); + + sc.context_data.replace (string_len, string_len, buf, true); + + // Add this context to the service context list. + ri->add_request_service_context (sc, false); + +} + +void +ClientInterceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_reply()." << std::endl; +} + +void +ClientInterceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr) +{ + std::cout << "Calling receive_other()." << std::endl; +} + +void +ClientInterceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_exception()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.h b/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.h new file mode 100644 index 00000000000..95b6966049b --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ClientInterceptor.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef CLIENTINTERCEPTOR_H +#define CLIENTINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" + +class ClientInterceptor +: public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ + + public: + ClientInterceptor (void); + + virtual ~ClientInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + + private: + const char *myname_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/Auth/Messenger.idl b/DevGuideExamples/PortableInterceptors/Auth/Messenger.idl new file mode 100644 index 00000000000..0af8b9e9c0f --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/Messenger.idl @@ -0,0 +1,11 @@ +// $Id$ + +// messenger.idl + +interface Messenger + { + boolean send_message ( in string user_name, + in string subject, + inout string message ); + }; + diff --git a/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp b/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp new file mode 100644 index 00000000000..46ad1a97cca --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp @@ -0,0 +1,78 @@ +// $Id$ + +#include "MessengerC.h" +#include "ClientInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI library is linked in when building statically +#include "tao/PI/PI.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ClientInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "Client ORB"); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object( ior ); + + if ( CORBA::is_nil(obj.in() ) ) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + Messenger_var messenger = Messenger::_narrow( obj.in() ); + + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Not a Messenger reference" << std::endl; + return 1; + } + + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + } + catch(const CORBA::Exception& ex) + { + std::cerr << "Caught CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp b/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp new file mode 100644 index 00000000000..e2f8d786fe1 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "Messenger_i.h" +#include "MessengerS.h" +#include "ServerInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI_Server library is linked in when building statically +#include "tao/PI_Server/PI_Server.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ServerInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "Server ORB"); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to Root POA + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in()); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile ( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << std::endl << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "Caught CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.cpp b/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.cpp new file mode 100644 index 00000000000..4cdf3098c47 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.cpp @@ -0,0 +1,40 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1) +#include <iostream> +#else +#include <iostream.h> +#endif + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) + +{ + //Add your implementation here + std::cerr << "Message from: " << user_name << std::endl; + std::cerr << "Subject: " << subject << std::endl; + std::cerr << "Message: " << message << std::endl; + return true; +} + diff --git a/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.h b/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.h new file mode 100644 index 00000000000..6cd2b747609 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/Messenger_i.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/PortableInterceptors/Auth/README b/DevGuideExamples/PortableInterceptors/Auth/README new file mode 100644 index 00000000000..5bcc33ea99b --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/README @@ -0,0 +1,38 @@ +// $Id$ + +Portable Interceptors + + +File: DevGuideExamples/PortableInterceptor/Auth/README + + +This directory contains an example illustrating client and server +Request Interceptors. + +This is a simple insecure authentication example that is based on +the Messenger example in GettingStarted directory. A message is +sent by MessengerClient and displayed by MessengerServer. A client-side +portable interceptor adds a username to each request sent to the server. +A server-side interceptor verifies that the supplied username is valid. + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl diff --git a/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.cpp b/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.cpp new file mode 100644 index 00000000000..c0078d24f43 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.cpp @@ -0,0 +1,44 @@ +// $Id$ + +#include "ServerInitializer.h" +#include "ServerInterceptor.h" + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1) +#include <iostream> +#else +#include <iostream.h> +#endif + +ServerInitializer::ServerInitializer () +{ +} + +void +ServerInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ServerInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + + // Create and register the request interceptors. + PortableInterceptor::ServerRequestInterceptor_ptr si = + PortableInterceptor::ServerRequestInterceptor::_nil (); + + try + { + si = new ServerInterceptor (); + } + catch(...) + { + std::cerr << "Exception occured trying to create ServerInterceptor." << std::endl; + } + + PortableInterceptor::ServerRequestInterceptor_var si_interceptor = + si; + + info->add_server_request_interceptor (si_interceptor.in ()); +} diff --git a/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.h b/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.h new file mode 100644 index 00000000000..e015f52a7b1 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ServerInitializer.h @@ -0,0 +1,25 @@ +// $Id$ + +#ifndef SERVERINITIALIZER_H +#define SERVERINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" + +class ServerInitializer : +public virtual PortableInterceptor::ORBInitializer, +public virtual CORBA::LocalObject +{ + public: + ServerInitializer (); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + + private: + int interceptor_type_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.cpp b/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.cpp new file mode 100644 index 00000000000..dead4337e88 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.cpp @@ -0,0 +1,107 @@ +// $Id$ + +#include "ServerInterceptor.h" +#include "tao/PI_Server/ServerRequestInfoA.h" +#include "ace/OS_NS_string.h" +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1) +#include <iostream> +#else +#include <iostream.h> +#endif + +const IOP::ServiceId service_id = 0xdeed; +const unsigned int num_allowed_users = 4; +static const char* allowed_users[num_allowed_users+1] = + {"Ron Klein", "Scott Case", "Mark Hodge", "Greg Black", 0}; +const char* restricted_interfaces[1] = {"IDL:Messenger:1.0"}; + +ServerInterceptor::ServerInterceptor (void) + : myname_ ("Server_Authentication_Interceptor") +{ + std::cout << "Calling ServerInterceptor constructor." << std::endl; +} + +ServerInterceptor::~ServerInterceptor () +{ +} + +char * +ServerInterceptor::name () +{ + std::cout << "Calling ServerInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ServerInterceptor::destroy () +{ + std::cout << "Calling destroy()." << std::endl; +} + +void +ServerInterceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_request_service_contexts()." << std::endl; +} + +void +ServerInterceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + bool permission_granted = false; + std::cout << "Calling receive_request()." << std::endl; + + if (ri->target_is_a(restricted_interfaces[0])){ + IOP::ServiceId id = service_id; + // Check that the request service context can be retrieved. + IOP::ServiceContext_var sc = + ri->get_request_service_context (id); + + CORBA::OctetSeq ocSeq = sc->context_data; + + const char * buf = + reinterpret_cast<const char *> (ocSeq.get_buffer ()); + + for (unsigned int i=0; i<num_allowed_users; ++i) { + if (ACE_OS::strcmp (buf, allowed_users[i]) == 0) + { + permission_granted = true; + } + } + } + + if (permission_granted == true) { + std::cout << "Permission Granted " << std::endl; + } + else { + std::cout << "Permission Denied " << std::endl; + throw CORBA::NO_PERMISSION(); + } +} + +void +ServerInterceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_reply()." << std::endl; +} + +void +ServerInterceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_exception()." << std::endl; +} + +void +ServerInterceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_other()." << std::endl; +} + diff --git a/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.h b/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.h new file mode 100644 index 00000000000..ca4732c5075 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/ServerInterceptor.h @@ -0,0 +1,36 @@ +// $Id$ + +#ifndef SERVERINTERCEPTOR_H +#define SERVERINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/ServerRequestInterceptorA.h" + +class ServerInterceptor +: public PortableInterceptor::ServerRequestInterceptor +{ + public: + ServerInterceptor (void); + + ~ServerInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri); + + private: + const char *myname_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/Auth/run_test.pl b/DevGuideExamples/PortableInterceptors/Auth/run_test.pl new file mode 100755 index 00000000000..2b431dd59e6 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/Auth/run_test.pl @@ -0,0 +1,75 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +select undef, undef, undef, .5; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.cpp b/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.cpp new file mode 100644 index 00000000000..0f18feb10e3 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.cpp @@ -0,0 +1,45 @@ +// $Id$ + +#include "ClientInitializer.h" +#include "ClientInterceptor.h" +#include <iostream> + +ClientInitializer::ClientInitializer (void) +{ +} + +void +ClientInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr + ) +{ +} + +void +ClientInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info + ) +{ + + // get Codec factory + IOP::CodecFactory_var codec_factory = info->codec_factory(); + + // Create and register the request interceptors. + PortableInterceptor::ClientRequestInterceptor_ptr ci = + PortableInterceptor::ClientRequestInterceptor::_nil (); + + try + { + ci = new ClientInterceptor (codec_factory); + } + catch(...) + { + std::cerr << "Exception occurred trying to create ClientInterceptor." << std::endl; + } + + PortableInterceptor::ClientRequestInterceptor_var ci_interceptor = + ci; + + info->add_client_request_interceptor (ci_interceptor.in ()); +} + diff --git a/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.h b/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.h new file mode 100644 index 00000000000..0fab8bc1d3b --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ClientInitializer.h @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef CLIENTINITIALIZER_H +#define CLIENTINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" + +class ClientInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ + public: + ClientInitializer (void); + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#endif + diff --git a/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.cpp b/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.cpp new file mode 100644 index 00000000000..cec3d86ddf5 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "ClientInterceptor.h" +#include "tao/OctetSeqC.h" +#include "tao/LocalObject.h" +#include "tao/PI/ClientRequestInfo.h" + +#include <iostream> + +const CORBA::ULong service_ctx_id = 0xdeed; + +ClientInterceptor:: +ClientInterceptor (IOP::CodecFactory_var cf) + : myname_ ("Client_Authentication_Interceptor") +{ + std::cout << "Calling ClientInterceptor constructor." << std::endl; + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + this->codec = cf->create_codec (encoding); +} + +ClientInterceptor::~ClientInterceptor (void) +{ +} + +char * +ClientInterceptor::name () +{ + std::cout << "Calling ClientInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ClientInterceptor::destroy () +{ +} + +void +ClientInterceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_poll()." << std::endl; +} + + +void +ClientInterceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + std::cout << "Calling send_request()." << std::endl; + + const CORBA::ULong tagID = 9654; + + try + { + IOP::TaggedComponent_var myTag = ri->get_effective_component(tagID); + char *tag = + reinterpret_cast<char*> (myTag->component_data.get_buffer()); + + std::cout << "IOR Tag is : " << tag << std::endl; + } + catch(...) + { + std::cerr << "Tagged Component not found" << std::endl; + } + + IOP::ServiceContext sc; + sc.context_id = service_ctx_id; + + const CORBA::Long gid = 9007; + + std::cout << "GID: " << gid << std::endl; + + CORBA::Any gid_as_any; + gid_as_any <<= gid; + + sc.context_data = *codec->encode(gid_as_any); + + // Add this context to the service context list. + ri->add_request_service_context (sc, false); + +} + +void +ClientInterceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_reply()." << std::endl; +} + +void +ClientInterceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_other()." << std::endl; +} + +void +ClientInterceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_exception()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.h b/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.h new file mode 100644 index 00000000000..6ab15cdda99 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ClientInterceptor.h @@ -0,0 +1,40 @@ +// $Id$ + +#ifndef CLIENTINTERCEPTOR_H +#define CLIENTINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/ClientRequestInterceptorA.h" +#include "tao/PI/ORBInitInfo.h" + +class ClientInterceptor: + public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ + + public: + ClientInterceptor (IOP::CodecFactory_var) ; + + virtual ~ClientInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + + private: + const char *myname_; + IOP::Codec_var codec; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/IOR/IOR.mpc b/DevGuideExamples/PortableInterceptors/IOR/IOR.mpc new file mode 100644 index 00000000000..28e5fe7e1ae --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/IOR.mpc @@ -0,0 +1,41 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, pi_server, avoids_minimum_corba, iorinterceptor { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + ServerInitializer.cpp + ServerInterceptor.cpp + ServerIORInterceptor.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, avoids_minimum_corba, interceptors { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + ClientInitializer.cpp + ClientInterceptor.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/Messenger.idl b/DevGuideExamples/PortableInterceptors/IOR/Messenger.idl new file mode 100644 index 00000000000..99713548b46 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/Messenger.idl @@ -0,0 +1,8 @@ +// $Id$ + +#include "orb.idl" + +interface Messenger +{ + void send_message(in CORBA::OctetSeq user_name); +}; diff --git a/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp b/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp new file mode 100644 index 00000000000..10cfb5c70cd --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "MessengerC.h" +#include "ClientInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI library is linked in when building statically +#include "tao/PI/PI.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ClientInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Destringify ior + CORBA::Object_var obj = orb->string_to_object( ior ); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + // Narrow + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Argument is not a Messenger reference" << std::endl; + return 1; + } + + // Obtain a reference to the CodecFactory. + CORBA::Object_var obj2 = + orb->resolve_initial_references ("CodecFactory"); + + IOP::CodecFactory_var codec_factory; + + if(CORBA::is_nil(obj2.in())) + { + std::cerr << "Error: codec_factory" << std::endl; + ACE_OS::exit(1); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj2.in ()); + std::cout << "got codec factory" << std::endl; + } + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + IOP::Codec_var codec = + codec_factory->create_codec (encoding); + + CORBA::Long uid = 64321; + + CORBA::Any uid_as_any; + + uid_as_any <<= uid; + CORBA::OctetSeq client_uid = *codec->encode (uid_as_any); + messenger->send_message( client_uid ); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "Exception in MessengerClient: " << ex << std::endl; + return 1; + } + + std::cout << "message was sent" << std::endl; + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp b/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp new file mode 100644 index 00000000000..eec45d66938 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "Messenger_i.h" +#include "MessengerC.h" +#include "ServerInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI_Server library is linked in when building statically +#include "tao/PI_Server/PI_Server.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ServerInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to Root POA + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "Exception in MessengerServer: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.cpp b/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.cpp new file mode 100644 index 00000000000..889a6659d3f --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.cpp @@ -0,0 +1,77 @@ +// $Id$ + +#include "tao/CodecFactory/CodecFactory.h" +#include "ace/OS_NS_string.h" +#include <iostream> +#include "Messenger_i.h" + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +void Messenger_i::send_message (const CORBA::OctetSeq & user_name) +{ + try + { + int argc = 1; + char **argv = new char *[argc]; + argv[0] = new char[ACE_OS::strlen ("MessengerServer")]; + ACE_OS::strcpy (argv[0], "MessengerServer"); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + // Obtain a reference to the CodecFactory. + CORBA::Object_var obj = + orb->resolve_initial_references ("CodecFactory"); + + IOP::CodecFactory_var codec_factory; + + if(CORBA::is_nil(obj.in())) + { + std::cerr << "Error: codec_factory" << std::endl; + ACE_OS::exit(1); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj.in ()); + std::cout << "Server got codec factory" << std::endl; + } + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + IOP::Codec_var codec = + codec_factory->create_codec (encoding); + + CORBA::Any uid_as_any; + uid_as_any = *(codec->decode(user_name)); + + CORBA::Long uid; + if (uid_as_any >>= uid) + { + std::cout << "UID: " << uid << std::endl; + } + else + { + std::cerr << "Could not extract UID from any." << std::endl; + } + + } + + catch(...) + { + std::cerr << "exception received" << std::endl; + ACE_OS::exit(1); + } +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.h b/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.h new file mode 100644 index 00000000000..81758f935ce --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/Messenger_i.h @@ -0,0 +1,28 @@ +// $Id$ + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ + public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + + virtual void send_message (const CORBA::OctetSeq & user_name); + +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/PortableInterceptors/IOR/README b/DevGuideExamples/PortableInterceptors/IOR/README new file mode 100644 index 00000000000..c0ae563435b --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/README @@ -0,0 +1,37 @@ +// $Id$ + +Portable Interceptors + + +File: DevGuideExamples/PortableInterceptor/IOR/README + + +This directory contains an example of using portable interceptors to add +tagged information to an IOR. + +This example is based on the Messenger example in GettingStarted +directory. A message is send by MessengerClient and displayed by +MessengerServer. On IOR creation, the server has added a special +tag "ServerRequiresAuth". The client is able to extract this tag. + + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + +Execution via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.cpp b/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.cpp new file mode 100644 index 00000000000..42bb29ef004 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.cpp @@ -0,0 +1,58 @@ +// $Id$ + +#include "ServerIORInterceptor.h" +#include <iostream> +char * +ServerIORInterceptor::name () +{ + return CORBA::string_dup ("ServerIORInterceptor"); +} + +void +ServerIORInterceptor::destroy () +{ +} + +void +ServerIORInterceptor::establish_components ( + PortableInterceptor::IORInfo_ptr info) +{ + const char * permission = "ServerRequiresAuth"; + + // arbitrary tag. + CORBA::ULong tagID = 9654; + + IOP::TaggedComponent myTag; + + myTag.tag = tagID; + myTag.component_data.length (ACE_OS::strlen(permission) + 1 ); + + CORBA::Octet *buf = myTag.component_data.get_buffer(); + + ACE_OS::memcpy (buf, permission, ACE_OS::strlen(permission) + 1); + + // add tagged component + info->add_ior_component (myTag); + + std::cout << "Created Tagged IOR." << std::endl; +} + +void +ServerIORInterceptor::components_established ( + PortableInterceptor::IORInfo_ptr /*info*/) +{ +} + +void +ServerIORInterceptor::adapter_manager_state_changed ( + const char* /*id*/, + PortableInterceptor::AdapterState /*state*/) +{ +} + +void +ServerIORInterceptor::adapter_state_changed ( + const PortableInterceptor::ObjectReferenceTemplateSeq& /*templates*/, + PortableInterceptor::AdapterState /*state*/) +{ +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.h b/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.h new file mode 100644 index 00000000000..169e117664c --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerIORInterceptor.h @@ -0,0 +1,27 @@ +// $Id$ + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/IORInterceptor/IORInterceptor.h" + +class ServerIORInterceptor : +public virtual PortableInterceptor::IORInterceptor_3_0, +public virtual ::CORBA::LocalObject +{ + public: + virtual char * name (); + + virtual void destroy (); + + virtual void establish_components (PortableInterceptor::IORInfo_ptr info); + + virtual void components_established (PortableInterceptor::IORInfo_ptr info); + + virtual void adapter_manager_state_changed ( + const char* id, + PortableInterceptor::AdapterState state); + + virtual void adapter_state_changed ( + const PortableInterceptor::ObjectReferenceTemplateSeq& templates, + PortableInterceptor::AdapterState state); +}; diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.cpp b/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.cpp new file mode 100644 index 00000000000..85546623723 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.cpp @@ -0,0 +1,32 @@ +// $Id$ + +#include "ServerInitializer.h" +#include "ServerInterceptor.h" +#include "ServerIORInterceptor.h" + +ServerInitializer::ServerInitializer () +{ +} + +void +ServerInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ServerInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + // get reference to the codec_factory + IOP::CodecFactory_var codec_factory = info->codec_factory(); + + // Create and register the request interceptors. + PortableInterceptor::ServerRequestInterceptor_var si = + new ServerInterceptor (codec_factory); + info->add_server_request_interceptor (si.in()); + + // add IOR Interceptor + PortableInterceptor::IORInterceptor_var iori = new ServerIORInterceptor; + info->add_ior_interceptor (iori.in()); +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.h b/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.h new file mode 100644 index 00000000000..bb8a55b1b8a --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerInitializer.h @@ -0,0 +1,23 @@ +// $Id$ + +#ifndef SERVERINITIALIZER_H +#define SERVERINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI/PI.h" + +class ServerInitializer : +public virtual PortableInterceptor::ORBInitializer +{ + public: + ServerInitializer (); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + + private: + int interceptor_type_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.cpp b/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.cpp new file mode 100644 index 00000000000..1554e33cbe9 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.cpp @@ -0,0 +1,122 @@ +// $Id$ + +#include "ServerInterceptor.h" +#include "tao/PI_Server/ServerRequestInfoA.h" +#include "tao/OctetSeqC.h" +#include <iostream> + +const IOP::ServiceId service_id = 0xdeed; +const CORBA::Long allowed_gid[4] = { 9006, 9007, 9008 }; +const char* restricted_interfaces[1] = {"IDL:Messenger:1.0"}; + +ServerInterceptor::ServerInterceptor (IOP::CodecFactory_var cf) + : myname_ ("Server_Authentication_Interceptor") +{ + std::cout << "Calling ServerInterceptor constructor." << std::endl; + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + this->codec = cf->create_codec (encoding); +} + +ServerInterceptor::~ServerInterceptor () +{ +} + +char * +ServerInterceptor::name () +{ + std::cout << "Calling ServerInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ServerInterceptor::destroy () +{ + std::cout << "Calling destroy()." << std::endl; +} + +void +ServerInterceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_request_service_contexts()." << std::endl; +} + +void +ServerInterceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + bool permission_granted = false; + std::cout << "Calling receive_request()." << std::endl; + + if (ri->target_is_a(restricted_interfaces[0])){ + IOP::ServiceId id = service_id; + // Check that the request service context can be retrieved. + IOP::ServiceContext_var sc = + ri->get_request_service_context (id); + // need to construct an octet seq for decoding + CORBA::OctetSeq ocSeq = CORBA::OctetSeq( + sc->context_data.length(), + sc->context_data.length(), + sc->context_data.get_buffer(), + false); + + CORBA::Any gid_as_any; + gid_as_any = *codec->decode(ocSeq); + + CORBA::Long gid; + if (gid_as_any >>= gid) + { + for (int i=0; i<3; ++i) { + if ( gid == allowed_gid[i] ) + { + permission_granted = true; + } + } + } + else + { + permission_granted = false; + std::cerr << "Could not extract GID from any." << std::endl; + } + } + + if (permission_granted == true) { + std::cout << "Permission Granted " << std::endl; + } + else { + std::cout << "Permission Denied " << std::endl;; + } +} + +void +ServerInterceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_reply()." << std::endl; +} + +void +ServerInterceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_exception()." << std::endl; +} + +void +ServerInterceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_other()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.h b/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.h new file mode 100644 index 00000000000..4ccc5ddf3ab --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/ServerInterceptor.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef SERVERINTERCEPTOR_H +#define SERVERINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/ServerRequestInterceptorA.h" +#include "tao/PI/ORBInitInfo.h" + +class ServerInterceptor +: public PortableInterceptor::ServerRequestInterceptor +{ + public: + ServerInterceptor (IOP::CodecFactory_var); + + ~ServerInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri); + + private: + const char *myname_; + IOP::Codec_var codec; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/IOR/run_test.pl b/DevGuideExamples/PortableInterceptors/IOR/run_test.pl new file mode 100755 index 00000000000..2b431dd59e6 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/IOR/run_test.pl @@ -0,0 +1,75 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +select undef, undef, undef, .5; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.cpp new file mode 100644 index 00000000000..2945d4b3816 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.cpp @@ -0,0 +1,57 @@ +// $Id$ + +#include "ClientInitializer.h" +#include "ClientInterceptor.h" +#include "MessengerC.h" +#include <iostream> + +ClientInitializer::ClientInitializer (void) + : slot_ (0), + current_ (PortableInterceptor::Current::_nil()) +{ +} + +void +ClientInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ClientInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info) +{ + // resolve Messenger object + CORBA::Object_var obj = info->resolve_initial_references( "Messenger" ); + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Not a Messenger reference" << std::endl; + ACE_ASSERT(false); + } + + // allocate slot + slot_ = info->allocate_slot_id(); + + // get PICurrent + CORBA::Object_var current_obj = info->resolve_initial_references("PICurrent"); + + current_ = + PortableInterceptor::Current::_narrow(current_obj.in()); + + // Create and register the request interceptors. + PortableInterceptor::ClientRequestInterceptor_var ci = + new ClientInterceptor(messenger, current_.in(), slot_); + info->add_client_request_interceptor (ci.in()); +} + +void +ClientInitializer::set_slot_data (void) +{ + // Set the recursion flag + CORBA::Any flag; + CORBA::Boolean x = false; + flag <<= CORBA::Any::from_boolean(x); + current_->set_slot(slot_, flag); + + // Now that we're done with the PICurrent, we will release + // our reference to it. + current_ = PortableInterceptor::Current::_nil(); +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.h b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.h new file mode 100644 index 00000000000..1bd687a032f --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInitializer.h @@ -0,0 +1,27 @@ +// $Id$ + +#ifndef CLIENTINITIALIZER_H +#define CLIENTINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" +#include "tao/PI/PICurrentC.h" + +class ClientInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ + public: + ClientInitializer (void); + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + void set_slot_data (void); + + private: + PortableInterceptor::SlotId slot_; + PortableInterceptor::Current_var current_; +}; + +#endif + diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.cpp new file mode 100644 index 00000000000..9b8850a173c --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.cpp @@ -0,0 +1,114 @@ +// $Id$ + +#include "ClientInterceptor.h" +#include "tao/OctetSeqC.h" +#include "tao/PI/ClientRequestInfo.h" +#include "MessengerC.h" +#include "ace/OS_NS_string.h" +#include <iostream> + +const CORBA::ULong service_ctx_id = 0xdeed; + +ClientInterceptor:: +ClientInterceptor (Messenger_var theMessenger, + PortableInterceptor::Current_ptr thePic, + PortableInterceptor::SlotId theSlot) + : myname_ ("Client_Authentication_Interceptor") +{ + std::cout << "Calling ClientInterceptor constructor." << std::endl; + this->messenger = theMessenger; + this->pic = thePic; + this->slot = theSlot; +} + +ClientInterceptor::~ClientInterceptor (void) +{ +} + +char * +ClientInterceptor::name () +{ + std::cout << "Calling ClientInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ClientInterceptor::destroy () +{ +} + +void +ClientInterceptor::send_poll (PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_poll()." << std::endl; +} + + +void +ClientInterceptor::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) +{ + std::cout << "Calling send_request()." << std::endl; + + IOP::ServiceContext sc; + sc.context_id = service_ctx_id; + + const char user_name[] = "Ron Klein"; + std::cout << "User's Name: " << user_name << std::endl; + CORBA::ULong string_len = sizeof (user_name) + 1; + CORBA::Octet *buf = 0; + buf = new CORBA::Octet [string_len]; + + ACE_OS::strcpy (reinterpret_cast<char*> (buf), user_name); + + sc.context_data.replace (string_len, string_len, buf, true); + + // recursive call setup + CORBA::Any *recurse = ri->get_slot(slot); + CORBA::Boolean x; + CORBA::Any flag; + if (*recurse >>= CORBA::Any::to_boolean(x)) { + if (x == false) + { + x = true; + flag <<= CORBA::Any::from_boolean(x); + + pic->set_slot(slot, flag); + + // get server time + std::cout << "Server Time = " << messenger->get_time() << std::endl; + } + } else { + std::cerr << "Could not extract a boolean value from any" << std::endl; + } + + // Add this context to the service context list. + ri->add_request_service_context (sc, false); + + // reset recursion test + x = false; + flag <<= CORBA::Any::from_boolean(x); + pic->set_slot(slot,flag); + +} + +void +ClientInterceptor::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_reply()." << std::endl; +} + +void +ClientInterceptor::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_other()." << std::endl; +} + +void +ClientInterceptor::receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_exception()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.h b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.h new file mode 100644 index 00000000000..15b0129df95 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ClientInterceptor.h @@ -0,0 +1,45 @@ +// $Id$ + +#ifndef CLIENTINTERCEPTOR_H +#define CLIENTINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/ClientRequestInterceptorA.h" +#include "tao/PI/PICurrentC.h" +#include "MessengerC.h" + +class ClientInterceptor: + public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ + + public: + ClientInterceptor (Messenger_var theMessage, + PortableInterceptor::Current_ptr thePic, + PortableInterceptor::SlotId theSlot); + + virtual ~ClientInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + + private: + const char *myname_; + Messenger_var messenger; + PortableInterceptor::Current_ptr pic; + PortableInterceptor::SlotId slot; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/Messenger.idl b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger.idl new file mode 100644 index 00000000000..4474bcc36f9 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger.idl @@ -0,0 +1,12 @@ +// $Id$ + +// messenger.idl + +interface Messenger + { + boolean send_message ( in string user_name, + in string subject, + inout string message ); + + string get_time (); + }; diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp new file mode 100644 index 00000000000..d5d6761f965 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp @@ -0,0 +1,85 @@ +// $Id$ + +#include "MessengerC.h" +#include "ClientInitializer.h" + +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI library is linked in when building statically +#include "tao/PI/PI.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + ClientInitializer* temp_initializer = new ClientInitializer; + + PortableInterceptor::ORBInitializer_var orb_initializer = + temp_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "Client ORB"); + + if (parse_args (argc, argv) != 0) + return 1; + // Now that the ORB is initialized (and subsequently the + // PICurrent), we can set the slot data on the PICurrent for our + // interceptor initializer. + temp_initializer->set_slot_data (); + + CORBA::Object_var obj = orb->string_to_object( ior ); + if ( CORBA::is_nil(obj.in() ) ) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + // Narrow + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Not a Messenger reference" << std::endl; + return 1; + } + + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "client Caught CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp new file mode 100644 index 00000000000..bcf37b51d37 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp @@ -0,0 +1,92 @@ +// $Id$ + +#include "Messenger_i.h" +#include "MessengerS.h" +#include "ServerInitializer.h" + +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI_Server library is linked in when building statically +#include "tao/PI_Server/PI_Server.h" +#include <iostream> +#include <fstream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ServerInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "Server ORB"); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to Root POA + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile ( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << std::endl << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "server Caught CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.cpp new file mode 100644 index 00000000000..c2f9473e3ef --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.cpp @@ -0,0 +1,51 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include "ace/OS_NS_time.h" +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1) +#include <iostream> +#else +#include <iostream.h> +#endif + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message) + +{ + //Add your implementation here + std::cerr << "Message from: " << user_name << std::endl; + std::cerr << "Subject: " << subject << std::endl; + std::cerr << "Message: " << message << std::endl; + return true; +} + +char * Messenger_i::get_time (void) +{ + time_t thetime; + struct tm * timeinfo = 0; + + ACE_OS::time(&thetime); + timeinfo = ACE_OS::localtime(&thetime); + char *timestring = CORBA::string_dup(ACE_OS::asctime(timeinfo)); + + return timestring; +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.h b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.h new file mode 100644 index 00000000000..c1f0e3daa84 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/Messenger_i.h @@ -0,0 +1,37 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message); + + virtual char * get_time (void); +}; + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/PICurrent.mpc b/DevGuideExamples/PortableInterceptors/PICurrent/PICurrent.mpc new file mode 100644 index 00000000000..6c9f86ccd66 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/PICurrent.mpc @@ -0,0 +1,40 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, pi_server { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + ServerInitializer.cpp + ServerInterceptor.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, interceptors { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + ClientInitializer.cpp + ClientInterceptor.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/README b/DevGuideExamples/PortableInterceptors/PICurrent/README new file mode 100644 index 00000000000..0f37fae7ad8 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/README @@ -0,0 +1,36 @@ +// $Id$ + +Portable Interceptors + + +File: DevGuideExamples/PortableInterceptor/PICurrent_NameService/README + + +This directory contains an example that shows how the PICurrent can +be used to stop client-side interceptor recursions. + +This example is based on the Messenger example in GettingStarted +directory. A message is send by MessengerClient and displayed by +MessengerServer. When the client receives a reply, it asks the server +for the current time. This causes a recursive call at the receive_reply() +interception point. A flag is passed in the PICurrent to let the client +know the call is recursive. + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + +To start the client: +------------------ +./MessengerClient -ORBInitRef Messenger=file://Messenger.ior + +Execuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.cpp new file mode 100644 index 00000000000..3408a7e5271 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.cpp @@ -0,0 +1,24 @@ +// $Id$ + +#include "ServerInitializer.h" +#include "ServerInterceptor.h" + +ServerInitializer::ServerInitializer () +{ +} + +void +ServerInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ServerInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + // Create and register the request interceptors. + PortableInterceptor::ServerRequestInterceptor_var si = + new ServerInterceptor(); + info->add_server_request_interceptor (si.in()); +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.h b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.h new file mode 100644 index 00000000000..bb8a55b1b8a --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInitializer.h @@ -0,0 +1,23 @@ +// $Id$ + +#ifndef SERVERINITIALIZER_H +#define SERVERINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI/PI.h" + +class ServerInitializer : +public virtual PortableInterceptor::ORBInitializer +{ + public: + ServerInitializer (); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + + private: + int interceptor_type_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.cpp b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.cpp new file mode 100644 index 00000000000..4a2caec4654 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.cpp @@ -0,0 +1,99 @@ +// $Id$ + +#include "ServerInterceptor.h" +#include "tao/PI_Server/ServerRequestInfoA.h" +#include "ace/OS_NS_string.h" +#include <iostream> + +const IOP::ServiceId service_id = 0xdeed; +const unsigned int num_allowed_users = 4; +static const char* allowed_users[num_allowed_users+1] = + {"Ron Klein", "Scott Case", "Mark Hodge", "Greg Black", 0}; +const char* restricted_interfaces[1] = {"IDL:Messenger:1.0"}; + +ServerInterceptor::ServerInterceptor (void) + : myname_ ("Server_Authentication_Interceptor") +{ + std::cout << "Calling ServerInterceptor constructor." << std::endl; +} + +ServerInterceptor::~ServerInterceptor () +{ +} + +char * +ServerInterceptor::name () +{ + std::cout << "Calling ServerInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ServerInterceptor::destroy () +{ + std::cout << "Calling destroy()." << std::endl; +} + +void +ServerInterceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_request_service_contexts()." << std::endl; +} + +void +ServerInterceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + bool permission_granted = false; + std::cout << "Calling receive_request()." << std::endl; + + if (ri->target_is_a(restricted_interfaces[0])){ + IOP::ServiceId id = service_id; + // Check that the request service context can be retrieved. + IOP::ServiceContext_var sc = + ri->get_request_service_context (id); + + CORBA::OctetSeq ocSeq = sc->context_data; + + const char * buf = + reinterpret_cast<const char *> (ocSeq.get_buffer ()); + + for (unsigned int i=0; i<num_allowed_users; ++i) { + if (ACE_OS::strcmp (buf, allowed_users[i]) == 0) + { + permission_granted = true; + } + } + } + + if (permission_granted == true) { + std::cout << "Permission Granted " << std::endl; + } + else { + std::cout << "Permission Denied " << std::endl;; + } +} + +void +ServerInterceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_reply()." << std::endl; +} + +void +ServerInterceptor::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_exception()." << std::endl; +} + +void +ServerInterceptor::send_other (PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_other()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.h b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.h new file mode 100644 index 00000000000..ca4732c5075 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/ServerInterceptor.h @@ -0,0 +1,36 @@ +// $Id$ + +#ifndef SERVERINTERCEPTOR_H +#define SERVERINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/ServerRequestInterceptorA.h" + +class ServerInterceptor +: public PortableInterceptor::ServerRequestInterceptor +{ + public: + ServerInterceptor (void); + + ~ServerInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri); + + private: + const char *myname_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl b/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl new file mode 100755 index 00000000000..186e6724704 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-ORBInitRef Messenger=file://$client_iorfile ". + "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +select undef, undef, undef, .5; +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.cpp new file mode 100644 index 00000000000..3df2ac79841 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.cpp @@ -0,0 +1,31 @@ +// $Id$ + +#include "ClientInitializer.h" +#include "ClientInterceptor.h" + +ClientInitializer::ClientInitializer (void) +{ +} + +void +ClientInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr + ) +{ +} + +void +ClientInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info + ) +{ + + // get Codec factory + IOP::CodecFactory_var codec_factory = info->codec_factory(); + + // Create and register the request interceptors. + PortableInterceptor::ClientRequestInterceptor_var ci = + new ClientInterceptor (codec_factory); + info->add_client_request_interceptor (ci.in()); +} + diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.h b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.h new file mode 100644 index 00000000000..0fab8bc1d3b --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInitializer.h @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef CLIENTINITIALIZER_H +#define CLIENTINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/PI.h" + +class ClientInitializer : + public virtual PortableInterceptor::ORBInitializer, + public virtual ::CORBA::LocalObject +{ + public: + ClientInitializer (void); + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); +}; + +#endif + diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.cpp new file mode 100644 index 00000000000..ce2a66ddb01 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.cpp @@ -0,0 +1,97 @@ +// $Id$ + +#include "ClientInterceptor.h" +#include "tao/OctetSeqC.h" +#include "tao/PI/ClientRequestInfo.h" +#include <iostream> + +const CORBA::ULong service_ctx_id = 0xdeed; + +ClientInterceptor:: +ClientInterceptor (IOP::CodecFactory_var cf) + : myname_ ("Client_Authentication_Interceptor") +{ + std::cout << "Calling ClientInterceptor constructor." << std::endl; + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + this->codec = cf->create_codec (encoding); + +} + +ClientInterceptor::~ClientInterceptor (void) +{ +} + +char * +ClientInterceptor::name () +{ + std::cout << "Calling ClientInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ClientInterceptor::destroy () +{ +} + +void +ClientInterceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_poll()." << std::endl; +} + + +void +ClientInterceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + std::cout << "Calling send_request()." << std::endl; + + IOP::ServiceContext sc; + sc.context_id = service_ctx_id; + + const CORBA::Long gid = 9007; + std::cout << "GID: " << gid << std::endl; + + CORBA::Any gid_as_any; + gid_as_any <<= gid; + + sc.context_data = *codec->encode(gid_as_any); + + // Add this context to the service context list. + ri->add_request_service_context (sc, false); + +} + +void +ClientInterceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_reply()." << std::endl; +} + +void +ClientInterceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_other()." << std::endl; +} + +void +ClientInterceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling receive_exception()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.h b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.h new file mode 100644 index 00000000000..4a68961eaa5 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ClientInterceptor.h @@ -0,0 +1,41 @@ +// $Id$ + +#ifndef CLIENTINTERCEPTOR_H +#define CLIENTINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/PI/ClientRequestInterceptorA.h" +#include "tao/PI/ORBInitInfo.h" + +class ClientInterceptor: + public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual ::CORBA::LocalObject +{ + + public: + ClientInterceptor (IOP::CodecFactory_var) ; + + virtual ~ClientInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri); + + private: + const char *myname_; + IOP::Codec_var codec; + +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger.idl b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger.idl new file mode 100644 index 00000000000..99713548b46 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger.idl @@ -0,0 +1,8 @@ +// $Id$ + +#include "orb.idl" + +interface Messenger +{ + void send_message(in CORBA::OctetSeq user_name); +}; diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp new file mode 100644 index 00000000000..b855692098c --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp @@ -0,0 +1,115 @@ +// $Id$ + +#include "MessengerC.h" +#include "ClientInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI library is linked in when building statically +#include "tao/PI/PI.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ClientInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Destringify ior + CORBA::Object_var obj = orb->string_to_object( ior ); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + // Narrow + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Argument is not a Messenger reference" << std::endl; + return 1; + } + + // Obtain a reference to the CodecFactory. + CORBA::Object_var obj2 = + orb->resolve_initial_references ("CodecFactory"); + + IOP::CodecFactory_var codec_factory; + + if(CORBA::is_nil(obj2.in())) + { + std::cerr << "Error: codec_factory" << std::endl; + ACE_OS::exit(1); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj2.in ()); + std::cout << "got codec factory" << std::endl; + } + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + IOP::Codec_var codec = + codec_factory->create_codec (encoding); + + CORBA::Long uid = 64321; + + CORBA::Any uid_as_any; + + uid_as_any <<= uid; + CORBA::OctetSeq client_uid = *codec->encode (uid_as_any); + messenger->send_message( client_uid ); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "Exception in MessengerClient: " << ex << std::endl; + return 1; + } + + std::cout << "Message was sent" << std::endl; + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp new file mode 100644 index 00000000000..56428bff073 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "Messenger_i.h" +#include "MessengerC.h" +#include "ServerInitializer.h" +#include "tao/ORBInitializer_Registry.h" +// Ensure that the PI_Server library is linked in when building statically +#include "tao/PI_Server/PI_Server.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + PortableInterceptor::ORBInitializer_var orb_initializer = + new ServerInitializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to Root POA + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) ); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + + catch(const CORBA::Exception& ex) + { + std::cerr << "Exception in MessengerServer: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.cpp new file mode 100644 index 00000000000..e95806dcf84 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.cpp @@ -0,0 +1,73 @@ +// $Id$ + +#include "Messenger_i.h" +#include "ace/OS_NS_string.h" +#include "tao/CodecFactory/CodecFactory.h" +#include <iostream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) +{ +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) +{ +} + +void Messenger_i::send_message (const CORBA::OctetSeq & user_name) +{ + try + { + int argc = 1; + char **argv = new char *[argc]; + argv[0] = new char[ACE_OS::strlen ("MessengerServer")]; + ACE_OS::strcpy (argv[0], "MessengerServer"); + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + // Obtain a reference to the CodecFactory. + CORBA::Object_var obj = + orb->resolve_initial_references ("CodecFactory"); + + IOP::CodecFactory_var codec_factory; + + if(CORBA::is_nil(obj.in())) + { + std::cerr << "Error: codec_factory" << std::endl; + ACE_OS::exit(1); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj.in ()); + std::cout << "Server got codec factory" << std::endl; + } + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + IOP::Codec_var codec = + codec_factory->create_codec (encoding); + + CORBA::Any uid_as_any; + uid_as_any = *(codec->decode(user_name)); + + CORBA::Long uid; + if (uid_as_any >>= uid) { + std::cout << "UID: " << uid << std::endl; + } else { + std::cerr << "Could not extract UID from any." << std::endl; + } + + } + catch(...) + { + std::cerr << "exception received" << std::endl; + ACE_OS::exit(1); + } +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.h b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.h new file mode 100644 index 00000000000..5fba8b25c10 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/Messenger_i.h @@ -0,0 +1,27 @@ +// $Id$ + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ + public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + + + virtual void send_message (const CORBA::OctetSeq & user_name); + +}; + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/README b/DevGuideExamples/PortableInterceptors/SimpleCodec/README new file mode 100644 index 00000000000..2f7dd7295c5 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/README @@ -0,0 +1,38 @@ +// $Id$ + +Portable Interceptors + + +File: DevGuideExamples/PortableInterceptor/SimpleCodec/README + + +This directory contains an example illustrating marshaling of data in +client and server Request Interceptors. + +This example extends the authentication example in ../Auth. It is based on +the Messenger example in GettingStarted directory. A message is +sent by MessengerClient and displayed by MessengerServer. A client-side +portable interceptor adds an encoded (marshaled) GID to each request +sent to the server. A server-side interceptor verifies that the supplied +GID is valid. + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient + + +Execution via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.cpp new file mode 100644 index 00000000000..6096a11c6e9 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.cpp @@ -0,0 +1,27 @@ +// $Id$ + +#include "ServerInitializer.h" +#include "ServerInterceptor.h" + +ServerInitializer::ServerInitializer () +{ +} + +void +ServerInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +ServerInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + // get reference to the codec_factory + IOP::CodecFactory_var codec_factory = info->codec_factory(); + + // Create and register the request interceptors. + PortableInterceptor::ServerRequestInterceptor_var si = + new ServerInterceptor (codec_factory); + info->add_server_request_interceptor (si.in()); +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.h b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.h new file mode 100644 index 00000000000..bb8a55b1b8a --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInitializer.h @@ -0,0 +1,23 @@ +// $Id$ + +#ifndef SERVERINITIALIZER_H +#define SERVERINITIALIZER_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI/PI.h" + +class ServerInitializer : +public virtual PortableInterceptor::ORBInitializer +{ + public: + ServerInitializer (); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + + private: + int interceptor_type_; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.cpp b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.cpp new file mode 100644 index 00000000000..bb113f93d2c --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.cpp @@ -0,0 +1,119 @@ +// $Id$ + +#include "ServerInterceptor.h" +#include "tao/PI_Server/ServerRequestInfoA.h" +#include "tao/OctetSeqC.h" +#include <iostream> + +const IOP::ServiceId service_id = 0xdeed; +const CORBA::Long allowed_gid[4] = { 9006, 9007, 9008 }; +const char* restricted_interfaces[1] = {"IDL:Messenger:1.0"}; + +ServerInterceptor::ServerInterceptor (IOP::CodecFactory_var cf) + : myname_ ("Server_Authentication_Interceptor") +{ + std::cout << "Calling ServerInterceptor constructor." << std::endl; + + // Set up a structure that contains information necessary to + // create a GIOP 1.2 CDR encapsulation Codec. + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + // Obtain the CDR encapsulation Codec. + this->codec = cf->create_codec (encoding); + +} + +ServerInterceptor::~ServerInterceptor () +{ +} + +char * +ServerInterceptor::name () +{ + std::cout << "Calling ServerInterceptor name() method" << std::endl; + return CORBA::string_dup (this->myname_); +} + +void +ServerInterceptor::destroy () +{ + std::cout << "Calling destroy()." << std::endl; +} + +void +ServerInterceptor::receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr) +{ + std::cout << "Calling receive_request_service_contexts()." << std::endl; +} + +void +ServerInterceptor::receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + bool permission_granted = false; + std::cout << "Calling receive_request()." << std::endl; + + if (ri->target_is_a(restricted_interfaces[0])){ + IOP::ServiceId id = service_id; + // Check that the request service context can be retrieved. + IOP::ServiceContext_var sc = + ri->get_request_service_context (id); + // need to construct an octet seq for decoding + CORBA::OctetSeq ocSeq = CORBA::OctetSeq( + sc->context_data.length(), + sc->context_data.length(), + sc->context_data.get_buffer(), + false); + + CORBA::Any gid_as_any; + gid_as_any = *codec->decode(ocSeq); + + CORBA::Long gid; + if (gid_as_any >>= gid) { + for (int i=0; i<3; ++i) { + if ( gid == allowed_gid[i] ) + { + permission_granted = true; + } + } + } else { + permission_granted = false; + std::cerr << "Could not extract GID from any." << std::endl; + } + } + + if (permission_granted == true) { + std::cout << "Permission Granted " << std::endl; + } + else { + std::cout << "Permission Denied " << std::endl;; + } +} + +void +ServerInterceptor::send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_reply()." << std::endl; +} + +void +ServerInterceptor::send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_exception()." << std::endl; +} + +void +ServerInterceptor::send_other ( + PortableInterceptor::ServerRequestInfo_ptr ri) +{ + ACE_UNUSED_ARG(ri); + std::cout << "Calling send_other()." << std::endl; +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.h b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.h new file mode 100644 index 00000000000..4ccc5ddf3ab --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/ServerInterceptor.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef SERVERINTERCEPTOR_H +#define SERVERINTERCEPTOR_H + +#include "tao/PortableInterceptorC.h" +#include "tao/PI_Server/ServerRequestInterceptorA.h" +#include "tao/PI/ORBInitInfo.h" + +class ServerInterceptor +: public PortableInterceptor::ServerRequestInterceptor +{ + public: + ServerInterceptor (IOP::CodecFactory_var); + + ~ServerInterceptor (); + + virtual char * name (); + + virtual void destroy (); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void receive_request_service_contexts ( + PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri); + + virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri); + + private: + const char *myname_; + IOP::Codec_var codec; +}; + +#endif diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/SimpleCode.mpc b/DevGuideExamples/PortableInterceptors/SimpleCodec/SimpleCode.mpc new file mode 100644 index 00000000000..654ada76322 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/SimpleCode.mpc @@ -0,0 +1,40 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): taoserver, pi_server, avoids_minimum_corba { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + ServerInitializer.cpp + ServerInterceptor.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, pi, avoids_minimum_corba, interceptors { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + ClientInitializer.cpp + ClientInterceptor.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl b/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl new file mode 100755 index 00000000000..5c168220043 --- /dev/null +++ b/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl @@ -0,0 +1,76 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +select undef, undef, undef, .5; + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/RTCORBA/Messenger.idl b/DevGuideExamples/RTCORBA/Messenger.idl new file mode 100644 index 00000000000..e7cc8a268d0 --- /dev/null +++ b/DevGuideExamples/RTCORBA/Messenger.idl @@ -0,0 +1,11 @@ +// $Id$ + +// messenger.idl + +interface Messenger +{ + boolean send_message (in string user_name, + in string subject, + inout string message); +}; + diff --git a/DevGuideExamples/RTCORBA/MessengerClient.cpp b/DevGuideExamples/RTCORBA/MessengerClient.cpp new file mode 100644 index 00000000000..e1df21b61ef --- /dev/null +++ b/DevGuideExamples/RTCORBA/MessengerClient.cpp @@ -0,0 +1,122 @@ +// $Id$ + +#include "MessengerC.h" +#include "common.h" +#include <iostream> +#include "tao/RTCORBA/RTCORBA.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_file = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get the RTORB + CORBA::Object_var obj = orb->resolve_initial_references("RTORB"); + RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (obj.in()); + + // PolicyCurrent. + obj = orb->resolve_initial_references("PolicyCurrent"); + CORBA::PolicyCurrent_var policy_current = + CORBA::PolicyCurrent::_narrow(obj.in()); + if (CORBA::is_nil(policy_current.in())) { + std::cerr << "Unable to narrow the PolicyCurrent" << std::endl; + return 1; + } + + // Destringify ior + obj = orb->string_to_object(ior_file); + if( CORBA::is_nil( obj.in() ) ) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + // Narrow + Messenger_var messenger = Messenger::_narrow( obj.in() ); + if( CORBA::is_nil( messenger.in() ) ) { + std::cerr << "Argument is not a Messenger reference" << std::endl; + return 1; + } + + // Set the Private Connection Policy + CORBA::PolicyList policy_list(1); + policy_list.length (1); + policy_list[0] = rt_orb->create_private_connection_policy(); + policy_current->set_policy_overrides (policy_list, + CORBA::SET_OVERRIDE); + + // Get the RTCurrent. + obj = orb->resolve_initial_references ("RTCurrent"); + RTCORBA::Current_var current = + RTCORBA::Current::_narrow(obj.in ()); + + // Change to a priority that matches the server + current->the_priority(0); + + // Explicitly bind a connection to the server + CORBA::PolicyList_var inconsistent_policies; + CORBA::Boolean status = + messenger->_validate_connection(inconsistent_policies.out()); + if (!status) { + std::cerr << "Unable to explicitly bind to the server" << std::endl; + return 1; + } + + static const CORBA::Short increment = get_increment(); + for(CORBA::ULong i = 0; i < get_total_lanes(); i++) { + + // Set the priority to one that matches one of the lanes + CORBA::Short priority = i * increment; + current->the_priority(priority); + + // Send the message + CORBA::String_var message = CORBA::string_dup( "Hello!" ); + messenger->send_message( "TAO User", "TAO Test", message.inout() ); + } + } + catch(const CORBA::Exception& ex) { + std::cerr << "MessengerClient caught CORBA exception: " << ex << std::endl; + return 1; + } + catch(...) { + std::cerr << "MessengerClient exception" << std::endl; + return 1; + } + + std::cout << "messages were sent" << std::endl; + return 0; +} diff --git a/DevGuideExamples/RTCORBA/MessengerServer.cpp b/DevGuideExamples/RTCORBA/MessengerServer.cpp new file mode 100644 index 00000000000..e5e97679b4a --- /dev/null +++ b/DevGuideExamples/RTCORBA/MessengerServer.cpp @@ -0,0 +1,131 @@ +// $Id$ + +#include "Messenger_i.h" +#include "common.h" +#include <iostream> +#include <fstream> +#include <fstream> +#include "tao/RTCORBA/RTCORBA.h" +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get the RTORB. + CORBA::Object_var obj = orb->resolve_initial_references("RTORB"); + RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow(obj.in()); + + // PolicyCurrent. + obj = orb->resolve_initial_references("PolicyCurrent"); + CORBA::PolicyCurrent_var policy_current = + CORBA::PolicyCurrent::_narrow(obj.in()); + if (CORBA::is_nil(policy_current.in())) { + std::cerr << "Unable to narrow the PolicyCurrent" << std::endl; + return 1; + } + + //Get reference to Root POA + obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create the thread-pool + const CORBA::Short increment = get_increment(); + RTCORBA::ThreadpoolLanes lanes(get_total_lanes()); + lanes.length(get_total_lanes()); + std::cout << "Creating " << get_total_lanes() << " lane" + << (get_total_lanes() == 1 ? "" : "s") << std::endl; + for(CORBA::ULong i = 0; i < get_total_lanes(); i++) { + lanes[i].static_threads = 1; + lanes[i].dynamic_threads = 0; + + lanes[i].lane_priority = i * increment; + std::cout << " Priority: " << lanes[i].lane_priority << std::endl; + } + + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool_with_lanes (0, // Stack Size + lanes, + false, // Allow borrowing + false, // Allow request buffering + 0, // Max buffered requests + 0); // Max request buffer size + + CORBA::PolicyList poa_policy_list(2); + poa_policy_list.length (2); + + poa_policy_list[0] = + rt_orb->create_priority_model_policy(RTCORBA::CLIENT_PROPAGATED, 0); + poa_policy_list[1] = + rt_orb->create_threadpool_policy(threadpool_id); + + PortableServer::POA_var client_propagated_poa = + poa->create_POA ("client_propagated_poa", + mgr.in (), + poa_policy_list); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant + = new Messenger_i(orb.in()); + + // Register the servant with the RootPOA, obtain its object + // reference, stringify it, and write it to a file. + PortableServer::ObjectId_var oid = + client_propagated_poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = + client_propagated_poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/RTCORBA/Messenger_i.cpp b/DevGuideExamples/RTCORBA/Messenger_i.cpp new file mode 100644 index 00000000000..2f66e7d7fd5 --- /dev/null +++ b/DevGuideExamples/RTCORBA/Messenger_i.cpp @@ -0,0 +1,39 @@ +// $Id$ + +#include "Messenger_i.h" +#include "ace/Thread.h" +#include <iostream> + +// Implementation skeleton constructor +Messenger_i::Messenger_i(CORBA::ORB_ptr orb) +{ + CORBA::Object_var obj = orb->resolve_initial_references("RTCurrent"); + rt_current_ = RTCORBA::Current::_narrow(obj.in()); +} + +// Implementation skeleton destructor +Messenger_i::~Messenger_i() +{ +} + +CORBA::Boolean +Messenger_i::send_message (const char* user_name, + const char* subject, + char*& message) +{ + CORBA::Short priority = rt_current_->the_priority(); + + ACE_hthread_t current; + ACE_Thread::self (current); + int native_priority; + + std::cout << "Message from: " << user_name << std::endl + << "Subject: " << subject << std::endl + << "CORBA Priority: " << priority << std::endl; + if (ACE_Thread::getprio (current, native_priority) != -1) { + std::cout << "Native Priority: " << native_priority << std::endl; + } + std::cout << "Message: " << message << std::endl << std::endl; + return true; +} + diff --git a/DevGuideExamples/RTCORBA/Messenger_i.h b/DevGuideExamples/RTCORBA/Messenger_i.h new file mode 100644 index 00000000000..7e844371990 --- /dev/null +++ b/DevGuideExamples/RTCORBA/Messenger_i.h @@ -0,0 +1,40 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/RTCORBA/RTCORBA.h" + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i(CORBA::ORB_ptr orb); + + //Destructor + virtual ~Messenger_i(); + + virtual CORBA::Boolean send_message(const char* user_name, + const char* subject, + char*& message); + +private: + RTCORBA::Current_var rt_current_; +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/RTCORBA/README b/DevGuideExamples/RTCORBA/README new file mode 100644 index 00000000000..38bc8e96a2f --- /dev/null +++ b/DevGuideExamples/RTCORBA/README @@ -0,0 +1,19 @@ +// $Id$ + +DevGuideExamples/RTCORBA/README + +This directory contains an RTCORBA example illustrating a simple client and +a server with a Interface Messenger. The Messenger Interface has +an operation for sending a message (send_message). + +How to Run +---------- + +To start the server: +------------------ +./MessengerServer + + +To start the client: +------------------ +./MessengerClient diff --git a/DevGuideExamples/RTCORBA/RTCORBA.mpc b/DevGuideExamples/RTCORBA/RTCORBA.mpc new file mode 100644 index 00000000000..55ae18affc1 --- /dev/null +++ b/DevGuideExamples/RTCORBA/RTCORBA.mpc @@ -0,0 +1,40 @@ +// $Id$ + +project(*idl): taoidldefaults { + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*Server): rt_server { + exename = MessengerServer + after += *idl + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + common.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + + +project(*Client): rt_client { + exename = MessengerClient + after += *idl + Source_Files { + MessengerClient.cpp + common.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} + diff --git a/DevGuideExamples/RTCORBA/common.cpp b/DevGuideExamples/RTCORBA/common.cpp new file mode 100644 index 00000000000..cece2ceefd9 --- /dev/null +++ b/DevGuideExamples/RTCORBA/common.cpp @@ -0,0 +1,22 @@ +// $Id$ + +#include "common.h" + +CORBA::ULong +get_total_lanes() +{ +#if defined (linux) + return 1; +#elif defined (ACE_CONFIG_WIN32_H) + return 3; +#else + return 5; +#endif +} + +CORBA::Short +get_increment() +{ + return 1; +} + diff --git a/DevGuideExamples/RTCORBA/common.h b/DevGuideExamples/RTCORBA/common.h new file mode 100644 index 00000000000..4fb308cb437 --- /dev/null +++ b/DevGuideExamples/RTCORBA/common.h @@ -0,0 +1,11 @@ +// $Id$ + +#ifndef MESSENGER_COMMON_H +#define MESSENGER_COMMON_H + +#include "tao/corba.h" + +CORBA::ULong get_total_lanes(); +CORBA::Short get_increment(); + +#endif /* MESSENGER_COMMON_H */ diff --git a/DevGuideExamples/RTCORBA/run_test.pl b/DevGuideExamples/RTCORBA/run_test.pl new file mode 100755 index 00000000000..09f2c3c47ec --- /dev/null +++ b/DevGuideExamples/RTCORBA/run_test.pl @@ -0,0 +1,74 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "Messenger.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/RTCORBA/svc.conf b/DevGuideExamples/RTCORBA/svc.conf new file mode 100644 index 00000000000..511f7c4974e --- /dev/null +++ b/DevGuideExamples/RTCORBA/svc.conf @@ -0,0 +1,3 @@ +# This is more portable across multiple systems + +static RT_ORB_Loader "-ORBPriorityMapping continuous" diff --git a/DevGuideExamples/SmartProxies/Logger.idl b/DevGuideExamples/SmartProxies/Logger.idl new file mode 100644 index 00000000000..b800e926afc --- /dev/null +++ b/DevGuideExamples/SmartProxies/Logger.idl @@ -0,0 +1,8 @@ +// $Id$ + +// Logger.idl + +interface Logger +{ + boolean log_message(in string message); +}; diff --git a/DevGuideExamples/SmartProxies/LoggerServer.cpp b/DevGuideExamples/SmartProxies/LoggerServer.cpp new file mode 100644 index 00000000000..d29453ef576 --- /dev/null +++ b/DevGuideExamples/SmartProxies/LoggerServer.cpp @@ -0,0 +1,80 @@ +// $Id$ + +// LoggerServer.cpp + +#include "Logger_i.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Logger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv []) +{ + try { + // Initialize the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Get a reference to Root POA. + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + // Activate the POA manager. + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create a Logger_i servant. + PortableServer::Servant_var<Logger_i> logger_servant = new Logger_i; + + // Register the servant with the RootPOA, obtain its object reference, + // stringify it, and write it to a file. + PortableServer::ObjectId_var oid = poa->activate_object(logger_servant.in()); + CORBA::Object_var logger_obj = poa->id_to_reference(oid.in()); + CORBA::String_var str = orb->object_to_string(logger_obj.in()); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests from clients. + orb->run(); + + // Release resources. + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA exception:" << ex << std::endl; + return 1; + } + return 0; +} diff --git a/DevGuideExamples/SmartProxies/Logger_i.cpp b/DevGuideExamples/SmartProxies/Logger_i.cpp new file mode 100644 index 00000000000..88b4c38bf35 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Logger_i.cpp @@ -0,0 +1,27 @@ +// $Id$ + +#include "Logger_i.h" +#include "ace/OS_NS_time.h" +#include <iostream> + +Logger_i::Logger_i (void) +{ + log_file.open("Logger.txt"); +} + +Logger_i::~Logger_i (void) +{ + log_file.close(); +} + +CORBA::Boolean Logger_i::log_message (const char * message) +{ + ACE_OS::time(&log_time); + log_time_string = ACE_OS::ctime(&log_time); + // Replace carriage return with string delimiter. + log_time_string[24] = '\0'; + log_file << ACE_TEXT_ALWAYS_CHAR(log_time_string.c_str()) << " " + << message << std::endl; + return true; +} + diff --git a/DevGuideExamples/SmartProxies/Logger_i.h b/DevGuideExamples/SmartProxies/Logger_i.h new file mode 100644 index 00000000000..4a4c9c4e612 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Logger_i.h @@ -0,0 +1,27 @@ +// $Id$ + +#ifndef LOGGERI_H_ +#define LOGGERI_H_ + +#include "LoggerS.h" +#include "ace/String_Base.h" +#include <fstream> + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Logger_i : public virtual POA_Logger +{ +public: + Logger_i (void); + virtual ~Logger_i (void); +private: + ofstream log_file; // Output file stream to which messages are logged. + time_t log_time; // Needed for creating a time stamp. + ACE_TString log_time_string; // The time stamp string. + +virtual CORBA::Boolean log_message (const char * message); +}; +#endif /* LOGGERI_H_ */ + diff --git a/DevGuideExamples/SmartProxies/Messenger.idl b/DevGuideExamples/SmartProxies/Messenger.idl new file mode 100644 index 00000000000..0af8b9e9c0f --- /dev/null +++ b/DevGuideExamples/SmartProxies/Messenger.idl @@ -0,0 +1,11 @@ +// $Id$ + +// messenger.idl + +interface Messenger + { + boolean send_message ( in string user_name, + in string subject, + inout string message ); + }; + diff --git a/DevGuideExamples/SmartProxies/MessengerClient.cpp b/DevGuideExamples/SmartProxies/MessengerClient.cpp new file mode 100644 index 00000000000..add68848b60 --- /dev/null +++ b/DevGuideExamples/SmartProxies/MessengerClient.cpp @@ -0,0 +1,83 @@ +// $Id$ + +#include "MessengerC.h" +#include "Smart_Messenger_Proxy.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) +{ + try { + // Initialize the ORB + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + // Create a smart proxy factory. It will register itself with the + // smart proxy factory adapter so it can be used to create + // Messenger proxies. It must be created on the heap, but is + // otherwise unused here. + new Smart_Messenger_Proxy_Factory(orb.in()); + + // Convert the contents of the Messenger.ior file to an object reference. + CORBA::Object_var obj = orb->string_to_object(ior); + if (CORBA::is_nil(obj.in())) { + std::cerr << "Nil Messenger reference" << std::endl; + return 1; + } + + // Narrow the object reference to a Messenger object reference. + Messenger_var messenger = Messenger::_narrow(obj.in()); + if (CORBA::is_nil(messenger.in())) { + std::cerr << "Not a Messenger object reference" << std::endl; + return 1; + } + + // Create a message and send it to the Messenger. + CORBA::String_var message = CORBA::string_dup("Hello!"); + messenger->send_message ("TAO User", "TAO Test", message.inout()); + std::cout << "Message was sent" << std::endl; + + // Release resources. + orb->destroy(); + } + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA exception: " << ex << std::endl; + return 1; + } + catch(...) { + std::cerr << "Caught an unknown exception type" << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/SmartProxies/MessengerServer.cpp b/DevGuideExamples/SmartProxies/MessengerServer.cpp new file mode 100644 index 00000000000..5e0fc0b2cbb --- /dev/null +++ b/DevGuideExamples/SmartProxies/MessengerServer.cpp @@ -0,0 +1,78 @@ +// $Id$ + +#include "Messenger_i.h" +#include <iostream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + + if (parse_args (argc, argv) != 0) + return 1; + + //Get reference to Root POA + CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); + PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() ); + + // Activate POA Manager + PortableServer::POAManager_var mgr = poa->the_POAManager(); + mgr->activate(); + + // Create an object + PortableServer::Servant_var<Messenger_i> messenger_servant = new Messenger_i; + + // Write its strigified reference to a file + PortableServer::ObjectId_var oid = + poa->activate_object( messenger_servant.in() ); + CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); + CORBA::String_var str = orb->object_to_string( messenger_obj.in() ); + std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + iorFile << str.in() << std::endl; + iorFile.close(); + std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl; + + // Accept requests + orb->run(); + orb->destroy(); + } + + catch(const CORBA::Exception& ex) { + std::cerr << "Caught a CORBA exception: " << ex << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/SmartProxies/Messenger_i.cpp b/DevGuideExamples/SmartProxies/Messenger_i.cpp new file mode 100644 index 00000000000..647e169df59 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Messenger_i.cpp @@ -0,0 +1,34 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "Messenger_i.h" +#include <iostream> +// Implementation skeleton constructor +Messenger_i::Messenger_i (void) + { + } + +// Implementation skeleton destructor +Messenger_i::~Messenger_i (void) + { + } + +CORBA::Boolean Messenger_i::send_message ( + const char * user_name, + const char * subject, + char *& message + ) +{ + //Add your implementation here + std::cerr << "Message from: " << user_name << std::endl; + std::cerr << "Subject: " << subject << std::endl; + std::cerr << "Message: " << message << std::endl; + return true; +} + diff --git a/DevGuideExamples/SmartProxies/Messenger_i.h b/DevGuideExamples/SmartProxies/Messenger_i.h new file mode 100644 index 00000000000..bab46846988 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Messenger_i.h @@ -0,0 +1,37 @@ +/* -*- C++ -*- $Id$ */ + +// ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//Class Messenger_i +class Messenger_i : public virtual POA_Messenger +{ +public: + //Constructor + Messenger_i (void); + + //Destructor + virtual ~Messenger_i (void); + +virtual CORBA::Boolean send_message ( + const char * user_name, + const char * subject, + char *& message + ); +}; + + +#endif /* MESSENGERI_H_ */ diff --git a/DevGuideExamples/SmartProxies/README b/DevGuideExamples/SmartProxies/README new file mode 100644 index 00000000000..4e6bf55cdcd --- /dev/null +++ b/DevGuideExamples/SmartProxies/README @@ -0,0 +1,26 @@ +// $Id$ + +DevGuideExamples/SmartProxies/README + +The example in this directory extends the Messenger example in +GettingStarted directory to use the Smart Proxy feature in TAO. + +A new Interface, Logger which supports an operation to log the messages +(log_message) is used to log the information about the use of the +Messenger. + +How to Run +---------- + +To start the logger server: +--------------------------- +./LoggerServer + +To start the messenger server: +----------------------------- +./MessengerServer + + +To start the messenger client: +----------------------------- +./MessengerClient diff --git a/DevGuideExamples/SmartProxies/SmartProxies.mpc b/DevGuideExamples/SmartProxies/SmartProxies.mpc new file mode 100644 index 00000000000..205a6bd1b4f --- /dev/null +++ b/DevGuideExamples/SmartProxies/SmartProxies.mpc @@ -0,0 +1,44 @@ +// $Id$ + +// The server doesn't use Smart Proxies, but since the client +// shares the idl generated source files, it needs to have the +// -Gsp option added to the tao_idl flags. +project(*Server): messaging, taoexe, portableserver, smart_proxies { + IDL_Files { + Messenger.idl + } + + Source_Files { + MessengerC.cpp + MessengerS.cpp + Messenger_i.cpp + MessengerServer.cpp + } +} + +project(*Client): taoexe, messaging, smart_proxies { + after += *Server *Logger + + IDL_Files { + } + + Source_Files { + LoggerC.cpp + MessengerC.cpp + MessengerClient.cpp + Smart_Messenger_Proxy.cpp + } +} + +project(*Logger): taoexe, portableserver { + IDL_Files { + Logger.idl + } + + Source_Files { + LoggerC.cpp + LoggerS.cpp + Logger_i.cpp + LoggerServer.cpp + } +} diff --git a/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.cpp b/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.cpp new file mode 100644 index 00000000000..4322b6397a4 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.cpp @@ -0,0 +1,59 @@ +// $Id$ + +// Smart_Messenger_Proxy.cpp + +#include "Smart_Messenger_Proxy.h" +#include <iostream> + +Smart_Messenger_Proxy_Factory::Smart_Messenger_Proxy_Factory( + CORBA::ORB_ptr orb) +{ + std::cout << "Creating smart proxy factory" << std::endl; + // Convert the contents of the Logger.ior file to an object reference. + CORBA::Object_var obj = orb->string_to_object("file://Logger.ior"); + if (CORBA::is_nil(obj.in())) { + std::cerr << "Nil Logger reference" << std::endl; + throw 0; + } + + // Narrow the object reference to a Logger object reference. + logger_ = Logger::_narrow(obj.in()); + if (CORBA::is_nil(logger_.in ())) { + std::cerr << "Not a Logger object reference" << std::endl; + throw 0; + } +} + +Messenger_ptr +Smart_Messenger_Proxy_Factory::create_proxy ( + Messenger_ptr proxy) +{ + + Messenger_ptr smart_proxy = 0; + if (CORBA::is_nil(proxy) == 0) + smart_proxy = new Smart_Messenger_Proxy(proxy, logger_.in()); + return smart_proxy; +} + + +Smart_Messenger_Proxy::Smart_Messenger_Proxy( + Messenger_ptr proxy, Logger_ptr logger) + : TAO_Smart_Proxy_Base(proxy), + logger_(Logger::_duplicate(logger)) +{ + std::cout << "Creating smart proxy" << std::endl; +} + +CORBA::Boolean +Smart_Messenger_Proxy::send_message ( + const char * user_name, + const char * subject, + char *& message) +{ + logger_->log_message("Before send_message()"); + CORBA::Boolean ret_val = + TAO_Messenger_Smart_Proxy_Base::send_message(user_name, subject, message); + logger_->log_message("After send_message()"); + return ret_val; +} + diff --git a/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.h b/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.h new file mode 100644 index 00000000000..6183c4bd0b0 --- /dev/null +++ b/DevGuideExamples/SmartProxies/Smart_Messenger_Proxy.h @@ -0,0 +1,31 @@ +// $Id$ + +// Smart_Messenger_Proxy.h + + +#include "MessengerC.h" +#include "LoggerC.h" + +class Smart_Messenger_Proxy_Factory : public TAO_Messenger_Default_Proxy_Factory +{ + public: + Smart_Messenger_Proxy_Factory(CORBA::ORB_ptr orb); + virtual Messenger_ptr create_proxy ( + Messenger_ptr proxy); + private: + Logger_var logger_; +}; + + +class Smart_Messenger_Proxy : public TAO_Messenger_Smart_Proxy_Base +{ + public: + Smart_Messenger_Proxy(Messenger_ptr proxy, Logger_ptr logger); + virtual CORBA::Boolean send_message( + const char * user_name, + const char * subject, + char *& message); + private: + Logger_var logger_; +}; + diff --git a/DevGuideExamples/SmartProxies/run_test.pl b/DevGuideExamples/SmartProxies/run_test.pl new file mode 100755 index 00000000000..e83e2e21d0d --- /dev/null +++ b/DevGuideExamples/SmartProxies/run_test.pl @@ -0,0 +1,105 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; +my $logger = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n"; + +my $iorbase = "Messenger.ior"; +my $iorlogger = "Logger.ior"; + +my $server_iorfile_base = $server->LocalFile ($iorbase); +my $client_iorfile_base = $client->LocalFile ($iorbase); +my $logger_iorfile_logger = $logger->LocalFile ($iorlogger); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +$logger->DeleteFile($iorlogger); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + "-o $server_iorfile_base"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile_base"); +$LR = $logger->CreateProcess ("LoggerServer", "-ORBdebuglevel $debug_level ". + "-o $logger_iorfile_logger"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile_base>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile_base>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile_base>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$logger_status = $LR->Spawn (); + +if ($logger_status != 0) { + print STDERR "ERROR: logger returned $logger_status\n"; + exit 1; +} + +if ($logger->WaitForFileTimed ($iorlogger, + $logger->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$logger_iorfile_logger>\n"; + $LR->Kill (); $LR->TimedWait (1); + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$logger_status = $LR->Kill (); + +if ($logger_status != 0) { + print STDERR "ERROR: logger returned $logger_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +$logger->DeleteFile($iorlogger); + +exit $status; diff --git a/DevGuideExamples/ValueTypes/Bank/README b/DevGuideExamples/ValueTypes/Bank/README new file mode 100644 index 00000000000..8078ebe21e1 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/README @@ -0,0 +1,37 @@ +// $Id$ + +A simple example using valuetypes. + + +How to Run +---------- + +Start the server : +------------------ +./server + + +Start the client: +------------------ +./client + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/ValueTypes/Bank/_pch.cpp b/DevGuideExamples/ValueTypes/Bank/_pch.cpp new file mode 100644 index 00000000000..4faf7a61ecc --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "_pch.h" diff --git a/DevGuideExamples/ValueTypes/Bank/_pch.h b/DevGuideExamples/ValueTypes/Bank/_pch.h new file mode 100644 index 00000000000..fe6d2628083 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/_pch.h @@ -0,0 +1,12 @@ +// $Id$ + +#ifndef PCH_H +#define PCH_H + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/ValueTypes/Bank/bank.idl b/DevGuideExamples/ValueTypes/Bank/bank.idl new file mode 100644 index 00000000000..9a122a1695b --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/bank.idl @@ -0,0 +1,15 @@ +// $Id$ + +valuetype Person { + + public string name; + public long balance; + + factory create(in string name); + + void debit(in long amt); +}; + +interface Transaction { + long update(in Person p); +}; diff --git a/DevGuideExamples/ValueTypes/Bank/bank.mpc b/DevGuideExamples/ValueTypes/Bank/bank.mpc new file mode 100644 index 00000000000..ac5592f62d6 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/bank.mpc @@ -0,0 +1,34 @@ +// $Id$ + +project(*Dev_Bank_idl): taoidldefaults, valuetype { + idlflags += -Wb,pch_include=_pch.h + IDL_Files { + bank.idl + } + custom_only = 1 +} + +project(*_Dev_Server): taoserver, valuetype, avoids_minimum_corba { + after += *Dev_Bank_idl + Source_Files { + server.cpp + } + Source_Files { + bankC.cpp + bankS.cpp + } + IDL_Files { + } +} + +project(*_Dev_Client): taoclient, valuetype, avoids_minimum_corba { + after += *Dev_Bank_idl + Source_Files { + client.cpp + } + Source_Files { + bankC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/ValueTypes/Bank/client.cpp b/DevGuideExamples/ValueTypes/Bank/client.cpp new file mode 100644 index 00000000000..9004be236a5 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/client.cpp @@ -0,0 +1,97 @@ +// $Id$ + +#include "_pch.h" + +#include "bankC.h" + +#include <iostream> +#include <stdexcept> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://server.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +// Note : We use a completely different implementation +// of the Person valuetype for the client side, just to +// show that this is possible. +class Person_i + : public virtual OBV_Person + , public virtual CORBA::DefaultValueRefCountBase +{ +public: + Person_i(const char* n, CORBA::Long bal) + { + name(n); + balance(bal); + } +private: + void debit(CORBA::Long) + { + throw std::runtime_error("Not supported."); + } +}; + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { + + try { + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var obj = orb->string_to_object(ior); + Transaction_var trans = Transaction::_narrow(obj.in()); + if (CORBA::is_nil(trans.in())) + throw std::runtime_error("failed to find a valid Transaction IOR"); + + Person_var p = new Person_i("TAOUser", 1000); + + const char* n = p->name(); + double bal = p->balance() / 100.0; + std::cout << "Client: Sending person:" << n + << " starting_balance:$" << bal + << std::endl; + + CORBA::Long b = trans->update(p.in()); + + while (orb->work_pending()) { + orb->perform_work(); + } + + std::cout << "Client: Ending balance: " << b/100.0 << std::endl; + + orb->destroy(); + + } catch(const CORBA::Exception& e) { + std::cerr << e << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/ValueTypes/Bank/run_test.pl b/DevGuideExamples/ValueTypes/Bank/run_test.pl new file mode 100755 index 00000000000..e01c181a775 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/run_test.pl @@ -0,0 +1,74 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/ValueTypes/Bank/server.cpp b/DevGuideExamples/ValueTypes/Bank/server.cpp new file mode 100644 index 00000000000..26c3612b9ca --- /dev/null +++ b/DevGuideExamples/ValueTypes/Bank/server.cpp @@ -0,0 +1,137 @@ +// $Id$ + +#include "_pch.h" + +#include "bankS.h" + +#include "tao/AnyTypeCode/TypeCode.h" +#include "ace/OS_NS_stdio.h" +#include <iostream> +#include <fstream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("server.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class Person_i + : public virtual OBV_Person + , public virtual CORBA::DefaultValueRefCountBase +{ +public: + void debit(CORBA::Long amt) + { + CORBA::Long tmp = balance(); + tmp -= amt; + balance(tmp); + } +}; + +class PersonFactory + : public virtual Person_init +{ + Person* create(const char* name) + { + Person_i* p = new Person_i; + p->name(name); + return p; + } + + CORBA::ValueBase * create_for_unmarshal() + { + // It doesn't matter what values we construct it with + // because they will be overwritten with the demarshaled values. + return new Person_i; + } +}; + +class Transaction_i + : public virtual POA_Transaction +{ +public: + CORBA::Long update(Person* p) + { + ACE_DEBUG((LM_DEBUG, + "Server: Subtracting $1.50 from person:%s starting balance:$%.2f\n", + p->name(), + p->balance() / 100.0)); + p->debit(150); + return p->balance(); + } +}; + +void write_ior(const char* ior) { + std::ofstream out(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + out << ior; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { + try + { + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + { + CORBA::ValueFactoryBase_var factory = new PersonFactory; + CORBA::String_var id = _tc_Person->id(); + orb->register_value_factory(id.in(), factory.in()); + } + + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + PortableServer::POAManager_var poaman = poa->the_POAManager(); + + PortableServer::Servant_var<Transaction_i> svt = new Transaction_i; + + { + PortableServer::ObjectId_var id = poa->activate_object(svt.in()); + obj = poa->id_to_reference(id.in()); + CORBA::String_var ior = orb->object_to_string(obj.in()); + write_ior(ior.in()); + } + + std::cout << "Server: Running..." << std::endl; + + poaman->activate(); + + orb->run(); + + poa->destroy(true, true); + orb->destroy(); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp b/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp new file mode 100644 index 00000000000..35529dbf768 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/Message_i.cpp @@ -0,0 +1,95 @@ +// $Id$ + +#include "_pch.h" +#include "Message_i.h" +#include "MessengerC.h" + +#include "tao/AnyTypeCode/TypeCode.h" + +#include <iostream> + +MessageImpl::MessageImpl() +{ +} + +MessageImpl::~MessageImpl() +{ +} + +MessageImpl::MessageImpl +(const char* address, + const char* user, + const char* subject, + const char* txt + ) : OBV_Message(Message::AddrList(), user, subject, txt) +{ + addAddress(address); +} + +Message::AddrList* MessageImpl::getAddresses() { + return new AddrList(addrs_()); +} + +void MessageImpl::addAddress(const char* s) { + AddrList& al = addrs_(); + CORBA::ULong idx = al.length(); + al.length(idx + 1); + al[idx] = s; +} + +char* MessageImpl::user() { + return CORBA::string_dup(user_()); +} +void MessageImpl::user(const char* s) { + user_(s); +} + +char* MessageImpl::subject() { + return CORBA::string_dup(subject_()); +} +void MessageImpl::subject(const char* s) { + subject_(s); +} + +char* MessageImpl::text() { + return CORBA::string_dup(text_()); +} +void MessageImpl::text(const char* s) { + text_(s); +} + +void MessageImpl::print() { + + std::cout << "Message from : " << user_() << std::endl; + + AddrList& addrs = addrs_(); + if (addrs.length() > 0) { + std::cout << "\tTo : "; + for (CORBA::ULong i = 0; i < addrs.length(); ++i) { + CORBA::String_var s = CORBA::string_dup(addrs[i]); + std::cout << s.in() << ";"; + } + std::cout << std::endl; + } + + std::cout << "\tSubject : " << subject_() << std::endl; + std::cout << "\tText : " << text_() << std::endl; +} + +//////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// + +void +MessageFactory::register_new_factory(CORBA::ORB& orb) { + CORBA::ValueFactoryBase_var mf = new MessageFactory; + CORBA::String_var id = _tc_Message->id(); + orb.register_value_factory(id.in(), mf.in()); +} + +CORBA::ValueBase* +MessageFactory::create_for_unmarshal() +{ + return new MessageImpl; +} + + diff --git a/DevGuideExamples/ValueTypes/Messenger/Message_i.h b/DevGuideExamples/ValueTypes/Messenger/Message_i.h new file mode 100644 index 00000000000..f4dac3f034d --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/Message_i.h @@ -0,0 +1,49 @@ +// $Id$ + +#ifndef MESSAGE_I_H +#define MESSAGE_I_H + +#include "MessengerC.h" + +#include "tao/Valuetype/ValueFactory.h" + +class MessageImpl : public virtual OBV_Message, + public virtual CORBA::DefaultValueRefCountBase +{ +public: + MessageImpl(); + + MessageImpl( + const char* address, + const char* user, + const char* subject, + const char* txt + ); + + virtual ::Message::AddrList* getAddresses(); + virtual void addAddress(const char*); + + virtual char* user(); + virtual void user(const char*); + + virtual char* subject(); + virtual void subject(const char*); + + virtual char* text(); + virtual void text(const char*); + + virtual void print(); +protected: + virtual ~MessageImpl(); +}; + +class MessageFactory + : public virtual CORBA::ValueFactoryBase +{ +public: + static void register_new_factory(CORBA::ORB& orb); +private: + virtual CORBA::ValueBase* create_for_unmarshal(); +}; + +#endif diff --git a/DevGuideExamples/ValueTypes/Messenger/Messenger.idl b/DevGuideExamples/ValueTypes/Messenger/Messenger.idl new file mode 100644 index 00000000000..299965806d6 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/Messenger.idl @@ -0,0 +1,29 @@ +// $Id$ + +// Messenger.idl +// Modified to make use of ValueTypes + +// Demonstrates how ValueTypes can let you make wrapper classes +// that make sequences easier to work with, and can simplify +// IDL interfaces by reducing the number of parameters. + +valuetype Message { + typedef sequence<string> AddrList; + + private AddrList addrs_; + private string user_; + private string subject_; + private string text_; + + AddrList getAddresses(); + void addAddress(in string address); + attribute string user; + attribute string subject; + attribute string text; + void print(); +}; + +interface Messenger { + boolean send_message(inout Message msg); +}; + diff --git a/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp b/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp new file mode 100644 index 00000000000..7f4da7efa74 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp @@ -0,0 +1,76 @@ +// $Id$ + +#include "_pch.h" +#include "Message_i.h" +#include <iostream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior = ACE_TEXT ("file://server.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { + try { + + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + // Normally we wouldn't have to register the factory in the client, but + // in this case the valuetype will be returned as an inout parameter, and + // we'll need the factory to support this. + MessageFactory::register_new_factory(* orb.in()); + + CORBA::Object_var obj = orb->string_to_object(ior); + Messenger_var tst = Messenger::_narrow(obj.in()); + ACE_ASSERT(! CORBA::is_nil(tst.in())); + + Message_var msg = new MessageImpl("Son", "Mom", "Dinner's Ready.", "Hurry home."); + + if (tst->send_message(msg)) { + + std::cout << "Message sent successfully.\n"; + msg->print(); + std::cout << std::endl; + + } else { + std::cout << "Message refused." << std::endl; + } + + while (orb->work_pending()) { + orb->perform_work(); + } + + orb->destroy(); + + } catch(const CORBA::Exception& e) { + std::cerr << e << std::endl; + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp b/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp new file mode 100644 index 00000000000..51323ff466d --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp @@ -0,0 +1,86 @@ +// $Id$ + +#include "_pch.h" + +#include "Messenger_i.h" +#include "Message_i.h" + +#include <iostream> +#include <fstream> +#include <fstream> +#include "ace/Get_Opt.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("server.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +void write_ior(const char* ior) { + std::ofstream out(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); + out << ior; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) != 0) + return 1; + + MessageFactory::register_new_factory(* orb.in()); + + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); + + PortableServer::POAManager_var poaman = poa->the_POAManager(); + + PortableServer::Servant_var<Messenger_i> svt = new Messenger_i; + + PortableServer::ObjectId_var id = poa->activate_object(svt.in()); + obj = poa->id_to_reference(id.in()); + CORBA::String_var ior = orb->object_to_string(obj.in()); + write_ior(ior.in()); + + std::cout << "Starting server." << std::endl; + + poaman->activate(); + + orb->run(); + + poa->destroy(true, true); + orb->destroy(); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/DevGuideExamples/ValueTypes/Messenger/Messenger_i.cpp b/DevGuideExamples/ValueTypes/Messenger/Messenger_i.cpp new file mode 100644 index 00000000000..3dc5a20807e --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/Messenger_i.cpp @@ -0,0 +1,26 @@ +// $Id$ + +#include "_pch.h" + +#include "Messenger_i.h" + +#include <sstream> + + +CORBA::Boolean Messenger_i::send_message (Message*& msg) +{ + msg->print(); + + msg->user("Son"); + msg->addAddress("Mom"); + msg->addAddress("Dad"); + + std::ostringstream out; + CORBA::String_var sub = msg->subject(); + out << "RE: " << sub.in(); + msg->subject(out.str().c_str()); + msg->text("Ok. I'm on my way."); + + return true; +} + diff --git a/DevGuideExamples/ValueTypes/Messenger/Messenger_i.h b/DevGuideExamples/ValueTypes/Messenger/Messenger_i.h new file mode 100644 index 00000000000..a12e478f95e --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/Messenger_i.h @@ -0,0 +1,14 @@ +// $Id$ + +#ifndef MESSENGER_I_H_ +#define MESSENGER_I_H_ + +#include "MessengerS.h" + +class Messenger_i : public virtual POA_Messenger +{ +public: + virtual CORBA::Boolean send_message(Message*& msg); +}; + +#endif diff --git a/DevGuideExamples/ValueTypes/Messenger/README b/DevGuideExamples/ValueTypes/Messenger/README new file mode 100644 index 00000000000..6d344abc251 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/README @@ -0,0 +1,46 @@ +// $Id$ + +This directory contains a CORBA example illustrating a simple client and +a server with a Interface Messenger. The Messenger Interface has +an operation for sending a message (send_message). The MessengerClient +will send a message which is displayed by the MessengerServer when +received. The MessengerClient will then confirm that the message has +been sent successfully. + +This version of the example has been modified to use a new ValueType called +Message that encapsulates the message information. The send method on +Messenger has been modified to take a single Message inout parameter. + + +How to Run +---------- + +Start the server : +------------------ +./server + + +Start the client: +------------------ +./client + + + +Exeuction via Perl Script +------------------------- + +A Perl script has been created to automate the steps shown +above. This script can be run via the following command: + +./run_test.pl + + +NOTE: + + If you run on Windows platform, go to Debug or Release directory to run the + script via following command: + + perl ../run_test.pl + + + diff --git a/DevGuideExamples/ValueTypes/Messenger/ValueTypes.mpc b/DevGuideExamples/ValueTypes/Messenger/ValueTypes.mpc new file mode 100644 index 00000000000..423ba67a264 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/ValueTypes.mpc @@ -0,0 +1,39 @@ +// $Id$ + +project(*DevGuideIDL): taoidldefaults, valuetype { + idlflags += -Wb,pch_include=_pch.h + IDL_Files { + Messenger.idl + } + custom_only = 1 +} + +project(*DevGuideMsgServer): taoserver, valuetype, avoids_minimum_corba { + exename = MessengerServer + after += *DevGuideIDL + Source_Files { + Messenger_i.cpp + Message_i.cpp + MessengerServer.cpp + } + Source_Files { + MessengerC.cpp + MessengerS.cpp + } + IDL_Files { + } +} + +project(*DevGuideMsgClient): taoclient, valuetype, avoids_minimum_corba { + exename = MessengerClient + after += *DevGuideIDL + Source_Files { + Message_i.cpp + MessengerClient.cpp + } + Source_Files { + MessengerC.cpp + } + IDL_Files { + } +} diff --git a/DevGuideExamples/ValueTypes/Messenger/_pch.cpp b/DevGuideExamples/ValueTypes/Messenger/_pch.cpp new file mode 100644 index 00000000000..4faf7a61ecc --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/_pch.cpp @@ -0,0 +1,3 @@ +// $Id$ + +#include "_pch.h" diff --git a/DevGuideExamples/ValueTypes/Messenger/_pch.h b/DevGuideExamples/ValueTypes/Messenger/_pch.h new file mode 100644 index 00000000000..fe6d2628083 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/_pch.h @@ -0,0 +1,12 @@ +// $Id$ + +#ifndef PCH_H +#define PCH_H + +#ifdef USING_PCH +#include "tao/corba.h" +#include "tao/ORB_Core.h" +#include "tao/Stub.h" +#endif + +#endif diff --git a/DevGuideExamples/ValueTypes/Messenger/run_test.pl b/DevGuideExamples/ValueTypes/Messenger/run_test.pl new file mode 100755 index 00000000000..319ad0e79b2 --- /dev/null +++ b/DevGuideExamples/ValueTypes/Messenger/run_test.pl @@ -0,0 +1,74 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; +my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; + +my $iorbase = "server.ior"; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile"); +$server_status = $SV->Spawn (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($iorbase) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($client->PutFile ($iorbase) == -1) { + print STDERR "ERROR: cannot set file <$client_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->Kill (); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; +} + +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); + +exit $status; diff --git a/DevGuideExamples/readme.txt b/DevGuideExamples/readme.txt new file mode 100644 index 00000000000..9f6e9699e07 --- /dev/null +++ b/DevGuideExamples/readme.txt @@ -0,0 +1,34 @@ +"These examples were developed by and are included in this +distribution with the permission of Object Computing, Inc. (OCI) +for the purpose of illustrating the usage of certain features of +The ACE ORB (TAO) as described in OCI's TAO Developer's Guide. +They are provided as is with no warranty, expressed or implied. +Though the examples are believed to illustrate correct usage of +TAO, OCI does not actively maintain them in this distribution and +does not guarantee their accuracy or their suitability for any +particular use. OCI does provide additional distributions of TAO +and provides commercial support for TAO. Visit +http://www.theaceorb.com or contact sales@ociweb.com for more +information on OCI's business model with respect to TAO." + +--MPC-- + +Generate GNU Makefiles + +$ACE_ROOT/bin/mwc.pl -type gnuace DevGuideExamples.mwc + +Generate Visual C++ 7.1 Workspace and Projects +%ACE_ROOT%\bin\mwc.pl -type vc71 DevGuideExamples.mwc + +Generate Visual C++ 8 Workspace and Projects +%ACE_ROOT%\bin\mwc.pl -type vc8 DevGuideExamples.mwc + + +--Windows-- +* To run the release version of a test specify the following: + run_test.pl -ExeSubDir Release +* The BiDirectionalGIOP projects can be referenced as an example of how to use + Automatic Precompiled Headers +* The GettingStarted projects can be referenced as an example of how to use + Manual Precompiled Headers + |
