diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-10-23 07:56:14 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-10-23 07:56:14 +0000 |
commit | 8ba7adad92fb48532967d72dd8c8a813057f32d2 (patch) | |
tree | 402b3f1efa21641439e8910560838c9ada285a91 | |
parent | 22460cf6f1f78b98370e80c01617b65e755a4f4b (diff) | |
download | ATCD-8ba7adad92fb48532967d72dd8c8a813057f32d2.tar.gz |
287 files changed, 0 insertions, 14274 deletions
diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumerMain.cpp deleted file mode 100644 index 79a2ef70181..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// $Id$ - -// EchoEventConsumerMain.cpp -// Main program for a PushConsumer of Echo events. - - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/CosEventCommC.h" -#include "orbsvcs/CosEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> - -const int EVENTS_TILL_SHUTDOWN = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str("CosEventService"); - - // Downcast the object reference to an EventChannel reference. - CosEventChannelAdmin::EventChannel_var echoEC = - CosEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(echoEC.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "Found the EchoEventChannel." << std::endl; - - // Get a ConsumerAdmin object from the EventChannel. - CosEventChannelAdmin::ConsumerAdmin_var consumerAdmin = - echoEC->for_consumers(); - - // Get a ProxyPushSupplier from the ConsumerAdmin. - CosEventChannelAdmin::ProxyPushSupplier_var supplier = - consumerAdmin->obtain_push_supplier(); - - // Instantiate an EchoEventConsumer_i servant. - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENTS_TILL_SHUTDOWN); - - // Register it with the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - CosEventComm::PushConsumer_var consumer = - CosEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect to the ProxyPushSupplier, passing our PushConsumer object - // reference to it. - supplier->connect_push_consumer(consumer.in()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - orb->destroy(); - - std::cout << "Test complete." << std::endl; - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Consumer: Caught CORBA::Exception: " << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.cpp deleted file mode 100644 index e586269cfd7..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(CosEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ -} - -// Override the push() operation. -void EchoEventConsumer_i::push(const CORBA::Any & data) -{ - // Extract event data from the any. - const char* eventData; - if (data >>= eventData) - { - std::cout << "EchoEventConsumer_i::push(): Received event: " - << eventData << std::endl; - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Override the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.h deleted file mode 100644 index 8a17a07ca08..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/CosEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/CosEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_CosEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const CORBA::Any & data); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - CosEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventSupplierMain.cpp deleted file mode 100644 index 1d66e52a524..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -// Main program for a PushSupplier of Echo events. - -#include "orbsvcs/CosEventCommC.h" -#include "orbsvcs/CosEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> - -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EventChannel. - obj = root_context->resolve_str("CosEventService"); - - // Downcast the object reference to an EventChannel reference. - CosEventChannelAdmin::EventChannel_var echoEC = - CosEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(echoEC.in())) { - std::cerr << "Could not resolve EchoEventChannel." << std::endl; - return 1; - } - - // Get a SupplierAdmin object from the EventChannel. - CosEventChannelAdmin::SupplierAdmin_var supplierAdmin = - echoEC->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - CosEventChannelAdmin::ProxyPushConsumer_var consumer = - supplierAdmin->obtain_push_consumer(); - - // Connect to the ProxyPushConsumer as a PushSupplier - // (passing a nil PushSupplier object reference to it because - // we don't care to be notified about disconnects). - consumer->connect_push_supplier(CosEventComm::PushSupplier::_nil()); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup("Hello, world."); - - // Send one event per second. (approx) - while (1) { - // Insert the event data into an any. - CORBA::Any any; - any <<= eventData; - - // Now push the event to the consumer - consumer->push(any); - - ACE_Time_Value event_delay(0, 1000 * EVENT_DELAY_MS); - orb->run(event_delay); - } - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Supplier Caught CORBA::Exception. " << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/OMG_Basic.mpc b/TAO/DevGuideExamples/EventServices/OMG_Basic/OMG_Basic.mpc deleted file mode 100644 index ce1e164120f..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/OMG_Basic.mpc +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, event_skel { - exename = EchoEventSupplier - includes += ../common - Source_Files { - EchoEventSupplierMain.cpp - } -} - -project(*Consumer): namingexe, event_skel { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/README b/TAO/DevGuideExamples/EventServices/OMG_Basic/README deleted file mode 100644 index 42db0c2a7c1..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/README +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -OMG Event Service - - -File: DevGuideExamples/EventServices/OMG_Basic/README - - -This directory contains a simple example of using the CosEvent service. -This example uses the push/push model: - - EchoEventSupplier ----> CosEvent_Service ----> EchoEventConsumer - -This example also works fine with the CosEvent_Service server. - -------------------------------------------------------------------------- - -Note: To test this, you must first run the Naming Service and the -CosEvent Service, e.g.: - -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior & -$TAO_ROOT/orbsvcs/CosEvent_Service/CosEvent_Service -ORBInitRef NameService=file://ns.ior& - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier -ORBInitRef NameService=file://ns.ior - - It will publish an event to the event channel every second. - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ORBInitRef NameService=file://ns.ior - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the CosEventComm::PushConsumer interface. - - - -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 -ExeSubDir <Release> - - - diff --git a/TAO/DevGuideExamples/EventServices/OMG_Basic/run_test.pl b/TAO/DevGuideExamples/EventServices/OMG_Basic/run_test.pl deleted file mode 100644 index a452c9efb65..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_Basic/run_test.pl +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; - -unlink $nsiorfile; -unlink $esiorfile; - -# start Naming Service - -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; - exit 1; -} - -# start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); - -# start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$C->Spawn(); - -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); - -unlink $nsiorfile; -unlink $esiorfile; - -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} - -exit 0; - - diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp deleted file mode 100644 index 448984bef77..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// $Id$ - -// EchoEventConsumerMain.cpp -// Main program for a PushConsumer of Echo events. - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/CosEventCommC.h" -#include "orbsvcs/CosEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const int EVENT_LIMIT = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str("CosEventService"); - - // Downcast the object reference to an EventChannel reference. - CosEventChannelAdmin::EventChannel_var echoEC = - CosEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(echoEC.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "Found the EchoEventChannel." << std::endl; - - // Get a ConsumerAdmin object from the EventChannel. - CosEventChannelAdmin::ConsumerAdmin_var consumerAdmin = - echoEC->for_consumers(); - - // Get a ProxyPushSupplier from the ConsumerAdmin. - CosEventChannelAdmin::ProxyPushSupplier_var supplier = - consumerAdmin->obtain_push_supplier(); - - // Instantiate an EchoEventConsumer_i servant. - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENT_LIMIT); - - // Register it with the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - CosEventComm::PushConsumer_var consumer = - CosEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect to the ProxyPushSupplier, passing our PushConsumer object - // reference to it. - supplier->connect_push_consumer(consumer.in()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - orb->destroy(); - - std::cout << "Test completed." << std::endl; - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp deleted file mode 100644 index e586269cfd7..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(CosEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ -} - -// Override the push() operation. -void EchoEventConsumer_i::push(const CORBA::Any & data) -{ - // Extract event data from the any. - const char* eventData; - if (data >>= eventData) - { - std::cout << "EchoEventConsumer_i::push(): Received event: " - << eventData << std::endl; - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Override the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h deleted file mode 100644 index 8a17a07ca08..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/CosEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/CosEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_CosEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const CORBA::Any & data); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - CosEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp deleted file mode 100644 index e616a556368..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// $Id$ - -// Main program for a PushSupplier of Echo events. - -#include "orbsvcs/CosEventCommC.h" -#include "orbsvcs/CosEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/CosEvent/CEC_EventChannel.h" -#include "orbsvcs/CosEvent/CEC_Default_Factory.h" - -#include <iostream> -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the CEC Factory so we can customize the CEC - TAO_CEC_Default_Factory::init_svcs (); - - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Get the root POA - CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - -1); - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in ()); - PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); - poa_manager->activate (); - - // Create and activate the event channel servant - CosEventChannelAdmin::EventChannel_var echoEC; - - TAO_CEC_EventChannel_Attributes attr(root_poa.in(), root_poa.in()); - TAO_CEC_EventChannel* ec = new TAO_CEC_EventChannel(attr); - ec->activate(); - PortableServer::ObjectId_var oid = root_poa->activate_object(ec); - CORBA::Object_var ec_obj = root_poa->id_to_reference(oid.in()); - echoEC = CosEventChannelAdmin::EventChannel::_narrow(ec_obj.in()); - - // Bind the EventChannel. - CosNaming::Name_var name = root_context->to_name("CosEventService"); - root_context->rebind(name.in(), echoEC.in()); - - // Get a SupplierAdmin object from the EventChannel. - CosEventChannelAdmin::SupplierAdmin_var supplierAdmin = - echoEC->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - CosEventChannelAdmin::ProxyPushConsumer_var consumer = - supplierAdmin->obtain_push_consumer(); - - // Connect to the ProxyPushConsumer as a PushSupplier - // (passing a nil PushSupplier object reference to it because - // we don't care to be notified about disconnects). - consumer->connect_push_supplier(CosEventComm::PushSupplier::_nil()); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup("Hello, world."); - - while (1) { - // Insert the event data into an any. - CORBA::Any any; - any <<= eventData; - - // Now push the event to the consumer - consumer->push(any); - - ACE_Time_Value tv(0, 1000 * EVENT_DELAY_MS); - orb->run(tv); - } - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught unknown CORBA::Exception exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc deleted file mode 100644 index cbdbc4a21cd..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/OMG_SupplierSideEC.mpc +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, event_serv { - exename = EchoEventSupplier - includes += ../common - - Source_Files { - EchoEventSupplierMain.cpp - } -} - -project(*Consumer): namingexe, event_skel { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/README b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/README deleted file mode 100644 index a4db5d42ba2..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/README +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -OMG Event Service - - -File: DevGuideExamples/EventServices/OMG_SupplierSideEC/README - - -This directory contains an example that extends the previous examples -so that the event supplier creates its own local event channel. All -other code is identical to that in EventServices/OMG_Basic. - - EchoEventSupplier (contains EC) ------> EchoEventConsumer - -By default, the supplier will create a "Native" EC. Passing -wrapper -will force creation of a "Wrapper" EC that will utilize a Real-Time -Event Channel (RTEC) as the underlying implementation. - -------------------------------------------------------------------------- - -Note: To test this, you must first run the Naming Service - -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier -ORBInitRef NameService=file://ns.ior - - It will create an event channel and publish an event to it every - second. - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ORBInitRef NameService=file://ns.ior - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the CosEventComm::PushConsumer interface. - - - -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/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl b/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl deleted file mode 100644 index 10e527f7fc4..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_SupplierSideEC/run_test.pl +++ /dev/null @@ -1,50 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$iorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$iorfile"; - -unlink $iorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $iorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); - -# Allow time for the supplier to register with the Naming Service -sleep(2); - -# start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$CRET = $C->SpawnWaitKill(60); - -$S->Kill(); -$NS->Kill(); - -unlink $iorfile; - -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} - - -exit 0; - - diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/ConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/ConsumerMain.cpp deleted file mode 100644 index 904c8ff3da7..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/ConsumerMain.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// $Id$ - -// ConsumerMain.cpp -// Main program for a TypedPushConsumer of Messenger objects. - - -#include "Messenger_i.h" -#include "Consumer_i.h" - -#include "orbsvcs/CosTypedEventCommC.h" -#include "orbsvcs/CosTypedEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" -#include "tao/AnyTypeCode/TypeCode.h" -#include "ace/OS_NS_stdio.h" -#include <iostream> - -const int EVENTS_TILL_SHUTDOWN = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EventChannel. - obj = root_context->resolve_str("CosEventService"); - - // Downcast the object reference to an TypedEventChannel reference. - CosTypedEventChannelAdmin::TypedEventChannel_var ec = - CosTypedEventChannelAdmin::TypedEventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not narrow TypedEventChannel." << std::endl; - return 1; - } - std::cout << "Found the TypedEventChannel." << std::endl; - - // Get a ConsumerAdmin object from the EventChannel. - CosTypedEventChannelAdmin::TypedConsumerAdmin_var consumerAdmin = - ec->for_consumers(); - - // Get a ProxyPushSupplier from the ConsumerAdmin. - CosEventChannelAdmin::ProxyPushSupplier_var supplier = - consumerAdmin->obtain_typed_push_supplier(::_tc_Messenger->id()); - - // Instantiate an Messenger_i servant. - Messenger_i servant(orb.in(), supplier.in(), EVENTS_TILL_SHUTDOWN); - - // Register it with the RootPOA. - // Activate the POA here before we connect our consumer. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var messenger_obj = poa->id_to_reference(oid.in()); - Consumer_i consumer_servant(orb.in(), messenger_obj.in()); - PortableServer::ObjectId_var cons_oid = - poa->activate_object(&consumer_servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(cons_oid.in()); - CosTypedEventComm::TypedPushConsumer_var consumer = - CosTypedEventComm::TypedPushConsumer::_narrow(consumer_obj.in()); - - // Connect to the ProxyPushSupplier, passing our PushConsumer object - // reference to it. - supplier->connect_push_consumer(consumer.in()); - - std::cout << "Ready to receive events..." << std::endl; - - CORBA::String_var str = orb->object_to_string (consumer.in ()); - const char* ior_file_name = "Consumer.ior"; - FILE *output_file= ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR(ior_file_name), - ACE_LIB_TEXT("w")); - if (output_file == 0) { - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_file_name), - 1); - } - ACE_OS::fprintf (output_file, "%s", str.in ()); - ACE_OS::fclose (output_file); - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - // Disconnect the ProxyPushSupplier. - orb->destroy(); - - std::cout << "Test complete." << std::endl; - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught CORBA::Exception. " << std::endl << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.cpp b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.cpp deleted file mode 100644 index 4d6ea9515a0..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ - -// Implements a PushConsumer. - -#include "Consumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -Consumer_i::Consumer_i(CORBA::ORB_ptr orb, - CORBA::Object_ptr obj) - : orb_(CORBA::ORB::_duplicate(orb)) - , object_(CORBA::Object::_duplicate(obj)) -{ -} - - -CORBA::Object_ptr -Consumer_i::get_typed_consumer () -{ - return CORBA::Object::_duplicate(object_.in()); -} - -// Override the push() operation. -void Consumer_i::push(const CORBA::Any &) -{ - throw CORBA::NO_IMPLEMENT (); -} - -// Override the disconnect_push_consumer() operation. -void Consumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.h b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.h deleted file mode 100644 index 6af0ab7bc63..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Consumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// Consumer_i.h -// Implements a TypedPushConsumer. - -#ifndef _Consumer_i_h_ -#define _Consumer_i_h_ - -#include "orbsvcs/CosTypedEventCommS.h"// for POA_CosTypedEventComm::TypedPushConsumer - -class Consumer_i -: public virtual POA_CosTypedEventComm::TypedPushConsumer -{ - public: - // Constructor - Consumer_i(CORBA::ORB_ptr orb, - CORBA::Object_ptr obj); - - // Override operations from TypedPushConsumer interface. - virtual CORBA::Object_ptr get_typed_consumer (); - - virtual void push(const CORBA::Any & data) ; - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - CORBA::Object_var object_; -}; - -#endif // _Consumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger.idl b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger.idl deleted file mode 100644 index bac20c4abe1..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger.idl +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -// Messenger.idl - -interface Messenger -{ - // Modified to make message an in parameter and - // remove the return value. - void send_message(in string user_name, - in string subject, - in string message); -}; diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.cpp b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.cpp deleted file mode 100644 index 5357c914909..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- 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, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(CosEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ -} - -// Implementation skeleton destructor -Messenger_i::~Messenger_i (void) -{ -} - -void Messenger_i::send_message (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; - - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.h b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.h deleted file mode 100644 index 4b11a93e683..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/Messenger_i.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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 */ - -#include "orbsvcs/CosTypedEventChannelAdminC.h" - -//Class Messenger_i -class Messenger_i : public virtual POA_Messenger -{ -public: - //Constructor - Messenger_i (CORBA::ORB_ptr orb, - CosEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - //Destructor - virtual ~Messenger_i (void); - - virtual void send_message (const char * user_name, - const char * subject, - const char * message); - -private: - CORBA::ORB_var orb_; - CosEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; - -}; - - -#endif /* MESSENGERI_H_ */ diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/OMG_TypedEC.mpc b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/OMG_TypedEC.mpc deleted file mode 100644 index 72a8d1e8b9f..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/OMG_TypedEC.mpc +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, event_skel { - exename = Supplier - includes += ../common - Source_Files { - SupplierMain.cpp - MessengerC.cpp - } -} - -project(*Consumer): namingexe, event_skel { - exename = Consumer - includes += ../common - - Source_Files { - ConsumerMain.cpp - Consumer_i.cpp - Messenger_i.cpp - } -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/README b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/README deleted file mode 100644 index abeca498b09..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/README +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -$TAO_ROOT/DevGuideExamples/EventServices/OMG_TypedEC - -This example is a simple demonstration of Typed Event Channel usage. -The Messenger interface is slightly modified for use in this example -to allow suppliers to send messages to all connected consumers. To -run the example, execute the following commands: - -export InterfaceRepositoryIOR=file://ifr.ior -export NameServiceIOR=file://ns.ior -$TAO_ROOT/orbsvcs/IFR_Service/IFR_Service -o ifr.ior & -$ACE_ROOT/bin/tao_ifr Messenger.idl -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior & -$TAO_ROOT/orbsvcs/CosEvent_Service/CosEvent_Service -t & -./Consumer & -./Supplier - diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/SupplierMain.cpp b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/SupplierMain.cpp deleted file mode 100644 index 8162a6bf508..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/SupplierMain.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -// Main program for a TypedPushSupplier of Messenger objects. - -#include "orbsvcs/CosTypedEventCommC.h" -#include "orbsvcs/CosTypedEventChannelAdminC.h" -#include "orbsvcs/CosNamingC.h" -#include "tao/AnyTypeCode/TypeCode.h" - -#include <iostream> -#include "MessengerC.h" - -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EventChannel. - obj = root_context->resolve_str("CosEventService"); - - // Downcast the object reference to a TypedEventChannel reference. - CosTypedEventChannelAdmin::TypedEventChannel_var ec = - CosTypedEventChannelAdmin::TypedEventChannel::_narrow(obj.in ()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not resolve TypedEventChannel." << std::endl; - return 1; - } - - // Get a SupplierAdmin object from the EventChannel. - CosTypedEventChannelAdmin::TypedSupplierAdmin_var supplierAdmin = - ec->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - CosTypedEventChannelAdmin::TypedProxyPushConsumer_var consumer = - supplierAdmin->obtain_typed_push_consumer(::_tc_Messenger->id()); - - // Connect to the ProxyPushConsumer as a PushSupplier - // (passing a nil PushSupplier object reference to it because - // we don't care to be notified about disconnects). - consumer->connect_push_supplier(CosEventComm::PushSupplier::_nil()); - - // Obtain the interface from the event channel - CORBA::Object_var messenger_obj = consumer->get_typed_consumer(); - - // Narrow the interface - Messenger_var messenger = Messenger::_narrow(messenger_obj.in () ); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup("Hello, world."); - - // Send one event per second. (approx) - while (1) { - messenger->send_message("King Lizard", - "Proclamations", - eventData.in()); - - ACE_Time_Value event_delay(0, 1000 * EVENT_DELAY_MS); - orb->run(event_delay); - } - - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught CORBA::Exception. " << std::endl << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl b/TAO/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl deleted file mode 100644 index 3089a483280..00000000000 --- a/TAO/DevGuideExamples/EventServices/OMG_TypedEC/run_test.pl +++ /dev/null @@ -1,96 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$ifriorfile = PerlACE::LocalFile ("ifr.ior"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$consiorfile = PerlACE::LocalFile ("Consumer.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -$arg_ifr_ref = "-ORBInitRef InterfaceRepository=file://$ifriorfile"; - -unlink $nsiorfile; -unlink $ifriorfile; -unlink $esiorfile; -unlink $consiorfile; - -# start the Interface Repository Service -$IFRService = "$ENV{TAO_ROOT}/orbsvcs/IFR_Service/IFR_Service"; -$IF = new PerlACE::Process ($IFRService, "-o $ifriorfile"); -$IF->Spawn (); -if (PerlACE::waitforfile_timed ($ifriorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$ifriorfile>\n"; - $IF->Kill (); - exit 1; -} - -# load the IFR with the Messenger interface info -$TAO_IFR = "$ENV{ACE_ROOT}/bin/tao_ifr"; -$TI = new PerlACE::Process ($TAO_IFR, - "$arg_ifr_ref Messenger.idl"); -$TI->SpawnWaitKill (60); - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - $IF->Kill (); - exit 1; -} - -# start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/CosEvent_Service"; -$ES = new PerlACE::Process($EventService, - "-t -o $esiorfile $arg_ns_ref $arg_ifr_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - $NS->Kill (); - $IF->Kill (); - unlink $nsiorfile; - exit 1; -} - -# start Consumer -$C = new PerlACE::Process("Consumer", "$arg_ns_ref"); -$C->Spawn(); -if (PerlACE::waitforfile_timed ($consiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$consiorfile>\n"; - $ES->Kill(); - $NS->Kill (); - $IF->Kill (); - $C->Kill (); - exit 1; -} - -# start Supplier -$S = new PerlACE::Process("Supplier", "$arg_ns_ref"); -$S->Spawn(); - -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); -$IF->Kill(); - -unlink $nsiorfile; -unlink $ifriorfile; -unlink $esiorfile; -unlink $consiorfile; - -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} - -exit 0; diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumerMain.cpp deleted file mode 100644 index 37695b39784..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// $Id$ - -// Main program for a PushConsumer of Echo events. - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const int EVENT_LIMIT = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str("EventService"); - - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "EchoEventConsumerMain.cpp: Found the EchoEventChannel." << std::endl; - - // Obtain a reference to the consumer administration object. - RtecEventChannelAdmin::ConsumerAdmin_var admin = ec->for_consumers(); - - // Obtain a reference to the push supplier proxy. - RtecEventChannelAdmin::ProxyPushSupplier_var supplier = - admin->obtain_push_supplier(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventConsumer_i servant. - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENT_LIMIT); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect as a consumer. - ACE_ConsumerQOS_Factory qos; - qos.start_disjunction_group (1); - qos.insert_type (ACE_ES_EVENT_ANY, // Event Type - 0); // handle to the rt_info - supplier->connect_push_consumer (consumer.in (), - qos.get_ConsumerQOS ()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "EchoEventConsumerMain.cpp: Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - // Disconnect the ProxyPushSupplier. - orb->destroy(); - - std::cout << "Test completed." << std::endl; - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught CORBA::Exception" << std::endl << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.cpp deleted file mode 100644 index 083875fe173..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.cpp -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include "ace/OS_NS_stdio.h" -#include <sstream> - -// Constructor duplicates the ORB reference. -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ - // Nothing to do. -} - -// Implement the push() operation. -void EchoEventConsumer_i::push(const RtecEventComm::EventSet& events) -{ - // Loop through the events, looking for shutdown events. - for (u_int i = 0; i < events.length (); ++i) { - //ACE_OS::printf("."); - // Extract event data from the any. - const char* eventData; - std::ostringstream out; - out << "Received event," - << " type: " << events[i].header.type - << " source: " << events[i].header.source; - if (events[i].data.any_value >>= eventData) { - out << " text: " << eventData; - } - - ACE_OS::printf("%s\n", out.str().c_str()); // printf is synchronized - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Implement the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.h deleted file mode 100644 index 4e846e79f47..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/RtecEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_RtecEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const RtecEventComm::EventSet& events); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplierMain.cpp deleted file mode 100644 index 76d9ee6e3bd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// $Id$ - -// EchoEventSupplierMain.cpp -// Main program for a PushSupplier of Echo events. - -#include "EchoEventSupplier_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const RtecEventComm::EventSourceID MY_SOURCE_ID = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1; - -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Get the Event Channel using Naming Services - obj = root_context->resolve_str("EventService"); - - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not resolve EchoEventChannel." << std::endl; - return 1; - } - - // Get a SupplierAdmin object from the EventChannel. - RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - RtecEventChannelAdmin::ProxyPushConsumer_var consumer = - admin->obtain_push_consumer(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventSupplier_i servant. - EchoEventSupplier_i servant(orb.in()); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushSupplier_var supplier = - RtecEventComm::PushSupplier::_narrow(supplier_obj.in()); - - // Publish the events the supplier provides. - ACE_SupplierQOS_Factory qos; - qos.insert (MY_SOURCE_ID, // Supplier's unique id - MY_EVENT_TYPE, // Event type - 0, // handle to the rt_info structure - 1); // number of calls - - // Connect as a supplier of the published events. - consumer->connect_push_supplier (supplier.in (), - qos.get_SupplierQOS ()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup("Hello, world."); - - // Create an event set for one event - RtecEventComm::EventSet events (1); - events.length (1); - - // Initialize event header. - events[0].header.source = MY_SOURCE_ID; - events[0].header.type = MY_EVENT_TYPE; - - // Initialize data fields in event. - events[0].data.any_value <<= eventData; - - std::cout << "Supplier starting sending of events" << std::endl; - - while (1) { - consumer->push (events); - ACE_Time_Value tv(0, 1000 * EVENT_DELAY_MS); - orb->run(tv); - } - - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Supplier::main() Caught CORBA::Exception" << std::endl << ex << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.cpp deleted file mode 100644 index 647b2545ef1..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.cpp -// Implements a PushSupplier. - -#include "EchoEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -// Constructor duplicates the ORB reference. -EchoEventSupplier_i::EchoEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ - // Nothing to do. -} - -// Override the disconnect_push_Supplier() operation. -void EchoEventSupplier_i::disconnect_push_supplier() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.h deleted file mode 100644 index 06d39ff04bd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/EchoEventSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.h -// Implements a PushSupplier. - -#ifndef _EchoEventSupplier_i_h_ -#define _EchoEventSupplier_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushSupplier - -class EchoEventSupplier_i : public virtual POA_RtecEventComm::PushSupplier -{ - public: - // Constructor - EchoEventSupplier_i(CORBA::ORB_ptr orb); - - virtual void disconnect_push_supplier(); - - private: - CORBA::ORB_var orb_; -}; - -#endif // _EchoEventSupplier_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/README b/TAO/DevGuideExamples/EventServices/RTEC_Basic/README deleted file mode 100644 index e2c3aae04e1..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/README +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -Real-Time Event Service - - -File: DevGuideExamples/EventServices/RTEC_Basic/README - - -This directory contains a simple example of using the RT Event service. -This example uses the push/push model: - - EchoEventSupplier ------> Event_Service ------> EchoEventConsumer - -------------------------------------------------------------------------- - -Note: To test this, you must first run the Naming Service and the -Event Service, e.g.: - -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& -$TAO_ROOT/orbsvcs/Event_Service/Event_Service -ORBInitRef NameService=file://ns.ior& - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier -ORBInitRef NameService=file://ns.ior - - It will publish an event to the event channel every 1 second. - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ORBInitRef NameService=file://ns.ior - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the RtecEventComm::PushConsumer interface. - - - -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/TAO/DevGuideExamples/EventServices/RTEC_Basic/RTEC_Basic.mpc b/TAO/DevGuideExamples/EventServices/RTEC_Basic/RTEC_Basic.mpc deleted file mode 100644 index d1a621f3c70..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/RTEC_Basic.mpc +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, rteventexe, { - exename = EchoEventSupplier - includes += ../common - - Source_Files { - EchoEventSupplierMain.cpp - EchoEventSupplier_i.cpp - } -} - -project(*Consumer): namingexe, rteventexe, { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl b/TAO/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl deleted file mode 100644 index 4a256b9dbef..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Basic/run_test.pl +++ /dev/null @@ -1,62 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; - -unlink $nsiorfile; -unlink $esiorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; - exit 1; -} - -# start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); - -# start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$CRET = $C->SpawnWaitKill(60); - -$S->Kill(); -$NS->Kill(); -$ES->Kill(); - -unlink $nsiorfile; -unlink $esiorfile; - -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} - - -exit 0; - - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumerMain.cpp deleted file mode 100644 index dcb4ef19d7f..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// $Id$ - -// EchoEventConsumerMain.cpp -// Main program for a PushConsumer of Echo events. - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const RtecEventComm::EventSourceID MY_SOURCE_ID = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1; - -const int EVENT_LIMIT = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - const char* ecname = "EventService"; - for (int i = 0; argv[i] != 0; i++) { - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) { - if (argv[i+1] != 0) { - ecname = argv[i+1]; - } else { - std::cerr << "Missing Event channel name" << std::endl; - } - } - } - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context - = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str(ecname); - - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "EchoEventConsumerMain.cpp: Found the EchoEventChannel." << std::endl; - - // Obtain a reference to the consumer administration object. - RtecEventChannelAdmin::ConsumerAdmin_var admin = ec->for_consumers(); - - // Obtain a reference to the push supplier proxy. - RtecEventChannelAdmin::ProxyPushSupplier_var supplier = - admin->obtain_push_supplier(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventConsumer_i servant and register it - // with the RootPOA - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENT_LIMIT); - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect as a consumer. - ACE_ConsumerQOS_Factory qos; - qos.start_disjunction_group (); - qos.insert (MY_SOURCE_ID, // Source ID - MY_EVENT_TYPE, // Event Type - 0); // handle to the rt_info - supplier->connect_push_consumer (consumer.in (), - qos.get_ConsumerQOS ()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "EchoEventConsumerMain.cpp: Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - // Disconnect the ProxyPushSupplier. - orb->destroy(); - - std::cout << "Test completed." << std::endl; - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.cpp deleted file mode 100644 index 083875fe173..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.cpp -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include "ace/OS_NS_stdio.h" -#include <sstream> - -// Constructor duplicates the ORB reference. -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ - // Nothing to do. -} - -// Implement the push() operation. -void EchoEventConsumer_i::push(const RtecEventComm::EventSet& events) -{ - // Loop through the events, looking for shutdown events. - for (u_int i = 0; i < events.length (); ++i) { - //ACE_OS::printf("."); - // Extract event data from the any. - const char* eventData; - std::ostringstream out; - out << "Received event," - << " type: " << events[i].header.type - << " source: " << events[i].header.source; - if (events[i].data.any_value >>= eventData) { - out << " text: " << eventData; - } - - ACE_OS::printf("%s\n", out.str().c_str()); // printf is synchronized - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Implement the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.h deleted file mode 100644 index 4e846e79f47..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/RtecEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_RtecEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const RtecEventComm::EventSet& events); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplierMain.cpp deleted file mode 100644 index 4735d2e9682..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,206 +0,0 @@ -// $Id$ - -// EchoEventSupplierMain.cpp -// Main program for a PushSupplier of Echo events. - -#include "EchoEventSupplier_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Gateway_IIOP.h" -#include "orbsvcs/Event/EC_Default_Factory.h" - -#include "ace/Thread_Manager.h" -#include <iostream> -#include <fstream> - -const RtecEventComm::EventSourceID MY_SOURCE_ID = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1; - -const int EVENT_DELAY_MS = 10; - -ACE_THR_FUNC_RETURN orb_thread(void *orb_ptr) -{ - CORBA::ORB_var orb = CORBA::ORB::_duplicate((CORBA::ORB_ptr) orb_ptr); - orb->run(); - return 0; -} - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the EC Factory so we can customize the EC - TAO_EC_Default_Factory::init_svcs (); - - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - const char* ecname = "EventService"; - const char* remote_ecname = 0; - const char* iorfile = 0; - for (int i = 0; argv[i] != 0; i++) { - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) { - if (argv[i+1] != 0) { - i++; - ecname = argv[i]; - } else { - std::cerr << "Missing Event channel name" << std::endl; - } - } - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-gateway")) == 0) { - if (argv[i+1] != 0) { - i++; - remote_ecname = argv[i]; - } else { - std::cerr << "Missing Event channel name" << std::endl; - } - } - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-iorfile")) == 0) { - if (argv[i+1] != 0) { - i++; - iorfile = argv[i]; - } - } - } - - // Get the POA - CORBA::Object_var object = orb->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ()); - PortableServer::POAManager_var poa_manager = poa->the_POAManager (); - poa_manager->activate (); - - // Spawn a thread for the orb - ACE_Thread_Manager *thread_mgr = ACE_Thread_Manager::instance(); - thread_mgr->spawn(orb_thread, orb.in()); - - // Create a local event channel and register it with the RootPOA. - TAO_EC_Event_Channel_Attributes attributes (poa.in (), poa.in ()); - TAO_EC_Event_Channel ec_impl (attributes); - ec_impl.activate (); - PortableServer::ObjectId_var oid = poa->activate_object(&ec_impl); - CORBA::Object_var ec_obj = poa->id_to_reference(oid.in()); - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(ec_obj.in()); - - // Find the Naming Service. - object = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(object.in()); - CosNaming::Name_var name = root_context->to_name(ecname); - root_context->rebind(name.in(), ec.in()); - - // Get a SupplierAdmin object from the EventChannel. - RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - RtecEventChannelAdmin::ProxyPushConsumer_var consumer = - admin->obtain_push_consumer(); - - // Instantiate an EchoEventSupplier_i servant. - EchoEventSupplier_i servant(orb.in()); - - // Register it with the RootPOA. - oid = poa->activate_object(&servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushSupplier_var supplier = - RtecEventComm::PushSupplier::_narrow(supplier_obj.in()); - - // Publish the events the supplier provides. - ACE_SupplierQOS_Factory qos; - qos.insert (MY_SOURCE_ID, // Supplier's unique id - MY_EVENT_TYPE, // Event type - 0, // handle to the rt_info structure - 1); // number of calls - - // Connect as a supplier of the published events. - consumer->connect_push_supplier (supplier.in (), - qos.get_SupplierQOS ()); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup(ecname); - - // Create an event set for one event - RtecEventComm::EventSet event (1); - event.length (1); - // Initialize event header. - event[0].header.source = MY_SOURCE_ID; - event[0].header.ttl = 1; - event[0].header.type = MY_EVENT_TYPE; - // Initialize data fields in event. - event[0].data.any_value <<= eventData; - - TAO_EC_Gateway_IIOP gateway; - int gateway_initialized = 0; - - std::cout << "Supplier starting sending of events.\n"; - - while (1) { - - consumer->push (event); - ACE_Time_Value tv(0, 1000 * EVENT_DELAY_MS); - orb->run(tv); - - if ((remote_ecname != 0) && (!gateway_initialized)) { - - try { - // Get the remote event channel object - CORBA::Object_var obj = root_context->resolve_str(remote_ecname); - RtecEventChannelAdmin::EventChannel_var remote_ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - - int ok = 0; - if (!CORBA::is_nil(remote_ec.in())) { - // Now check if we can talk to it... - try { - RtecEventChannelAdmin::SupplierAdmin_var adm = - remote_ec->for_suppliers(); - ok = 1; - } catch(const CORBA::UserException&) { - // What is the correct exception(s) to catch here? - } - } - - // There is a good remote event channel so initialize the - // gateway. - if (ok) { - gateway.init(remote_ec.in(), ec.in()); - - PortableServer::ObjectId_var gateway_oid = - poa->activate_object(&gateway); - CORBA::Object_var gateway_obj = - poa->id_to_reference(gateway_oid.in()); - RtecEventChannelAdmin::Observer_var obs = - RtecEventChannelAdmin::Observer::_narrow(gateway_obj.in()); - RtecEventChannelAdmin::Observer_Handle local_ec_obs_handle = - ec->append_observer (obs.in ()); - ACE_UNUSED_ARG (local_ec_obs_handle); - gateway_initialized = 1; - std::cout << "Gateway initialized\n"; - if (iorfile != 0) { - CORBA::String_var str = orb->object_to_string( ec.in() ); - std::ofstream iorFile( iorfile ); - iorFile << str.in() << std::endl; - iorFile.close(); - } - } - } catch(const CosNaming::NamingContext::NotFound&) { - // Try again later... - } - } - } - - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.cpp deleted file mode 100644 index 647b2545ef1..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.cpp -// Implements a PushSupplier. - -#include "EchoEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -// Constructor duplicates the ORB reference. -EchoEventSupplier_i::EchoEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ - // Nothing to do. -} - -// Override the disconnect_push_Supplier() operation. -void EchoEventSupplier_i::disconnect_push_supplier() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.h deleted file mode 100644 index 06d39ff04bd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/EchoEventSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.h -// Implements a PushSupplier. - -#ifndef _EchoEventSupplier_i_h_ -#define _EchoEventSupplier_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushSupplier - -class EchoEventSupplier_i : public virtual POA_RtecEventComm::PushSupplier -{ - public: - // Constructor - EchoEventSupplier_i(CORBA::ORB_ptr orb); - - virtual void disconnect_push_supplier(); - - private: - CORBA::ORB_var orb_; -}; - -#endif // _EchoEventSupplier_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/README b/TAO/DevGuideExamples/EventServices/RTEC_Federated/README deleted file mode 100644 index f905a2717da..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/README +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ - -Real-Time Event Service - - -File: DevGuideExamples/EventServices/RTEC_Federated/README - - -This directory contains an example that shows how to create and -federate real-time event channels. - -------------------------------------------------------------------------- - -Note: To test this, you must first run the Naming Service, e.g.: - - $TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -After running the naming service, start a couple of suppliers: - - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -ORBSvcConf supplier.conf -ecname name1 -gateway name2 - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -ORBSvcConf supplier.conf -ecname name2 -gateway name1 - -Now start some consumers: - - ./EchoEventConsumer -ORBInitRef NameService=file://ns.ior -ecname name1 - ./EchoEventConsumer -ORBInitRef NameService=file://ns.ior -ecname name2 - -It may be easiest to start these in separate windows. You should -see events from both suppliers on both event channels. - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier -ORBInitRef NameService=file://ns.ior -ORBSvcConf supplier.conf -ecname <name> -gateway <rname> -iorfile <file> - - This will create a local RTEC event channel and bind it under - the root context of the naming service with the name <name>. - It will also create a gateway that links from the remote event - channel bound under <rname> to the locally created event channel. - After initializing the local event channel, it will idle until - it locates the remote event channel, initialize the gateway, - and then publish an event to the local event channel every 10 - milliseconds. This event will contain the string <name> in the - any_value field. When the gateway is initialized, you'll see a - message stating "Gateway initialized". If you pass the -iorfile - parameter, this server also writes the EC's IOR to <file> when - the gateway is initialized. - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ORBInitRef NameService=file://ns.ior -ecname <name> - - This will look for an event channel bound to <name> in the Root context - of the Naming Service. It will consume events from this channel and - print the type, source, and string contents contained in any_value. - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the RtecEventComm::PushConsumer interface. - - -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/TAO/DevGuideExamples/EventServices/RTEC_Federated/RTEC_Federated.mpc b/TAO/DevGuideExamples/EventServices/RTEC_Federated/RTEC_Federated.mpc deleted file mode 100644 index 74545e5f7fd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/RTEC_Federated.mpc +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, rteventexe, rtevent_serv { - exename = EchoEventSupplier - includes += ../common - - Source_Files { - EchoEventSupplierMain.cpp - EchoEventSupplier_i.cpp - } -} - -project(*Consumer): namingexe, rteventexe { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl b/TAO/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl deleted file mode 100644 index 59a8f65a7e6..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/run_test.pl +++ /dev/null @@ -1,96 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$iorfile = PerlACE::LocalFile ("ns.ior"); -$ec1iorfile = PerlACE::LocalFile ("ec1.ior"); -$ec2iorfile = PerlACE::LocalFile ("ec2.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$iorfile"; - -unlink $iorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $iorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start Supplier -if ( -e "supplier.conf" ) -{ - $supplier_conf_file = "supplier.conf"; -} -else{ - $supplier_conf_file = "../supplier.conf"; -} -$args1 = "-ORBSvcConf $supplier_conf_file -ecname ec1 -gateway ec2 -iorfile $ec1iorfile"; -$S1 = new PerlACE::Process("EchoEventSupplier", "$arg_ns_ref $args1"); -$S1->Spawn(); - -$args2 = "-ORBSvcConf $supplier_conf_file -ecname ec2 -gateway ec1 -iorfile $ec2iorfile"; -$S2 = new PerlACE::Process("EchoEventSupplier", "$arg_ns_ref $args2"); -$S2->Spawn(); - -if ((PerlACE::waitforfile_timed ($ec1iorfile, 15) == -1) || - (PerlACE::waitforfile_timed ($ec2iorfile, 2) == -1)) { - print STDERR "ERROR: cannot find files <$ec1iorfile> and <$ec2iorfile>\n"; - $NS->Kill(); - $S1->Kill(); - $S2->Kill(); - exit 1; -} - -$args3 = "-ecname ec1"; -$C1 = new PerlACE::Process("EchoEventConsumer", "$arg_ns_ref $args3"); -$C1->Spawn(); - -$args4 = "-ecname ec2"; -$C2 = new PerlACE::Process("EchoEventConsumer", "$arg_ns_ref $args4"); -$C2->Spawn(); - -if ($C1->WaitKill(60) == -1) { - print STDERR "consumer1 timedout \n"; - - $C2->Kill(); - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - - unlink $iorfile; - - exit 1; -} - -if ($C2->WaitKill(10) == -1) { - print STDERR "consumer2 timedout \n"; - - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - - unlink $iorfile; - - exit 1; -} - -$NS->Kill(); -$S1->Kill(); -$S2->Kill(); - -unlink $iorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; - -exit 0; diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Federated/supplier.conf b/TAO/DevGuideExamples/EventServices/RTEC_Federated/supplier.conf deleted file mode 100644 index 87ebf02489e..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Federated/supplier.conf +++ /dev/null @@ -1,6 +0,0 @@ -# $Id -# Use 5 dispatching threads and the rw wait strategy to resolve deadlock -# issues in the gateway at disconnect time. -static Resource_Factory "-ORBFlushingStrategy blocking" -static EC_Factory "-ECobserver basic -ECDispatching mt -ECDispatchingThreads 5" -static Client_Strategy_Factory "-ORBWaitStrategy rw -ORBTransportMuxStrategy exclusive" diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumerMain.cpp deleted file mode 100644 index 66bd74c77fe..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -// EchoEventConsumerMain.cpp -// Main program for a PushConsumer of Echo events. - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const RtecEventComm::EventSourceID MY_SUPPLIER_ID_START = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventSourceID MY_SUPPLIER_ID_END = ACE_ES_EVENT_SOURCE_ANY + 3; -const RtecEventComm::EventType MY_EVENT_START = ACE_ES_EVENT_UNDEFINED + 1; -const RtecEventComm::EventType MY_EVENT_END = ACE_ES_EVENT_UNDEFINED + 4; - -const int EVENT_LIMIT = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = - CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str("EventService"); - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "EchoEventConsumerMain.cpp: Found the EchoEventChannel." << std::endl; - - // Obtain a reference to the consumer administration object. - RtecEventChannelAdmin::ConsumerAdmin_var admin = ec->for_consumers(); - - // Obtain a reference to the push supplier proxy. - RtecEventChannelAdmin::ProxyPushSupplier_var supplier = - admin->obtain_push_supplier(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventConsumer_i servant and register it - // with the RootPOA - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENT_LIMIT); - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect as a consumer. - ACE_ConsumerQOS_Factory qos; - qos.start_disjunction_group (1); - qos.insert_type (MY_EVENT_START, // Event Type - 0); // handle to the rt_info - supplier->connect_push_consumer (consumer.in (), - qos.get_ConsumerQOS ()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "EchoEventConsumerMain.cpp: Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - // Disconnect the ProxyPushSupplier. - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.cpp deleted file mode 100644 index 083875fe173..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.cpp -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include "ace/OS_NS_stdio.h" -#include <sstream> - -// Constructor duplicates the ORB reference. -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ - // Nothing to do. -} - -// Implement the push() operation. -void EchoEventConsumer_i::push(const RtecEventComm::EventSet& events) -{ - // Loop through the events, looking for shutdown events. - for (u_int i = 0; i < events.length (); ++i) { - //ACE_OS::printf("."); - // Extract event data from the any. - const char* eventData; - std::ostringstream out; - out << "Received event," - << " type: " << events[i].header.type - << " source: " << events[i].header.source; - if (events[i].data.any_value >>= eventData) { - out << " text: " << eventData; - } - - ACE_OS::printf("%s\n", out.str().c_str()); // printf is synchronized - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Implement the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.h deleted file mode 100644 index 4e846e79f47..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/RtecEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_RtecEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const RtecEventComm::EventSet& events); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplierMain.cpp deleted file mode 100644 index 4f0830bc17f..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// $Id$ - -// EchoEventSupplierMain.cpp -// Main program for a PushSupplier of Echo events. - -#include "EchoEventSupplier_i.h" - -#include "orbsvcs/RtecEventCommC.h"// for Event Communication interfaces -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h"// for Naming Service interfaces - -#include <iostream> -const RtecEventComm::EventSourceID MY_SOURCE_ID_START = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventSourceID MY_SOURCE_ID_END = ACE_ES_EVENT_SOURCE_ANY + 3; -const RtecEventComm::EventType MY_EVENT_START = ACE_ES_EVENT_UNDEFINED + 1; -const RtecEventComm::EventType MY_EVENT_END = ACE_ES_EVENT_UNDEFINED + 4; - -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Get the Event Channel using Naming Services - obj = root_context->resolve_str("EventService"); - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not resolve EchoEventChannel." << std::endl; - return 1; - } - - // Get a SupplierAdmin object from the EventChannel. - RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers(); - - // Get a ProxyPushConsumer from the SupplierAdmin. - RtecEventChannelAdmin::ProxyPushConsumer_var consumer = - admin->obtain_push_consumer(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventConsumer_i servant. - EchoEventSupplier_i servant(orb.in()); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushSupplier_var supplier = - RtecEventComm::PushSupplier::_narrow(supplier_obj.in()); - - // Publish the events the supplier provides. - ACE_SupplierQOS_Factory qos; - RtecEventComm::EventSourceID supplier_id = MY_SOURCE_ID_START; - for (; supplier_id <= MY_SOURCE_ID_END; ++supplier_id) { - RtecEventComm::EventType event_type = MY_EVENT_START; - for (; event_type <= MY_EVENT_END; ++event_type) - { - qos.insert (supplier_id, event_type, - 0, // handle to the rt_info structure - 1); // number of calls - } - } - - // Connect as a supplier of the published events. - consumer->connect_push_supplier (supplier.in (), qos.get_SupplierQOS ()); - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup("Hello, world."); - - // Create an event set for one event - RtecEventComm::EventSet event (1); - event.length (1); - - // Initialize event header. - event[0].header.source = MY_SOURCE_ID_START; - event[0].header.type = MY_EVENT_START; - - // Initialize data fields in event. - event[0].data.any_value <<= eventData; - - std::cout << "Supplier starting sending events.\n"; - while (1) { - - event[0].header.type++; - if (event[0].header.type > MY_EVENT_END) { - event[0].header.type = MY_EVENT_START; - } - event[0].header.source++; - if (event[0].header.source > MY_SOURCE_ID_END) { - event[0].header.source = MY_SOURCE_ID_START; - } - consumer->push (event); - - ACE_Time_Value tv(0, EVENT_DELAY_MS * 1000); - orb->run(tv); - } - - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.cpp deleted file mode 100644 index 70271836d2e..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.cpp -// Implements a PushSupplier. - -#include "EchoEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -// Constructor duplicates the ORB reference. -EchoEventSupplier_i::EchoEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ - // Nothing to do. -} - -// Override the disconnect_push_Supplier() operation. -void EchoEventSupplier_i::disconnect_push_supplier() -{ - - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.h b/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.h deleted file mode 100644 index 06d39ff04bd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/EchoEventSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.h -// Implements a PushSupplier. - -#ifndef _EchoEventSupplier_i_h_ -#define _EchoEventSupplier_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushSupplier - -class EchoEventSupplier_i : public virtual POA_RtecEventComm::PushSupplier -{ - public: - // Constructor - EchoEventSupplier_i(CORBA::ORB_ptr orb); - - virtual void disconnect_push_supplier(); - - private: - CORBA::ORB_var orb_; -}; - -#endif // _EchoEventSupplier_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/README b/TAO/DevGuideExamples/EventServices/RTEC_Filter/README deleted file mode 100644 index 74f2f79cd5a..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/README +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -Real-Time Event Service - - -File: DevGuideExamples/EventServices/RTEC_Filter/README - - -This directory contains some example code for the filters, correlations, -and timeouts features of the RT Event service. For now the code is all -in the EchoEventConsumerMain.cpp file. Simply, comment out the filters/ -timeouts/correlations required, remake, and run as below. - -------------------------------------------------------------------------- - -Note: To test this, you must first run the Naming Service and the -Event Service, e.g.: - -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& -$TAO_ROOT/orbsvcs/Event_Service/Event_Service -ORBSvcConf ec.conf -ORBInitRef NameService=file://ns.ior& - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier -ORBInitRef NameService=file://ns.ior - - It will publish an event to the event channel every 1 second. - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ORBInitRef NameService=file://ns.ior - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the RtecEventComm::PushConsumer interface. - - - -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/TAO/DevGuideExamples/EventServices/RTEC_Filter/RTEC_Filter.mpc b/TAO/DevGuideExamples/EventServices/RTEC_Filter/RTEC_Filter.mpc deleted file mode 100644 index d1a621f3c70..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/RTEC_Filter.mpc +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -project(*Supplier): namingexe, rteventexe, { - exename = EchoEventSupplier - includes += ../common - - Source_Files { - EchoEventSupplierMain.cpp - EchoEventSupplier_i.cpp - } -} - -project(*Consumer): namingexe, rteventexe, { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/ec.conf b/TAO/DevGuideExamples/EventServices/RTEC_Filter/ec.conf deleted file mode 100644 index 0d41159fbd9..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/ec.conf +++ /dev/null @@ -1,2 +0,0 @@ -# $Id$ -static EC_Factory "-ECFiltering prefix" diff --git a/TAO/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl b/TAO/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl deleted file mode 100644 index 204135e8346..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_Filter/run_test.pl +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$esiorfile = PerlACE::LocalFile ("es.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; - -unlink $nsiorfile; -unlink $esiorfile; - -# start Naming Service - -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start Event Service -$EventService = "$ENV{TAO_ROOT}/orbsvcs/Event_Service/Event_Service"; -$ES = new PerlACE::Process($EventService, "-o $esiorfile $arg_ns_ref"); -$ES->Spawn(); -if (PerlACE::waitforfile_timed ($esiorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$esiorfile>\n"; - $ES->Kill(); - unlink $nsiorfile; - exit 1; -} - -# start EchoEventSupplier -$S = new PerlACE::Process("EchoEventSupplier", $arg_ns_ref); -$S->Spawn(); - -# start EchoEventConsumer -$C = new PerlACE::Process("EchoEventConsumer", $arg_ns_ref); -$C->Spawn(); - -$CRET = $C->WaitKill(60); -$S->Kill(); -$NS->Kill(); -$ES->Kill(); - -unlink $nsiorfile; -unlink $esiorfile; - -if ($CRET != 0) { - print STDERR "ERROR: Client returned <$CRET>\n"; - exit 1 ; -} - -exit 0; - - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp deleted file mode 100644 index 9bd23fbe075..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumerMain.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// $Id$ - -// EchoEventConsumerMain.cpp -// Main program for a PushConsumer of Echo events. - -#include "EchoEventConsumer_i.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" - -#include <iostream> -const RtecEventComm::EventSourceID MY_SOURCE_ID = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1; - -const int EVENT_LIMIT = 20; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - const char* ecname = "EventService"; - for (int i = 0; argv[i] != 0; i++) { - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) { - if (argv[i+1] != 0) { - ecname = argv[i+1]; - } else { - std::cerr << "Missing Event channel name" << std::endl; - } - } - } - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Find the EchoEventChannel. - obj = root_context->resolve_str(ecname); - - // Downcast the object reference to an EventChannel reference. - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(obj.in()); - if (CORBA::is_nil(ec.in())) { - std::cerr << "Could not narrow EchoEventChannel." << std::endl; - return 1; - } - std::cout << "EchoEventConsumerMain.cpp: Found the EchoEventChannel." << std::endl; - - // Obtain a reference to the consumer administration object. - RtecEventChannelAdmin::ConsumerAdmin_var admin = ec->for_consumers(); - - // Obtain a reference to the push supplier proxy. - RtecEventChannelAdmin::ProxyPushSupplier_var supplier = - admin->obtain_push_supplier(); - - // Get the RootPOA. - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - - // Instantiate an EchoEventConsumer_i servant. - EchoEventConsumer_i servant(orb.in(), supplier.in(), EVENT_LIMIT); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushConsumer_var consumer = - RtecEventComm::PushConsumer::_narrow(consumer_obj.in()); - - // Connect as a consumer. - ACE_ConsumerQOS_Factory qos; - qos.start_disjunction_group (); - qos.insert (MY_SOURCE_ID, // Source ID - MY_EVENT_TYPE, // Event Type - 0); // handle to the rt_info - supplier->connect_push_consumer (consumer.in (), - qos.get_ConsumerQOS ()); - - // Activate the POA via its POAManager. - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - poa_manager->activate(); - - std::cout << "EchoEventConsumerMain.cpp: Ready to receive events..." << std::endl; - - // Enter the ORB event loop. - orb->run(); - - // If we have reached this, we must be shutting down... - // Disconnect the ProxyPushSupplier. - orb->destroy(); - - return 0; - - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp deleted file mode 100644 index 083875fe173..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.cpp -// Implements a PushConsumer. - -#include "EchoEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include "ace/OS_NS_stdio.h" -#include <sstream> - -// Constructor duplicates the ORB reference. -EchoEventConsumer_i::EchoEventConsumer_i( - CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit) - : orb_(CORBA::ORB::_duplicate(orb)) - , supplier_(RtecEventChannelAdmin::ProxyPushSupplier::_duplicate(supplier)) - , event_limit_(event_limit) -{ - // Nothing to do. -} - -// Implement the push() operation. -void EchoEventConsumer_i::push(const RtecEventComm::EventSet& events) -{ - // Loop through the events, looking for shutdown events. - for (u_int i = 0; i < events.length (); ++i) { - //ACE_OS::printf("."); - // Extract event data from the any. - const char* eventData; - std::ostringstream out; - out << "Received event," - << " type: " << events[i].header.type - << " source: " << events[i].header.source; - if (events[i].data.any_value >>= eventData) { - out << " text: " << eventData; - } - - ACE_OS::printf("%s\n", out.str().c_str()); // printf is synchronized - } - if (--event_limit_ <= 0) { - supplier_->disconnect_push_supplier(); - orb_->shutdown(0); - } -} - -// Implement the disconnect_push_consumer() operation. -void EchoEventConsumer_i::disconnect_push_consumer() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h deleted file mode 100644 index 4e846e79f47..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventConsumer_i.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -// EchoEventConsumer_i.h -// Implements a PushConsumer. - -#ifndef _EchoEventConsumer_i_h_ -#define _EchoEventConsumer_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushConsumer -#include "orbsvcs/RtecEventChannelAdminC.h" - -class EchoEventConsumer_i : public virtual POA_RtecEventComm::PushConsumer -{ - public: - // Constructor - EchoEventConsumer_i(CORBA::ORB_ptr orb, - RtecEventChannelAdmin::ProxyPushSupplier_ptr supplier, - int event_limit); - - // Override operations from PushConsumer interface. - virtual void push(const RtecEventComm::EventSet& events); - - virtual void disconnect_push_consumer(); - - private: - CORBA::ORB_var orb_; - RtecEventChannelAdmin::ProxyPushSupplier_var supplier_; - int event_limit_; -}; - -#endif // _EchoEventConsumer_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp deleted file mode 100644 index d6f3314dc7e..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp +++ /dev/null @@ -1,245 +0,0 @@ -// $Id$ - -// EchoEventSupplierMain.cpp -// Main program for a PushSupplier of Echo events. - -#include "EchoEventSupplier_i.h" -#include "SimpleAddressServer.h" - -#include "orbsvcs/RtecEventCommC.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "orbsvcs/Time_Utilities.h" -#include "orbsvcs/Event_Utilities.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Default_Factory.h" -#include "orbsvcs/Event/ECG_Mcast_EH.h" -#include "orbsvcs/Event/ECG_UDP_Sender.h" -#include "orbsvcs/Event/ECG_UDP_Receiver.h" -#include "orbsvcs/Event/ECG_UDP_Out_Endpoint.h" -#include "orbsvcs/Event/ECG_UDP_EH.h" - -#include "tao/ORB_Core.h" - -#include "ace/Auto_Ptr.h" -#include <iostream> -#include <fstream> - -const RtecEventComm::EventSourceID MY_SOURCE_ID = ACE_ES_EVENT_SOURCE_ANY + 1; -const RtecEventComm::EventType MY_EVENT_TYPE = ACE_ES_EVENT_UNDEFINED + 1; - -const int EVENT_DELAY_MS = 10; - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Initialize the EC Factory so we can customize the EC - TAO_EC_Default_Factory::init_svcs (); - - // Initialize the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - const char* ecname = "EventService"; - const char* address = "localhost"; - const char* iorfile = 0; - u_short port = 12345; - u_short listenport = 12345; - int mcast = 1; - - for (int i = 0; argv[i] != 0; i++) { - if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) { - if (argv[i+1] != 0) { - i++; - ecname = argv[i]; - } else { - std::cerr << "Missing Event channel name" << std::endl; - } - } else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-address")) == 0) { - if (argv[i+1] != 0) { - i++; - address = argv[i]; - } else { - std::cerr << "Missing address" << std::endl; - } - } else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-port")) == 0) { - if (argv[i+1] != 0) { - i++; - port = ACE_OS::atoi(argv[i]); - } else { - std::cerr << "Missing port" << std::endl; - } - } else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-listenport")) == 0) { - if (argv[i+1] != 0) { - i++; - listenport = ACE_OS::atoi(argv[i]); - } else { - std::cerr << "Missing port" << std::endl; - } - } else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-iorfile")) == 0) { - if (argv[i+1] != 0) { - i++; - iorfile = argv[i]; - } - } else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-udp")) == 0) { - mcast = 0; - } - } - - // Get the POA - CORBA::Object_var object = orb->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ()); - PortableServer::POAManager_var poa_manager = poa->the_POAManager (); - poa_manager->activate (); - - // Create a local event channel and register it - TAO_EC_Event_Channel_Attributes attributes (poa.in (), poa.in ()); - TAO_EC_Event_Channel ec_impl (attributes); - ec_impl.activate (); - PortableServer::ObjectId_var oid = poa->activate_object(&ec_impl); - CORBA::Object_var ec_obj = poa->id_to_reference(oid.in()); - RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow(ec_obj.in()); - - // Find the Naming Service. - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); - - // Bind the Event Channel using Naming Services - CosNaming::Name_var name = root_context->to_name(ecname); - root_context->rebind(name.in(), ec.in()); - - // Get a proxy push consumer from the EventChannel. - RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers(); - RtecEventChannelAdmin::ProxyPushConsumer_var consumer = - admin->obtain_push_consumer(); - - // Instantiate an EchoEventSupplier_i servant. - EchoEventSupplier_i servant(orb.in()); - - // Register it with the RootPOA. - oid = poa->activate_object(&servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - RtecEventComm::PushSupplier_var supplier = - RtecEventComm::PushSupplier::_narrow(supplier_obj.in()); - - // Connect to the EC. - ACE_SupplierQOS_Factory qos; - qos.insert (MY_SOURCE_ID, MY_EVENT_TYPE, 0, 1); - consumer->connect_push_supplier (supplier.in (), qos.get_SupplierQOS ()); - - // Initialize the address server with the desired address. - // This will be used by the sender object and the multicast - // receiver. - ACE_INET_Addr send_addr (port, address); - SimpleAddressServer addr_srv_impl (send_addr); - - PortableServer::ObjectId_var addr_srv_oid = - poa->activate_object(&addr_srv_impl); - CORBA::Object_var addr_srv_obj = poa->id_to_reference(addr_srv_oid.in()); - RtecUDPAdmin::AddrServer_var addr_srv = - RtecUDPAdmin::AddrServer::_narrow(addr_srv_obj.in()); - - // Create and initialize the sender object - TAO_EC_Servant_Var<TAO_ECG_UDP_Sender> sender = - TAO_ECG_UDP_Sender::create(); - TAO_ECG_UDP_Out_Endpoint endpoint; - if (endpoint.dgram ().open (ACE_Addr::sap_any) == -1) { - std::cerr << "Cannot open send endpoint" << std::endl; - return 1; - } - - // TAO_ECG_UDP_Sender::init() takes a TAO_ECG_Refcounted_Endpoint. - // If we don't clone our endpoint and pass &endpoint, the sender will - // attempt to delete endpoint during shutdown. - TAO_ECG_UDP_Out_Endpoint* clone; - ACE_NEW_RETURN (clone, - TAO_ECG_UDP_Out_Endpoint (endpoint), - -1); - sender->init (ec.in (), addr_srv.in (), clone); - - // Setup the subscription and connect to the EC - ACE_ConsumerQOS_Factory cons_qos_fact; - cons_qos_fact.start_disjunction_group (); - cons_qos_fact.insert (ACE_ES_EVENT_SOURCE_ANY, ACE_ES_EVENT_ANY, 0); - RtecEventChannelAdmin::ConsumerQOS sub = cons_qos_fact.get_ConsumerQOS (); - sender->connect (sub); - - // Create and initialize the receiver - TAO_EC_Servant_Var<TAO_ECG_UDP_Receiver> receiver = - TAO_ECG_UDP_Receiver::create(); - - // TAO_ECG_UDP_Receiver::init() takes a TAO_ECG_Refcounted_Endpoint. - // If we don't clone our endpoint and pass &endpoint, the receiver will - // attempt to delete endpoint during shutdown. - ACE_NEW_RETURN (clone, - TAO_ECG_UDP_Out_Endpoint (endpoint), - -1); - receiver->init (ec.in (), clone, addr_srv.in ()); - - // Setup the registration and connect to the event channel - ACE_SupplierQOS_Factory supp_qos_fact; - supp_qos_fact.insert (MY_SOURCE_ID, MY_EVENT_TYPE, 0, 1); - RtecEventChannelAdmin::SupplierQOS pub = supp_qos_fact.get_SupplierQOS (); - receiver->connect (pub); - - // Create the appropriate event handler and register it with the reactor - auto_ptr<ACE_Event_Handler> eh; - if (mcast) { - auto_ptr<TAO_ECG_Mcast_EH> mcast_eh(new TAO_ECG_Mcast_EH (receiver.in())); - mcast_eh->reactor (orb->orb_core ()->reactor ()); - mcast_eh->open (ec.in()); - ACE_AUTO_PTR_RESET(eh,mcast_eh.release(),ACE_Event_Handler); - //eh.reset(mcast_eh.release()); - } else { - auto_ptr<TAO_ECG_UDP_EH> udp_eh (new TAO_ECG_UDP_EH (receiver.in())); - udp_eh->reactor (orb->orb_core ()->reactor ()); - ACE_INET_Addr local_addr (listenport); - if (udp_eh->open (local_addr) == -1) { - std::cerr << "Cannot open EH" << std::endl; - } - ACE_AUTO_PTR_RESET(eh,udp_eh.release(),ACE_Event_Handler); - //eh.reset(udp_eh.release()); - } - - // Create an event (just a string in this case). - const CORBA::String_var eventData = CORBA::string_dup(ecname); - - // Create an event set for one event - RtecEventComm::EventSet event (1); - event.length (1); - - // Initialize event header. - event[0].header.source = MY_SOURCE_ID; - event[0].header.ttl = 1; - event[0].header.type = MY_EVENT_TYPE; - - // Initialize data fields in event. - event[0].data.any_value <<= eventData; - - if (iorfile != 0) { - CORBA::String_var str = orb->object_to_string( ec.in() ); - std::ofstream iorFile( iorfile ); - iorFile << str.in() << std::endl; - iorFile.close(); - } - std::cout << "Starting main loop" << std::endl; - - const int EVENT_DELAY_MS = 10; - - while (1) { - consumer->push (event); - - ACE_Time_Value tv(0, 1000 * EVENT_DELAY_MS); - orb->run(tv); - } - - orb->destroy(); - return 0; - } - catch(const CORBA::Exception& exc) - { - std::cerr << "Caught CORBA::Exception" << std::endl << exc << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp deleted file mode 100644 index 647b2545ef1..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.cpp -// Implements a PushSupplier. - -#include "EchoEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -// Constructor duplicates the ORB reference. -EchoEventSupplier_i::EchoEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ - // Nothing to do. -} - -// Override the disconnect_push_Supplier() operation. -void EchoEventSupplier_i::disconnect_push_supplier() -{ - // Deactivate this object. - CORBA::Object_var obj = orb_->resolve_initial_references("POACurrent"); - PortableServer::Current_var current = PortableServer::Current::_narrow(obj.in()); - PortableServer::POA_var poa = current->get_POA(); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h deleted file mode 100644 index 06d39ff04bd..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -// EchoEventSupplier_i.h -// Implements a PushSupplier. - -#ifndef _EchoEventSupplier_i_h_ -#define _EchoEventSupplier_i_h_ - -#include "orbsvcs/RtecEventCommS.h"// for POA_CosEventComm::PushSupplier - -class EchoEventSupplier_i : public virtual POA_RtecEventComm::PushSupplier -{ - public: - // Constructor - EchoEventSupplier_i(CORBA::ORB_ptr orb); - - virtual void disconnect_push_supplier(); - - private: - CORBA::ORB_var orb_; -}; - -#endif // _EchoEventSupplier_i_h_ diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/README b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/README deleted file mode 100644 index c1540c193f3..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/README +++ /dev/null @@ -1,140 +0,0 @@ -// $Id$ - -Real-Time Event Service - - -File: DevGuideExamples/EventServices/RTEC_MCast_Federated/README - - -This directory contains an example that shows how to create and -federate real-time event channels using the classes in EC_Gateway_UDP.h. -Depending on the options, it will use either UDP or multicast to link -the event channels. - -------------------------------------------------------------------------- - -Note: To run this example, you must first run the Naming Service, e.g.: - - $TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -------------------------------------------------------------------------- - -To start the supplier/EC processes on a single host and federate them -using UDP, do the following (after starting the Naming_Service): - - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -udp -ecname name1 -port 1233 -listenport 1234 - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -udp -ecname name2 -port 1234 -listenport 1233 - -This will start two EC/supplier processes on the same node. One (name1) -will listen on port 1234 and send on port 1233. The other (name2) will -do the opposite. You should be able to use any available port as long as -the port and listenport options are symmetric (listenport of one process -must be the port of the other). The -address option can be used to -specify a supplier/EC process on another host. Here is an example of two -processes on different hosts: - -On node1: - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -udp -ecname name1 -port 1233 -listenport 1234 -address node2 -On node2: - ./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -udp -ecname name2 -port 1234 -listenport 1233 -address node1 - -When using UDP, this example is limited to federating two ECs. - -------------------------------------------------------------------------- - -To start the supplier/EC processes and federate them using multicast, do the -following (after starting the Naming_Service): - -./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -ORBSvcConf supplier.conf -ecname name1 -address 224.9.9.2 -port 1234 -./EchoEventSupplier -ORBInitRef NameService=file://ns.ior -ORBSvcConf supplier.conf -ecname name2 -address 224.9.9.2 -port 1234 - -The -address and -port options should be passed a valid and available -multicast address and port. - -------------------------------------------------------------------------- - -To start the consumers, simply do the following (this works the same for -both types of federations): - -./EchoEventConsumer -ORBInitRef NameService=file://ns.ior -ecname name1 -./EchoEventConsumer -ORBInitRef NameService=file://ns.ior -ecname name2 - -It may be easiest to start these in separate windows. Each consumer -connects to one EC (specified by the -ecname option). You should see -events from both suppliers on each event channel (each supplier passes -events containing with the name of the EC they are using). - -------------------------------------------------------------------------- - -EchoEventSupplerMain.cpp - - Main program for a PushSupplier. - - EchoEventSupplier [ -ORBSvcConf supplier.conf ] [ -udp ] -ecname <name> - [ -address <address> ] [ -port <port> ] - [ -listenport <lport> ] - - This will create a local RTEC event channel and bind it under - the root context of the naming service with the name <name>. - It will also federate with remote event channels specified via - the other options. By default, it uses multicast to federate - the ECs (specifying -udp forces use of UDP). <address> is - the address of the remote EC when using UDP and the multicast - address when using multicast. <port> is the port to send - to when using UDP and the multicast port when using multicast. - <lport> is the port to listen on for UDP (and not used by - multicast. You must pass -ORBSvcConf supplier.conf when - using multicast so as to enable Observers. - - After initializing the local event channel and setting up the - connection for the federation, it publishes an event to the - local event channel every 10 milliseconds. This event will - contain the string <name> in the any_value field. - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumerMain.cpp - - Main program for a PushConsumer. - - To run it: - - EchoEventConsumer -ecname <name> - - This will look for an event channel bound to <name> in the Root context - of the Naming Service. It will consume events from this channel and - print the type, source, and string contents contained in any_value. - - Use Control-C to kill the process. - -------------------------------------------------------------------------- - -EchoEventConsumer_i.{h,cpp} - - Call which implements the RtecEventComm::PushConsumer interface. - -------------------------------------------------------------------------- - -SimpleAddressServer.{h,cpp} - - This is a servant class that implements the RtecUDPAdmin::AddrServer - interface. It is used by the UDP/multicast senders to return an - address that they will send out particular events on. It is also - used by the multicast event handler, to determine which addresses - to listen to based on consumer subscriptions. This simple - implementation always returns the same address. - - - -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 - -By default, this script uses multicast; pass -udp to the -script to use udp. diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc deleted file mode 100644 index 9f3dd500486..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/RTEC_MCast_Federated.mpc +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -project(*_Dev_Supplier): namingexe, rteventexe, rtevent_serv { - exename = EchoEventSupplier - includes += ../common - - Source_Files { - EchoEventSupplierMain.cpp - EchoEventSupplier_i.cpp - SimpleAddressServer.cpp - } -} - -project(*_Dev_Consumer): namingexe, rteventexe { - exename = EchoEventConsumer - includes += ../common - - Source_Files { - EchoEventConsumerMain.cpp - EchoEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp deleted file mode 100644 index 44433fb5a00..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -// SimpleAddressServer.cpp - -#include "SimpleAddressServer.h" -#include "ace/INET_Addr.h" -#include "ace/OS_NS_string.h" - -SimpleAddressServer::SimpleAddressServer (const ACE_INET_Addr& address) { -#if defined (ACE_HAS_IPV6) - if (address.get_type() == PF_INET6) - { - RtecUDPAdmin::UDP_Addr_v6 v6; - sockaddr_in6 *in6 = - reinterpret_cast<sockaddr_in6 *>(address.get_addr()); - ACE_OS::memcpy (v6.ipaddr,&in6->sin6_addr,16); - v6.port = address.get_port_number(); - this->address_.v6_addr (v6); - return; - } -#endif /* ACE_HAS_IPV6 */ - RtecUDPAdmin::UDP_Addr v4; - v4.ipaddr = address.get_ip_address (); - v4.port = address.get_port_number (); - this->address_.v4_addr (v4); -} - -void -SimpleAddressServer::get_addr (const RtecEventComm::EventHeader&, - RtecUDPAdmin::UDP_Addr& address) -{ - if (this->address_._d() == RtecUDPAdmin::Rtec_inet6) - throw CORBA::DATA_CONVERSION(0, CORBA::COMPLETED_YES); - address = this->address_.v4_addr(); -} - -void -SimpleAddressServer::get_address(const RtecEventComm::EventHeader&, - RtecUDPAdmin::UDP_Address& address) -{ - address = this->address_; -} diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.h b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.h deleted file mode 100644 index 9c346d87a81..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/SimpleAddressServer.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -// SimpleAddressServer.h - -#ifndef SIMPLEADDRESSSERVER_H -#define SIMPLEADDRESSSERVER_H - -#include "orbsvcs/RtecUDPAdminS.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_INET_Addr; -ACE_END_VERSIONED_NAMESPACE_DECL - -class SimpleAddressServer : public POA_RtecUDPAdmin::AddrServer { -public: - SimpleAddressServer (const ACE_INET_Addr& address); - virtual void get_addr (const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Addr& address); - - virtual void get_address(const RtecEventComm::EventHeader& header, - RtecUDPAdmin::UDP_Address& address); - -private: - RtecUDPAdmin::UDP_Address address_; -}; - -#endif diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl deleted file mode 100644 index 176c6327f8f..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/run_test.pl +++ /dev/null @@ -1,146 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -if (!defined $ENV{TAO_ROOT}) { - $ENV{TAO_ROOT} = "$ENV{ACE_ROOT}/TAO"; -} - -sub usage() { - print "Usage:\n"; - print " run_test [-h] [-debug]\n\n"; - print " -udp -- Federate using udp\n"; - print " -mcast -- Federate using multicast (the default)\n"; - print " -h -- Prints this information\n"; - print " -debug -- Sets the debug flag for the test\n"; - exit; -} - -my $udp = 0; -my $i = 0; -my $flags = ""; -while ($i <= $#ARGV) { - if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-help" || - $ARGV[$i] eq "--help" || $ARGV[$i] eq "-?") { - usage (); - } elsif ($ARGV[$i] eq "-debug") { - $flags .= " -ORBDebugLevel 10 "; - } elsif ($ARGV[$i] eq "-udp") { - $udp = 1; - } elsif ($ARGV[$i] eq "-mcast") { - $udp = 0; - } else { - print "ERROR: Unknown Option: ".$ARGV[$i]."\n\n"; - usage (); - } - $i++; -} - -if ($udp) { - print "Using UDP to link the event channels.\n\n"; -} else { - print "Using multicast to link the event channels.\n\n"; -} - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$ec1iorfile = PerlACE::LocalFile ("ec1.ior"); -$ec2iorfile = PerlACE::LocalFile ("ec2.ior"); - -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -$end_point = "-ORBEndpoint iiop://localhost"; -$ns_port = PerlACE::random_port(); - -unlink $nsiorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; - -# start Naming Service - -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "$flags -o $nsiorfile $end_point:$ns_port"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start EchoEventSupplier -my($port1) = 10001 + PerlACE::uniqueid() ; -my($port2) = 10001 + PerlACE::uniqueid() ; -my($mport) = 10001 + PerlACE::uniqueid() ; -if ( -e "supplier.conf" ) -{ - $supplier_conf_file = "supplier.conf"; -} -else{ - $supplier_conf_file = "../supplier.conf"; -} - -$args1 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile $ec1iorfile"; -if ($udp) { - $args1 .= " -udp -ecname ec1 -port $port1 -listenport $port2 "; -} else { - $args1 .= " -ecname ec1 -address 224.9.9.2 -port $mport "; -} -$S1 = new PerlACE::Process("EchoEventSupplier", $args1); -$S1->Spawn(); - -$args2 = "$flags $arg_ns_ref -ORBSvcConf $supplier_conf_file $end_point -iorfile $ec2iorfile"; -if ($udp) { - $args2 .= " -udp -ecname ec2 -port $port2 -listenport $port1 "; -} else { - $args2 .= " -ecname ec2 -address 224.9.9.2 -port $mport "; -} -$S2 = new PerlACE::Process("EchoEventSupplier", $args2); -$S2->Spawn(); - -if ((PerlACE::waitforfile_timed ($ec1iorfile, 15) == -1) || - (PerlACE::waitforfile_timed ($ec2iorfile, 2) == -1)) { - print STDERR "ERROR: cannot find files <$ec1iorfile> and <$ec2iorfile>\n"; - $NS->Kill(); - $S1->Kill(); - $S2->Kill(); - exit 1; -} - -$args3 = "$flags $arg_ns_ref -ecname ec1 $end_point"; -$C1 = new PerlACE::Process("EchoEventConsumer", $args3); -$C1->Spawn(); - - -$args4 = "$flags $arg_ns_ref -ecname ec2 $end_point"; -$C2 = new PerlACE::Process("EchoEventConsumer", $args4); -$C2->Spawn(); - -if ($C1->WaitKill(30) == -1) { - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - $C2->Kill(); - - exit 1; -} - -if ($C2->WaitKill(5) == -1) { - $S1->Kill(); - $S2->Kill(); - $NS->Kill(); - exit 1; -} - -$NS->Kill(); -$S1->Kill(); -$S2->Kill(); - -unlink $nsiorfile; -unlink $ec1iorfile; -unlink $ec2iorfile; - -exit 0; diff --git a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/supplier.conf b/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/supplier.conf deleted file mode 100644 index d9eeea24f43..00000000000 --- a/TAO/DevGuideExamples/EventServices/RTEC_MCast_Federated/supplier.conf +++ /dev/null @@ -1,2 +0,0 @@ -# $Id$ -static EC_Factory "-ECobserver basic" diff --git a/TAO/DevGuideExamples/ImplRepo/Activator/run_test.pl b/TAO/DevGuideExamples/ImplRepo/Activator/run_test.pl deleted file mode 100644 index b13adc4b92d..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Activator/run_test.pl +++ /dev/null @@ -1,123 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; -use Sys::Hostname; - -my $WAIT_TIMEOUT = 2; -my $DEBUG_LEVEL = 1; -my $OBJ_REF_STYLE = "-orbobjrefstyle url"; - -my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImplRepo_Service"; -my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImR_Activator"; -my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr"; - -my $implrepo_ior = "imr.ior"; -my $activator_ior = "activator.ior"; -my $messenger_ior = "messenger.ior"; - -my $imr_init_ref = "-ORBInitRef ImplRepoService=file://$implrepo_ior"; - -my $Svr = new PerlACE::Process('../Basic/MessengerServer', "-orbuseimr 1 $OBJ_REF_STYLE $imr_init_ref"); -my $Cli = new PerlACE::Process('../Basic/MessengerClient'); - -my $server_cmd = $Svr->Executable(); - -sub CleanupOutput { - unlink $messenger_ior; - unlink $implrepo_ior; - unlink $activator_ior; -} - -sub SpawnWait { - my $process = shift; - my $file = shift; - - print ">>> " . $process->CommandLine() . "\n"; - $process->Spawn(); - my $ret = PerlACE::waitforfile_timed($file, $WAIT_TIMEOUT); - if ($ret == -1) { - print STDERR "ERROR: Cannot find file <$file>\n"; - } - return $ret; -} - -# Use url object reference style for readability, and startup timeout of 2 seconds. -# Unlike the chapter we'll forgo using -m, because we want to be able to run this -# as a test in our nightly builds, and multicast could interfere with other machines. -my $ImR = new PerlACE::Process ($implrepo_server, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -t 2 -o $implrepo_ior"); -my $Act = new PerlACE::Process ($imr_activator, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -o $activator_ior $imr_init_ref"); - -my $imr_util = new PerlACE::Process ("$tao_imr"); -# We want the tao_imr executable to be found exactly in the path -# given, without being modified by the value of -ExeSubDir. -# So, we tell its Process object to ignore the setting of -ExeSubDir. -$imr_util->IgnoreExeSubDir(1); - -sub RunImRUtil { - my $cmd = shift; - print ">>> " . $imr_util->CommandLine() . "\n"; - $imr_util->Arguments("$imr_init_ref $cmd"); - return $imr_util->SpawnWaitKill(5); -} - -CleanupOutput(); - -#### Start the example - -if (SpawnWait($ImR, $implrepo_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -if (SpawnWait($Act, $activator_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -#instead of using tao_imr add, we'll use tao_imr update, because -#we want to run the server once to generate the ior file. - -if (SpawnWait($Svr, $messenger_ior) != 0) { - $Act->Kill(); - $ImR->Kill(); - exit 1; -} - -RunImRUtil("list -v"); - -RunImRUtil("shutdown MessengerService"); -$Svr->WaitKill($WAIT_TIMEOUT); - -RunImRUtil("list -v"); - -# Note : If the server registers itself, then it won't set the -# activator name. If we don't set it here, then the activator -# won't be able to start the server. -my $actname = hostname; -RunImRUtil("update MessengerService -l $actname -c \"$server_cmd $OBJ_REF_STYLE -ORBUseIMR 1 $imr_init_ref\""); - -RunImRUtil("list -v"); - -if ($Cli->SpawnWaitKill(1000) != 0) { - print STDERR "Error : Client failed to run correctly."; -} - -$Act->Kill(); - -RunImRUtil("list -v"); - -RunImRUtil("shutdown MessengerService"); - -$ImR->Kill(); - -#### Clean up any output files - -CleanupOutput(); - -exit 0; diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/ImplRepo_Basic.mpc b/TAO/DevGuideExamples/ImplRepo/Basic/ImplRepo_Basic.mpc deleted file mode 100644 index 25045b0a376..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/ImplRepo_Basic.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, avoids_minimum_corba, avoids_corba_e_micro { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): taoexe, anytypecode, avoids_minimum_corba { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger.idl b/TAO/DevGuideExamples/ImplRepo/Basic/Messenger.idl deleted file mode 100644 index f02608af6f5..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger.idl +++ /dev/null @@ -1,5 +0,0 @@ -// $Id$ - -interface Messenger { - boolean send_message (in string user_name, in string subject, inout string message); -}; diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/MessengerClient.cpp b/TAO/DevGuideExamples/ImplRepo/Basic/MessengerClient.cpp deleted file mode 100644 index 018890322c4..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/MessengerClient.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include <iostream> - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->string_to_object("file://messenger.ior"); - - Messenger_var messenger = Messenger::_narrow(obj.in()); - if (CORBA::is_nil(messenger.in())) { - std::cerr << "Unable to get a Messenger reference." << std::endl; - return 1; - } - - CORBA::String_var message = CORBA::string_dup("Hello!"); - messenger->send_message("TAO User", "TAO Test", message.inout()); - std::cout << "message was sent" << std::endl; - std::cout << "Reply was : " << message.in() << std::endl; - - return 0; - } catch(const CORBA::Exception& ex) { - std::cerr << "Client main() Caught Exception: " << ex << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/MessengerServer.cpp b/TAO/DevGuideExamples/ImplRepo/Basic/MessengerServer.cpp deleted file mode 100644 index 63678a9b2f3..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/MessengerServer.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include <iostream> -#include <fstream> - - -PortableServer::POA_ptr -createPersistentPOA(PortableServer::POA_ptr root_poa, - const char* poa_name) -{ - CORBA::PolicyList policies; - policies.length(2); - - policies[0] = root_poa->create_lifespan_policy(PortableServer::PERSISTENT); - policies[1] = root_poa->create_id_assignment_policy(PortableServer::USER_ID); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - PortableServer::POA_var poa = - root_poa->create_POA(poa_name, mgr.in(), policies); - - policies[0]->destroy(); - policies[1]->destroy(); - - return poa._retn(); -} - -void writeIORFile(const char* ior) { - std::ofstream out("messenger.ior"); - out << ior; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in()); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - - const char* poa_name = "MessengerService"; - - PortableServer::POA_var poa = createPersistentPOA(root_poa.in(), poa_name); - - Messenger_i servant; - - PortableServer::ObjectId_var object_id = - PortableServer::string_to_ObjectId("object"); - - poa->activate_object_with_id(object_id.in(), &servant); - - obj = poa->id_to_reference(object_id.in()); - CORBA::String_var ior = orb->object_to_string(obj.in()); - - writeIORFile(ior.in()); - - mgr->activate(); - - std::cout << "Messenger server ready." << std::endl; - - orb->run(); - - std::cout << "Messenger server shutting down." << std::endl; - - root_poa->destroy(1,1); - orb->destroy(); - - return 0; - } catch(const CORBA::Exception& ex) { - std::cerr << "Server main() Caught Exception" << ex << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.cpp b/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.cpp deleted file mode 100644 index 0e1e7d1793b..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include <iostream> -#include <exception> - -CORBA::Boolean Messenger_i::send_message( - const char * user_name, - const char * subject, - char *& message) -{ - std::cout << "Message from: " << user_name << std::endl - << "Subject: " << subject << std::endl - << "Message: " << message << std::endl; - message = CORBA::string_dup("A reply."); - return 1; -} - diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.h b/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.h deleted file mode 100644 index d129ac6800a..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/Messenger_i.h +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -#ifndef MESSENGERI_H_ -#define MESSENGERI_H_ - -#include "MessengerS.h" - -class Messenger_i : public virtual POA_Messenger -{ - int count; -public: - Messenger_i() : count(0) {} - virtual CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message); -}; - -#endif diff --git a/TAO/DevGuideExamples/ImplRepo/Basic/run_test.pl b/TAO/DevGuideExamples/ImplRepo/Basic/run_test.pl deleted file mode 100644 index c43b69dc02d..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Basic/run_test.pl +++ /dev/null @@ -1,94 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -my $WAIT_TIMEOUT = 2; -my $DEBUG_LEVEL = 1; -my $OBJ_REF_STYLE = "-orbobjrefstyle url"; - -my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImplRepo_Service"; -my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImR_Activator"; -my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr"; - -my $implrepo_ior = "imr.ior"; -my $activator_ior = "activator.ior"; -my $messenger_ior = "messenger.ior"; - -my $imr_init_ref = "-ORBInitRef ImplRepoService=file://$implrepo_ior"; - -my $Svr = new PerlACE::Process('MessengerServer', "-orbuseimr 1 $OBJ_REF_STYLE $imr_init_ref"); -my $Cli = new PerlACE::Process('MessengerClient'); - -sub CleanupOutput { - unlink $messenger_ior; - unlink $implrepo_ior; - unlink $activator_ior; -} - -sub SpawnWait { - my $process = shift; - my $file = shift; - - print ">>> " . $process->CommandLine() . "\n"; - $process->Spawn(); - my $ret = PerlACE::waitforfile_timed($file, $WAIT_TIMEOUT); - if ($ret == -1) { - print STDERR "ERROR: Cannot find file <$file>\n"; - } - return $ret; -} - -# Use url object reference style for readability, and startup timeout of 2 seconds. -# Unlike the chapter we'll forgo using -m, because we want to be able to run this -# as a test in our nightly builds, and multicast could interfere with other machines. -my $ImR = new PerlACE::Process ($implrepo_server, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -t 2 -o $implrepo_ior"); -my $Act = new PerlACE::Process ($imr_activator, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -o $activator_ior $imr_init_ref"); - -my $imr_util = new PerlACE::Process ("$tao_imr", - "$imr_init_ref add MessengerService -c \"$Svr->Executable() $OBJ_REF_STYLE -ORBUseIMR 1 $imr_init_ref\""); - -# We want the tao_imr executable to be found exactly in the path -# given, without being modified by the value of -ExeSubDir. -# So, we tell its Process object to ignore the setting of -ExeSubDir. -$imr_util->IgnoreExeSubDir(1); - -sub RunImRUtil { - my $cmd = shift; - print ">>> " . $imr_util->CommandLine() . "\n"; - $imr_util->Arguments("$imr_init_ref $cmd"); - return $imr_util->SpawnWaitKill(5); -} - -CleanupOutput(); - -#### Start the example - -if (SpawnWait($ImR, $implrepo_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -if (SpawnWait($Svr, $messenger_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -if ($Cli->SpawnWaitKill($WAIT_TIMEOUT) != 0) { - print STDERR "Error : Client failed to run correctly."; -} - -$Svr->Kill(); -$ImR->Kill(); - - -#### Clean up any output files - -CleanupOutput(); - -exit 0; diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/ImplRepo_IORTable.mpc b/TAO/DevGuideExamples/ImplRepo/IORTable/ImplRepo_IORTable.mpc deleted file mode 100644 index f09b51adba2..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/ImplRepo_IORTable.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, avoids_minimum_corba, iortable, avoids_corba_e_micro { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): taoexe, anytypecode, avoids_minimum_corba { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger.idl b/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger.idl deleted file mode 100644 index f02608af6f5..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger.idl +++ /dev/null @@ -1,5 +0,0 @@ -// $Id$ - -interface Messenger { - boolean send_message (in string user_name, in string subject, inout string message); -}; diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerClient.cpp b/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerClient.cpp deleted file mode 100644 index 7659b23a2cd..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerClient.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "ace/SString.h" -#include <iostream> - - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - try { - if (argc <= 1) { - std::cerr << "Error: Must specify the name of an IOR file." << std::endl; - return 1; - } - ACE_TString ior = ACE_TEXT("file://"); - ior += argv[1]; - - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->string_to_object(ior.c_str()); - - Messenger_var messenger = Messenger::_narrow(obj.in()); - if (CORBA::is_nil(messenger.in())) { - std::cerr << "Unable to get a Messenger reference." << std::endl; - return 1; - } - - CORBA::String_var message = CORBA::string_dup("Hello!"); - messenger->send_message("TAO User", "TAO Test", message.inout()); - std::cout << "message was sent" << std::endl; - std::cout << "Reply was : " << message.in() << std::endl; - - return 0; - } catch(const CORBA::Exception& ex) { - std::cerr << "Client main() Caught Exception: " << ex << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerServer.cpp b/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerServer.cpp deleted file mode 100644 index 5abbd2fc6db..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/MessengerServer.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "tao/PortableServer/Root_POA.h" -#include "tao/IORTable/IORTable.h" -#include <iostream> -#include <fstream> -#include <fstream> - -PortableServer::POA_ptr -createPersistentPOA(PortableServer::POA_ptr root_poa, - const char* poa_name) { - - PortableServer::LifespanPolicy_var life = - root_poa->create_lifespan_policy(PortableServer::PERSISTENT); - - PortableServer::IdAssignmentPolicy_var assign = - root_poa->create_id_assignment_policy(PortableServer::USER_ID); - - CORBA::PolicyList pols; - pols.length(2); - pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in()); - pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in()); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - PortableServer::POA_var poa = - root_poa->create_POA(poa_name, mgr.in(), pols); - - life->destroy(); - assign->destroy(); - - return poa._retn(); -} - -void writeIORFile(const char* ior, const char* name) { - std::ofstream out(name); - out << ior; -} - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in()); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - - const char* poa_name = "MessengerService"; - - PortableServer::POA_var poa = createPersistentPOA(root_poa.in(), poa_name); - - Messenger_i servant1, servant2; - - PortableServer::ObjectId_var id1 = PortableServer::string_to_ObjectId("Object1"); - poa->activate_object_with_id(id1.in(), &servant1); - PortableServer::ObjectId_var id2 = PortableServer::string_to_ObjectId("Object2"); - poa->activate_object_with_id(id2.in(), &servant2); - - obj = poa->id_to_reference(id1.in()); - CORBA::String_var ior1 = orb->object_to_string(obj.in()); - obj = poa->id_to_reference(id2.in()); - CORBA::String_var ior2 = orb->object_to_string(obj.in()); - - TAO_Root_POA* tpoa = dynamic_cast<TAO_Root_POA*>(poa.in()); - obj = tpoa->id_to_reference_i(id1.in(), false); - CORBA::String_var direct_ior1 = orb->object_to_string(obj.in()); - - obj = orb->resolve_initial_references("IORTable"); - IORTable::Table_var ior_table = IORTable::Table::_narrow(obj.in()); - ior_table->bind("MessengerService/Object1", direct_ior1.in()); - ior_table->bind("MessengerService/Object2", ior2.in()); - - writeIORFile(ior1.in(), "messenger1.ior"); - writeIORFile(ior2.in(), "messenger2.ior"); - - mgr->activate(); - - std::cout << "Messenger server ready." << std::endl; - - orb->run(); - - std::cout << "Messenger server shutting down." << std::endl; - - root_poa->destroy(1,1); - orb->destroy(); - - return 0; - } catch(const CORBA::Exception& ex) { - std::cerr << "Server main() Caught Exception" << ex << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.cpp b/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.cpp deleted file mode 100644 index 401d9a7cd1c..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include <iostream> - - -CORBA::Boolean Messenger_i::send_message( - const char * user_name, - const char * subject, - char *& message) -{ - std::cout << "Message from: " << user_name << std::endl - << "Subject: " << subject << std::endl - << "Message: " << message << std::endl; - message = CORBA::string_dup("A reply."); - return 1; -} - diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.h b/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.h deleted file mode 100644 index 10f376d0ed0..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/Messenger_i.h +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#ifndef MESSENGERI_H_ -#define MESSENGERI_H_ - -#include "MessengerS.h" - -class Messenger_i : public virtual POA_Messenger -{ -public: - virtual CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message - ); -}; - -#endif diff --git a/TAO/DevGuideExamples/ImplRepo/IORTable/run_test.pl b/TAO/DevGuideExamples/ImplRepo/IORTable/run_test.pl deleted file mode 100644 index c17e026ca98..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/IORTable/run_test.pl +++ /dev/null @@ -1,131 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -my $WAIT_TIMEOUT = 2; -my $DEBUG_LEVEL = 1; -my $OBJ_REF_STYLE = "-orbobjrefstyle url"; - -my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImplRepo_Service"; -my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImR_Activator"; -my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr"; - -my $implrepo_ior = "imr.ior"; -my $activator_ior = "activator.ior"; -my $messenger1_ior = "messenger1.ior"; -my $messenger2_ior = "messenger2.ior"; -my $messenger3_ior = "messenger3.ior"; -my $messenger4_ior = "messenger4.ior"; - -my $imr_init_ref = "-ORBInitRef ImplRepoService=file://$implrepo_ior"; - -my $Svr = new PerlACE::Process('MessengerServer', "-orbuseimr 1 $OBJ_REF_STYLE $imr_init_ref"); -my $Cli = new PerlACE::Process('MessengerClient'); - -sub CleanupOutput { - unlink $messenger1_ior; - unlink $messenger2_ior; - unlink $messenger3_ior; - unlink $messenger4_ior; - unlink $implrepo_ior; - unlink $activator_ior; -} - -sub SpawnWait { - my $process = shift; - my $file = shift; - - print ">>> " . $process->CommandLine() . "\n"; - $process->Spawn(); - my $ret = PerlACE::waitforfile_timed($file, $WAIT_TIMEOUT); - if ($ret == -1) { - print STDERR "ERROR: Cannot find file <$file>\n"; - } - return $ret; -} - -sub SpawnWaitKill { - my $process = shift; - - print ">>> " . $process->CommandLine() . "\n"; - return $process->SpawnWaitKill($WAIT_TIMEOUT); -} - -# Use url object reference style for readability, and startup timeout of 2 seconds. -# Unlike the chapter we'll forgo using -m, because we want to be able to run this -# as a test in our nightly builds, and multicast could interfere with other machines. -my $ImR = new PerlACE::Process ($implrepo_server, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -t 2 -o $implrepo_ior"); -my $Act = new PerlACE::Process ($imr_activator, "-d $DEBUG_LEVEL $OBJ_REF_STYLE -o $activator_ior $imr_init_ref"); - -my $imr_util = new PerlACE::Process ("$tao_imr", - "$imr_init_ref add MessengerService -c \"$Svr->Executable() $OBJ_REF_STYLE -ORBUseIMR 1 $imr_init_ref\""); - -# We want the tao_imr executable to be found exactly in the path -# given, without being modified by the value of -ExeSubDir. -# So, we tell its Process object to ignore the setting of -ExeSubDir. -$imr_util->IgnoreExeSubDir(1); - -sub RunImRUtil { - my $cmd = shift; - print ">>> " . $imr_util->CommandLine() . "\n"; - $imr_util->Arguments("$imr_init_ref $cmd"); - return $imr_util->SpawnWaitKill(5); -} - -CleanupOutput(); - -#### Start the example - -if (SpawnWait($ImR, $implrepo_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -if (SpawnWait($Svr, $messenger2_ior) != 0) { - $ImR->Kill(); - exit 1; -} - -$Cli->Arguments($messenger1_ior); -if (SpawnWaitKill($Cli, $WAIT_TIMEOUT) != 0) { - print STDERR "Error : Client 1 failed to run correctly."; -} - -$Cli->Arguments($messenger2_ior); -if (SpawnWaitKill($Cli, $WAIT_TIMEOUT) != 0) { - print STDERR "Error : Client 2 failed to run correctly."; -} - -#Since we didn't start the ImR with a known endpoint, we'll -#have to use the tao_imr utility to create a our urls. -RunImRUtil("ior MessengerService/Object1 -f $messenger3_ior"); -RunImRUtil("ior MessengerService/Object2 -f $messenger4_ior"); - -$Cli->Arguments($messenger3_ior); -if (SpawnWaitKill($Cli, $WAIT_TIMEOUT) != 0) { - print STDERR "Error : Client 3 failed to run correctly."; -} - -# Notice that this one results in two calls through the ImR, because -# we bound an indirect reference in the IORTable. If we were using -# PER_CLIENT activation, this would be bad. -$Cli->Arguments($messenger4_ior); -if (SpawnWaitKill($Cli, $WAIT_TIMEOUT) != 0) { - print STDERR "Error : Client 4 failed to run correctly."; -} - -$Svr->Kill(); -$ImR->Kill(); - - -#### Clean up any output files - -CleanupOutput(); - -exit 0; diff --git a/TAO/DevGuideExamples/ImplRepo/ImplRepo.mpc b/TAO/DevGuideExamples/ImplRepo/ImplRepo.mpc deleted file mode 100644 index a2d1c3a39b6..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/ImplRepo.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, iortable, avoids_minimum_corba, avoids_corba_e_micro { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): taoexe, anytypecode, avoids_minimum_corba { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/ImplRepo/Messenger.idl b/TAO/DevGuideExamples/ImplRepo/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/ImplRepo/MessengerClient.cpp b/TAO/DevGuideExamples/ImplRepo/MessengerClient.cpp deleted file mode 100644 index 9d9a3273d03..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/MessengerClient.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - // Destringify ior - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.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; - } - - CORBA::String_var message = CORBA::string_dup( "Hello!" ); - messenger->send_message( "TAO User", "TAO Test", message.inout() ); - - std::cout << "message was sent" << std::endl; - } - catch(const CORBA::Exception& ex) { - std::cerr << "Client main() Caught CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/ImplRepo/MessengerServer.cpp b/TAO/DevGuideExamples/ImplRepo/MessengerServer.cpp deleted file mode 100644 index 6e6e804a2ca..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/MessengerServer.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// $Id$ - -// MessengerServer.cpp -// This version uses the Implementation Repository. - -#include "Messenger_i.h" -#include "tao/IORTable/IORTable.h" -#include "tao/PortableServer/Root_POA.h" -#include <iostream> - -PortableServer::POA_ptr -createPOA(PortableServer::POA_ptr root_poa, const char* poa_name) -{ - PortableServer::LifespanPolicy_var life = - root_poa->create_lifespan_policy(PortableServer::PERSISTENT); - - PortableServer::IdAssignmentPolicy_var assign = - root_poa->create_id_assignment_policy(PortableServer::USER_ID); - - CORBA::PolicyList pols; - pols.length(2); - pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in()); - pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in()); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - PortableServer::POA_var poa = - root_poa->create_POA(poa_name, mgr.in(), pols); - - life->destroy(); - assign->destroy(); - - return poa._retn(); -} - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in()); - - PortableServer::POAManager_var mgr = root_poa->the_POAManager(); - - const char* poa_name = "MessengerService"; - - PortableServer::POA_var messenger_poa = createPOA(root_poa.in(), poa_name); - - Messenger_i messenger_servant; - - PortableServer::ObjectId_var object_id = - PortableServer::string_to_ObjectId("messenger_object"); - - // - // Activate the servant with the messenger POA, - // obtain its object reference, and get a - // stringified IOR. - // - messenger_poa->activate_object_with_id(object_id.in(), &messenger_servant); - - // - // Create binding between "MessengerService" and - // the messenger object reference in the IOR Table. - // Use a TAO extension to get the non imrified poa - // to avoid forwarding requests back to the ImR. - - TAO_Root_POA* tpoa = dynamic_cast<TAO_Root_POA*>(messenger_poa.in()); - obj = tpoa->id_to_reference_i(object_id.in(), false); - CORBA::String_var messenger_ior = orb->object_to_string(obj.in()); - obj = orb->resolve_initial_references("IORTable"); - IORTable::Table_var table = IORTable::Table::_narrow(obj.in()); - table->bind(poa_name, messenger_ior.in()); - - // - // This server is now ready to run. - // This version does not create an IOR - // file as demonstrated in the - // Developer's Guide. It assumes that - // users create IORs for the client using - // the tao_imr utility. - // - // - // Stop discarding requests. - // - mgr->activate(); - - std::cout << "Messenger server ready." << std::endl; - - orb->run(); - - std::cout << "Messenger server shutting down." << std::endl; - - root_poa->destroy(1,1); - orb->destroy(); - } - catch(const CORBA::Exception& ex) { - std::cerr << "Server main() Caught CORBA::Exception" << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/ImplRepo/Messenger_i.cpp b/TAO/DevGuideExamples/ImplRepo/Messenger_i.cpp deleted file mode 100644 index de1edefd4fa..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Messenger_i.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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 - << "Subject: " << subject << std::endl - << "Message: " << message << std::endl; - return 1; -} - diff --git a/TAO/DevGuideExamples/ImplRepo/Messenger_i.h b/TAO/DevGuideExamples/ImplRepo/Messenger_i.h deleted file mode 100644 index e386c4c71da..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/Messenger_i.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/ImplRepo/README b/TAO/DevGuideExamples/ImplRepo/README deleted file mode 100644 index 99a264e11a9..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/README +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -DevGuideExamples/ImplRepo/README - -This directory contains a CORBA example illustrating use of the TAO -Implementation Repository with a simple server (MessengerServer) and -a client (MessengerClient). - -How to Run ----------- - -Start the Implementation Repository (ImplRepo) server: ------------------------------------------------------- -$TAO_ROOT/orbsvcs/ImplRepo_Service/ImplRepo_Service -o implrepo.ior - -Register the server's POA name and start-up command with the ImplRepo: ----------------------------------------------------------------------- -$TAO_ROOT/orbsvcs/ImplRepo_Service/tao_imr -ORBInitRef \ - ImplRepoService=file://implrepo.ior add MessengerService \ - -c "MessengerServer -ORBUseIMR 1 -ORBInitRef ImplRepoService=file://implrepo.ior" - -Generate an IMRified Object Reference for the MessengerService: ---------------------------------------------------------------- -$TAO_ROOT/orbsvcs/ImplRepo_Service/tao_imr -ORBInitRef \ - ImplRepoService=file://implrepo.ior ior MessengerService -f Messenger.ior - -Run the client (ImplRepo should automatically start the server): ----------------------------------------------------------------- -./MessengerClient diff --git a/TAO/DevGuideExamples/ImplRepo/run_test.pl b/TAO/DevGuideExamples/ImplRepo/run_test.pl deleted file mode 100644 index d053e18fb9d..00000000000 --- a/TAO/DevGuideExamples/ImplRepo/run_test.pl +++ /dev/null @@ -1,110 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImplRepo_Service"; -$imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImR_Activator"; -$tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr"; - -# Note : We don't actually use SVR, but we need a way to get the -# path to the -ExeSubDir -my $SVR = new PerlACE::Process ('MessengerServer'); -my $server = $SVR->Executable (); - -# The Tests -$implrepo_ior = "implrepo.ior"; -$activator_ior = "activator.ior"; -$messenger_ior = "Messenger.ior"; - -# Make sure the files are gone, so we can wait on them. -unlink $messenger_ior; -unlink $implrepo_ior; -unlink $activator_ior; - -$IR = new PerlACE::Process ($implrepo_server, "-d 1 -orbobjrefstyle url -t 5 -o $implrepo_ior"); -print ">>> " . $IR->CommandLine() . "\n"; -$IR->Spawn(); -if (PerlACE::waitforfile_timed ($implrepo_ior, 10) == -1) { - print STDERR "ERROR: cannot find file <$implrepo_ior>\n"; - $IR->Kill(); - exit 1; -} - -$imr_init_ref = "-ORBInitRef ImplRepoService=file://$implrepo_ior"; - -$ACT = new PerlACE::Process ($imr_activator, "-d 1 -orbobjrefstyle url -o $activator_ior $imr_init_ref"); -print ">>> " . $ACT->CommandLine() . "\n"; -$ACT->Spawn(); -if (PerlACE::waitforfile_timed ($activator_ior, 15) == -1) { - print STDERR "ERROR: cannot find file <$activator_ior>\n"; - $IR->Kill(); - $ACT->Kill(); - exit 1; -} - - -$add_imr = new PerlACE::Process ("$tao_imr", - "$imr_init_ref add MessengerService -c \"$server -orbobjrefstyle url -ORBUseIMR 1 $imr_init_ref\""); -print ">>> " . $add_imr->CommandLine() . "\n"; -# We want the tao_imr executable to be found exactly in the path -# given, without being modified by the value of -ExeSubDir. -# So, we tell its Process object to ignore the setting of -ExeSubDir. - -$add_imr->IgnoreExeSubDir (1); - -## Note : Instead of using tao_imr to generate the ior, it's easy enough -## to just create one by hand. The ior is just a normal corbaloc ior with -## the poa_name of the server and ip address of the imr. -## (ie corbaloc::localhost:8888/Messengerservice) -## Of course, to do this, you'd have to start the imr on port 8888. -## We use the "tao_imr ior" command, because we don't know which port was used. -$add_imr->SpawnWaitKill(10); -$set_ior = new PerlACE::Process ("$tao_imr", - "$imr_init_ref ior MessengerService -f $messenger_ior"); -print ">>> " . $set_ior->CommandLine() . "\n"; -$set_ior->IgnoreExeSubDir (1); -$set_ior->SpawnWaitKill(10); -if (PerlACE::waitforfile_timed ($messenger_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$messenger_ior>\n"; - $IR->Kill(); - $ACT->Kill(); - exit 1; -} - -$C1 = new PerlACE::Process("MessengerClient"); -print ">>> " . $C1->CommandLine() . "\n"; -if ($C1->SpawnWaitKill(10) != 0) { - print "client 1 timed failed\n"; - $IR->Kill (); - $ACT->Kill(); - exit 1; -} - -$shutdown = new PerlACE::Process ("$tao_imr", - "$imr_init_ref shutdown MessengerService"); -$shutdown->IgnoreExeSubDir (1); -$shutdown->SpawnWaitKill(5); - -$C2 = new PerlACE::Process("MessengerClient"); -if ($C2->SpawnWaitKill(5) != 0) { - $IR->Kill (); - $ACT->Kill(); - exit 1; -} - -$shutdown->SpawnWaitKill(5); - -$IR->Kill(); -$ACT->Kill(); - -unlink $messenger_ior; -unlink $implrepo_ior; -unlink $activator_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/InterfaceRepo/IFRBrowser.cpp b/TAO/DevGuideExamples/InterfaceRepo/IFRBrowser.cpp deleted file mode 100644 index 944aef0f190..00000000000 --- a/TAO/DevGuideExamples/InterfaceRepo/IFRBrowser.cpp +++ /dev/null @@ -1,279 +0,0 @@ -// $Id$ - -// -// IFRBrowser.cpp -// -// A rudimentary interface repository -// browser, very rudimentary -// - -#include "tao/IFR_Client/IFR_BasicC.h" -#include "tao/ORB.h" -#include "ace/Log_Msg.h" - -#include <iostream> - -const char* programLabel = "IFR Browser"; - -void listContents(const CORBA::ContainedSeq &repoContents); -void listInterface(CORBA::InterfaceDef_ptr interfaceDef); -void listOperation(CORBA::OperationDescription* operationDescr); -void listParameter(CORBA::ParameterDescription* parameterDescr); - -const char* decodeTypeCode(const CORBA::TypeCode_ptr typeCode); -const char* decodeParameterMode(CORBA::ParameterMode mode); -const char* decodeOperationMode(CORBA::OperationMode mode); - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = - orb->resolve_initial_references("InterfaceRepository"); - - CORBA::Repository_var ifrRepo = CORBA::Repository::_narrow(obj.in()); - - if (CORBA::is_nil(ifrRepo.in())) - { - ACE_DEBUG((LM_ERROR, - ACE_TEXT("(%N) failed to narrow interface repository referece.\n") - )); - return -1; - } - - CORBA::ContainedSeq_var repoContents = ifrRepo->contents(CORBA::dk_all, 1); - - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: the interface repository contains %d elements.\n"), - programLabel, - repoContents->length() - )); - listContents(repoContents.in()); - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "main() Caught CORBA::Exception : " << ex << std::endl; - } - return 1; -} - -void listContents(const CORBA::ContainedSeq& repoContents) -{ - // - // List the contents of each element. - // - for(unsigned int i = 0; i < repoContents.length(); ++i) - { - CORBA::Contained::Description_var desc = repoContents[i]->describe(); - switch(desc->kind) - { - case CORBA::dk_Constant: - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: element[%d] is a constant definition.\n"), - programLabel, - i + 1 - )); - break; - case CORBA::dk_Typedef: - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: element[%d] is a typedef definition.\n"), - programLabel, - i + 1 - )); - break; - case CORBA::dk_Exception: - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: element[%d] is an exception definition.\n"), - programLabel, - i + 1 - )); - break; - case CORBA::dk_Interface: - { - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: element[%d] is an interface definition.\n") - ACE_TEXT("%s: listing element[%d]...\n"), - programLabel, - i + 1, - programLabel, - i + 1 - )); - CORBA::InterfaceDef_var interfaceDef = - CORBA::InterfaceDef::_narrow(repoContents[i]); - listInterface(interfaceDef.in()); - break; - } - case CORBA::dk_Module: { - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: element[%d] is a module definition.\n"), - programLabel, - i + 1 - )); - CORBA::ModuleDef_var moduleDef = - CORBA::ModuleDef::_narrow(repoContents[i]); - CORBA::ContainedSeq_var moduleContents = - moduleDef->contents(CORBA::dk_all,1); - CORBA::String_var moduleId = moduleDef->id(); - CORBA::String_var moduleName = moduleDef->name(); - - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s:\n// %s\nmodule %s\n{\n") - ACE_TEXT("%s: the module contains %d elements.\n"), - programLabel, - moduleId.in(), - moduleName.in(), - programLabel, - moduleContents->length() - )); - listContents(moduleContents.in()); - ACE_DEBUG((LM_INFO, ACE_TEXT("}\n"))); - break; - } - default: - break; - } - } -} - -void listInterface(CORBA::InterfaceDef_ptr interfaceDef) -{ - CORBA::InterfaceDef::FullInterfaceDescription_var fullDescr = - interfaceDef->describe_interface(); - - const char* interfaceName = - fullDescr->name; - const char* interfaceRepoId = - fullDescr->id; - - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s:\n\t// %s\n\tinterface %s\n\t{"), - programLabel, - interfaceRepoId, - interfaceName - )); - - - unsigned int operationsCount; - if ((operationsCount = fullDescr->operations.length()) > 0) - { - for(unsigned int i = 0; i < operationsCount; ++i) - { - listOperation(&(fullDescr->operations[i])); - } - } - - unsigned int attributesCount; - if ((attributesCount = fullDescr->attributes.length()) > 0) - { - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s: %s has %d attribute(s).\n"), - programLabel, - interfaceName, - attributesCount - )); - } - - ACE_DEBUG((LM_INFO, "\n\t}\n")); -} - -void listOperation(CORBA::OperationDescription* operationDescr) -{ - const char* operationName = - operationDescr->name; - const char* operationRepoId = - operationDescr->id; - const char* operationResult = - decodeTypeCode(operationDescr->result.in()); - const char* operationMode = - decodeOperationMode(operationDescr->mode); - - ACE_DEBUG((LM_INFO, - ACE_TEXT("\n\t\t// %s \n\t\t%s %s %s"), - operationRepoId, - operationResult, - operationName, - operationMode - )); - - CORBA::ParDescriptionSeq* params = &(operationDescr->parameters); - CORBA::ULong paramsCount = params->length(); - if (paramsCount > 0) - { - ACE_DEBUG((LM_INFO, "\n\t\t(\n\t\t")); - for(CORBA::ULong i =0; i < paramsCount; ++i) - { - listParameter(&((*params)[i])); - if(i < (paramsCount - 1)) - { - ACE_DEBUG((LM_INFO, ",\n\t\t")); - } - } - ACE_DEBUG((LM_INFO, "\n\t\t);\n")); - } - else - { - ACE_DEBUG((LM_INFO, "();\n")); - } -} - -void listParameter(CORBA::ParameterDescription *parameterDescr) -{ - const char *typCode = - decodeTypeCode(parameterDescr->type.in()); - const char *paramMode = - decodeParameterMode(parameterDescr->mode); - ACE_DEBUG((LM_INFO, - ACE_TEXT("%s %s %s"), - paramMode, - typCode, - parameterDescr->name.in() - )); -} - -const char* decodeTypeCode(const CORBA::TypeCode_ptr typeCode) -{ - const char* code = ""; - if (typeCode->equivalent(CORBA::_tc_void)) { - code = "void"; - } else if (typeCode->equivalent(CORBA::_tc_boolean)) { - code = "boolean"; - } else if (typeCode->equivalent(CORBA::_tc_string)) { - code = "string"; - } - return code; -} - -const char* decodeParameterMode(CORBA::ParameterMode mode) -{ - const char* paramMode; - switch(mode) - { - case CORBA::PARAM_IN: - { - paramMode = "in"; - break; - } - case CORBA::PARAM_OUT: - { - paramMode = "out"; - break; - } - case CORBA::PARAM_INOUT: - { - paramMode = "inout"; - break; - } - default: - paramMode = ""; - } - return paramMode; -} - -const char* decodeOperationMode(CORBA::OperationMode mode) -{ - return (mode == CORBA::OP_NORMAL) ? "synchronous" : "asynchronous"; -} diff --git a/TAO/DevGuideExamples/InterfaceRepo/InterfaceRepo.mpc b/TAO/DevGuideExamples/InterfaceRepo/InterfaceRepo.mpc deleted file mode 100644 index 84c40a3a130..00000000000 --- a/TAO/DevGuideExamples/InterfaceRepo/InterfaceRepo.mpc +++ /dev/null @@ -1,5 +0,0 @@ -// $Id$ - -project(*Browser): taoexe, portableserver, ifr_client { - exename = IFRBrowser -} diff --git a/TAO/DevGuideExamples/InterfaceRepo/run_test.pl b/TAO/DevGuideExamples/InterfaceRepo/run_test.pl deleted file mode 100644 index 70c47951eb8..00000000000 --- a/TAO/DevGuideExamples/InterfaceRepo/run_test.pl +++ /dev/null @@ -1,86 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use Env (TAO_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$status = 0; - -$ifr_iorfile= "if_repo.ior"; - -$ifr_server = "$ENV{TAO_ROOT}/orbsvcs/IFR_Service/IFR_Service"; -$tao_ifr = "$ENV{ACE_ROOT}/bin/tao_ifr"; -$test_idl = "test.idl"; - -$lookup_by_name = ""; -$other = ""; - -for ($i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq "-n") { - $lookup_by_name = "-n"; - } - else { - $other .= $ARGV[$i]; - } -} - -$TAO_IFR = new PerlACE::Process ($tao_ifr); -$IFR = new PerlACE::Process ($ifr_server); -$CL = new PerlACE::Process ("IFRBrowser", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile $lookup_by_name"); - -# We want the tao_ifr executable to be found exactly in the path -# given, without being modified by the value of -ExeSubDir. -# So, we tell its Process object to ignore the setting of -ExeSubDir. - -$TAO_IFR->IgnoreExeSubDir (1); - -unlink $ifr_iorfile; - -$IFR->Spawn (); - -if (PerlACE::waitforfile_timed ($ifr_iorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); - exit 1; -} - -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile $test_idl"); - -$tresult = $TAO_IFR->SpawnWaitKill (30); - -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (test.idl) returned $tresult\n"; - exit 1; -} - -$client = $CL->SpawnWaitKill (5); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -# remove the interface from the Interface Repository. -$TAO_IFR->Arguments ("-ORBInitRef InterfaceRepository=file://$ifr_iorfile -r $test_idl"); - -$tresult = $TAO_IFR->SpawnWaitKill (30); - -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (-r test.idl) returned $tresult\n"; - $status = 1; -} - -$server = $IFR->TerminateWaitKill (5); -if ($server != 0) { - print STDERR "ERROR: IFR returned $server\n"; - $status = 1; -} - -unlink $ifr_iorfile; - -exit $status; - diff --git a/TAO/DevGuideExamples/InterfaceRepo/test.idl b/TAO/DevGuideExamples/InterfaceRepo/test.idl deleted file mode 100644 index 8ac11a758fb..00000000000 --- a/TAO/DevGuideExamples/InterfaceRepo/test.idl +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -// $Id$ - -module warehouse -{ - interface inventory - { - boolean getCDinfo (in string artist, - inout string title, - out float price); - }; -}; - - diff --git a/TAO/DevGuideExamples/NamingService/Messenger/Messenger.idl b/TAO/DevGuideExamples/NamingService/Messenger/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/Messenger/Messenger.mpc b/TAO/DevGuideExamples/NamingService/Messenger/Messenger.mpc deleted file mode 100644 index 46552c8a086..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/Messenger.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(NamingService*Server): namingexe, naming_skel { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(NamingService*Client): namingexe { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/NamingService/Messenger/MessengerClient.cpp b/TAO/DevGuideExamples/NamingService/Messenger/MessengerClient.cpp deleted file mode 100644 index 4f56c28b581..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/MessengerClient.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - // Find the Naming Service - CORBA::Object_var naming_obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root = - CosNaming::NamingContextExt::_narrow(naming_obj.in()); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Resolve the Messenger object - CosNaming::Name name; - name.length( 2 ); - name[0].id = CORBA::string_dup( "example" ); - name[1].id = CORBA::string_dup( "Messenger" ); - CORBA::Object_var obj = root->resolve_str("example/Messenger"); - - // Narrow the Messenger object reference - 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!"); - - // Send a message - messenger->send_message("TAO User", "TAO Test", message.inout()); - - std::cout << "Message was sent" << 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/TAO/DevGuideExamples/NamingService/Messenger/MessengerServer.cpp b/TAO/DevGuideExamples/NamingService/Messenger/MessengerServer.cpp deleted file mode 100644 index 4566177938b..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/MessengerServer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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(); - - // Find the Naming Service - CORBA::Object_var naming_obj = - orb->resolve_initial_references( "NameService" ); - CosNaming::NamingContext_var root = - CosNaming::NamingContext::_narrow( naming_obj.in() ); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Bind the example Naming Context, if necessary - CosNaming::Name name; - name.length( 1 ); - name[0].id = CORBA::string_dup( "example" ); - try { - CORBA::Object_var dummy = root->resolve( name ); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = root->bind_new_context( name ); - } - - // Bind the Messenger object - name.length( 2 ); - name[1].id = CORBA::string_dup( "Messenger" ); - - // Create an object - Messenger_i messenger_servant; - PortableServer::ObjectId_var oid = poa->activate_object(&messenger_servant); - obj = poa->id_to_reference( oid.in() ); - root->rebind(name, obj.in()); - - std::cout << "Messenger object bound in Naming Service" << 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/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.cpp deleted file mode 100644 index 8215d5e4cef..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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 1; - } - diff --git a/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.h b/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.h deleted file mode 100644 index e386c4c71da..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/Messenger_i.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/Messenger/README b/TAO/DevGuideExamples/NamingService/Messenger/README deleted file mode 100644 index 68eec11fbc1..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/README +++ /dev/null @@ -1,45 +0,0 @@ -// $Id$ - -OMG Naming Service - -File: DevGuideExamples/NamingService/Messenger/README - - -The Original Messenger example, introduced in Chapters 4 and 5 -(GettingStartedUNIX and GettingStartedVC), is modified to utilize the -Naming Service. The client now uses the Naming Service rather than -reading the server object's IOR as a string from a file. - -The Client code is stored in: - -DevGuideExamples/NamingService/Messenger/MessengerClient.cpp - -The Server code is stored in: - -DevGuideExamples/NamingService/Messenger/MessengerServer.cpp - - -How to Run ----------- - -To start the Naming_Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the server: ------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the client: ------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - -Exeuction via Perl Script -------------------------- - -A Perl script has been created to automate the three steps shown -above. This script can be run via the following command: - -./run_test.pl - diff --git a/TAO/DevGuideExamples/NamingService/Messenger/run_test.pl b/TAO/DevGuideExamples/NamingService/Messenger/run_test.pl deleted file mode 100644 index 4a2f39045a4..00000000000 --- a/TAO/DevGuideExamples/NamingService/Messenger/run_test.pl +++ /dev/null @@ -1,60 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - - -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; - -unlink $nsiorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Give the server some time -# to bind the object reference -# with the Naming Service -sleep 3; - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); - -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; -} - -# clean-up - -$C->Kill(); -$S->Kill(); -$NS->Kill(); - -unlink $nsiorfile; - -exit 0; - - - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger.idl b/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerClient.cpp b/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerClient.cpp deleted file mode 100644 index bcb73045e27..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerClient.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Naming/Naming_Client.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - // Find the Naming Service - TAO_Naming_Client naming_client; - - if (naming_client.init (orb.in ()) != 0) { - std::cerr << "Could not initialize naming client." << std::endl; - return 1; - } - - // Resolve the Messenger object - CosNaming::Name name; - name.length( 2 ); - name[0].id = CORBA::string_dup( "example" ); - name[1].id = CORBA::string_dup( "Messenger" ); - CORBA::Object_var obj = naming_client->resolve(name); - - // 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() ); - - std::cout << "Message was sent" << std::endl; - } - catch(const CORBA::Exception& ex) { - std::cerr << "Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerServer.cpp b/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerServer.cpp deleted file mode 100644 index 40e46da5588..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/MessengerServer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Naming/Naming_Client.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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(); - - // Find the Naming Service - TAO_Naming_Client naming_client; - - if(naming_client.init(orb.in()) != 0){ - std::cerr << "Could not initialize naming client." << std::endl; - return 1; - } - - // Bind the example Naming Context, if necessary - CosNaming::Name name; - name.length(1); - name[0].id = CORBA::string_dup("example"); - try { - CORBA::Object_var dummy = naming_client->resolve(name); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = naming_client->bind_new_context( name ); - } - - // Bind the Messenger object - name.length( 2 ); - name[1].id = CORBA::string_dup( "Messenger" ); - - // Create an object - Messenger_i servant; - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - obj = poa->id_to_reference(oid.in()); - naming_client->rebind(name, obj.in()); - - std::cout << "Messenger object bound in Naming Service" << 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/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.cpp deleted file mode 100644 index 106a8da3630..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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) -{ - std::cout << "Hello"; -} - -// 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 1; -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.h b/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.h deleted file mode 100644 index e386c4c71da..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/Messenger_i.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/Naming_Client/Naming_Client.mpc b/TAO/DevGuideExamples/NamingService/Naming_Client/Naming_Client.mpc deleted file mode 100644 index 042d4c4b5fc..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/Naming_Client.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): namingexe, naming_skel { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): namingexe { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/README b/TAO/DevGuideExamples/NamingService/Naming_Client/README deleted file mode 100644 index d3b94d1a528..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/README +++ /dev/null @@ -1,47 +0,0 @@ -// $Id$ - -OMG Naming Service - -File: DevGuideExamples/NamingService/Naming_Client/README - - -The example in this directory is a modification of the code given -in the NamingService/Messenger example. It illustrates how to use the -TAO_Naming_Client class for accessing the Naming Service. This class -simplifies the interface for accessing and using the Naming Service. -The TAO_Naming_Client class is used by both the Client and -Server to access the Naming Service. - -The Client code is stored in: - -DevGuideExamples/NamingService/Naming_Client/MessengerClient.cpp - -The Server code is stored in: - -DevGuideExamples/NamingService/Naming_Client/MessengerServer.cpp - - -How to Run ----------- - -To start the Naming_Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior - -To start the server: ------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the client: ------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - -Exeuction via Perl Script -------------------------- - -A Perl script has been created to automate the three steps shown -above. This script can be run via the following command: - -./run_test.pl - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Client/run_test.pl b/TAO/DevGuideExamples/NamingService/Naming_Client/run_test.pl deleted file mode 100644 index 8bae3ffa518..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Client/run_test.pl +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - - -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; - -$nsiorfile = PerlACE::LocalFile ("ns.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; - -unlink $nsiorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) { - print STDERR "ERROR: cannot find file <$nsiorfile>\n"; - $NS->Kill(); - exit 1; -} - -# start MessengerServer -$MessengerServer = "MessengerServer"; -$S = new PerlACE::Process($MessengerServer, $arg_ns_ref); -$S->Spawn(); - -# Give the server some time -# to bind the object reference -# with the Naming Service -sleep 3; - -# start MessengerClient -$MessengerClient = "MessengerClient"; -$C = new PerlACE::Process($MessengerClient, $arg_ns_ref ); - -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; -} - - -# clean-up - -$C->Kill(); -$S->Kill(); -$NS->Kill(); - -unlink $nsiorfile; - -exit 0; - - - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger.idl b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp deleted file mode 100644 index e942c7b662b..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -#include <fstream> -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - char url[200]; - std::ifstream iorFile( "url.ior" ); - iorFile >> url; - iorFile.close(); - - std::cout << "url: " << url << std::endl; - - // Find the Naming Service & the Message Server name in it - CORBA::Object_var obj = orb->string_to_object(url); - - // 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()); - - std::cout << "Message was sent" << std::endl; - - std::cout << "Now try the same thing with the simple name." << std::endl; - obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root = - CosNaming::NamingContextExt::_narrow(obj.in()); - obj = root->resolve_str("Simple/Messenger"); - messenger = Messenger::_narrow(obj.in()); - messenger->send_message( "ACE User", "TAO Test", message.inout()); - - std::cout << "Message was sent" << std::endl; - } - catch(const CORBA::Exception& ex) { - std::cerr << "Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp deleted file mode 100644 index 95880c8d32f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -#include <fstream> -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - //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(); - - // Find the Naming Service - obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var root = - CosNaming::NamingContextExt::_narrow(obj.in()); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Bind a new context. - CosNaming::Name name; - name.length( 1 ); - name[0].id = CORBA::string_dup( "root.esc-dot" ); - name[0].kind = CORBA::string_dup( "kind1" ); - - try { - obj = root->resolve(name); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = root->bind_new_context(name); - } - - name.length( 2 ); - name[1].id = CORBA::string_dup( "leaf/esc-slash" ); - name[1].kind = CORBA::string_dup( "kind2" ); - - // Create an object - Messenger_i servant; - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var messenger_obj = poa->id_to_reference(oid.in()); - root->rebind(name, messenger_obj.in()); - - // Also try rebinding to a simple path. - CosNaming::Name_var simp_name = root->to_name("Simple"); - try { - obj = root->resolve(simp_name.in()); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = - root->bind_new_context(simp_name.in()); - } - simp_name = root->to_name("Simple/Messenger"); - root->rebind(simp_name.in(), messenger_obj.in()); - - // Convert Name to String Name. - CORBA::String_var str_name = root->to_string(name); - std::cout << "str_name: " << str_name.in() << std::endl; - CORBA::String_var str_simple = root->to_string(simp_name.in()); - std::cout << "simple: " << str_simple.in() << std::endl; - - // Convert String Name to Name. - CosNaming::Name_var tname = root->to_name(str_name.in()); - - std::cout << "converted back to a CosNaming::Name: " << std::endl; - std::cout << " name[0] = " << (* tname)[0].id.in() << " , " - << (* tname)[0].kind.in() << std::endl; - std::cout << " name[1] = " << (* tname)[1].id.in() << " , " - << (* tname)[1].kind.in() << std::endl; - - // Find the application object by resolve_str. - try { - obj = root->resolve_str(str_name.in()); - } - catch(const CosNaming::NamingContext::NotFound&) { - std::cerr<<"Couldn't resolve the string name: " << str_name << std::endl; - return 1; - } - - // Create an URL string for application object. - CORBA::String_var address = CORBA::string_dup (":localhost:2809/key/str"); - - std::cout << "call to_url(\"" << address.in() << "\"" << std::endl; - std::cout << " ,\"" << str_simple.in() << "\")"<< std::endl; - - CORBA::String_var url_string = root->to_url(address.in(), str_simple.in()); - - std::cout << "to_url result: " << url_string.in() << std::endl; - - - // Write NS url to a file to let client read NS URL to get - // NamingContext reference. - CORBA::String_var ns_addr = CORBA::string_dup(":localhost:2809"); - - std::cout << "call to_url(\"" <<ns_addr.in() << "\",\"" - << str_simple.in() << "\")"<< std::endl; - - CORBA::String_var url = root->to_url(ns_addr.in(), str_simple.in()); - std::cout << "to_url result: " << url.in() << std::endl; - - - std::ofstream iorFile("url.ior"); - iorFile << url.in() << std::endl; - iorFile.close(); - - std::cout << "Naming Service URL written to file url.ior" << 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/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.cpp deleted file mode 100644 index d40e8496387..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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 1; - } - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.h b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.h deleted file mode 100644 index b021dcaa44c..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Messenger_i.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc deleted file mode 100644 index 042d4c4b5fc..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/Naming_Context_Ext.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): namingexe, naming_skel { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): namingexe { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/README b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/README deleted file mode 100644 index c816b68c778..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/README +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -DevGuideExamples/NamingService/Naming_Context_Ext/README - -The example in this directory illustratues how to convert between CosNames, -Stringified Names, and URLs. - -A Name can be converted to a stringified Name by to_string operation. A stringified -Name can be converted to a Name by to_name operation. The resolve_str operation -resolves an object by passing a strigified Name. - -The MessengerServer writes its corbaname URL to a file by calling to_url and -the MessengerClient reads the URL file to get the MessengerServer object reference. - - - -How to Run: ------------ -To start the Naming_Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -ORBEndPoint iiop://localhost:2809 & - - -To start the server: ------------------- -./MessengerServer -ORBInitRef NameService=iiop://localhost:2809/NameService - - -To start the client: ------------------- -./MessengerClient - - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl b/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl deleted file mode 100644 index 5c62e4de560..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl +++ /dev/null @@ -1,56 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsref="-ORBInitRef NameService=iiop://localhost:2809/NameService"; -$nsior = "ns.ior"; -$ior="url.ior"; -unlink $ior; - -# start Naming Service -unlink($nsior); -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBEndPoint iiop://localhost:2809 -o $nsior"); -$NS->Spawn(); - -if (PerlACE::waitforfile_timed ($nsior, 10) == -1) { - print STDERR "ERROR: cannot find IOR file <$nsior>\n"; - $NS->Kill (); - exit 1; -} - -# start MessengerServer -$MessengerServer = "MessengerServer"; -$S = new PerlACE::Process($MessengerServer, $nsref ); -$S->Spawn(); -if (PerlACE::waitforfile_timed ($ior, 15) == -1) { - print STDERR "ERROR: cannot find file $ior\n"; - $NS->Kill(); - $S->Kill(); - exit 1; -} - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $nsref); -if ($C->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $S->Kill(); - $NS->Kill(); - exit 1; -} - -# clean-up -$S->Kill(); -$NS->Kill(); -unlink $ior; - -exit 0; - - - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger.idl b/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.cpp b/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.cpp deleted file mode 100644 index 030214872d7..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// $Id$ - -#include "MessengerTask.h" -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -MessengerTask::MessengerTask() -{ - // cast away constness to make Sun CC family of compilers happy. - char* argv[] = {const_cast<char *>("Messenger"), 0 }; - int argc = 1; - orb_ = CORBA::ORB_init(argc, argv, "ServerORB"); -} - -void MessengerTask::end() -{ - orb_->shutdown(0); - this->wait(); -} - -int MessengerTask::svc() -{ - - try { - // 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(); - - // Find the Naming Service - obj = orb_->resolve_initial_references("NameService"); - CosNaming::NamingContext_var root = - CosNaming::NamingContext::_narrow(obj.in()); - - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - // Bind the example Naming Context, if necessary - CosNaming::Name name; - name.length(1); - name[0].id = CORBA::string_dup("example"); - try { - root->resolve(name); - } - catch(const CosNaming::NamingContext::NotFound&) { - root->bind_new_context(name); - } - - // Bind the Messenger object - name.length(2); - name[1].id = CORBA::string_dup("Messenger"); - - // Create an object - Messenger_i servant; - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - obj = poa->id_to_reference(oid.in()); - root->rebind(name, obj.in()); - - std::cout << "Messenger object bound in Naming Service" << std::endl; - - // Normally we run the orb and the orb is shutdown by - // calling MessengerTask::end(). To simplify the coordination - // between the main thread and this Messenger thread, specify - // the time period to let the Messenger thread finish by itself. - // Accept requests - ACE_Time_Value tv(1); - orb_->run(tv); - orb_->destroy(); - - return 0; - } - catch(const CORBA::Exception& ex) { - std::cerr << "CORBA exception: " << ex << std::endl; - } - - return -1; -} - - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.h b/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.h deleted file mode 100644 index bc5cdebca15..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/MessengerTask.h +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -#ifndef MESSENGERTASK_H -#define MESSENGERTASK_H - -#include "tao/corba.h" -#include "ace/Task.h" - -class MessengerTask : public ACE_Task_Base -{ -public: - MessengerTask(); - virtual int svc(); - - void end(); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.cpp deleted file mode 100644 index 21edede8773..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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 1; - } - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.h b/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.h deleted file mode 100644 index b021dcaa44c..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/Messenger_i.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/Naming_Server/NamingMessenger.cpp b/TAO/DevGuideExamples/NamingService/Naming_Server/NamingMessenger.cpp deleted file mode 100644 index 35c41b37b58..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/NamingMessenger.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -#include "NamingTask.h" -#include "MessengerTask.h" -#include "ace/OS.h" - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - // Start the Naming Service task - NamingTask namingService(argc, argv); - namingService.activate(); - // Wait for the Naming Service initialized. - namingService.waitInit(); - - // Start the Messenger task - MessengerTask messenger; - messenger.activate(); - - // Wait the Messenger task finish. - messenger.wait(); - // Shutdown the Naming Service. - namingService.end(); - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.cpp b/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.cpp deleted file mode 100644 index 6f2c99971e9..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// $Id$ - -#include "NamingTask.h" -#include "orbsvcs/Naming/Naming_Server.h" -#include "ace/OS_NS_unistd.h" -#include <iostream> - -NamingTask::NamingTask (int argc, ACE_TCHAR** argv) -: argc_ (argc), - argv_ (argv), - initialized_(false) -{ - orb_ = CORBA::ORB_init(argc, argv, "NamingORB"); -} - -void NamingTask::waitInit () -{ - // Wait for Naming Service initialized. - while (! initialized_) { - ACE_OS::sleep(ACE_Time_Value(0, 100 * 1000)); - } -} - -void NamingTask::end() -{ - orb_->shutdown(0); - this->wait(); -} - -int NamingTask::svc() -{ - try { - // 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 poaManager = poa->the_POAManager(); - poaManager->activate(); - - // Initialize the naming service - // We are not going to look for other naming servers - TAO_Naming_Server naming; - if (naming.init(orb_.in(), - poa.in(), - ACE_DEFAULT_MAP_SIZE, - 0, - 0) == 0) { - std::cout << "The Naming Service Task is ready." << std::endl; - initialized_ = true; - // Accept requests - orb_->run(); - orb_->destroy(); - return 0; - } - else { - std::cerr << "Unable to initialize the Naming Service." << std::endl; - } - } - catch(const CORBA::Exception& ex) { - std::cerr << "NamingTask::svc() CORBA::Exception: " << ex << std::endl; - } - - return -1; -} - diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.h b/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.h deleted file mode 100644 index 647b32f0a8f..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/NamingTask.h +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#ifndef NAMINGTASK_H -#define NAMINGTASK_H - -#include "tao/corba.h" -#include "ace/Task.h" - -class NamingTask : public ACE_Task<ACE_MT_SYNCH> -{ -public: - NamingTask (int argc, ACE_TCHAR** argv); - virtual int svc(); - void waitInit (); - void end(); - -private: - int argc_; - ACE_TCHAR **argv_; - CORBA::ORB_var orb_; - bool initialized_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/Naming_Server.mpc b/TAO/DevGuideExamples/NamingService/Naming_Server/Naming_Server.mpc deleted file mode 100644 index 6a91c764766..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/Naming_Server.mpc +++ /dev/null @@ -1,5 +0,0 @@ -// $Id$ - -project(*Messenger): namingexe, naming_serv { - requires += threads -} diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/README b/TAO/DevGuideExamples/NamingService/Naming_Server/README deleted file mode 100644 index b98ba3a2ee3..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/README +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ - -OMG Naming Service - -File: DevGuideExamples/NamingService/Naming_Server/README - -The example in NamingService/Naming_Client is modified to utilize -the TAO_Naming_Server class. This class enables the Naming Service -to easily be collocated within an application. In this example, -the Naming Service is collocated with a server that supports the -Messenger Interface described in GettingStartedUNIX (or GettingStartedVC). - -The Server code is stored in: - -DevGuideExamples/NamingService/Naming_Server/MessengerServer.cpp - - -How to Run ----------- - -To start the server: ------------------- -./MessengerServer -o ns.ior - -To start the client: ------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - -Exeuction via Perl Script -------------------------- - -A Perl script has been created to automate the three steps shown -above. This script can be run via the following command: - -./run_test.pl - - -NOTE: This example has been changed from the example that appears in the -dev-guide in order to pass command line parameters to the thread -that runs the naming server. diff --git a/TAO/DevGuideExamples/NamingService/Naming_Server/run_test.pl b/TAO/DevGuideExamples/NamingService/Naming_Server/run_test.pl deleted file mode 100644 index e0733c60dc9..00000000000 --- a/TAO/DevGuideExamples/NamingService/Naming_Server/run_test.pl +++ /dev/null @@ -1,20 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$CS = new PerlACE::Process("NamingMessenger"); - -if ($CS->SpawnWaitKill(10) != 0) { - exit 1; -} - -exit 0; - - - diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger.idl b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerClient.cpp b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerClient.cpp deleted file mode 100644 index e71d7dc2b36..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerClient.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - const ACE_TCHAR* url = ACE_TEXT("corbaloc:rir:/NameService"); // default URL to InitRef - if ( argc < 2 ) { - std::cout << "Defaulting URL to " << url << std::endl; - std::cout << "Usage: " << argv[0] - << " [corbaloc URL] [-ORB options]" << std::endl; - } - else { - url = argv[1]; - } - - // Find the Naming Service - CORBA::Object_var obj = orb->string_to_object(url); - - CosNaming::NamingContextExt_var root = - CosNaming::NamingContextExt::_narrow(obj.in()); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Resolve the Messenger object - obj = root->resolve_str("example/Messenger"); - - // 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()); - - std::cout << "Message was sent" << std::endl; - } - catch(const CORBA::Exception& ex) { - std::cerr << "client:Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerServer.cpp b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerServer.cpp deleted file mode 100644 index ab882806879..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/MessengerServer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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(); - - - // Find the Naming Service - obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var root = - CosNaming::NamingContext::_narrow(obj.in()); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Bind the example Naming Context, if necessary - CosNaming::Name name; - name.length( 1 ); - name[0].id = CORBA::string_dup("example"); - try { - obj = root->resolve(name); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = root->bind_new_context(name); - } - - // Bind the Messenger object - name.length(2); - name[1].id = CORBA::string_dup("Messenger"); - - // Create an object - Messenger_i servant; - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - obj = poa->id_to_reference(oid.in()); - Messenger_var messenger = Messenger::_narrow(obj.in()); - root->rebind(name, messenger.in()); - - std::cout << "Messenger object bound in Naming Service" << std::endl; - - // Accept requests - orb->run(); - orb->destroy(); - } - catch(const CORBA::Exception& ex) { - std::cerr << "server: Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.cpp deleted file mode 100644 index 8f75d589951..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- 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 1; -} - diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.h b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.h deleted file mode 100644 index e386c4c71da..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/Messenger_i.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/README b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/README deleted file mode 100644 index 72ac810d00f..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/README +++ /dev/null @@ -1,173 +0,0 @@ -// $Id$ - -DevGuideExamples/NamingService/corbaloc_Messenger/README -// $Id$ - -The example in this directory extends the example in GettingStartedUNIX -(or GettingStartedVC) to use the Naming_Service -and calling string_to_object instead of calling resolve_initial_references -to get the NameService object reference. - -This example only differs from the NamingService/Messenger example by a few lines -in the MessengerClient.cpp. (All other source files should be the same.) - -How to Run: ------------ -To start the Naming_Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -m 1 & - -Note: Must start the Naming_Service using multicast (-m 1) - for the default initial reference for NameService to work. - -To start the server: ------------------- -./MessengerServer -To start the client: ------------------- -./MessengerClient - - -This MessengerClient will optionally take parameter that is a URL (corbaloc:) -that addresses the Naming_Service. - -The MessengerServer and MessengerClient may also take an -ORBInitRef option -to help qualify the address of the Naming_Service. - -Here are some examples: - -REM start the name server -cd/d %TAO_ROOT%\orbsvcs\Naming_Service -title NS -Naming_Service -ORBEndpoint iiop://localhost:2809 -m 0 - -REM start the example server -cd/d %EXAMPLES%\NamingService\corbaloc_Messenger\Debug -title server -REM use -ORBInitRef with IIOP -MessengerServer -ORBInitRef NameService=iiop://localhost:2809/NameService - -REM use -ORBDefaultInitRef with specific host and port -MessengerServer -ORBDefaultInitRef iiop://localhost:2809 - -REMuse -ORBDefaultInitRef <port 2809 is the default if not specified. -MessengerServer -ORBDefaultInitRef corbaloc::localhost - -REM crashes - ? is this a bug? -MessengerServer -ORBDefaultInitRef corbaloc:rir:/ - -REM -ORBInitRef with corbaloc and default port -MessengerServer -ORBInitRef NameService=corbaloc::localhost/NameService -REM and specific port -MessengerServer -ORBInitRef NameService=corbaloc::localhost:2809/NameService - -REM crashes -MessengerServer -ORBInitRef NameService=corbaloc:rir/NameService - -REM start the client -cd/d %EXAMPLES%\NamingService\corbaloc_Messenger\Debug -title client -MessengerClient -ORBInitRef NameService=iiop://localhost:2809/NameService corbaloc:rir:/NameService - - -REM use -ORBDefaultInitRef with specific host and default port == 2809 -MessengerClient -ORBDefaultInitRef corbaloc::localhost corbaloc:rir:/NameService - -REM use a corbaloc that does not require -ORBDefaultInitRef (port defaults) -MessengerClient corbaloc::localhost/NameService - -=========================== -REM !!! kill the previous Naming_Service and MessengerServer !!! - -REM start the name server (at another address) -cd/d %TAO_ROOT%\orbsvcs\Naming_Service -Naming_Service -ORBEndpoint iiop://localhost:9999 -m 0 - -REM start the example server -cd/d %EXAMPLES%\NamingService\corbaloc_Messenger\Debug -MessengerServer -ORBInitRef NameService=iiop://localhost:9999/NameService - - - -REM start the client -cd/d %EXAMPLES%\NamingService\corbaloc_Messenger\Debug -MessengerClient -ORBInitRef NameService=iiop://localhost:9999/NameService - - - -MessengerClient -ORBInitRef NameService=iiop://localhost:9999/NameService -Usage: MessengerClient [-ORB options] [corbaname URL for the name service] - -MessengerClient -ORBInitRef NameService=iiop://localhost:9999/NameService corbaloc:rir:/NameService -Message was sent - -MessengerClient -ORBInitRef NameService=iiop://localhost:9999/NameService corbaloc:rir:/ -Message was sent - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc:rir:/ -Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0) - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc:iiop:localhost:9999/NameService -Message was sent - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc:localhost:9999/NameService -TAO (249|231) no usable transport protocol was found. -Caught a CORBA exception: BAD_PARAM (IDL:omg.org/CORBA/BAD_PARAM:1.0) - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc::localhost:9999/NameService -Message was sent - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc::1.0\localhost:9999/NameService -Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0) - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc::1.0\@localhost:9999/NameService -Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0) - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc::localhost:9999/NameService -Message was sent - -MessengerClient -ORBInitRef NameService=iiop://localhost:9669/NameService corbaloc::localhost/NameService -Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0) - - - -===================== IIOPLOC ================= -REM iioploc: is TAO specific and deprecated - -REM start the name server -cd/d %TAO_ROOT%\orbsvcs\Naming_Service -title NS -Naming_Service -ORBEndpoint iiop://localhost:2809 -m 0 - -REM -ORBInitRef with iioploc (TAO specific and deprecated) -MessengerServer -ORBInitRef NameService=iioploc://localhost:2809/NameService - -cd/d %EXAMPLES%\NamingService\corbaloc_Messenger\Debug -title client -MessengerClient iioploc://localhost:2809/NameService - -===== MCAST example ====== -!!! only on platforms supporting multicast (not Windows) !!! - - -# start the name server using MultiCast -cd $TAO_ROOT/orbsvcs/Naming_Service -Naming_Service -m 1 - -# start the example server -cd $EXAMPLES/NamingService/corbaloc_Messenger -MessengerServer - -cd $EXAMPLES/NamingService/corbaloc_Messenger -MessengerClient - - ---- specify the multicast address. -Naming_Service -m 1 -ORBNameServicePort 12345 -# -ORBNameServicePort 12345 is ingored if -m 1 is not specified. - - -MessengerServer -ORBInitRef NameService=mcast://:12345::/NameService - - -<TBD more using URL parameter> diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc deleted file mode 100644 index 042d4c4b5fc..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/corbaloc_Messenger.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): namingexe, naming_skel { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): namingexe { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl b/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl deleted file mode 100644 index 6df4159cd9f..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl +++ /dev/null @@ -1,111 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - - -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBEndpoint iiop://$TARGETHOSTNAME:$def_port"); -$NS->Spawn(); - -sleep(1); - -# List of tests to test corbaloc URL syntax. -@corbaloc_servers = ( "-ORBDefaultInitRef corbaloc::$TARGETHOSTNAME", - "-ORBInitRef NameService=corbaloc::$TARGETHOSTNAME/NameService", - "-ORBInitRef NameService=corbaloc::$TARGETHOSTNAME:$def_port/NameService"); - - -@servers_comments = ( "Using -ORBDefaultInitRef with default port $def_port and default transport IIOP: \n", - "Using -ORBInitRef with corbaloc URL: \n", - "Using -ORBInitRef with corbaloc URL and specified port: \n"); - -@corbaloc_clients = ( "corbaloc::$TARGETHOSTNAME/NameService", - "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService corbaloc:rir:/NameService"); - -@clients_comments = ( "Using the URL parameter: \n"); - "Using a corbaloc:rir form URL(must specify initial reference): \n", - - - - -$MessengerServer= "MessengerServer"; -$MessengerClient= "MessengerClient"; - -$test_number = 0; - -foreach $o (@corbaloc_servers) { - - # Run messenger server for each test. - #print "Start $MessengerServer $o \n"; - $SR = new PerlACE::Process($MessengerServer, $o); - $SR->Spawn(); - - sleep(1); - - #print "Start $MessengerClient \n"; - $CL = new PerlACE::Process($MessengerClient, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); - $test_number++; - - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - - print "======================================\n"; - print "Finish Test $test_number: $servers_comments[$test_number] \n"; - print " $MessengerServer $o\n"; - print "======================================\n\n"; - - $SR->Kill(1); -} - - -#print "Start $MessengerServer \n"; -$SR = new PerlACE::Process($MessengerServer, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port"); -$SR->Spawn(); - -sleep(1); - -$i = 0; -foreach $o (@corbaloc_clients) { - - # Run the client for each test. - #print "Start $MessengerClient $o \n"; - $CL = new PerlACE::Process($MessengerClient, $o); - - - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - - $test_number++; - print "======================================\n"; - print "Finish Test $test_number: $clients_comments[$i]\n"; - print " $MessengerClient $o"; - print "\n======================================\n\n"; - - $i ++; -} - - -# clean up - -$SR->Kill(); -$NS->Kill(); - -exit 0; diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger.idl b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger.idl deleted file mode 100644 index 0af8b9e9c0f..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerClient.cpp b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerClient.cpp deleted file mode 100644 index 9c8104ebaa5..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerClient.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - const ACE_TCHAR *url = ACE_TEXT("corbaname:rir:#example/Messenger"); // default URL to InitRef - if ( argc < 2 ) { - std::cout << "Defaulting URL to " << url << std::endl; - std::cout << "Usage: " << argv[0] - << " [-ORB options] [corbaname URL for message server]" << std::endl; - } - else { - url = argv[1]; - } - - // Find the Naming Service & the Message Server name in it - CORBA::Object_var obj = orb->string_to_object(url); - - // 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() ); - - std::cout << "Message was sent" << std::endl; - } - catch(const CORBA::Exception& ex) { - std::cerr << "client:Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp deleted file mode 100644 index dfabdf2746e..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -#include "Messenger_i.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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(); - - // Find the Naming Service - obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var root = - CosNaming::NamingContext::_narrow(obj.in()); - if (CORBA::is_nil(root.in())) { - std::cerr << "Nil Naming Context reference" << std::endl; - return 1; - } - - // Bind the example Naming Context, if necessary - CosNaming::Name name; - name.length( 1 ); - name[0].id = CORBA::string_dup("example"); - try { - CORBA::Object_var dummy = root->resolve(name); - } - catch(const CosNaming::NamingContext::NotFound&) { - CosNaming::NamingContext_var dummy = root->bind_new_context( name ); - } - - // Bind the Messenger object - name.length( 2 ); - name[1].id = CORBA::string_dup("Messenger"); - - // Create an object - Messenger_i servant; - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - obj = poa->id_to_reference(oid.in()); - Messenger_var messenger = Messenger::_narrow(obj.in()); - root->rebind(name, messenger.in()); - - std::cout << "Messenger object bound in Naming Service" << std::endl; - - // Accept requests - orb->run(); - orb->destroy(); - } - catch(const CORBA::Exception& ex) { - std::cerr << "server:Caught a CORBA::Exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.cpp b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.cpp deleted file mode 100644 index fd6a487bd02..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- 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 1; - } - diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.h b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.h deleted file mode 100644 index 0a3c9f1a2e8..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/Messenger_i.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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/TAO/DevGuideExamples/NamingService/corbaname_Messenger/README b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/README deleted file mode 100644 index 4f530421b08..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/README +++ /dev/null @@ -1,65 +0,0 @@ -// $Id$ - -DevGuideExamples/NamingService/corbaname_Messenger/README - -The example in this directory extends the example in GettingStartedUNIX -(or GettingStartedVC) to use the Naming_Service -and calling string_to_object instead of calling resolve_initial_references -to get the NameService object reference and look up the service in the Naming_Service. - -This example only differs from the NamingService/Messenger example by a few lines -in the MessengerClient.cpp. (All other source files should be the same.) - -How to Run: ------------ -To start the Naming_Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service & - -To start the server: ------------------- -./MessengerServer - -To start the client: ------------------- -./MessengerClient - - -This MessengerClient will optionally take parameter that is a URL (corbaname:) -that addresses the Naming_Service and the MessengerServer within it. - -The MessengerServer and MessengerClient may also take an -ORBInitRef option -to help qualify the address of the Naming_Service. - -Here are some examples: - -REM start the name server -cd/d %TAO_ROOT%\orbsvcs\Naming_Service -title NS -Naming_Service -ORBEndpoint iiop://localhost:2809 -m 0 - -REM start the example server -cd/d %EXAMPLES%\NamingService\corbaname_Messenger\Debug -title server -REM use -ORBInitRef with IIOP -MessengerServer -ORBInitRef NameService=iiop://localhost:2809/NameService - - - -REM start the client -cd/d %EXAMPLES%\NamingService\corbaname_Messenger\Debug -title client - -REM use a corbaname that does not require -ORBDefaultInitRef -MessengerClient corbaname:iiop:localhost:2809#example/Messenger - -REM defaults to iiop protocol -MessengerClient corbaname::localhost:2809#example/Messenger - -REM default protocol (iiop) and default port (2809) -MessengerClient corbaname::localhost#example/Messenger - - - -REM use RIR -MessengerClient -ORBInitRef NameService=iiop://localhost:2809/NameService corbaname:rir:#example/Messenger diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/corbaname_Messenger.mpc b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/corbaname_Messenger.mpc deleted file mode 100644 index 042d4c4b5fc..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/corbaname_Messenger.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): namingexe, naming_skel { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): namingexe { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl b/TAO/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl deleted file mode 100644 index 8aa19b03646..00000000000 --- a/TAO/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl +++ /dev/null @@ -1,72 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - - -$TARGETHOSTNAME = "localhost"; -$def_port = 2809; -$nsior = "ns.ior"; - -# start Naming Service -unlink($nsior); -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-ORBEndpoint iiop://$TARGETHOSTNAME:$def_port -o $nsior"); -$NS->Spawn(); - -if (PerlACE::waitforfile_timed ($nsior, 10) == -1) { - print STDERR "ERROR: cannot find IOR file <$nsior>\n"; - $NS->Kill (); - exit 1; -} - -# start the server -print "Start Messenger Server \n"; -$SR = new PerlACE::Process("MessengerServer", - "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService"); -$SR->Spawn(); -sleep(2); - - -@corbaname_clients = ("corbaname:iiop:$TARGETHOSTNAME:2809#example/Messenger", - "corbaname::$TARGETHOSTNAME:2809#example/Messenger", - "corbaname::$TARGETHOSTNAME#example/Messenger", - "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:2809/NameService corbaname:rir:#example/Messenger"); - -@clients_comments = ( "Using a corbaname that does not require -ORBDefaultInitRef: \n", - "Using defaults to iiop protocol: \n", - "Using default protocol (iiop) and default port ($def_port): \n", - "Using Resolve Initial Reference form(must tell ORB where NS is located with -ORBInitRef)\n"); - -# Run the client for each of the corbaname test. -$test_number = 0; -foreach $o (@corbaname_clients) { - - $CL = new PerlACE::Process("MessengerClient", $o); - - if ($CL->SpawnWaitKill(15) != 0) { - print STDERR "ERROR: client failed\n"; - $SR->Kill(); - $NS->Kill(); - exit 1; - } - - $test_number++; - - print "======================================\n"; - print "Finish Test $test_number: $clients_comments[$test_number]\n"; - print " $CL_NAME $o\n"; - print "======================================\n\n"; - -} - -# clean up -$SR->Kill (); -$NS->Kill (); - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequence.mpc b/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequence.mpc deleted file mode 100644 index 7cd986e6a2d..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequence.mpc +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -project(*Server): portableserver, orbsvcsexe, notification_skel, naming { - Source_Files { - EventSequenceSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): orbsvcsexe, notification, naming { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): portableserver, orbsvcsexe, notification_skel, naming { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - EventSequenceConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.cpp deleted file mode 100644 index 90be87592af..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ - -#include "EventSequenceConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -EventSequenceConsumer_i::EventSequenceConsumer_i(CORBA::ORB_ptr orb) -: orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -EventSequenceConsumer_i::push_structured_events ( - const CosNotification::EventBatch& events - ) -{ - - std::cout << "events received " << std::endl; - - const char* value = 0; - - for (unsigned int n = 0; n < events.length(); ++n) { - for (unsigned int i = 0; i < events[n].filterable_data.length(); ++i) { - events[n].filterable_data[i].value >>= value; - std::cout << events[n].filterable_data[i].name.in() << "\t" << value << std::endl; - } - } -} - -void -EventSequenceConsumer_i::disconnect_sequence_push_consumer () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id(); - poa->deactivate_object(objectId.in()); - -} - -void -EventSequenceConsumer_i::offer_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.h b/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.h deleted file mode 100644 index e8bdfef2775..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceConsumer_i.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class EventSequenceConsumer_i : public POA_CosNotifyComm::SequencePushConsumer -{ -public: - EventSequenceConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_events ( - const CosNotification::EventBatch & events - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_sequence_push_consumer (); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.cpp deleted file mode 100644 index 4bd0dee0204..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -#include "EventSequenceSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -EventSequenceSupplier_i::EventSequenceSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -EventSequenceSupplier_i::disconnect_sequence_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -EventSequenceSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} - diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.h b/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.h deleted file mode 100644 index 3a5a153a42e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/EventSequenceSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class EventSequenceSupplier_i : public POA_CosNotifyComm::SequencePushSupplier -{ -public: - // Constructor - EventSequenceSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_sequence_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger.idl b/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger.idl deleted file mode 100644 index c7e25db57d8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger.idl +++ /dev/null @@ -1,9 +0,0 @@ -// $Id$ - -// messenger.idl -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp deleted file mode 100644 index eeea6d8701a..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->string_to_object("file://Messenger.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; - } - - CORBA::String_var message = - CORBA::string_dup("Where can I get TAO?"); - - messenger->send_message ( - "person@company.com", - "OCI's Distribution of TAO", - message.inout()); - } - catch(const CORBA::Exception& ex) - { - std::cerr << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerConsumer.cpp deleted file mode 100644 index 1196078a73f..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerConsumer.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "EventSequenceConsumer_i.h" -#include <iostream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - - CosNaming::NamingContextExt_var naming_context = - CosNaming::NamingContextExt::_narrow(obj.in()); - - obj = naming_context->resolve_str("MyEventChannel"); - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(obj.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - obj = orb->resolve_initial_references("RootPOA"); - - PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in()); - - EventSequenceConsumer_i servant(orb.in()); - - PortableServer::ObjectId_var objectId = poa->activate_object(&servant); - - obj = poa->id_to_reference (objectId.in()); - CosNotifyComm::SequencePushConsumer_var consumer = - CosNotifyComm::SequencePushConsumer::_narrow(obj.in()); - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::SEQUENCE_EVENT, - consumeradmin_proxy_id); - - CosNotifyChannelAdmin::SequenceProxyPushSupplier_var supplier_proxy = - CosNotifyChannelAdmin::SequenceProxyPushSupplier::_narrow(proxy_supplier.in()); - - supplier_proxy->connect_sequence_push_consumer(consumer.in()); - - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - supplier_proxy->subscription_change(added, removed); - - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - - poa_manager->activate(); - - orb->run(); - - orb->destroy(); - - return 0; - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - } - return 1; -} diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp deleted file mode 100644 index 640f0013c6e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContextExt_var rootNC = - CosNaming::NamingContextExt::_narrow(obj.in()); - - obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate(); - - Messenger_i messenger_servant (orb.in()); - PortableServer::ObjectId_var oid = poa->activate_object (&messenger_servant); - obj = poa->id_to_reference(oid.in()); - CORBA::String_var str = orb->object_to_string (obj.in()); - - std::ofstream iorFile ("Messenger.ior"); - iorFile << str.in() << std::endl; - iorFile.close(); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - orb->run(); - orb->destroy(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << " Caught Exception: " << ex << std::endl; - return 1; - } - - return 0; - -} - - - - - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.cpp deleted file mode 100644 index 17dea7b9aff..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "Messenger_i.h" -#include "EventSequenceSupplier_i.h" - -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) -: orb_ (CORBA::ORB::_duplicate (orb)) -, supplier_(new EventSequenceSupplier_i(orb)) -{ - - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - CosNaming::NamingContextExt_var naming_context = - CosNaming::NamingContextExt::_narrow (naming_obj.in()); - - CORBA::Object_var obj = naming_context->resolve_str("NotifyEventChannelFactory"); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ()); - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - CosNaming::Name_var name = naming_context->to_name("MyEventChannel"); - naming_context->rebind(name.in(), ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::SEQUENCE_EVENT, - supplieradmin_proxy_id); - - CORBA::Object_var poa_obj = orb_->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj.in()); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate (); - - PortableServer::ObjectId_var objectId = poa->activate_object(supplier_.get()); - CORBA::Object_var supplier_obj = poa->id_to_reference(objectId.in()); - - CosNotifyComm::SequencePushSupplier_var supplier = - CosNotifyComm::SequencePushSupplier::_narrow(supplier_obj.in()); - - consumer_proxy_ = - CosNotifyChannelAdmin::SequenceProxyPushConsumer::_narrow(proxy_consumer.in()); - - consumer_proxy_->connect_sequence_push_supplier(supplier.in()); -} - - -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; - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // OptionalHeaderFields - // PropertySeq - - // sequence<Property>: string name, any value - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - std::cout << "pushing " << std::endl; - CosNotification::EventBatch events; - events.length(4); - events[0] = event; - events[1] = event; - events[2] = event; - events[3] = event; - - consumer_proxy_->push_structured_events(events); - - return 1; - -} - diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.h deleted file mode 100644 index 949f5c87dc6..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/Messenger_i.h +++ /dev/null @@ -1,37 +0,0 @@ -// $Id$ - -#ifndef MESSENGER_H_ -#define MESSENGER_H_ - -#include "MessengerS.h" - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "ace/Auto_Ptr.h" - -class EventSequenceSupplier_i; - -class Messenger_i : public POA_Messenger -{ - public: - Messenger_i (CORBA::ORB_ptr orb); - - virtual ~Messenger_i (void); - - CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message - ); - - private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::SequenceProxyPushConsumer_var consumer_proxy_; - auto_ptr<EventSequenceSupplier_i> supplier_; -}; - -#endif - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/EventSequence/README b/TAO/DevGuideExamples/NotifyService/EventSequence/README deleted file mode 100644 index 4a60c213d06..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/README +++ /dev/null @@ -1,65 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: examples/NotifyService/EventSequence/README - -This directory contains an example which transmits an EventBatch using the Notification Service. - -This example extends the Messenger example in GettingStarted directory -to illustrate how the Notification channel can be used to push event batches -from the supplier to the consumer. The example uses the push/push model. - -The MessengerServer in this example plays the role of a server for -the MessengerClient and the role of a supplier for the MessengerConsumer. -The flow of messages is shown below: - -MessengerClient->MessengerSupplier->NotificationChannel->MessengerConsumer. - - -The Client code is stored in: - -examples/NotifyService/EventSequence/MessengerClient.cpp - -The Server code is stored in: - -examples/NotifyService/EventSequence/MessengerServer.cpp - -The Consumer code is stored in: - -examples/NotifyService/EventSequence/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.ior& - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/EventSequence/run_test.pl b/TAO/DevGuideExamples/NotifyService/EventSequence/run_test.pl deleted file mode 100644 index b787dd9f8c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/EventSequence/run_test.pl +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/Filtering.mpc b/TAO/DevGuideExamples/NotifyService/Filtering/Filtering.mpc deleted file mode 100644 index 88a7660808e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/Filtering.mpc +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -project(*Server): portableserver, orbsvcsexe, notification_skel, naming { - exename = MessengerServer - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): orbsvcsexe, notification, naming { - exename = MessengerClient - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): portableserver, orbsvcsexe, notification_skel, naming { - exename = MessengerConsumer - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} - diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger.idl b/TAO/DevGuideExamples/NotifyService/Filtering/Messenger.idl deleted file mode 100644 index 657fea8c323..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - - -// messenger.idl - -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/MessengerClient.cpp deleted file mode 100644 index 8d52a5af557..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerClient.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "MessengerC.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var rootObj = - orb->resolve_initial_references("NameService"); - - CosNaming::NamingContext_var rootContext = - CosNaming::NamingContext::_narrow(rootObj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("MessengerService"); - - CORBA::Object_var messengerObj = rootContext->resolve(name); - - if (CORBA::is_nil(messengerObj.in())) { - std::cerr << "Nil Messenger reference" << std::endl; - return 1; - } - - // Narrow - Messenger_var messenger = Messenger::_narrow(messengerObj.in()); - if (CORBA::is_nil(messenger.in ())) { - std::cerr << "Argument is not a Messenger reference" << std::endl; - return 1; - } - - CORBA::String_var message = CORBA::string_dup( - "We are experiencing network problems."); - messenger->send_message ("sysadmin@company.com", - "urgent", - message.inout()); - - message = CORBA::string_dup("Where can I get TAO?"); - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - - message = CORBA::string_dup( - "Please contact sales@company.com regarding your request."); - messenger->send_message ("sysadmin@company.com", - "OCI's Distribution of TAO", - message.inout()); - - } - catch(const CORBA::Exception& ex) { - std::cerr << "Caught a CORBA exception: " << ex << std::endl; - return 1; - } - - std::cout << "MessengerClient: success" << std::endl; - return 0; -} - diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/MessengerConsumer.cpp deleted file mode 100644 index 035b72b23c0..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerConsumer.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "StructuredEventConsumer_i.h" -#include <iostream> - -#define CA_FILTER "($.From == 'sysadmin@company.com') and ($.Subject == 'urgent') " -#define TCL_GRAMMAR "EXTENDED_TCL" - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - return 1; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name(1); - name.length (1); - name[0].id = CORBA::string_dup("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in()); - - if (CORBA::is_nil(notify_factory.in())) { - std::cerr << "Unable to find notify factory" << std::endl; - return 1; - } - - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to find event channel" << std::endl; - return 1; - } - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::AND_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - if (CORBA::is_nil (consumer_admin.in())) { - std::cerr << "Unable to find consumer admin" << std::endl; - return 1; - } - - CosNotifyFilter::FilterFactory_var ffact = - ec->default_filter_factory (); - - // setup a filter at the consumer admin - CosNotifyFilter::Filter_var ca_filter = - ffact->create_filter (TCL_GRAMMAR); - - if (CORBA::is_nil (ca_filter.in())) { - std::cerr << "Unable to create filetr object" << std::endl; - return 1; - } - - CosNotifyFilter::ConstraintExpSeq constraint_list (1); - constraint_list.length (1); - constraint_list[0].event_types.length (0); - constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER); - - ca_filter->add_constraints (constraint_list); - - consumer_admin ->add_filter (ca_filter.in()); - - CosNotification::EventTypeSeq added(1); - CosNotification::EventTypeSeq removed (0); - added.length (1); - removed.length (0); - - added[0].domain_name = CORBA::string_dup ("*"); - added[0].type_name = CORBA::string_dup ("*"); - - consumer_admin->subscription_change (added, removed); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - if (CORBA::is_nil (poa_object.in())) { - std::cerr << "Unable to initialize the POA." << std::endl; - return 1; - } - - PortableServer::POA_var poa = - PortableServer::POA::_narrow(poa_object.in()); - - StructuredEventConsumer_i servant(orb.in()); - /* - CosNotifyComm::StructuredPushConsumer_var consumer = - servant._this(); - */ - - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - CosNotifyComm::StructuredPushConsumer_var consumer = - CosNotifyComm::StructuredPushConsumer::_narrow(consumer_obj.in()); - - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - - // The proxy that we are connected to. - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier:: - _narrow(proxy_supplier.in()); - - if (CORBA::is_nil (supplier_proxy.in())) { - std::cerr << "Unable to create structured push supplier proxy" << std::endl; - return 1; - } - - supplier_proxy->connect_structured_push_consumer(consumer.in()); - - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - - poa_manager->activate(); - - orb->run(); - orb->destroy (); - - } - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - return 1; - } - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/MessengerServer.cpp deleted file mode 100644 index a26fb9a60c4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/MessengerServer.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include "ace/Argv_Type_Converter.h" -#include "ace/Get_Opt.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; - - case '?': - default: - std::cerr << "usage: " << argv[0] << " -o <ior>" << std::endl; - return -1; - break; - } - return 0; -} - -int -ACE_TMAIN(int argc, ACE_TCHAR* argv[]) -{ - try - { - // Initialize orb - ACE_Argv_Type_Converter conv(argc, argv); - CORBA::ORB_var orb = CORBA::ORB_init(conv.get_argc(), - conv.get_TCHAR_argv()); - - if (parse_args(argc, argv) != 0) { - return 1; - } - - // Find the Naming Service. - CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var rootNC = - CosNaming::NamingContext::_narrow(rootObj.in()); - - // Get the 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 our Messenger servant. - Messenger_i messenger_servant(orb.in()); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = - poa->activate_object( &messenger_servant ); - CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); - - // Generating the ior file is just for the purpose of synchronize the - // the startup of the server and consumer. - CORBA::String_var ior = orb->object_to_string(messenger_obj.in()); - if (ior_output_file != ACE_TEXT("")) { - std::ofstream outfile(ACE_TEXT_ALWAYS_CHAR(ior_output_file.c_str())); - outfile << ior.in(); - } - - // Bind it in the Naming Service. - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MessengerService"); - rootNC->rebind(name, messenger_obj.in()); - - // Accept requests - orb->run(); - orb->destroy(); - - } - catch(const CORBA::Exception& ex) - { - std::cerr << ex << std::endl; - return 1; - } - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.cpp deleted file mode 100644 index f63bc493769..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" - -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate(orb)) - -{ - try - { - CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj.in()); - - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name(1); - name.length (1); - name[0].id = CORBA::string_dup("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in()); - - if (CORBA::is_nil(notify_factory.in())) { - std::cerr << "Unable to find notify factory" << std::endl; - } - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to crete event channel" << std::endl; - } - - name.length(1); - name[0].id = CORBA::string_dup("MyEventChannel"); - - naming_context->rebind(name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::AND_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - if (CORBA::is_nil (supplier_admin.in())) { - std::cerr << "Unable to find supplier admin" << std::endl; - } - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - PortableServer::ObjectId_var oid = poa->activate_object(servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - CosNotifyComm::StructuredPushSupplier_var supplier = - CosNotifyComm::StructuredPushSupplier::_narrow(supplier_obj.in()); - - consumer_proxy_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer:: - _narrow(proxy_consumer.in()); - - if (CORBA::is_nil (consumer_proxy_.in())) { - std::cerr << "Unable to find structured proxy push consumer" << std::endl; - } - - consumer_proxy_->connect_structured_push_supplier(supplier.in()); - - } - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - } - -} - - -// 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; - - try - { - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // sequence<Property>: string name, any value - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("From"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message"); - event.filterable_data[2].value <<= (const char *)message; - - consumer_proxy_->push_structured_event(event); - } - - catch(const CosNotifyComm::InvalidEventType&) { - std::cerr << "Invalid Event Type Exception " << std::endl; - return 1; - } - - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - return 1; - } - return 0; -} - diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.h deleted file mode 100644 index 087c07b3aba..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/Messenger_i.h +++ /dev/null @@ -1,34 +0,0 @@ -// $Id$ - -#ifndef MESSENGERI_H_ -#define MESSENGERI_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "MessengerS.h" - -//Class Messenger_i -class Messenger_i : public virtual POA_Messenger -{ -public: - //Constructor - Messenger_i (CORBA::ORB_ptr orb); - - //Destructor - virtual ~Messenger_i (void); - - CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message - ); - -private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy_; - -}; - -#endif /* MESSENGERI_H_ */ diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/README b/TAO/DevGuideExamples/NotifyService/Filtering/README deleted file mode 100644 index c91cd77888d..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/README +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: DevGuideExamples/NotifyService/Filtering/README - - -This example extends the NotifyService/Messenger example by -demonstrating how filtering can be incorporated into the utilization -of the Notification channel. Supplier-side, and consumer-side -filtering can be implemented, but only consumer_side filtering is -demonstrated in this example. - -Filters are configured to guarantee that only certain events are -passed to the consumer. The criteria is specified by imposing constraints -on the appropriate fields of a structured event. - - -The Client code is stored in: - -DevGuideExamples/NotifyService/Filtering/MessengerClient.cpp - -The Server code is stored in: - -DevGuideExamples/NotifyService/Filtering/MessengerServer.cpp - -The Consumer code is stored in: - -DevGuideExamples/NotifyService/Filtering/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.ior& - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.cpp deleted file mode 100644 index bcf2f8ceeaf..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event - ) -{ - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name << "\t" <<value<< std::endl; - } - - std::cerr << "MessengerConsumer: success" << std::endl; -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer( - ) -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ - //Noop -} diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.h deleted file mode 100644 index 2cee3e77fd8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventConsumer_i.h +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventConsumer_i : - public virtual POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_structured_push_consumer( - ); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.cpp deleted file mode 100644 index 4d086d17e7e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq &) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.h deleted file mode 100644 index 9f18951c030..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/StructuredEventSupplier_i.h +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventSupplier_i : - public virtual POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier ( - ); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/Filtering/run_test.pl b/TAO/DevGuideExamples/NotifyService/Filtering/run_test.pl deleted file mode 100644 index 7a52de8ba1d..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Filtering/run_test.pl +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", "$arg_ns_ref -o $messiorfile"); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger.idl b/TAO/DevGuideExamples/NotifyService/Messenger/Messenger.idl deleted file mode 100644 index e2b13b5a3e4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger.idl +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp deleted file mode 100644 index 226fd6b54c6..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.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; - } - - CORBA::String_var message = CORBA::string_dup( - "Where can I get TAO?"); - for (int i=0; i<3; i++) { - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - } - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/MessengerConsumer.cpp deleted file mode 100644 index 63a9956ca80..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerConsumer.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "StructuredEventConsumer_i.h" -#include <iostream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - PortableServer::POA_var poa = - PortableServer::POA::_narrow (poa_object.in()); - - StructuredEventConsumer_i servant (orb.in()); - - PortableServer::ObjectId_var objectId = poa->activate_object (&servant); - - CORBA::Object_var consumer_obj = poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushConsumer_var consumer = - CosNotifyComm::StructuredPushConsumer::_narrow (consumer_obj.in ()); - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier:: - _narrow(proxy_supplier.in()); - - supplier_proxy->connect_structured_push_consumer(consumer.in()); - - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - supplier_proxy->subscription_change(added, removed); - - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - - poa_manager->activate(); - - orb->run(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp deleted file mode 100644 index aa3ad6bb744..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate(); - - Messenger_i messenger_servant (orb.in ()); - 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 ("Messenger.ior"); - iorFile << str.in () << std::endl; - iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - orb->run (); - orb->destroy (); - } - - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; - -} - - - - - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.cpp deleted file mode 100644 index 91addf9f407..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" -#include "ace/OS_NS_stdio.h" - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ - - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve (name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ()); - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - name[0].id = CORBA::string_dup ("MyEventChannel"); - - naming_context->rebind (name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - CORBA::Object_var poa_obj = orb_->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj.in ()); - PortableServer::POAManager_var mgr = poa->the_POAManager (); - - mgr->activate (); - PortableServer::ObjectId_var objectId = poa->activate_object (servant); - - CORBA::Object_var supplier_obj = poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushSupplier_var supplier = - CosNotifyComm::StructuredPushSupplier::_narrow (supplier_obj.in ()); - - consumer_proxy_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxy_consumer.in()); - - consumer_proxy_-> - connect_structured_push_supplier (supplier.in()); -} - -Messenger_i::~Messenger_i (void) -{ -} - -CORBA::Boolean Messenger_i::send_message ( - const char * user_name, - const char * subject, - char *& message) -{ - ACE_OS::printf("Message from: %s\nSubject: %s\nMessage: %s\n", - user_name, subject, message); - //cout << "Message from: " << user_name << endl; - //cout << "Subject: " << subject << endl; - //cout << "Message: " << message << endl; - - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // OptionalHeaderFields - // PropertySeq - - // sequence<Property>: string name, any value - event.filterable_data.length (3); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - std::cout << "pushing " << std::endl; - consumer_proxy_->push_structured_event(event); - - return 1; -} diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.h deleted file mode 100644 index 38fa49c29e9..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/Messenger_i.h +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#ifndef MESSENGER_H_ -#define MESSENGER_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "MessengerS.h" - -class Messenger_i : public POA_Messenger -{ - public: - Messenger_i (CORBA::ORB_ptr orb); - - virtual ~Messenger_i (void); - - CORBA::Boolean send_message (const char * user_name, - const char * subject, - char *& message); - - private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy_; -}; - -#endif - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/NotifyServiceMessenger.mpc b/TAO/DevGuideExamples/NotifyService/Messenger/NotifyServiceMessenger.mpc deleted file mode 100644 index c6cd2f3d24c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/NotifyServiceMessenger.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, namingexe, notification_skel { - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): taoexe, namingexe, notification { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): taoexe, portableserver, namingexe, notification_skel { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/README b/TAO/DevGuideExamples/NotifyService/Messenger/README deleted file mode 100644 index 29688714703..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/README +++ /dev/null @@ -1,66 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: examples/NotifyService/Messenger/README - -This directory contains a simple example of using the Notification Service. - -This example extends the Messenger example in GettingStarted directory -to illustrate how the Notification channel can be used to push messages -from the supplier to the consumer. Structured events are used to demonstrate -the operation of the channel. The example uses the push/push model. - -The MessengerServer in this example plays the role of a server for -the MessengerClient and the role of a supplier for the MessengerConsumer. -The flow of messages is shown below: - -MessengerClient->MessengerSupplier->NotificationChannel->MessengerConsumer. - - -The Client code is stored in: - -examples/NotifyService/Messenger/MessengerClient.cpp - -The Server code is stored in: - -examples/NotifyService/Messenger/MessengerServer.cpp - -The Consumer code is stored in: - -examples/NotifyService/Messenger/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.ior& - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.cpp deleted file mode 100644 index 74c54474e14..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event - ) -{ - - std::cout << "event received " << std::endl; - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name.in() << "\t" << value << std::endl; - } - -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer() -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.h deleted file mode 100644 index adb5bd999c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventConsumer_i.h +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyCommS.h" - -class StructuredEventConsumer_i : - public virtual POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_structured_push_consumer(); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.cpp deleted file mode 100644 index 18fd224aa8e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} - diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.h deleted file mode 100644 index 6df2455fcb0..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/StructuredEventSupplier_i.h +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyCommS.h" - -class StructuredEventSupplier_i : - public virtual POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/Messenger/run_test.pl b/TAO/DevGuideExamples/NotifyService/Messenger/run_test.pl deleted file mode 100644 index b787dd9f8c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/Messenger/run_test.pl +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger.idl b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger.idl deleted file mode 100644 index e2b13b5a3e4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger.idl +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerClient.cpp deleted file mode 100644 index cf6f2cec87c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerClient.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var rootObj = - orb->resolve_initial_references("NameService"); - - CosNaming::NamingContext_var rootContext = - CosNaming::NamingContext::_narrow(rootObj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("MessengerService"); - - CORBA::Object_var messengerObj = rootContext->resolve(name); - - Messenger_var messenger = Messenger::_narrow(messengerObj.in()); - - if (CORBA::is_nil(messenger.in ())) { - std::cerr << "Argument is not a Messenger reference" << std::endl; - } - - CORBA::String_var message = CORBA::string_dup("Where can I get TAO?"); - - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - } - - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - std::cout << "MessengerClient: success" << std::endl; - return 0; - -} - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerConsumer.cpp deleted file mode 100644 index 589b6a37c70..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerConsumer.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "StructuredEventConsumer_i.h" -#include <iostream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - if (CORBA::is_nil (poa_object.in())) { - std::cerr << "Unable to initialize the POA." << std::endl; - return 1; - } - - PortableServer::POA_var poa = - PortableServer::POA::_narrow(poa_object.in()); - - // Activate POA manager - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate(); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - return 1; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name(1); - - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to find event channel" << std::endl; - return 1; - } - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - if (CORBA::is_nil (consumer_admin.in())) { - std::cerr << "Unable to find consumer admin" << std::endl; - return 1; - } - - StructuredEventConsumer_i servant(orb.in()); - - CosNotifyComm::StructuredPushConsumer_var consumer = - servant._this(); - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - // The proxy that we are connected to. - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier:: - _narrow(proxy_supplier.in()); - - if (CORBA::is_nil (supplier_proxy.in())) { - std::cerr << "Unable to create structured push supplier proxy" << std::endl; - return 1; - } - - supplier_proxy->connect_structured_push_consumer(consumer.in()); - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - supplier_proxy->subscription_change(added, removed); - - orb->run(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << "MessengerConsumer:: Caught exception: " << ex << std::endl; - return 1; - } - std::cerr << "MessengerConsumer: success" << std::endl; - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp deleted file mode 100644 index e64d6a4b4c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); - - CosNaming::NamingContext_var rootNC = - CosNaming::NamingContext::_narrow(rootObj.in()); - - // 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 - Messenger_i messenger_servant(orb.in()); - - Messenger_var messenger = messenger_servant._this(); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MessengerService"); - - rootNC->rebind(name, messenger.in()); - - CORBA::String_var str = orb->object_to_string (messenger.in()); - std::ofstream iorFile ("Messenger.ior"); - iorFile << str.in () << std::endl; - iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - // Accept requests - orb->run(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << "MessengerServer::Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} - - - - - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.cpp deleted file mode 100644 index b362f3ba60e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ - CORBA::Object_var poa_object = - orb_->resolve_initial_references("RootPOA"); - - if (CORBA::is_nil (poa_object.in())) { - std::cerr << "Unable to initialize the POA." << std::endl; - } - - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in()); - - if (CORBA::is_nil(notify_factory.in())) { - std::cerr << "Unable to find notify factory" << std::endl; - } - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to crete event channel" << std::endl; - } - - // name.length(1); - name[0].id = CORBA::string_dup("MyEventChannel"); - - naming_context->rebind(name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - if (CORBA::is_nil (supplier_admin.in())) { - std::cerr << "Unable to find supplier admin" << std::endl; - } - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - CosNotifyComm::StructuredPushSupplier_var supplier = - servant->_this(); - - s_proxy_consumer_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer:: - _narrow(proxy_consumer.in()); - - if (CORBA::is_nil (s_proxy_consumer_.in())) { - std::cerr << "Unable to find structured proxy push consumer" << std::endl; - } - - s_proxy_consumer_-> - connect_structured_push_supplier(supplier.in()); - - - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - s_proxy_consumer_->offer_change(added, removed); -} - -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; - - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // OptionalHeaderFields - // PropertySeq - - // sequence<Property>: string name, any value - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - s_proxy_consumer_->push_structured_event(event); - - return 1; -} diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.h deleted file mode 100644 index 401201354b4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/Messenger_i.h +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -#ifndef MESSENGER_H_ -#define MESSENGER_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "MessengerS.h" - -class Messenger_i : public POA_Messenger -{ -public: - Messenger_i (CORBA::ORB_ptr orb); - virtual ~Messenger_i (void); - - CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message); - -private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var s_proxy_consumer_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/OfferSubscriptions.mpc b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/OfferSubscriptions.mpc deleted file mode 100644 index c6cd2f3d24c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/OfferSubscriptions.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, namingexe, notification_skel { - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): taoexe, namingexe, notification { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): taoexe, portableserver, namingexe, notification_skel { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/README b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/README deleted file mode 100644 index 90edd9fa6a0..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/README +++ /dev/null @@ -1,68 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: examples/NotifyService/OfferSubscriptions/README - - -This example extends the NotifyService/Messenger example by incorporating -"offers" and "subscriptions" into the utilization of the Notification -channel. - -The publication of "offers" by a supplier, informs consumers of the -Notification channel about the types of events it will be producing. This -is accomplished via the 'offer_change()' operation. - -Moreover, the example demonstrates how consumers can inform Notification -channel suppliers about the types of events in which they are interested. -The set of events in which a consumer is interested is called a "subscription" -and can be communicated via the 'subscription_change()' operation. - - - -The Client code is stored in: - -examples/NotifyService/OfferSubscriptions/MessengerClient.cpp - -The Server code is stored in: - -examples/NotifyService/OfferSubscriptions/MessengerServer.cpp - -The Consumer code is stored in: - -examples/NotifyService/OfferSubscriptions/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.ior& - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp deleted file mode 100644 index 684122ac49f..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event - ) -{ - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name << "\t" <<value<< std::endl; - } - -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer( - ) -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h deleted file mode 100644 index 86c10e74910..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventConsumer_i.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventConsumer_i : public POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_structured_push_consumer(); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp deleted file mode 100644 index e6cf9911d12..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq &) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h deleted file mode 100644 index aac055fad6c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/StructuredEventSupplier_i.h +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventSupplier_i : public POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl b/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl deleted file mode 100644 index b787dd9f8c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger.idl b/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger.idl deleted file mode 100644 index e2b13b5a3e4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger.idl +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp deleted file mode 100644 index 21c6615ea95..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.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; - } - - CORBA::String_var message = CORBA::string_dup( - "Where can I get TAO?"); - for (int i=0; i<3; i++) { - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - } - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerConsumer.cpp deleted file mode 100644 index ca63f55d999..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerConsumer.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "StructuredEventConsumer_i.h" -#include <iostream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, adminid); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - PortableServer::POA_var poa = - PortableServer::POA::_narrow (poa_object.in()); - - StructuredEventConsumer_i servant (orb.in()); - - PortableServer::ObjectId_var objectId = poa->activate_object (&servant); - - CORBA::Object_var consumer_obj = poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushConsumer_var consumer = - CosNotifyComm::StructuredPushConsumer::_narrow (consumer_obj.in ()); - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = - CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxy_supplier.in()); - - CosNotification::QoSProperties properties (1); - - properties.length (1); - properties[0].name = CORBA::string_dup (CosNotification::OrderPolicy); - properties[0].value <<= CosNotification::FifoOrder; - - supplier_proxy->set_qos (properties); - supplier_proxy->connect_structured_push_consumer(consumer.in()); - - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - supplier_proxy->subscription_change(added, removed); - - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - - poa_manager->activate(); - - orb->run(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp deleted file mode 100644 index 94ec2c65574..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -#include <fstream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var rootNC = - CosNaming::NamingContext::_narrow(rootObj.in()); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate(); - - Messenger_i messenger_servant (orb.in ()); - 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 ("Messenger.ior"); - iorFile << str.in () << std::endl; - iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - orb->run (); - orb->destroy (); - } - - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.cpp deleted file mode 100644 index e5d99375ae4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve (name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ()); - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - initial_admin.length (4); - - initial_admin[0].name = CORBA::string_dup (CosNotification::MaxQueueLength); - initial_admin[0].value <<= (CORBA::Long)7; - - initial_admin[1].name = CORBA::string_dup (CosNotification::MaxSuppliers); - initial_admin[1].value <<= (CORBA::Long)1; - - initial_admin[2].name = CORBA::string_dup (CosNotification::MaxConsumers); - initial_admin[2].value <<= (CORBA::Long)1; - - initial_admin[3].name = CORBA::string_dup (CosNotification::RejectNewEvents); - initial_admin[3].value <<= CORBA::Any::from_boolean((CORBA::Boolean)1); - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - name[0].id = CORBA::string_dup ("MyEventChannel"); - - naming_context->rebind (name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - CORBA::Object_var poa_obj = orb_->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj.in ()); - PortableServer::POAManager_var mgr = poa->the_POAManager (); - - mgr->activate (); - PortableServer::ObjectId_var objectId = poa->activate_object (servant); - - CORBA::Object_var supplier_obj = poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushSupplier_var supplier = - CosNotifyComm::StructuredPushSupplier::_narrow (supplier_obj.in ()); - - consumer_proxy_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxy_consumer.in()); - - consumer_proxy_-> - connect_structured_push_supplier (supplier.in()); -} - - -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; - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // OptionalHeaderFields - // PropertySeq - - // sequence<Property>: string name, any value - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - std::cout << "pushing " << std::endl; - consumer_proxy_->push_structured_event(event); - - return 1; -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.h deleted file mode 100644 index 38fa49c29e9..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/Messenger_i.h +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#ifndef MESSENGER_H_ -#define MESSENGER_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "MessengerS.h" - -class Messenger_i : public POA_Messenger -{ - public: - Messenger_i (CORBA::ORB_ptr orb); - - virtual ~Messenger_i (void); - - CORBA::Boolean send_message (const char * user_name, - const char * subject, - char *& message); - - private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy_; -}; - -#endif - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/QoSProperties.mpc b/TAO/DevGuideExamples/NotifyService/QoSProperties/QoSProperties.mpc deleted file mode 100644 index c6cd2f3d24c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/QoSProperties.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, namingexe, notification_skel { - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): taoexe, namingexe, notification { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): taoexe, portableserver, namingexe, notification_skel { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/README b/TAO/DevGuideExamples/NotifyService/QoSProperties/README deleted file mode 100644 index d35c3106746..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/README +++ /dev/null @@ -1,57 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: DevGuideExamples/NotifyService/QoSProperties/README - - -This example extends the NotifyService/Messenger example by -demonstrating how QoS features can be incorporated into the utilization -of the Notification channel. - -The Client code is stored in: - -DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp - -The Server code is stored in: - -DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp - -The Consumer code is stored in: - -DevGuideExamples/NotifyService/QoSProperties/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.ior& - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.cpp deleted file mode 100644 index 74c54474e14..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event - ) -{ - - std::cout << "event received " << std::endl; - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name.in() << "\t" << value << std::endl; - } - -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer() -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.h deleted file mode 100644 index 567e8e1a57c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventConsumer_i.h +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventConsumer_i : - public virtual POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_structured_push_consumer(); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.cpp deleted file mode 100644 index 18fd224aa8e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} - diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.h deleted file mode 100644 index 01fad5fb2d0..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/StructuredEventSupplier_i.h +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventSupplier_i : - public virtual POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/QoSProperties/run_test.pl b/TAO/DevGuideExamples/NotifyService/QoSProperties/run_test.pl deleted file mode 100644 index b787dd9f8c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/QoSProperties/run_test.pl +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger.idl b/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger.idl deleted file mode 100644 index e2b13b5a3e4..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger.idl +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -// messenger.idl - -interface Messenger -{ - boolean send_message(in string user_name, - in string subject, - inout string message); -}; diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp deleted file mode 100644 index 226fd6b54c6..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ - -#include "MessengerC.h" -#include "orbsvcs/CosNamingC.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.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; - } - - CORBA::String_var message = CORBA::string_dup( - "Where can I get TAO?"); - for (int i=0; i<3; i++) { - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - } - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp deleted file mode 100644 index 9f981295a41..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/NotifyExtC.h" -#include "tao/RTCORBA/RTCORBA.h" - -#include "StructuredEventConsumer_i.h" -#include "Priorities.h" -#include <iostream> - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - PortableServer::POA_var poa = - PortableServer::POA::_narrow (poa_object.in()); - - CORBA::Object_var rtorb_obj = orb->resolve_initial_references ("RTORB"); - RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (rtorb_obj.in ()); - - // Create an RT POA with a lane at the given priority. - CORBA::Policy_var priority_model_policy = - rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, - DEFAULT_PRIORITY); - - RTCORBA::ThreadpoolLanes lanes (2); - lanes.length (2); - - lanes[0].lane_priority = LOW_PRIORITY; - lanes[0].static_threads = 2; - lanes[0].dynamic_threads = 0; - lanes[1].lane_priority = HIGH_PRIORITY; - lanes[1].static_threads = 2; - lanes[1].dynamic_threads = 0; - - - // Create a thread-pool. - CORBA::ULong stacksize = 0; - CORBA::Boolean allow_request_buffering = 0; - CORBA::ULong max_buffered_requests = 0; - CORBA::ULong max_request_buffer_size = 0; - CORBA::Boolean allow_borrowing = 0; - - // Create the thread-pool. - RTCORBA::ThreadpoolId threadpool_id = - rt_orb->create_threadpool_with_lanes (stacksize, - lanes, - allow_borrowing, - allow_request_buffering, - max_buffered_requests, - max_request_buffer_size); - - // Create a thread-pool policy. - CORBA::Policy_var lanes_policy = - rt_orb->create_threadpool_policy (threadpool_id); - - CORBA::PolicyList poa_policy_list(2); - poa_policy_list.length (2); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = lanes_policy; - - PortableServer::POAManager_var poa_manager = poa->the_POAManager (); - - PortableServer::POA_var rt_poa = poa->create_POA ("RT POA", - poa_manager.in (), - poa_policy_list); - - StructuredEventConsumer_i servant (orb.in()); - - PortableServer::ObjectId_var objectId = - rt_poa->activate_object (&servant); - - CORBA::Object_var consumer_obj = - rt_poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushConsumer_var consumer = - CosNotifyComm::StructuredPushConsumer::_narrow (consumer_obj.in ()); - - NotifyExt::ThreadPoolLanesParams tpl_params; - - tpl_params.priority_model = NotifyExt::CLIENT_PROPAGATED; - tpl_params.server_priority = DEFAULT_PRIORITY; - tpl_params.stacksize = 0; - tpl_params.allow_borrowing = 0; - tpl_params.allow_request_buffering = 0; - tpl_params.max_buffered_requests = 0; - tpl_params.max_request_buffer_size = 0; - tpl_params.lanes.length (2); - tpl_params.lanes[0].lane_priority = LOW_PRIORITY; - tpl_params.lanes[0].static_threads = 2; - tpl_params.lanes[0].dynamic_threads = 0; - tpl_params.lanes[1].lane_priority = HIGH_PRIORITY; - tpl_params.lanes[1].static_threads = 2; - tpl_params.lanes[1].dynamic_threads = 0; - CosNotification::QoSProperties qos; - qos.length(1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPoolLanes); - qos[0].value <<= tpl_params; - - consumer_admin->set_qos(qos); - CORBA::Object_var current_obj = - orb->resolve_initial_references ("RTCurrent"); - - RTCORBA::Current_var current = - RTCORBA::Current::_narrow (current_obj.in ()); - current->the_priority(HIGH_PRIORITY); - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier:: - _narrow(proxy_supplier.in()); - - supplier_proxy->connect_structured_push_consumer(consumer.in()); - - CosNotification::EventTypeSeq added (1); - CosNotification::EventTypeSeq removed (1); - added.length (1); - removed.length (1); - - added[0].domain_name = CORBA::string_dup ("OCI_TAO"); - added[0].type_name = CORBA::string_dup ("examples"); - - removed[0].domain_name = CORBA::string_dup ("*"); - removed[0].type_name = CORBA::string_dup ("*"); - - supplier_proxy->subscription_change(added, removed); - - poa_manager->activate(); - - orb->run(); - } - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp deleted file mode 100644 index aa3ad6bb744..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); - PortableServer::POAManager_var mgr = poa->the_POAManager(); - mgr->activate(); - - Messenger_i messenger_servant (orb.in ()); - 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 ("Messenger.ior"); - iorFile << str.in () << std::endl; - iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - orb->run (); - orb->destroy (); - } - - catch(const CORBA::Exception& ex) - { - std::cerr << "Caught exception: " << ex << std::endl; - return 1; - } - - return 0; - -} - - - - - - - - - diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.cpp deleted file mode 100644 index c6dc34bc7e1..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/NotifyExtC.h" -#include "ace/OS_NS_stdio.h" - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" -#include "Priorities.h" -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("NotifyEventChannelFactory"); - - CORBA::Object_var obj = naming_context->resolve (name); - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ()); - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - name[0].id = CORBA::string_dup ("MyEventChannel"); - - naming_context->rebind (name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - NotifyExt::ThreadPoolLanesParams tpl_params; - - tpl_params.priority_model = NotifyExt::CLIENT_PROPAGATED; - tpl_params.server_priority = DEFAULT_PRIORITY; - tpl_params.stacksize = 0; - tpl_params.allow_borrowing = 0; - tpl_params.allow_request_buffering = 0; - tpl_params.max_buffered_requests = 0; - tpl_params.max_request_buffer_size = 0; - tpl_params.lanes.length (2); - tpl_params.lanes[0].lane_priority = LOW_PRIORITY; - tpl_params.lanes[0].static_threads = 2; - tpl_params.lanes[0].dynamic_threads = 0; - tpl_params.lanes[1].lane_priority = HIGH_PRIORITY; - tpl_params.lanes[1].static_threads = 2; - tpl_params.lanes[1].dynamic_threads = 0; - CosNotification::QoSProperties qos; - qos.length(1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPoolLanes); - qos[0].value <<= tpl_params; - - supplier_admin->set_qos(qos); - CORBA::Object_var current_obj = - this->orb_->resolve_initial_references ("RTCurrent"); - - current_ = RTCORBA::Current::_narrow (current_obj.in ()); - current_->the_priority(HIGH_PRIORITY); - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - CORBA::Object_var poa_obj = orb_->resolve_initial_references ("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj.in ()); - PortableServer::POAManager_var mgr = poa->the_POAManager (); - - mgr->activate (); - PortableServer::ObjectId_var objectId = poa->activate_object (servant); - - CORBA::Object_var supplier_obj = poa->id_to_reference (objectId.in ()); - - CosNotifyComm::StructuredPushSupplier_var supplier = - CosNotifyComm::StructuredPushSupplier::_narrow (supplier_obj.in ()); - - consumer_proxy_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxy_consumer.in()); - - consumer_proxy_-> - connect_structured_push_supplier (supplier.in()); -} - - -Messenger_i::~Messenger_i (void) -{ -} - -CORBA::Boolean Messenger_i::send_message ( - const char * user_name, - const char * subject, - char *& message) -{ - ACE_OS::printf("Message from: %s\nSubject: %s\nMessage: %s\n", - user_name, subject, message); - //cout << "Message from: " << user_name << endl; - //cout << "Subject: " << subject << endl; - //cout << "Message: " << message << endl; - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // OptionalHeaderFields - // PropertySeq - - // sequence<Property>: string name, any value - event.filterable_data.length (3); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - std::cout << "pushing " << std::endl; - current_->the_priority(HIGH_PRIORITY); - consumer_proxy_->push_structured_event(event); - - return 1; -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.h deleted file mode 100644 index 9eb0591df2e..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/Messenger_i.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -#ifndef MESSENGER_H_ -#define MESSENGER_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "MessengerS.h" -#include "tao/RTCORBA/RTCORBA.h" - -class Messenger_i : public POA_Messenger -{ - public: - Messenger_i (CORBA::ORB_ptr orb); - - virtual ~Messenger_i (void); - - CORBA::Boolean send_message (const char * user_name, - const char * subject, - char *& message); - - private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy_; - RTCORBA::Current_var current_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/Priorities.h b/TAO/DevGuideExamples/NotifyService/RTNotify/Priorities.h deleted file mode 100644 index 581af1cb221..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/Priorities.h +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -#ifndef _PRIORITIES_H_ -#define _PRIORITIES_H_ - -#define LOW_PRIORITY 0 -#define HIGH_PRIORITY 0 -#define DEFAULT_PRIORITY LOW_PRIORITY - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/README b/TAO/DevGuideExamples/NotifyService/RTNotify/README deleted file mode 100644 index b2308f5b781..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/README +++ /dev/null @@ -1,69 +0,0 @@ -// $Id$ - -Event Notification Service - - -File: examples/NotifyService/RTNotify/README - -This directory contains a simple example of using the Notification Service -with Real-Time CORBA. - -This example extends the basic Messenger notify service example to illustrate -how the Notification channel can be used with RT CORBA features. The supplier -and consumer both set up their proxies to use a thread pool with lanes and -the Notify_Service executable is configured to load the RT_Notification library -and associated features. A priority is set in the supplier and propagetd through -the channel into the consumer. - -The MessengerServer in this example plays the role of a server for -the MessengerClient and the role of a supplier for the MessengerConsumer. -The flow of messages is shown below: - -MessengerClient->MessengerSupplier->NotificationChannel->MessengerConsumer. - - -The Client code is stored in: - -examples/NotifyService/Messenger/MessengerClient.cpp - -The Server code is stored in: - -examples/NotifyService/Messenger/MessengerServer.cpp - -The Consumer code is stored in: - -examples/NotifyService/Messenger/MessengerConsumer.cpp - - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ns.ior& - -To start the Notification Service: ---------------------------------- -$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBInitRef NameService=file://ns.iori -ORBSvcConf notify.conf & - -To start the server/supplier ----------------------------- -./MessengerServer -ORBInitRef NameService=file://ns.ior -ORBSvcConf nsclient.conf - -To start the consumer ---------------------- -./MessengerConsumer -ORBInitRef NameService=file://ns.ior -ORBSvcConf nsclient.conf - -To start the client -------------------- -./MessengerClient -ORBInitRef NameService=file://ns.ior - - - -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/TAO/DevGuideExamples/NotifyService/RTNotify/RTNotify.mpc b/TAO/DevGuideExamples/NotifyService/RTNotify/RTNotify.mpc deleted file mode 100644 index cc01e7483d9..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/RTNotify.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, namingexe, notification_skel, rtcorba { - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): taoexe, namingexe, notification { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): taoexe, portableserver, namingexe, notification_skel, rtportableserver { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.cpp deleted file mode 100644 index 74c54474e14..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event - ) -{ - - std::cout << "event received " << std::endl; - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name.in() << "\t" << value << std::endl; - } - -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer() -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.h deleted file mode 100644 index adb5bd999c8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventConsumer_i.h +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyCommS.h" - -class StructuredEventConsumer_i : - public virtual POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification - ); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); - - virtual void disconnect_structured_push_consumer(); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.cpp deleted file mode 100644 index 0747d830bbf..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq & - ) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.h deleted file mode 100644 index 6df2455fcb0..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/StructuredEventSupplier_i.h +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyCommS.h" - -class StructuredEventSupplier_i : - public virtual POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ); -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/notify.conf b/TAO/DevGuideExamples/NotifyService/RTNotify/notify.conf deleted file mode 100644 index 837d36af6c7..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/notify.conf +++ /dev/null @@ -1,6 +0,0 @@ -dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBPriorityMapping continuous" - -# Uncomment this line to use SCHED_FIFO -#dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy PROCESS -ORBPriorityMapping continuous" - -dynamic TAO_Notify_Service Service_Object * TAO_RT_Notification:_make_TAO_RT_Notify_Service () "" diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/nsclient.conf b/TAO/DevGuideExamples/NotifyService/RTNotify/nsclient.conf deleted file mode 100644 index c121382ee7d..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/nsclient.conf +++ /dev/null @@ -1,4 +0,0 @@ -dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBPriorityMapping continuous" - -# Uncomment this line to use SCHED_FIFO -#dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy PROCESS -ORBPriorityMapping continuous" diff --git a/TAO/DevGuideExamples/NotifyService/RTNotify/run_test.pl b/TAO/DevGuideExamples/NotifyService/RTNotify/run_test.pl deleted file mode 100644 index 9c17b7055f1..00000000000 --- a/TAO/DevGuideExamples/NotifyService/RTNotify/run_test.pl +++ /dev/null @@ -1,82 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$notify_ior = PerlACE::LocalFile("notify.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start Notification Service - -$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service"; -$NFS = new PerlACE::Process($NotifyService, - "$arg_ns_ref -IORoutput $notify_ior " . - "-ORBSvcConf notify.conf"); -$NFS->Spawn(); -# the ior file is only used to wait for the service to start -if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $notify_ior\n"; - $NS->Kill (); - $NFS->Kill (); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "$arg_ns_ref -ORBSvcConf nsclient.conf"); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 15) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - $NFS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", - "$arg_ns_ref -ORBSvcConf nsclient.conf"); -$MC->Spawn(); - -sleep(2); -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", ""); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NFS->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NFS->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; -unlink $notify_ior; - -exit 0; diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger.idl b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger.idl deleted file mode 100644 index a3bd8c12943..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger.idl +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -// messenger.idl - - -interface Messenger -{ - - boolean send_message(in string user_name, - - in string subject, - - inout string message); - -}; - diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerClient.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerClient.cpp deleted file mode 100644 index 5d3cb836453..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerClient.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "MessengerC.h" -#include <iostream> -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var rootObj = - orb->resolve_initial_references("NameService"); - - CosNaming::NamingContext_var rootContext = - CosNaming::NamingContext::_narrow(rootObj.in()); - - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup ("MessengerService"); - - CORBA::Object_var messengerObj = rootContext->resolve(name); - - if (CORBA::is_nil(messengerObj.in())) { - std::cerr << "Nil Messenger reference" << std::endl; - return 1; - } - - // Narrow - Messenger_var messenger = Messenger::_narrow(messengerObj.in()); - if (CORBA::is_nil(messenger.in ())) { - std::cerr << "Argument is not a Messenger reference" << std::endl; - return 1; - } - - CORBA::String_var message = - CORBA::string_dup("Where can I get TAO?"); - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - - message = CORBA::string_dup("I need TAO now."); - messenger->send_message ("person@company.com", - "OCI's Distribution of TAO", - message.inout()); - - } - catch(const CORBA::Exception& ex) { - std::cerr << "Caught a CORBA exception: " << ex << std::endl; - return 1; - } - - std::cout << "MessengerClient: success" << std::endl; - return 0; -} - - diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerConsumer.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerConsumer.cpp deleted file mode 100644 index 6d286da5e63..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerConsumer.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// $Id$ - -#include "ace/Get_Opt.h" - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "StructuredEventConsumer_i.h" -#include <iostream> - -#define CA_FILTER "Subject == 'OCI_TAO'" -#define TCL_GRAMMAR "TCL" - -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - return 1; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - CosNaming::Name name(1); - name.length (1); - name[0].id = CORBA::string_dup("MyEventChannel"); - CORBA::Object_var ecObj = naming_context->resolve(name); - - CosNotifyChannelAdmin::EventChannel_var ec = - CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in()); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to find event channel" << std::endl; - return 1; - } - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::AND_OP; - - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - ec->new_for_consumers(ifgop, - adminid); - - if (CORBA::is_nil (consumer_admin.in())) { - std::cerr << "Unable to find consumer admin" << std::endl; - return 1; - } - - CosNotifyFilter::FilterFactory_var ffact = - ec->default_filter_factory (); - - // setup a filter at the consumer admin - CosNotifyFilter::Filter_var ca_filter = - ffact->create_filter (TCL_GRAMMAR); - - if (CORBA::is_nil (ca_filter.in())) { - std::cerr << "Unable to create filetr object" << std::endl; - return 1; - } - - CosNotifyFilter::ConstraintExpSeq constraint_list (1); - constraint_list.length (1); - constraint_list[0].event_types.length (0); - constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER); - - ca_filter->add_constraints (constraint_list); - - consumer_admin ->add_filter (ca_filter.in()); - - CosNotification::EventTypeSeq added(1); - CosNotification::EventTypeSeq removed (0); - added.length (1); - removed.length (0); - - added[0].domain_name = CORBA::string_dup ("*"); - added[0].type_name = CORBA::string_dup ("*"); - - consumer_admin->subscription_change (added, removed); - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA"); - - if (CORBA::is_nil (poa_object.in())) { - std::cerr << "Unable to initialize the POA." << std::endl; - return 1; - } - - PortableServer::POA_var poa = - PortableServer::POA::_narrow(poa_object.in()); - - StructuredEventConsumer_i servant(orb.in()); - - PortableServer::ObjectId_var oid = poa->activate_object(&servant); - CORBA::Object_var consumer_obj = poa->id_to_reference(oid.in()); - CosNotifyComm::StructuredPushConsumer_var consumer = - CosNotifyComm::StructuredPushConsumer::_narrow(consumer_obj.in()); - - - CosNotifyChannelAdmin::ProxyID consumeradmin_proxy_id; - - CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = - consumer_admin->obtain_notification_push_supplier( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - consumeradmin_proxy_id); - - - // The proxy that we are connected to. - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var supplier_proxy; - supplier_proxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier:: - _narrow(proxy_supplier.in()); - - if (CORBA::is_nil (supplier_proxy.in())) { - std::cerr << "Unable to create structured push supplier proxy" << std::endl; - return 1; - } - - supplier_proxy->connect_structured_push_consumer(consumer.in()); - - PortableServer::POAManager_var poa_manager = poa->the_POAManager(); - - poa_manager->activate(); - - orb->run(); - orb->destroy (); - - } - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - return 1; - } - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp deleted file mode 100644 index 1e214673971..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNamingC.h" -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv []) -{ - try - { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - // Find the Naming Service. - CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var rootNC = - CosNaming::NamingContext::_narrow(rootObj.in()); - - // Get the 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 our Messenger servant. - Messenger_i messenger_servant(orb.in()); - - // Register it with the RootPOA. - PortableServer::ObjectId_var oid = - poa->activate_object( &messenger_servant ); - CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() ); - - // Bind it in the Naming Service. - CosNaming::Name name; - name.length (1); - name[0].id = CORBA::string_dup("MessengerService"); - rootNC->rebind(name, messenger_obj.in()); - - CORBA::String_var str = orb->object_to_string (messenger_obj.in()); - std::ofstream iorFile ("Messenger.ior"); - iorFile << str.in () << std::endl; - iorFile.close (); - std::cout << "IOR written to file Messenger.ior " << std::endl; - - // Accept requests - orb->run(); - orb->destroy(); - - } - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - return 1; - } - return 0; - -} - - diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerSupplier.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerSupplier.cpp deleted file mode 100644 index e1468ab0c93..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/MessengerSupplier.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// $Id$ - -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" -#include "orbsvcs/CosNamingC.h" -#include "ace/Profile_Timer.h" -#include "StructuredEventSupplier_i.h" -#include <iostream> - -int ACE_TMAIN(int argc, ACE_TCHAR * argv[]) -{ - try - { - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - CORBA::Object_var rootObj = orb->resolve_initial_references("NameService"); - CosNaming::NamingContext_var rootNC = - CosNaming::NamingContext::_narrow(rootObj.in()); - - // 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 Event Channel factory. - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - TAO_Notify_EventChannelFactory_i::create(poa.in()); - ACE_ASSERT (!CORBA::is_nil (notify_factory.in ())); - - // Create an Event Channel. - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, initial_admin, id); - - // Bind it in the Naming Service. - CosNaming::Name name(1); - name.length(1); - name[0].id = CORBA::string_dup("MyEventChannel"); - rootNC->rebind(name, ec.in()); - - // Become a structured push supplier. - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::OR_OP; - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb.in()); - CosNotifyComm::StructuredPushSupplier_var supplier = servant->_this(); - - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy = - CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow( - proxy_consumer.in()); - consumer_proxy->connect_structured_push_supplier(supplier.in()); - - // Set up events to push. - CosNotification::StructuredEvent event; - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - event.header.fixed_header.event_name = CORBA::string_dup("myevent"); - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("Message from:"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject:"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message:"); - event.filterable_data[2].value <<= (const char *)message; - - // Push events. - while (1) { - std::cout << "pushing " << std::endl; - consumer_proxy->push_structured_event (event); - ACE_OS::sleep (1); - } - } - catch(const CORBA::Exception& ex) { - return 1; - } - - return 0; -} - diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.cpp deleted file mode 100644 index 5b5f93e2167..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// $Id$ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" - -// The static initialization trick doesn't work with static builds. -// On SunOS 5.8 and MacOS X, the static initialization trick used -// in the CosNotification_Serv library does not work. Including the -// initializer class here works around the problem. -#if defined (TAO_AS_STATIC_LIBS) || defined (sun) || defined (__APPLE__) -#include "orbsvcs/Notify/CosNotify_Initializer.h" -#endif /* sun || __APPLE__ */ - -#include "Messenger_i.h" -#include "StructuredEventSupplier_i.h" -#include <iostream> - -Messenger_i::Messenger_i (CORBA::ORB_ptr orb) -: orb_ (CORBA::ORB::_duplicate(orb)) - -{ - try - { - CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA"); - PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj.in()); - - CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService"); - - if (CORBA::is_nil(naming_obj.in())) { - std::cerr << "Unable to find naming service" << std::endl; - } - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow(naming_obj.in()); - - - // - // Create an instance of TAO's notification event channel - // - - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory = - TAO_Notify_EventChannelFactory_i::create(poa.in()); - - if (CORBA::is_nil (notify_factory.in ())) { - std::cerr << "Unable to create the notify event channel" << std::endl; - return; - } - - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - - CosNotifyChannelAdmin::EventChannel_var ec = - notify_factory->create_channel (initial_qos, - initial_admin, - id); - - if (CORBA::is_nil (ec.in())) { - std::cerr << "Unable to create event channel" << std::endl; - return; - } - - - CosNaming::Name name(1); - name.length(1); - name[0].id = CORBA::string_dup("MyEventChannel"); - - naming_context->rebind(name, ec.in()); - - CosNotifyChannelAdmin::AdminID adminid; - CosNotifyChannelAdmin::InterFilterGroupOperator ifgop = - CosNotifyChannelAdmin::AND_OP; - - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - ec->new_for_suppliers (ifgop, adminid); - - if (CORBA::is_nil (supplier_admin.in())) { - std::cerr << "Unable to find supplier admin" << std::endl; - } - - CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id; - - CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = - supplier_admin->obtain_notification_push_consumer( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - supplieradmin_proxy_id); - - StructuredEventSupplier_i *servant = - new StructuredEventSupplier_i(orb_.in()); - - PortableServer::ObjectId_var oid = poa->activate_object(servant); - CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in()); - CosNotifyComm::StructuredPushSupplier_var supplier = - CosNotifyComm::StructuredPushSupplier::_narrow(supplier_obj.in()); - - consumer_proxy_ = - CosNotifyChannelAdmin::StructuredProxyPushConsumer:: - _narrow(proxy_consumer.in()); - - if (CORBA::is_nil (consumer_proxy_.in())) { - std::cerr << "Unable to find structured proxy push consumer" << std::endl; - } - - consumer_proxy_->connect_structured_push_supplier(supplier.in()); - - } - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - } - -} - - -// 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; - - try - { - - // Event Definition - CosNotification::StructuredEvent event; - - event.header.fixed_header.event_type.domain_name = - CORBA::string_dup("OCI_TAO"); - // string - event.header.fixed_header.event_type.type_name = - CORBA::string_dup("examples"); - // string - event.header.fixed_header.event_name = - CORBA::string_dup("myevent"); - - // sequence<Property>: string name, any value - event.filterable_data.length (1); - event.filterable_data[0].name = CORBA::string_dup("From"); - event.filterable_data[0].value <<= (const char *)user_name; - event.filterable_data.length (2); - event.filterable_data[1].name = CORBA::string_dup("Subject"); - event.filterable_data[1].value <<= (const char *)subject; - event.filterable_data.length (3); - event.filterable_data[2].name = CORBA::string_dup("Message"); - event.filterable_data[2].value <<= (const char *)message; - - consumer_proxy_->push_structured_event(event); - } - - catch(const CosNotifyComm::InvalidEventType&) { - std::cerr << "Invalid Event Type Exception " << std::endl; - return 1; - } - - catch(const CORBA::Exception& ex) { - std::cerr << ex << std::endl; - return 1; - } - return 0; -} diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.h b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.h deleted file mode 100644 index 15471aaedde..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/Messenger_i.h +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -#ifndef MESSENGERI_H_ -#define MESSENGERI_H_ - -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNamingC.h" - -#include "MessengerS.h" - -//Class Messenger_i -class Messenger_i : public virtual POA_Messenger -{ -public: - //Constructor - Messenger_i (CORBA::ORB_ptr orb); - - //Destructor - virtual ~Messenger_i (void); - - CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message - ); - -private: - CORBA::ORB_var orb_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy_; -}; - -#endif /* MESSENGERI_H_ */ diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/README b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/README deleted file mode 100644 index 74ca8f88ca8..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/README +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -examples/NotifyService/SupplierSideNC/README - -This directory contains a simple example of using the Notification Service. - -This example extends the Messenger example in Filtering directory -to illustrate how the Notification channel can be used to push messages -from the supplier to the consumer. Furthermore, this example shows -how you could set up filters so that only a certain events are -passed to the consumer. - -This example uses the push/push model. - -In this example, the Notify Service initiation is incorporated into the -MessengerServer. - -The MessengerSupplier in this example plays the role of a server for -the MessengerClient and the role of a supplier for the MessengerConsumer. -The flow of messages is shown below: - -MessengerClient->(MessengerSupplier->NotificationChannel)->MessengerConsumer. - -How to Run ----------- - -To start the Naming Service: ----------------------------- -$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service & - -To start the supplier: ------------------- -./MessengerServer - -To start the consumer ---------------------- -./MessengerConsumer - -To start the client -------------------- -./MessengerClient -To start the client: ------------------- -./MessengerClient diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp deleted file mode 100644 index 7f4d6bc3524..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// $Id$ - -#include "StructuredEventConsumer_i.h" -#include "tao/PortableServer/PS_CurrentC.h" -#include <iostream> - -StructuredEventConsumer_i::StructuredEventConsumer_i(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventConsumer_i::push_structured_event( - const CosNotification::StructuredEvent &event) -{ - - const char *value; - - for (unsigned int i=0; i<event.filterable_data.length(); i++) { - event.filterable_data[i].value >>= value; - std::cout << event.filterable_data[i].name << "\t" <<value<< std::endl; - } - - std::cerr << "MessengerConsumer: success" << std::endl; -} - -void -StructuredEventConsumer_i::disconnect_structured_push_consumer() -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventConsumer_i::offer_change( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq &) -{ - //Noop -} diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.h b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.h deleted file mode 100644 index 6dd45e0b20c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventConsumer_i.h +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -#ifndef _EVENTCONSUMER_I_H_ -#define _EVENTCONSUMER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventConsumer_i : public POA_CosNotifyComm::StructuredPushConsumer -{ -public: - StructuredEventConsumer_i(CORBA::ORB_ptr orb); - - virtual void push_structured_event( - const CosNotification::StructuredEvent ¬ification); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed); - - virtual void disconnect_structured_push_consumer(); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp deleted file mode 100644 index 0bd7c8a5ccb..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// $Id$ - -#include "StructuredEventSupplier_i.h" -#include "tao/PortableServer/PS_CurrentC.h" - -StructuredEventSupplier_i::StructuredEventSupplier_i(CORBA::ORB_ptr orb) -: orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -StructuredEventSupplier_i::disconnect_structured_push_supplier () -{ - - CORBA::Object_var obj = orb_->resolve_initial_references ("POACurrent"); - PortableServer::Current_var current = - PortableServer::Current::_narrow (obj.in()); - PortableServer::POA_var poa = current->get_POA (); - PortableServer::ObjectId_var objectId = current->get_object_id (); - poa->deactivate_object (objectId.in()); - -} - -void -StructuredEventSupplier_i::subscription_change ( - const CosNotification::EventTypeSeq &, - const CosNotification::EventTypeSeq &) -{ -} diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.h b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.h deleted file mode 100644 index 37d97731643..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/StructuredEventSupplier_i.h +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -#ifndef _EVENTSUPPLIER_I_H_ -#define _EVENTSUPPLIER_I_H_ - -#include "orbsvcs/CosNotifyChannelAdminS.h" - -class StructuredEventSupplier_i : public POA_CosNotifyComm::StructuredPushSupplier -{ -public: - // Constructor - StructuredEventSupplier_i(CORBA::ORB_ptr orb); - virtual void disconnect_structured_push_supplier (); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed); - -private: - CORBA::ORB_var orb_; -}; - -#endif diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/SupplierSideNC.mpc b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/SupplierSideNC.mpc deleted file mode 100644 index 5458a3127b2..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/SupplierSideNC.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, namingexe, notification_serv { - Source_Files { - StructuredEventSupplier_i.cpp - MessengerServer.cpp - Messenger_i.cpp - } -} - -project(*Client): taoexe, namingexe, notification { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} - -project(*Consumer): taoexe, portableserver, namingexe, notification_skel { - IDL_Files { - } - Source_Files { - MessengerConsumer.cpp - StructuredEventConsumer_i.cpp - } -} diff --git a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl b/TAO/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl deleted file mode 100644 index f0656a34a6c..00000000000 --- a/TAO/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl +++ /dev/null @@ -1,58 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$nsiorfile = PerlACE::LocalFile("ns.ior"); -$messiorfile = PerlACE::LocalFile("Messenger.ior"); -$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile"; -unlink $nsiorfile; -unlink $messiorfile; - -# start Naming Service -$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service"; -$NS = new PerlACE::Process($NameService, "-o $nsiorfile"); -$NS->Spawn(); -if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) { - print STDERR "ERROR: cannot find file $nsiorfile\n"; - $NS->Kill(); - exit 1; -} - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", $arg_ns_ref); -$S->Spawn(); - -# Wait for the MessengerServer -if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) { - print STDERR "ERROR: Timed out waiting for $messiorfile\n"; - $S->Kill(); - $NS->Kill (); - exit 1; -} -# start MessengerConsumer -$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref); -$MC->Spawn(); - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", $arg_ns_ref); -if ($C->SpawnWaitKill(10) != 0) { - $MC->Kill(); - $S->Kill(); - $NS->Kill(); - exit (1); -} - -$MC->Kill(); -$S->Kill(); -$NS->Kill(); - -unlink $nsiorfile; -unlink $messiorfile; - -exit 0; diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger.idl b/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger.idl deleted file mode 100644 index e492f3c79ab..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger.idl +++ /dev/null @@ -1,12 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -// messenger.idl - -interface Messenger -{ - boolean send_message ( in string user_name, - in string subject, - inout string message ); - - void shutdown ( in string user_name ); -}; diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp b/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp deleted file mode 100644 index 7e6551a08a8..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "orbsvcs/SecurityC.h" -#include "MessengerC.h" - -#if 0 -The servers service configuration file -for this example is: ---------------------------------------- -# server.conf -dynamic SSLIOP_Factory Service_Object * - TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() - "-SSLNoProtection \ - -SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" ---------------------------------------- - -The clients service configuration file -for this example is: ---------------------------------------- -# client.conf -dynamic SSLIOP_Factory Service_Object * - TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() - "-SSLNoProtection \ - -SSLAuthenticate SERVER \ - -SSLPrivateKey PEM:clientkey.pem \ - -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" ---------------------------------------- -#endif - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - - CORBA::ORB_var orb = - CORBA::ORB_init( argc, argv ); - - CORBA::Object_var obj = - orb->string_to_object( "file://Messenger.ior" ); - - Messenger_var messenger = - Messenger::_narrow( obj.in() ); - - CORBA::String_var message = - CORBA::string_dup( "Terminating messenger service!" ); - - messenger->send_message( "Chief of Security", - "New Directive", - message.inout() ); - - messenger->shutdown("Chief of Security"); - - Security::QOP qop = - Security::SecQOPIntegrityAndConfidentiality; - - CORBA::Any want_protection; - want_protection <<= qop; - - CORBA::Policy_var policy = - orb->create_policy (Security::SecQOPPolicy, - want_protection); - - Security::EstablishTrust establish_trust; - establish_trust.trust_in_client = 0; - establish_trust.trust_in_target = 1; - - CORBA::Any want_trust; - want_trust <<= establish_trust; - - CORBA::Policy_var policy2 = - orb->create_policy (Security::SecEstablishTrustPolicy, - want_trust); - - - CORBA::PolicyList policy_list (2); - policy_list.length (1); - policy_list[0] = - CORBA::Policy::_duplicate (policy.in ()); - policy_list.length (2); - policy_list[1] = - CORBA::Policy::_duplicate (policy2.in ()); - - - CORBA::Object_var object = - obj->_set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE); - - Messenger_var messenger2 = - Messenger::_narrow( object.in() ); - - message = - CORBA::string_dup( "Terminating messenger service!" ); - - messenger2->send_message( "Chief of Security", - "New Directive", - message.inout() ); - - messenger2->shutdown("Chief of Security"); - - orb->destroy(); - } - catch(const CORBA::Exception& ex) - { - ex._tao_print_exception("Client: main block"); - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp b/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp deleted file mode 100644 index 5f4b7573a9e..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - - CORBA::Object_var obj = - orb->resolve_initial_references( "RootPOA" ); - - PortableServer::POA_var poa = - PortableServer::POA::_narrow( obj.in() ); - - PortableServer::POAManager_var mgr = - poa->the_POAManager(); - mgr->activate(); - - obj = - orb->resolve_initial_references ("SSLIOPCurrent"); - - SSLIOP::Current_var ssliop_current = - SSLIOP::Current::_narrow (obj.in ()); - - Messenger_i messenger_servant(orb.in(), - ssliop_current.in() - ); - - 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( "Messenger.ior" ); - - iorFile << str.in() << std::endl; - - iorFile.close(); - - std::cout << "IOR written to file Messenger.ior" << std::endl; - - orb->run(); - poa->destroy (1, 1); - orb->destroy (); - - std::cout << "Messenger Server is shut down!" - << std::endl; - std::cout << std::endl; - - } - catch(const CORBA::Exception& ex) { - ex._tao_print_exception("Server Error: main block"); - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.cpp b/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.cpp deleted file mode 100644 index 6b414ea4a80..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "Messenger_i.h" -#include "ace/OS_NS_string.h" -#include <iostream> - -Messenger_i::Messenger_i ( - CORBA::ORB_ptr orb, - SSLIOP::Current_ptr ssliop_current -) -: orb_(CORBA::ORB::_duplicate(orb)), - ssliop_current_(SSLIOP::Current::_duplicate(ssliop_current)) - { - } - -Messenger_i::~Messenger_i (void) - { - } - -CORBA::Boolean Messenger_i::send_message ( - const char * user_name, - const char * subject, - char *& message - ) - { - if (ssliop_current_->no_context()) - std::cout << "Message from: " << user_name << std::endl; - else - std::cout << "SECURE message from: " << user_name << std::endl; - - std::cout << "Subject: " << subject << std::endl; - std::cout << "Message: " << message << std::endl; - std::cout << std::endl; - return 1; - } - - -void Messenger_i::shutdown ( - const char * user_name - ) -{ - if ( ! (ssliop_current_->no_context()) ) - { - // requestor is authentic, go ahead and - // shut the server down. Report access - // ID of requestor prior to shutdown. - - std::cout << "Shutdown command from: " << user_name << std::endl; - std::cout << "Status: User authenticated." << std::endl; - std::cout << "Action: Sever shutdown in progress..." << std::endl; - std::cout << std::endl; - -#if 0 - char name_buf[BUFSIZ]; - - // - // Populate an attribute type list - // to request the initiating principal's - // AccessId. - // - Security::AttributeTypeList requested_attributes; - requested_attributes.length(0); - Security::AttributeType desired_attribute; - desired_attribute.attribute_family.family_definer = 0; // OMG - desired_attribute.attribute_family.family = 1; // Privilege - // Attributes - desired_attribute.attribute_type = Security::AccessId; - requested_attributes.length(1); - requested_attributes[0] = desired_attribute; - // - // Request the attribtue - // - Security::AttributeList_var attrib_list = - this->current_->get_attributes(requested_attributes); - - if(attrib_list->length() > 0) - { - // - // Copy the values out - // - Security::SecAttribute attribute_returned; - - attribute_returned.defining_authority = - (attrib_list.in())[0].defining_authority ; - attribute_returned.value = - (attrib_list.in())[0].value; - - // Certificates are returned in - // X.509 format - // - const char x509[] = "x509"; - // - // Setup a Security::OID (sequence<octet>) - // to hold the attribute's defining authority. - // - Security::OID x509_defining_authority; - x509_defining_authority.length(sizeof (x509)); - // - // Populate the defining authority value. - // - CORBA::Octet *buf = - x509_defining_authority.get_buffer(); - ACE_OS_String::memcpy( buf, x509, sizeof(x509)); - // - // Confirm the defining authority is "x509". - // - if(attribute_returned.defining_authority == - x509_defining_authority) - { - // - // Get the buffer holding the certificate - // - CORBA::Octet *der_cert = - attribute_returned.value.get_buffer(); - // - // Convert the DER encoded certificate into - // OpenSSL's internal format. - // - X509 *peer = ::d2i_X509 (0, - &der_cert, - attribute_returned.value.length()); - - ::X509_NAME_oneline(::X509_get_subject_name (peer), - name_buf, - BUFSIZ); - - ::X509_free(peer); - } - } - // - // Report the certificate's subject name - // and terminate the server - // - std::cout << "Shutdown commanded by: " - << name_buf - << std::endl; - std::cout << std::endl; -#endif - - orb_->shutdown (0); - } - else - { - // requestor is not secure, - // ignore shutdown command - std::cout << "Shutdown command from: " << user_name << std::endl; - std::cout << "Status: User *NOT* authenticated." << std::endl; - std::cout << "Action: Ignored." << std::endl; - std::cout << std::endl; - } -} diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h b/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h deleted file mode 100644 index 9dfb7ce0ff3..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/Messenger_i.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#ifndef MESSENGERI_H_ -#define MESSENGERI_H_ - -#include <openssl/ssl.h> -#include <openssl/x509.h> -#include "orbsvcs/SecurityC.h" -#include "orbsvcs/SSLIOPC.h" - -#include "MessengerS.h" - -class Messenger_i : public virtual POA_Messenger -{ -public: - Messenger_i ( - CORBA::ORB_ptr orb, - SSLIOP::Current_ptr ssliop_current - ); - - virtual ~Messenger_i (void); - - virtual CORBA::Boolean send_message ( - const char * user_name, - const char * subject, - char *& message - ); - - virtual void shutdown ( - const char * user_name - ); - -protected: - CORBA::ORB_var orb_; - SSLIOP::Current_var ssliop_current_; -}; - -#endif /* MESSENGERI_H_ */ diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/ParticipatingApp.mpc b/TAO/DevGuideExamples/Security/ParticipatingApp/ParticipatingApp.mpc deleted file mode 100644 index a0025ee06d6..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/ParticipatingApp.mpc +++ /dev/null @@ -1,17 +0,0 @@ -// $Id$ - -project(*Server): portableserver, orbsvcsexe, security, ssliop { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(ParticipatingApp_Client): orbsvcsexe, security, ssliop { - exename = MessengerClient - - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/README b/TAO/DevGuideExamples/Security/ParticipatingApp/README deleted file mode 100644 index 5d001721f0b..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/README +++ /dev/null @@ -1,47 +0,0 @@ -TAO Security - -DevGuideExamples/Security/ParticipatingApp/README - -This directory contains an illustration of a security -aware application that accepts secured and unsecured -requests and provides access to certain operations -only for secured requests. - -This example uses a single set of service configuration -files and takes a single path through the application -code. - -For simplicity, the pass phrases have been stripped from the -private keys included with these examples in the 1.2a release. -This *should not* be construed as a recommended practice. Instead, -OCI strongly recommends that the security requirements of each -real-world application be evaluated carefully and that appropriate -procedures and practice be established accordingly. Private keys -without pass phrase protection are easily compromised and may -allow an unauthorized party to masquerade as an authorized system -user. - -Prior to running the server in these examples, the SSL_CERT_FILE -environment variable must be set, e.g., - # /bin/bash - export SSL_CERT_FILE=cacert.pem -or - rem Windows - set SSL_CERT_FILE=cacert.pem - -To run the server: - ./MessengerServer -ORBSvcConf server.conf - -To run the client: - ./MessengerClient -ORBSvcConf client.conf - - ------------------------------------------ -Files: DevGuideExamples/Security/ParticipatingApp - -Messenger.idl - Messenger interface definition. -Messenger_i.h - Messenger servant class definition. -Messenger_i.cpp - Messenger servant implementation. -MessengerServer.cpp - MessengerServer process main. -MessengerClient.cpp - MessengerClient process main. - diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/cacert.pem b/TAO/DevGuideExamples/Security/ParticipatingApp/cacert.pem deleted file mode 100644 index c493d28a523..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/cacert.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDujCCAyOgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBoDELMAkGA1UEBhMCVVMx -ETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNVBAoT -Fk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMU -Q2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5j -b20wHhcNMDMwNzIzMjAyNDIwWhcNMTMwNzIwMjAyNDIwWjCBoDELMAkGA1UEBhMC -VVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNV -BAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UE -AxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdl -Yi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO4QS4bqrXVuBnHsOg1/ -gijXjiWhFTngG/sDLWAA52fHIobyFo5//7UaLedke0fkwqsmky8hjzSbXGJsGI5g -Yjp2Va7WeJhRQNr8VYWobCq00f//drHN2NF5M23Cx0JF9WfyfWpqq5TQRGtVZ+We -+q4S6wH1exZrVGHfkp5Xq5FvAgMBAAGjggEAMIH9MB0GA1UdDgQWBBQvTY0YWmHq -o2TMOKba/ECH9ayXZzCBzQYDVR0jBIHFMIHCgBQvTY0YWmHqo2TMOKba/ECH9ayX -Z6GBpqSBozCBoDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYD -VQQHEwlTdC4gTG91aXMxHzAdBgNVBAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4x -DDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAa -BgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkq -hkiG9w0BAQQFAAOBgQBgjn97nbyyjFxyHC8vheAiDCQRblI4lZbZC6vSmxxqEGze -eAMiTYL2iK3vj2Ot3V2/o5VdLyEYV4RBP2iq1XuMYXjmL2ni+NVgepyXceynH8/b -72yciZZcDE5FVUaMUHAgZUpxsGSDyD70LnOFwBxuvxtlMtG5vXYNvwF/FJPs1g== ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/client.conf b/TAO/DevGuideExamples/Security/ParticipatingApp/client.conf deleted file mode 100644 index cffba696b54..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/client.conf +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -# client.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLNoProtection -SSLAuthenticate SERVER -SSLPrivateKey PEM:clientkey.pem -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/clientcert.pem b/TAO/DevGuideExamples/Security/ParticipatingApp/clientcert.pem deleted file mode 100644 index 56616fcd469..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/clientcert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQQwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjIwN1oXDTEzMDgwNTAwMjIwN1owgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBmNs -aWVudDEgMB4GCSqGSIb3DQEJARYRY2xpZW50QG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAMYaaQgEmp2zv0t+MAEGf5GIsKSIB1YFrkkVR6Qv -LP0t9FHDPGFawh/aK3Yq+l7RiNpK1H5SSOaIavm4xV/3tpHxzuRjd0H3fdhaoAgD -xvcYZ75l662PEa25MCJsp40tACO0hGNOQCJ8kWVmT4xEhKcFl3xm+1OvNbwDM/pA -t4WpAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEArs6S6qud6D9t6AcGJS91XWqbBY1G -rSgmv9yFbvUyrGAQuMpyNuYTGlZA+Nd3EAjYlwP4fWbzUMM0MEtd3Xl0Aep0O39W -Cgp9HxDaJi3b4h63cd/B0su+2CNd4P6+NOX+IxgrrioCgKSnu6Nxy14fb03RQhjl -a3vOY5Juf8ySB/M= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/clientkey.pem b/TAO/DevGuideExamples/Security/ParticipatingApp/clientkey.pem deleted file mode 100644 index 2b4af2322ad..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/clientkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDGGmkIBJqds79LfjABBn+RiLCkiAdWBa5JFUekLyz9LfRRwzxh -WsIf2it2Kvpe0YjaStR+UkjmiGr5uMVf97aR8c7kY3dB933YWqAIA8b3GGe+Zeut -jxGtuTAibKeNLQAjtIRjTkAifJFlZk+MRISnBZd8ZvtTrzW8AzP6QLeFqQIDAQAB -AoGAJx1X16lxDepLvxAvUkSCM64Vkqb5K9b7TprRBm36KBNGxk4SQfa1laxyIGbk -AIzGxLM5uadtlXciCCSfdA9pEJbjtxSRJt2RbOWioT3sfIzXO7SCMHuuRjnPK3P8 -rgFmOOpo/ldVZ3mBJajxzWTEFXMUTAC4tB2j2B6of7MG5fECQQDu+uKzI2QjiTpW -5WFd/vzpS2SpDHks4sEu0F6zk1Zhbsc3KoJd3xxSLhKFLLoRDVZsDKE3opr7WRNT -+sjoGRY3AkEA1DZArJqLeWuB8L8GjC/AtMXsxlSe3Iy9X+4uffZ/y5A1JbYidLJl -3FlejMoQqp0EpbHO+mRCMSHyJqAFW1ZTHwJBANjv3oMHiYvIsrDXIQAWzLdqvUHI -FOfuH7fDZ3RUN4HS8fzeFeHo+uiO8jj6VR3NoboL7P14GoA4aBc//MjUnRkCQQCH -KZ770NtxFKaIvkLfWzL0cPQkRpWAiCu+RChclnpDH7CaOm2rwkzakhmEttbytFvX -ZW8dUGpQfPyM2XNP/6WlAkEAoOQ5UI1WREbjoJs5mTwTG1gTrQjShQwjC0dqt66s -bOS5os5EePGdctm//Xq7uR4/6hB6T7npPYqiyfWix1SINQ== ------END RSA PRIVATE KEY----- diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/run_test.pl b/TAO/DevGuideExamples/Security/ParticipatingApp/run_test.pl deleted file mode 100644 index 95c461a7f20..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/run_test.pl +++ /dev/null @@ -1,40 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; - -$file = PerlACE::LocalFile("Messenger.ior"); - -unlink $file; - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 15) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $S->Kill (); - exit 1; -} - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient", - "-ORBSvcConf client.conf"); - -if ($C->SpawnWaitKill(10) != 0) { - exit (1); -} - -if ($S->WaitKill(10) == -1) { - $S->Kill(); -} - -exit 0; - diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/server.conf b/TAO/DevGuideExamples/Security/ParticipatingApp/server.conf deleted file mode 100644 index 380312b03fc..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/server.conf +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -# server.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLNoProtection -SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:serverkey.pem -SSLCertificate PEM:servercert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/servercert.pem b/TAO/DevGuideExamples/Security/ParticipatingApp/servercert.pem deleted file mode 100644 index 9659fb07334..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/servercert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQMwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjAyOVoXDTEzMDgwNTAwMjAyOVowgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBlNl -cnZlcjEgMB4GCSqGSIb3DQEJARYRc2VydmVyQG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAKw+tjwQz/stcesfm6WvnB6D/FTYu79tHzGUDlSV -N+kycFYcZfsRmIEo5afG+epOwlp1f9Wpij23AMY4BcdcSP9R4yhH46uMFThQhkn9 -fraZ8slcgVog5G6MwXmsWb5gThjgiT0KPSQHkEU0bryw+CiM4oV+9dSaFBLa3Uqc -iQZdAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAur+t7sIqGjqAPgFtFcgByAJTvNYb -UDZ43AGd22tCtT/usoy/x9qsQv8jwd8kA8yUNQUmjRxR4vEkZ06L6HF8Ii1QmU/E -fZ7YcjXjWxgnCEQGSXuHLhmlIMAlXNvX1XzNddu/NuRbSP3lYS/j32W8gTb6MdyL -8bOkIqRpVY0ek80= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/ParticipatingApp/serverkey.pem b/TAO/DevGuideExamples/Security/ParticipatingApp/serverkey.pem deleted file mode 100644 index c61b8152649..00000000000 --- a/TAO/DevGuideExamples/Security/ParticipatingApp/serverkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCsPrY8EM/7LXHrH5ulr5weg/xU2Lu/bR8xlA5UlTfpMnBWHGX7 -EZiBKOWnxvnqTsJadX/VqYo9twDGOAXHXEj/UeMoR+OrjBU4UIZJ/X62mfLJXIFa -IORujMF5rFm+YE4Y4Ik9Cj0kB5BFNG68sPgojOKFfvXUmhQS2t1KnIkGXQIDAQAB -AoGBAKjg08wQr9qVtBvT4ceRZoCE5+JIncwSMYNqpqJHq4n46iuDrHl9xwjcEE9v -x5jzn5sRmUTj9aaMxzWRuBi/YtFVmgsl8lNiBOniIkFYqIyXfzNgX+2qyRzgOtAo -0ByWFsqkLmW9cUXWaICkM49b9Jz7SnmPs+9VWGiNrjgJSiABAkEA4eFIc82mP2KJ -wap8LJV7GLBA3iiVRmOgVb0TvRMitFWPGdGKFcsAVVkogQ/zIixKeZKc5enMhAI9 -i3Q2tmolZQJBAMM2hlSbJZncMjooKBlp2VZgUpEjbBPpD9XGgA5BO2RfKi3B29T9 -2v8I3m9WbCxbtFKlHcjNT3GToGCoi4S1qZkCQDcn7qwwZE8H/cFnoui0G5ncuApH -eKP2gdlN0TsTKB9G4SmZzBEkP9GXcteJEIKgtBLZpSxTGdiGP4cE+rMyWi0CQDam -TgbjhCxFq74CPe+XZWO8BYFiREByr58uOe1Dr8fSqHE040EGbEeXiQXsUM4+QgYc -+XCcoY/vPyewJ5bYcIkCQERqwlO9/JUiX2w01l82tMxVK8DmN3QwHWJxNexD5Ewf -QFG6FYFPNHCR2f+MUSMFp1djUSVpCrWbppmlr96uZ48= ------END RSA PRIVATE KEY----- diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger.idl b/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger.idl deleted file mode 100644 index 05cf30bf5f9..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp b/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp deleted file mode 100644 index d5ac902909d..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "ace/OS.h" -#include "ace/Get_Opt.h" - -#include "MessengerC.h" -#include "orbsvcs/SecurityC.h" - -// Policy Example 1 -// ================ -// -// Example of a client that downgrades -// from message protection to no message -// protection and upgrades from no -// peer authentication to authentication -// of targets, i.e., authentication of -// servers. -// -// The server's service configuration file -// for this example is -// -// # server.conf -// dynamic SSLIOP_Factory Service_Object * -// TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() -// "-SSLNoProtection -// -SSLAuthenticate SERVER_AND_CLIENT -// -SSLPrivateKey PEM:serverkey.pem -// -SSLCertificate PEM:servercert.pem" -// -// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -// -// The clients service configuration file -// for this example is: -// -// # client.conf -// dynamic SSLIOP_Factory Service_Object * -// TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() -// "-SSLAuthenticate NONE -// -SSLPrivateKey PEM:clientkey.pem -// -SSLCertificate PEM:clientcert.pem" -// -// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -// -// Policy Example 2 -// ================ -// -// Example of client upgrading from -// no message protection and no -// no authentication to message -// protection and authentication -// of targets, i.e., authentication -// of servers. -// -// The server's service configuration file for this example is -// -// # server.conf -// dynamic SSLIOP_Factory Service_Object * -// TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() -// "-SSLAuthenticate SERVER_AND_CLIENT -// -SSLPrivateKey PEM:serverkey.pem -// -SSLCertificate PEM:servercert.pem" -// -// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -// -// The client's service configuration file -// for this example is: -// -// # client.conf -// dynamic SSLIOP_Factory Service_Object * -// TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() -// "-SSLNoProtection -// -SSLAuthenticate NONE -// -SSLPrivateKey PEM:clientkey.pem -// -SSLCertificate PEM:clientcert.pem" -// -// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -// - - -int which = 0; - -int -parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "e:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'e': - which = ACE_OS::atoi(get_opts.optarg); - if(which < 1 || 2 < which) - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-e [12]" - "\n", - argv [0]), - -1); - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-e [12]" - "\n", - argv [0]), - -1); - } - // 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 ); - - CORBA::Object_var obj = - orb->string_to_object( "file://Messenger.ior" ); - - if (parse_args (argc, argv) != 0) - return 1; - else if(which < 1 || 2 < which) - return 1; - - Security::QOP qop; - CORBA::Any protection; - Security::EstablishTrust establish_trust; - CORBA::Any trust; - CORBA::PolicyList policy_list (2); - - if (which == 1) - { - qop = Security::SecQOPNoProtection; - //qop = Security::SecQOPIntegrity; - - establish_trust.trust_in_client = 0; - establish_trust.trust_in_target = 1; - } - else - { - qop = Security::SecQOPIntegrityAndConfidentiality; - - establish_trust.trust_in_client = 0; - establish_trust.trust_in_target = 1; - } - - protection <<= qop; - trust <<= establish_trust; - - CORBA::Policy_var policy = - orb->create_policy (Security::SecQOPPolicy, protection); - - CORBA::Policy_var policy2 = - orb->create_policy (Security::SecEstablishTrustPolicy, trust); - - policy_list.length (1); - policy_list[0] = CORBA::Policy::_duplicate (policy.in ()); - policy_list.length (2); - policy_list[1] = CORBA::Policy::_duplicate (policy2.in ()); - - CORBA::Object_var object = - obj->_set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE); - - Messenger_var messenger = - Messenger::_narrow( object.in() ); - - CORBA::String_var message = - CORBA::string_dup( "Implementing security policy now!" ); - - messenger->send_message( "Chief of Security", - "New Directive", - message.inout() ); - } - catch(const CORBA::Exception& ex) { - ex._tao_print_exception("Client: main block"); - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp b/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp deleted file mode 100644 index c6fdabeeb1e..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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 - Messenger_i messenger_servant; - - // 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( "Messenger.ior" ); - iorFile << str.in() << std::endl; - iorFile.close(); - std::cout << "IOR written to file Messenger.ior" << std::endl; - - // Accept requests - orb->run(); - orb->destroy(); - } - - catch(const CORBA::Exception& ex) { - ex._tao_print_exception("Server Error: main block"); - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.cpp b/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.cpp deleted file mode 100644 index a92cea8879f..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- C++ -*- $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; - return 1; - } diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.h b/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.h deleted file mode 100644 index ef9b4a759a2..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/Messenger_i.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#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/TAO/DevGuideExamples/Security/PolicyControllingApp/PolicyControllingApp.mpc b/TAO/DevGuideExamples/Security/PolicyControllingApp/PolicyControllingApp.mpc deleted file mode 100644 index e79645474db..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/PolicyControllingApp.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): portableserver, orbsvcsexe, security, ssliop { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): orbsvcsexe, security, ssliop { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/README b/TAO/DevGuideExamples/Security/PolicyControllingApp/README deleted file mode 100644 index bf3b57390a4..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/README +++ /dev/null @@ -1,144 +0,0 @@ -TAO Security - -DevGuideExamples/Security/PolicyControllingApp/README - -This directory contains an illustration of a security aware -application that modifies security service policies. Similar -to the security unaware application example, these examples -vary the client and server's configurations. However, there -are also different paths through the client application that -demonstrate different policy settings. - -For readability, long text lines from the example's service -configuration files are split into multiple lines. A backslash -indicates the end of partial line except for the final fragment. -The backslashes should be removed and the fragments joined for -use with the example programs. - -For simplicity, the pass phrases have been stripped from the -private keys included with these examples in the 1.2a release. -This *should not* be construed as a recommended practice. Instead, -OCI strongly recommends that the security requirements of each -real-world application be evaluated carefully and that appropriate -procedures and practice be established accordingly. Private keys -without pass phrase protection are easily compromised and may -allow an unauthorized party to masquerade as an authorized system -user. - -Prior to running the server in these examples, the SSL_CERT_FILE -environment variable must be set, e.g., - # /bin/bash - export SSL_CERT_FILE=cacert.pem -or - rem Windows - set SSL_CERT_FILE=cacert.pem - -Example 1: Client sets Quality of Protection to NoProtection ------------------------------------------------------------- -The server is configured to accept both secured and unsecured -invocations (by setting -SSLNoProtection). The client is -configured to make secured invocations only. The client -application sets the quality of protection policy to -no protection to make an unsecured invocation to the server. - -The server's configuration is: - -# -# server.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLNoProtection \ - -SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of server.conf -# - -The client's configuration is: - -# -# client.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate NONE \ - -SSLPrivateKey PEM:clientkey.pem \ - -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of client.conf -# - -To run the server: - ./MessengerServer -ORBSvcConf server.conf - -To run the client: - ./MessengerClient -e 1 -ORBSvcConf client.conf - -Note: as presented in the 1.2a Developer's Guide, the client code -for this first example also manipulates the establish trust -policy. After the text went to print, changes in TAO have required -a change to this example such that the establish trust policy can't -be modified as shown in the text without causing an exception. This -example has been modified accordingly to execute without causing an -exception. - -Example 2: Client sets Quality of Protection to IntegrityAndConfidentiality -and EstablishTrust to authenticate the server ---------------------------------------------------------------------------- -The server is configured to accept secured invocations only. The client -is configured to issue unsecured invocations by default (-SSLNoProtection is -set). The client sets the quality of protection policy to integrity and -confidentiality and establish trust policy to authenticate the server. This -can only be achieved via a secured invocation. - -The server's configuration is: - -# -# server1.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of server1.conf -# - -The client's configuration is: - -# -# client1.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLNoProtection \ - -SSLAuthenticate NONE \ - -SSLPrivateKey PEM:clientkey.pem \ - -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of client1.conf -# - -To run the server: - ./MessengerServer -ORBSvcConf server1.conf - -To run the client: - ./MessengerClient -e 2 -ORBSvcConf client1.conf - - --------------------------------------------------- -Files: DevGuideExamples/Security/PolicyControllingApp - -Messenger.idl - Messenger interface definition. -Messenger_i.h - Messenger servant class definition. -Messenger_i.cpp - Messenger servant implementation. -MessengerServer.cpp - MessengerServer process main. -MessengerClient.cpp - MessengerClient process main. - diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/cacert.pem b/TAO/DevGuideExamples/Security/PolicyControllingApp/cacert.pem deleted file mode 100644 index c493d28a523..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/cacert.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDujCCAyOgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBoDELMAkGA1UEBhMCVVMx -ETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNVBAoT -Fk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMU -Q2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5j -b20wHhcNMDMwNzIzMjAyNDIwWhcNMTMwNzIwMjAyNDIwWjCBoDELMAkGA1UEBhMC -VVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNV -BAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UE -AxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdl -Yi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO4QS4bqrXVuBnHsOg1/ -gijXjiWhFTngG/sDLWAA52fHIobyFo5//7UaLedke0fkwqsmky8hjzSbXGJsGI5g -Yjp2Va7WeJhRQNr8VYWobCq00f//drHN2NF5M23Cx0JF9WfyfWpqq5TQRGtVZ+We -+q4S6wH1exZrVGHfkp5Xq5FvAgMBAAGjggEAMIH9MB0GA1UdDgQWBBQvTY0YWmHq -o2TMOKba/ECH9ayXZzCBzQYDVR0jBIHFMIHCgBQvTY0YWmHqo2TMOKba/ECH9ayX -Z6GBpqSBozCBoDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYD -VQQHEwlTdC4gTG91aXMxHzAdBgNVBAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4x -DDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAa -BgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkq -hkiG9w0BAQQFAAOBgQBgjn97nbyyjFxyHC8vheAiDCQRblI4lZbZC6vSmxxqEGze -eAMiTYL2iK3vj2Ot3V2/o5VdLyEYV4RBP2iq1XuMYXjmL2ni+NVgepyXceynH8/b -72yciZZcDE5FVUaMUHAgZUpxsGSDyD70LnOFwBxuvxtlMtG5vXYNvwF/FJPs1g== ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/client.conf b/TAO/DevGuideExamples/Security/PolicyControllingApp/client.conf deleted file mode 100644 index 1130e620d7b..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/client.conf +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -# client.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate NONE -SSLPrivateKey PEM:clientkey.pem -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/client1.conf b/TAO/DevGuideExamples/Security/PolicyControllingApp/client1.conf deleted file mode 100644 index 23f4e0a5859..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/client1.conf +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -# client.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLNoProtection -SSLAuthenticate NONE -SSLPrivateKey PEM:clientkey.pem -SSLCertificate PEM:clientcert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/clientcert.pem b/TAO/DevGuideExamples/Security/PolicyControllingApp/clientcert.pem deleted file mode 100644 index 56616fcd469..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/clientcert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQQwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjIwN1oXDTEzMDgwNTAwMjIwN1owgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBmNs -aWVudDEgMB4GCSqGSIb3DQEJARYRY2xpZW50QG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAMYaaQgEmp2zv0t+MAEGf5GIsKSIB1YFrkkVR6Qv -LP0t9FHDPGFawh/aK3Yq+l7RiNpK1H5SSOaIavm4xV/3tpHxzuRjd0H3fdhaoAgD -xvcYZ75l662PEa25MCJsp40tACO0hGNOQCJ8kWVmT4xEhKcFl3xm+1OvNbwDM/pA -t4WpAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEArs6S6qud6D9t6AcGJS91XWqbBY1G -rSgmv9yFbvUyrGAQuMpyNuYTGlZA+Nd3EAjYlwP4fWbzUMM0MEtd3Xl0Aep0O39W -Cgp9HxDaJi3b4h63cd/B0su+2CNd4P6+NOX+IxgrrioCgKSnu6Nxy14fb03RQhjl -a3vOY5Juf8ySB/M= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/clientkey.pem b/TAO/DevGuideExamples/Security/PolicyControllingApp/clientkey.pem deleted file mode 100644 index 2b4af2322ad..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/clientkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDGGmkIBJqds79LfjABBn+RiLCkiAdWBa5JFUekLyz9LfRRwzxh -WsIf2it2Kvpe0YjaStR+UkjmiGr5uMVf97aR8c7kY3dB933YWqAIA8b3GGe+Zeut -jxGtuTAibKeNLQAjtIRjTkAifJFlZk+MRISnBZd8ZvtTrzW8AzP6QLeFqQIDAQAB -AoGAJx1X16lxDepLvxAvUkSCM64Vkqb5K9b7TprRBm36KBNGxk4SQfa1laxyIGbk -AIzGxLM5uadtlXciCCSfdA9pEJbjtxSRJt2RbOWioT3sfIzXO7SCMHuuRjnPK3P8 -rgFmOOpo/ldVZ3mBJajxzWTEFXMUTAC4tB2j2B6of7MG5fECQQDu+uKzI2QjiTpW -5WFd/vzpS2SpDHks4sEu0F6zk1Zhbsc3KoJd3xxSLhKFLLoRDVZsDKE3opr7WRNT -+sjoGRY3AkEA1DZArJqLeWuB8L8GjC/AtMXsxlSe3Iy9X+4uffZ/y5A1JbYidLJl -3FlejMoQqp0EpbHO+mRCMSHyJqAFW1ZTHwJBANjv3oMHiYvIsrDXIQAWzLdqvUHI -FOfuH7fDZ3RUN4HS8fzeFeHo+uiO8jj6VR3NoboL7P14GoA4aBc//MjUnRkCQQCH -KZ770NtxFKaIvkLfWzL0cPQkRpWAiCu+RChclnpDH7CaOm2rwkzakhmEttbytFvX -ZW8dUGpQfPyM2XNP/6WlAkEAoOQ5UI1WREbjoJs5mTwTG1gTrQjShQwjC0dqt66s -bOS5os5EePGdctm//Xq7uR4/6hB6T7npPYqiyfWix1SINQ== ------END RSA PRIVATE KEY----- diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/run_test.pl b/TAO/DevGuideExamples/Security/PolicyControllingApp/run_test.pl deleted file mode 100644 index 1e1ac789af7..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/run_test.pl +++ /dev/null @@ -1,69 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$file = PerlACE::LocalFile("Messenger.ior"); - -unlink $file; - -$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); - -$S1 = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server1.conf"); - -$C = new PerlACE::Process("MessengerClient", - "-e 1 -ORBSvcConf client.conf"); - -$C1 = new PerlACE::Process("MessengerClient", - "-e 2 -ORBSvcConf client1.conf"); - - -print STDERR "\n\nSecurity Policy Controlling Application Examples\n"; -print STDERR "------------------------------------------------\n"; - -print STDERR "Starting Messenger Server, example 1...\n\n"; -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); - exit 1; -} - -print STDERR "\nStarting MessengerClient, example 1...\n\n"; -if ($C->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); -} - -unlink $file; -$S->Kill(); - -print STDERR "\nStarting Messenger Server, example 2...\n\n"; -$S1->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); - exit 1; -} - -print STDERR "\nStarting MessengerClient, example 2...\n\n"; -if ($C1->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); -} - -# clean-up -$S1->Kill(); - -exit 0; - diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/server.conf b/TAO/DevGuideExamples/Security/PolicyControllingApp/server.conf deleted file mode 100644 index 380312b03fc..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/server.conf +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -# server.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLNoProtection -SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:serverkey.pem -SSLCertificate PEM:servercert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/server1.conf b/TAO/DevGuideExamples/Security/PolicyControllingApp/server1.conf deleted file mode 100644 index f975ec687f8..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/server1.conf +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -# server.conf -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:serverkey.pem -SSLCertificate PEM:servercert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/servercert.pem b/TAO/DevGuideExamples/Security/PolicyControllingApp/servercert.pem deleted file mode 100644 index 9659fb07334..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/servercert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQMwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjAyOVoXDTEzMDgwNTAwMjAyOVowgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBlNl -cnZlcjEgMB4GCSqGSIb3DQEJARYRc2VydmVyQG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAKw+tjwQz/stcesfm6WvnB6D/FTYu79tHzGUDlSV -N+kycFYcZfsRmIEo5afG+epOwlp1f9Wpij23AMY4BcdcSP9R4yhH46uMFThQhkn9 -fraZ8slcgVog5G6MwXmsWb5gThjgiT0KPSQHkEU0bryw+CiM4oV+9dSaFBLa3Uqc -iQZdAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAur+t7sIqGjqAPgFtFcgByAJTvNYb -UDZ43AGd22tCtT/usoy/x9qsQv8jwd8kA8yUNQUmjRxR4vEkZ06L6HF8Ii1QmU/E -fZ7YcjXjWxgnCEQGSXuHLhmlIMAlXNvX1XzNddu/NuRbSP3lYS/j32W8gTb6MdyL -8bOkIqRpVY0ek80= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/PolicyControllingApp/serverkey.pem b/TAO/DevGuideExamples/Security/PolicyControllingApp/serverkey.pem deleted file mode 100644 index c61b8152649..00000000000 --- a/TAO/DevGuideExamples/Security/PolicyControllingApp/serverkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCsPrY8EM/7LXHrH5ulr5weg/xU2Lu/bR8xlA5UlTfpMnBWHGX7 -EZiBKOWnxvnqTsJadX/VqYo9twDGOAXHXEj/UeMoR+OrjBU4UIZJ/X62mfLJXIFa -IORujMF5rFm+YE4Y4Ik9Cj0kB5BFNG68sPgojOKFfvXUmhQS2t1KnIkGXQIDAQAB -AoGBAKjg08wQr9qVtBvT4ceRZoCE5+JIncwSMYNqpqJHq4n46iuDrHl9xwjcEE9v -x5jzn5sRmUTj9aaMxzWRuBi/YtFVmgsl8lNiBOniIkFYqIyXfzNgX+2qyRzgOtAo -0ByWFsqkLmW9cUXWaICkM49b9Jz7SnmPs+9VWGiNrjgJSiABAkEA4eFIc82mP2KJ -wap8LJV7GLBA3iiVRmOgVb0TvRMitFWPGdGKFcsAVVkogQ/zIixKeZKc5enMhAI9 -i3Q2tmolZQJBAMM2hlSbJZncMjooKBlp2VZgUpEjbBPpD9XGgA5BO2RfKi3B29T9 -2v8I3m9WbCxbtFKlHcjNT3GToGCoi4S1qZkCQDcn7qwwZE8H/cFnoui0G5ncuApH -eKP2gdlN0TsTKB9G4SmZzBEkP9GXcteJEIKgtBLZpSxTGdiGP4cE+rMyWi0CQDam -TgbjhCxFq74CPe+XZWO8BYFiREByr58uOe1Dr8fSqHE040EGbEeXiQXsUM4+QgYc -+XCcoY/vPyewJ5bYcIkCQERqwlO9/JUiX2w01l82tMxVK8DmN3QwHWJxNexD5Ewf -QFG6FYFPNHCR2f+MUSMFp1djUSVpCrWbppmlr96uZ48= ------END RSA PRIVATE KEY----- diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger.idl b/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger.idl deleted file mode 100644 index 05cf30bf5f9..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger.idl +++ /dev/null @@ -1,11 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -// messenger.idl - -interface Messenger - { - boolean send_message ( in string user_name, - in string subject, - inout string message ); - }; - diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp b/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp deleted file mode 100644 index 76f812e7cff..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "MessengerC.h" -#include <iostream> -int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - // Destringify ior - CORBA::Object_var obj = orb->string_to_object( "file://Messenger.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; - } - - CORBA::String_var message = CORBA::string_dup( - "Implementing security policy now!" ); - messenger->send_message( "Chief of Security", - "New Directive", - message.inout() ); - std::cout << "message was sent" << std::endl; - } - - catch(const CORBA::Exception& ex) { - std::cerr << "Caught CORBA excepti.o.n: " << ex << std::endl; - return 1; - } - - return 0; -} diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerI.cpp b/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerI.cpp deleted file mode 100644 index dea865aa6f4..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerI.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -*- 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 "MessengerI.h" - -// 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 - } - diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp b/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp deleted file mode 100644 index 8cdfce1b28e..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#include "Messenger_i.h" -#include <iostream> -#include <fstream> -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - //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 - Messenger_i messenger_servant; - - // 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( "Messenger.ior" ); - iorFile << str.in() << std::endl; - iorFile.close(); - std::cout << "IOR written to file Messenger.ior" << 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/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.cpp b/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.cpp deleted file mode 100644 index 809cfcc584f..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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; - return 1; - } diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.h b/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.h deleted file mode 100644 index ef9b4a759a2..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/Messenger_i.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- C++ -*- $Id$ */ - -#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/TAO/DevGuideExamples/Security/SecurityUnawareApp/README b/TAO/DevGuideExamples/Security/SecurityUnawareApp/README deleted file mode 100644 index 7eebb03ebfb..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/README +++ /dev/null @@ -1,172 +0,0 @@ -TAO Security - -DevGuideExamples/Security/SecurityUnawareApp/README - -This directory contains an illustration of a security unaware -application. The examples vary the client's configuration to -demonstrate different features. For each of these examples, -however, the client and server process code remains the same. - -For readability, long text lines from the example's service -configuration files are split into multiple lines. A backslash -indicates the end of partial line except for the final fragment. -The backslashes should be removed and the fragments joined for -use with the example programs. - -For simplicity, the pass phrases have been stripped from the -private keys included with these examples in the 1.2a release. -This *should not* be construed as a recommended practice. Instead, -OCI strongly recommends that the security requirements of each -real-world application be evaluated carefully and that appropriate -procedures and practice be established accordingly. Private keys -without pass phrase protection are easily compromised and may -allow an unauthorized party to masquerade as an authorized system -user. - -Prior to running the server in these examples, the SSL_CERT_FILE -environment variable must be set, e.g., - # /bin/bash - export SSL_CERT_FILE=cacert.pem -or - rem Windows - set SSL_CERT_FILE=cacert.pem - -For examples 1 and 2, the client's environment should also -define SSL_CERT_FILE appropriately. The final example -demonstrates how to establish a connection between a client -and server such that the client does not authenticate the -server and therefore does not need a value for SSL_CERT_FILE. - - - -Example 1: Secured server and unsecured client ----------------------------------------------- -The server is configured to accept requests only via secured -connections. No specific configurationi is provided for the -client so it has the default configuration. - -The server's configuration is: - -# -# server.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of server.conf -# - -To run the server: - ./MessengerServer -ORBSvcConf server.conf - -To run the client: - ./MessengerClient - - - -Example 2: Secured server and unsecured client ----------------------------------------------- -Both server and client are configured to issue and accept -requests via secured connections. - -The server's configuration is: - -# -# server.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of server.conf -# - -The client's configuration is: - -# -# client.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of client.conf -# - -To run the server: - ./MessengerServer -ORBSvcConf server.conf - -To run the client: - ./MessengerClient -ORBSvcConf client.conf - - - -Example 3: client doesn't authenticate server ---------------------------------------------- -The client is configured such that it doesn't authenticate -the server. It still employs an encrypted connection but, -since it doesn't need a CA certificate, no value for -SSL_CERT_FILE is required. - -The server's configuration is: - -# -# server.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate SERVER_AND_CLIENT \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of server.conf -# - -The client's configuration is: - -# -# client.conf -# -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() \ - "-SSLAuthenticate NONE \ - -SSLPrivateKey PEM:serverkey.pem \ - -SSLCertificate PEM:servercert.pem" - -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -# -# end of client.conf -# - -To run the server: - ./MessengerServer -ORBSvcConf server.conf - -To run the client: - ./MessengerClient -ORBSvcConf client.conf - -If a value for SSL_CERT_FILE has already been placed in the -client's environment, the client may be executed as follows (on -Unix platforms): - SSL_CERT_FILE= ./MessengerClient -ORBSvcConf client.conf - - - --------------------------------------------------- -Files: DevGuideExamples/Security/SecurityUnawareApp/ - -Messenger.idl - Messenger interface definition. -Messenger_i.h - Messenger servant class definition. -Messenger_i.cpp - Messenger servant implementation. -MessengerServer.cpp - MessengerServer process main. -MessengerClient.cpp - MessengerClient process main. - diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/SecurityUnawareApp.mpc b/TAO/DevGuideExamples/Security/SecurityUnawareApp/SecurityUnawareApp.mpc deleted file mode 100644 index 09a2598b354..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/SecurityUnawareApp.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -project(*Server): taoexe, portableserver, security, ssl { - Source_Files { - Messenger_i.cpp - MessengerServer.cpp - } -} - -project(*Client): taoexe, security, ssl { - Source_Files { - MessengerC.cpp - MessengerClient.cpp - } -} diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/cacert.pem b/TAO/DevGuideExamples/Security/SecurityUnawareApp/cacert.pem deleted file mode 100644 index c493d28a523..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/cacert.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDujCCAyOgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBoDELMAkGA1UEBhMCVVMx -ETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNVBAoT -Fk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMU -Q2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5j -b20wHhcNMDMwNzIzMjAyNDIwWhcNMTMwNzIwMjAyNDIwWjCBoDELMAkGA1UEBhMC -VVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYDVQQHEwlTdC4gTG91aXMxHzAdBgNV -BAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4xDDAKBgNVBAsTA1RBTzEdMBsGA1UE -AxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAaBgkqhkiG9w0BCQEWDWNhQG9jaXdl -Yi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO4QS4bqrXVuBnHsOg1/ -gijXjiWhFTngG/sDLWAA52fHIobyFo5//7UaLedke0fkwqsmky8hjzSbXGJsGI5g -Yjp2Va7WeJhRQNr8VYWobCq00f//drHN2NF5M23Cx0JF9WfyfWpqq5TQRGtVZ+We -+q4S6wH1exZrVGHfkp5Xq5FvAgMBAAGjggEAMIH9MB0GA1UdDgQWBBQvTY0YWmHq -o2TMOKba/ECH9ayXZzCBzQYDVR0jBIHFMIHCgBQvTY0YWmHqo2TMOKba/ECH9ayX -Z6GBpqSBozCBoDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE1pc3NvdXJpMRIwEAYD -VQQHEwlTdC4gTG91aXMxHzAdBgNVBAoTFk9iamVjdCBDb21wdXRpbmcsIEluYy4x -DDAKBgNVBAsTA1RBTzEdMBsGA1UEAxMUQ2VydGlmeWluZyBBdXRob3JpdHkxHDAa -BgkqhkiG9w0BCQEWDWNhQG9jaXdlYi5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkq -hkiG9w0BAQQFAAOBgQBgjn97nbyyjFxyHC8vheAiDCQRblI4lZbZC6vSmxxqEGze -eAMiTYL2iK3vj2Ot3V2/o5VdLyEYV4RBP2iq1XuMYXjmL2ni+NVgepyXceynH8/b -72yciZZcDE5FVUaMUHAgZUpxsGSDyD70LnOFwBxuvxtlMtG5vXYNvwF/FJPs1g== ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/client.conf b/TAO/DevGuideExamples/Security/SecurityUnawareApp/client.conf deleted file mode 100644 index 78e939b5c7e..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/client.conf +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:clientkey.pem -SSLCertificate PEM:clientcert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/client1.conf b/TAO/DevGuideExamples/Security/SecurityUnawareApp/client1.conf deleted file mode 100644 index daafe5fdf58..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/client1.conf +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate NONE -SSLPrivateKey PEM:clientkey.pem -SSLCertificate PEM:clientcert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientcert.pem b/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientcert.pem deleted file mode 100644 index 56616fcd469..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientcert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQQwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjIwN1oXDTEzMDgwNTAwMjIwN1owgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBmNs -aWVudDEgMB4GCSqGSIb3DQEJARYRY2xpZW50QG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAMYaaQgEmp2zv0t+MAEGf5GIsKSIB1YFrkkVR6Qv -LP0t9FHDPGFawh/aK3Yq+l7RiNpK1H5SSOaIavm4xV/3tpHxzuRjd0H3fdhaoAgD -xvcYZ75l662PEa25MCJsp40tACO0hGNOQCJ8kWVmT4xEhKcFl3xm+1OvNbwDM/pA -t4WpAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEArs6S6qud6D9t6AcGJS91XWqbBY1G -rSgmv9yFbvUyrGAQuMpyNuYTGlZA+Nd3EAjYlwP4fWbzUMM0MEtd3Xl0Aep0O39W -Cgp9HxDaJi3b4h63cd/B0su+2CNd4P6+NOX+IxgrrioCgKSnu6Nxy14fb03RQhjl -a3vOY5Juf8ySB/M= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientkey.pem b/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientkey.pem deleted file mode 100644 index 2b4af2322ad..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/clientkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDGGmkIBJqds79LfjABBn+RiLCkiAdWBa5JFUekLyz9LfRRwzxh -WsIf2it2Kvpe0YjaStR+UkjmiGr5uMVf97aR8c7kY3dB933YWqAIA8b3GGe+Zeut -jxGtuTAibKeNLQAjtIRjTkAifJFlZk+MRISnBZd8ZvtTrzW8AzP6QLeFqQIDAQAB -AoGAJx1X16lxDepLvxAvUkSCM64Vkqb5K9b7TprRBm36KBNGxk4SQfa1laxyIGbk -AIzGxLM5uadtlXciCCSfdA9pEJbjtxSRJt2RbOWioT3sfIzXO7SCMHuuRjnPK3P8 -rgFmOOpo/ldVZ3mBJajxzWTEFXMUTAC4tB2j2B6of7MG5fECQQDu+uKzI2QjiTpW -5WFd/vzpS2SpDHks4sEu0F6zk1Zhbsc3KoJd3xxSLhKFLLoRDVZsDKE3opr7WRNT -+sjoGRY3AkEA1DZArJqLeWuB8L8GjC/AtMXsxlSe3Iy9X+4uffZ/y5A1JbYidLJl -3FlejMoQqp0EpbHO+mRCMSHyJqAFW1ZTHwJBANjv3oMHiYvIsrDXIQAWzLdqvUHI -FOfuH7fDZ3RUN4HS8fzeFeHo+uiO8jj6VR3NoboL7P14GoA4aBc//MjUnRkCQQCH -KZ770NtxFKaIvkLfWzL0cPQkRpWAiCu+RChclnpDH7CaOm2rwkzakhmEttbytFvX -ZW8dUGpQfPyM2XNP/6WlAkEAoOQ5UI1WREbjoJs5mTwTG1gTrQjShQwjC0dqt66s -bOS5os5EePGdctm//Xq7uR4/6hB6T7npPYqiyfWix1SINQ== ------END RSA PRIVATE KEY----- diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl b/TAO/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl deleted file mode 100644 index 0b3a2b0446e..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl +++ /dev/null @@ -1,64 +0,0 @@ -# $Id$ - -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -use Env (ACE_ROOT); -use lib "$ACE_ROOT/bin"; -use PerlACE::Run_Test; - -$file = PerlACE::LocalFile("Messenger.ior"); - -unlink $file; - -$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; - -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); - -print STDERR "\n\nSecurity Unaware Application Examples\n"; -print STDERR "-------------------------------------\n"; -print STDERR "Starting Messenger Server...\n\n"; - -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 5) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); - exit 1; -} - -# start MessengerClient -$C = new PerlACE::Process("MessengerClient"); - -$C1 = new PerlACE::Process("MessengerClient", - "-ORBSvcConf client.conf"); - -$C2 = new PerlACE::Process("MessengerClient", - "-ORBSvcConf client1.conf"); - -print STDERR "\nStarting MessengerClient, example 1...\n\n"; -if ($C->SpawnWaitKill(10) == 0) { - $S->Kill(); - exit (1); -} - -print STDERR "\nStarting MessengerClient, example 2...\n\n"; -if ($C1->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); -} - -$ENV{'SSL_CERT_FILE'} = ''; - -print STDERR "\nStarting MessengerClient, example 3...\n\n"; -if ($C2->SpawnWaitKill(10) != 0) { - $S->Kill(); - exit (1); -} - -# clean-up -$S->Kill(); - -exit 0; diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/server.conf b/TAO/DevGuideExamples/Security/SecurityUnawareApp/server.conf deleted file mode 100644 index 200fbd6cb8b..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/server.conf +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:serverkey.pem -SSLCertificate PEM:servercert.pem" -static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/servercert.pem b/TAO/DevGuideExamples/Security/SecurityUnawareApp/servercert.pem deleted file mode 100644 index 9659fb07334..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/servercert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpzCCAhACAQMwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlVTMREwDwYD -VQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZPYmpl -Y3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xHTAbBgNVBAMTFENlcnRp -ZnlpbmcgQXV0aG9yaXR5MRwwGgYJKoZIhvcNAQkBFg1jYUBvY2l3ZWIuY29tMB4X -DTAzMDgwODAwMjAyOVoXDTEzMDgwNTAwMjAyOVowgZYxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhNaXNzb3VyaTESMBAGA1UEBxMJU3QuIExvdWlzMR8wHQYDVQQKExZP -YmplY3QgQ29tcHV0aW5nLCBJbmMuMQwwCgYDVQQLEwNUQU8xDzANBgNVBAMTBlNl -cnZlcjEgMB4GCSqGSIb3DQEJARYRc2VydmVyQG9jaXdlYi5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAKw+tjwQz/stcesfm6WvnB6D/FTYu79tHzGUDlSV -N+kycFYcZfsRmIEo5afG+epOwlp1f9Wpij23AMY4BcdcSP9R4yhH46uMFThQhkn9 -fraZ8slcgVog5G6MwXmsWb5gThjgiT0KPSQHkEU0bryw+CiM4oV+9dSaFBLa3Uqc -iQZdAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAur+t7sIqGjqAPgFtFcgByAJTvNYb -UDZ43AGd22tCtT/usoy/x9qsQv8jwd8kA8yUNQUmjRxR4vEkZ06L6HF8Ii1QmU/E -fZ7YcjXjWxgnCEQGSXuHLhmlIMAlXNvX1XzNddu/NuRbSP3lYS/j32W8gTb6MdyL -8bOkIqRpVY0ek80= ------END CERTIFICATE----- diff --git a/TAO/DevGuideExamples/Security/SecurityUnawareApp/serverkey.pem b/TAO/DevGuideExamples/Security/SecurityUnawareApp/serverkey.pem deleted file mode 100644 index c61b8152649..00000000000 --- a/TAO/DevGuideExamples/Security/SecurityUnawareApp/serverkey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCsPrY8EM/7LXHrH5ulr5weg/xU2Lu/bR8xlA5UlTfpMnBWHGX7 -EZiBKOWnxvnqTsJadX/VqYo9twDGOAXHXEj/UeMoR+OrjBU4UIZJ/X62mfLJXIFa -IORujMF5rFm+YE4Y4Ik9Cj0kB5BFNG68sPgojOKFfvXUmhQS2t1KnIkGXQIDAQAB -AoGBAKjg08wQr9qVtBvT4ceRZoCE5+JIncwSMYNqpqJHq4n46iuDrHl9xwjcEE9v -x5jzn5sRmUTj9aaMxzWRuBi/YtFVmgsl8lNiBOniIkFYqIyXfzNgX+2qyRzgOtAo -0ByWFsqkLmW9cUXWaICkM49b9Jz7SnmPs+9VWGiNrjgJSiABAkEA4eFIc82mP2KJ -wap8LJV7GLBA3iiVRmOgVb0TvRMitFWPGdGKFcsAVVkogQ/zIixKeZKc5enMhAI9 -i3Q2tmolZQJBAMM2hlSbJZncMjooKBlp2VZgUpEjbBPpD9XGgA5BO2RfKi3B29T9 -2v8I3m9WbCxbtFKlHcjNT3GToGCoi4S1qZkCQDcn7qwwZE8H/cFnoui0G5ncuApH -eKP2gdlN0TsTKB9G4SmZzBEkP9GXcteJEIKgtBLZpSxTGdiGP4cE+rMyWi0CQDam -TgbjhCxFq74CPe+XZWO8BYFiREByr58uOe1Dr8fSqHE040EGbEeXiQXsUM4+QgYc -+XCcoY/vPyewJ5bYcIkCQERqwlO9/JUiX2w01l82tMxVK8DmN3QwHWJxNexD5Ewf -QFG6FYFPNHCR2f+MUSMFp1djUSVpCrWbppmlr96uZ48= ------END RSA PRIVATE KEY----- |