1 //=============================================================================
3 * @file Locator_NT_Service.cpp
5 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
6 * @author Jeff Parsons <parsons@cs.wustl.edu>
7 * @author John Tucker <jtucker@infoglide.com>
8 * @author Mike Vitalo <mvitalo@infoglide.com>
10 //=============================================================================
12 #include "Locator_NT_Service.h"
14 #if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_SERVICES)
16 #include "ImR_Locator_i.h"
17 #include "Locator_Options.h"
19 #include "tao/ORB_Core.h"
20 #include "tao/corba.h"
21 #include "ace/Reactor.h"
23 const ACE_TCHAR
* IMR_LOCATOR_SERVICE_NAME
= ACE_TEXT("TAOImR");
24 const ACE_TCHAR
* IMR_LOCATOR_DISPLAY_NAME
= ACE_TEXT("TAO Implementation Repository");
25 const ACE_TCHAR
* IMR_LOCATOR_DESCRIPTION
= ACE_TEXT("Implementation Repository Locator service for TAO");
28 * Handles the SERVICE_CONTROL_SHUTDOWN and SERVICE_CONTROL_STOP commands
29 * by shutting down the ORB. Otherwise ACE_NT_Service::handle_control
30 * handles the command.
33 Locator_NT_Service::handle_control (DWORD control_code
)
35 if (control_code
== SERVICE_CONTROL_SHUTDOWN
36 || control_code
== SERVICE_CONTROL_STOP
)
38 report_status (SERVICE_STOP_PENDING
);
39 TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
40 TAO_ORB_Core_instance ()->orb ()->shutdown (1);
44 ACE_NT_Service::handle_control (control_code
);
50 Locator_NT_Service::handle_exception (ACE_HANDLE
)
57 * We do almost the same thing as we do in run_standalone ()
60 Locator_NT_Service::svc (void)
65 if (opts
.init_from_registry () != 0)
67 report_status (SERVICE_STOPPED
);
73 int status
= server
.init (opts
);
77 report_status (SERVICE_STOPPED
);
82 report_status (SERVICE_RUNNING
);
85 status
= server
.fini ();
87 report_status (SERVICE_STOPPED
);
93 catch (const CORBA::SystemException
& sysex
)
95 sysex
._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME
);
97 catch (const CORBA::UserException
& userex
)
99 userex
._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME
);
101 catch (const CORBA::Exception
& ex
)
103 ex
._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME
);
106 report_status (SERVICE_STOPPED
);
111 #endif /* ACE_WIN32 && !ACE_LACKS_WIN32_SERVICES */