summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/Event_Service/Event_Service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/Event_Service/Event_Service.cpp')
-rw-r--r--TAO/orbsvcs/Event_Service/Event_Service.cpp119
1 files changed, 0 insertions, 119 deletions
diff --git a/TAO/orbsvcs/Event_Service/Event_Service.cpp b/TAO/orbsvcs/Event_Service/Event_Service.cpp
deleted file mode 100644
index 5d20ba57242..00000000000
--- a/TAO/orbsvcs/Event_Service/Event_Service.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// $Id$
-//
-
-#include "ace/Get_Opt.h"
-#include "tao/corba.h"
-
-#include "orbsvcs/CosNamingC.h"
-#include "orbsvcs/Scheduler_Factory.h"
-#include "orbsvcs/Event_Utilities.h"
-#include "orbsvcs/Event/Event_Channel.h"
-
-
-
-const char* service_name = "EventService";
-
-int
-parse_args (int argc, char *argv [])
-{
- ACE_Get_Opt get_opt (argc, argv, "n:");
- int opt;
-
- while ((opt = get_opt ()) != EOF)
- {
- switch (opt)
- {
- case 'n':
- service_name = get_opt.optarg;
- break;
- case '?':
- default:
- ACE_DEBUG ((LM_DEBUG,
- "Usage: %s "
- "-n service_name "
- "\n",
- argv[0]));
- return -1;
- }
- }
-
- return 0;
-}
-
-
-int main (int argc, char *argv[])
-{
- TAO_TRY
- {
- // Initialize ORB.
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "internet", TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (parse_args (argc, argv) == -1)
- return 1;
-
- 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 (), TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService");
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to initialize the POA.\n"),
- 1);
-
- CosNaming::NamingContext_var naming_context =
- CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- ACE_Scheduler_Factory::use_config (naming_context.in ());
-
- // Register Event_Service with Naming Service.
- ACE_EventChannel ec_impl;
-
- RtecEventChannelAdmin::EventChannel_var ec =
- ec_impl._this (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CORBA::String_var str =
- orb->object_to_string (ec.in (), TAO_TRY_ENV);
-
- ACE_DEBUG ((LM_DEBUG, "The EC IOR is <%s>\n", str.in ()));
-
- CosNaming::Name channel_name (1);
- channel_name.length (1);
- channel_name[0].id = CORBA::string_dup (service_name);
- naming_context->bind (channel_name, ec.in (), TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- poa_manager->activate (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- ACE_DEBUG ((LM_DEBUG, "running event service\n"));
- if (orb->run () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), 1);
-
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("EC");
- }
- TAO_ENDTRY;
-
-
- return 0;
-}