diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/orbsvcs/Naming_Service | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/Naming_Service')
-rw-r--r-- | TAO/orbsvcs/Naming_Service/.cvsignore | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Makefile.am | 101 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/NT_Naming_Server.cpp | 228 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp | 199 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/NT_Naming_Service.h | 97 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Server.cpp | 69 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.cpp | 158 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.h | 76 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Service.mpc | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/README | 409 |
10 files changed, 0 insertions, 1360 deletions
diff --git a/TAO/orbsvcs/Naming_Service/.cvsignore b/TAO/orbsvcs/Naming_Service/.cvsignore deleted file mode 100644 index c089bb234b3..00000000000 --- a/TAO/orbsvcs/Naming_Service/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -NT_Naming_Service -Naming_Service diff --git a/TAO/orbsvcs/Naming_Service/Makefile.am b/TAO/orbsvcs/Naming_Service/Makefile.am deleted file mode 100644 index dc236ad3e21..00000000000 --- a/TAO/orbsvcs/Naming_Service/Makefile.am +++ /dev/null @@ -1,101 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## ../bin/mwc.pl -type automake -noreldefs TAO.mwc - -ACE_BUILDDIR = $(top_builddir)/.. -ACE_ROOT = $(top_srcdir)/.. -TAO_BUILDDIR = $(top_builddir) -TAO_ROOT = $(top_srcdir) - -bin_PROGRAMS = - -## Makefile.NT_Naming_Service.am - -if BUILD_WINNT -if !BUILD_ACE_FOR_TAO - -bin_PROGRAMS += NT_Naming_Service - -NT_Naming_Service_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) \ - -I$(TAO_ROOT)/orbsvcs \ - -I$(TAO_BUILDDIR)/orbsvcs - -NT_Naming_Service_SOURCES = \ - NT_Naming_Server.cpp \ - NT_Naming_Service.cpp \ - Naming_Service.cpp \ - NT_Naming_Service.h \ - Naming_Service.h - -NT_Naming_Service_LDADD = \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming_Serv.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \ - $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ - $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming_Skel.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif !BUILD_ACE_FOR_TAO -endif BUILD_WINNT - -## Makefile.Naming_Service.am - -if !BUILD_ACE_FOR_TAO - -bin_PROGRAMS += Naming_Service - -Naming_Service_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) \ - -I$(TAO_ROOT)/orbsvcs \ - -I$(TAO_BUILDDIR)/orbsvcs - -Naming_Service_SOURCES = \ - Naming_Server.cpp \ - Naming_Service.cpp \ - Naming_Service.h - -Naming_Service_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_ImR_Client.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming_Serv.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \ - $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ - $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming_Skel.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -endif !BUILD_ACE_FOR_TAO - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/Naming_Service/NT_Naming_Server.cpp b/TAO/orbsvcs/Naming_Service/NT_Naming_Server.cpp deleted file mode 100644 index dc1288420cb..00000000000 --- a/TAO/orbsvcs/Naming_Service/NT_Naming_Server.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// *- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// NT_Naming_Server.cpp -// -// -// = DESCRIPTION -// Driver program that runs the TAO Naming Service as a Windows NT -// Service. -// -// = AUTHORS -// John Tucker <jtucker@infoglide.com> and -// Mike Vitalo <mvitalo@infoglide.com> -// -// ============================================================================ - -#include "ace/OS.h" - -#if !defined (ACE_WIN32) - -#include "ace/Log_Msg.h" - -int -main (int, char*[]) -{ - ACE_ERROR ((LM_INFO, - "This program is only supported " - "on Win32 platforms\n")); - return 1; -} - -#else - -#include "ace/Get_Opt.h" - -#include "winreg.h" -#include "NT_Naming_Service.h" - -// Default for the -i (install) option -#define DEFAULT_SERVICE_INIT_STARTUP SERVICE_DEMAND_START - -class Options -{ - // = TITLE - // Keeps track of the command-line options for this program. -public: - Options (void); - ~Options (void); - - int run (int argc, char *argv[]); - -private: - void parse_args (int argc, - char *argv[]); - void print_usage_and_die (void); - -private: - char progname[128]; - - int opt_install; - int opt_remove; - int opt_start; - int opt_kill; - int opt_type; - int opt_debug; - - int opt_startup; -}; - -typedef ACE_Singleton<Options, ACE_Mutex> OPTIONS; - -Options::Options (void) - : opt_install (0), - opt_remove (0), - opt_start (0), - opt_kill (0), - opt_type (0), - opt_debug (0), - opt_startup (0) -{ - ACE_OS::strcpy (progname, - "service"); - ACE::init (); -} - -Options::~Options (void) -{ - ACE::fini (); -} - -void -Options::print_usage_and_die (void) -{ - ACE_DEBUG ((LM_INFO, - "Usage: %s" - " -in -r -s -k -tn -d\n" - " -i: Install this program as an NT service, with specified startup\n" - " -r: Remove this program from the Service Manager\n" - " -s: Start the service\n" - " -k: Kill the service\n" - " -t: Set startup for an existing service\n" - " -d: Debug; run as a regular application\n", - progname, - 0)); - ACE_OS::exit (1); -} - -void -Options::parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, "i:rskt:d"); - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 'i': - opt_install = 1; - opt_startup = ACE_OS::atoi (get_opt.opt_arg ()); - if (opt_startup <= 0) - print_usage_and_die (); - break; - case 'r': - opt_remove = 1; - break; - case 's': - opt_start = 1; - break; - case 'k': - opt_kill = 1; - break; - case 't': - opt_type = 1; - opt_startup = ACE_OS::atoi (get_opt.opt_arg ()); - if (opt_startup <= 0) - print_usage_and_die (); - break; - case 'd': - //opt_debug = 1; - break; - default: - // -i can also be given without a value - if so, it defaults - // to defined value. - if (ACE_OS::strcmp (get_opt.argv ()[get_opt.opt_ind () - 1], "-i") == 0) - { - opt_install = 1; - opt_startup = DEFAULT_SERVICE_INIT_STARTUP; - } - else - this->print_usage_and_die (); - break; - } -} - -// Define a function to handle Ctrl+C to cleanly shut this down. - -static BOOL __stdcall -ConsoleHandler (DWORD /* ctrlType */) -{ - SERVICE::instance ()->handle_control (SERVICE_CONTROL_STOP); - return TRUE; -} - -ACE_NT_SERVICE_DEFINE (service, - TAO_NT_Naming_Service, - "TAO NT Naming Service"); - -int -Options::run (int argc, char* argv[]) -{ - SERVICE::instance ()->name ("TAO_NT_Naming_Service", - "TAO NT Naming Service"); - - this->parse_args (argc, argv); - - if (opt_install && !opt_remove) - return SERVICE::instance ()->insert (opt_startup); - - if (opt_remove && !opt_install) - return SERVICE::instance ()->remove (); - - if (opt_start && opt_kill) - print_usage_and_die (); - - if (opt_start) - return SERVICE::instance ()->start_svc (); - - if (opt_kill) - return SERVICE::instance ()->stop_svc (); - - if (opt_type) - return SERVICE::instance ()->startup (opt_startup); - - // If we get here, we either run the app in debug mode (-d) or are - // being called from the service manager to start the service. - - if (opt_debug) - { - SetConsoleCtrlHandler (&ConsoleHandler, 1); - SERVICE::instance ()->svc (); - } - else - { - ACE_NT_SERVICE_RUN (service, - SERVICE::instance (), - ret); - if (ret == 0) - ACE_ERROR ((LM_ERROR, - "%p\n", - "Couldn't start service")); - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - return OPTIONS::instance ()->run (argc, argv); -} - -#endif /* ACE_WIN32 */ diff --git a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp deleted file mode 100644 index 506d38edb32..00000000000 --- a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.cpp +++ /dev/null @@ -1,199 +0,0 @@ -// -*- C++ -*- - -// $Id$ - -#include /**/ "NT_Naming_Service.h" - -#if defined (ACE_WIN32) - -#include /**/ "Naming_Service.h" -#include "tao/ORB_Core.h" -#include "ace/ARGV.h" - -#define REGISTRY_KEY_ROOT HKEY_LOCAL_MACHINE -#define TAO_REGISTRY_SUBKEY "SOFTWARE\\ACE\\TAO" -#define TAO_NAMING_SERVICE_OPTS_NAME "TaoNamingServiceOptions" -#define TAO_SERVICE_PARAM_COUNT "TaoServiceParameterCount" - -AutoFinalizer::AutoFinalizer (TAO_NT_Naming_Service &service) - : service_ (service) -{ -} - -AutoFinalizer::~AutoFinalizer () -{ - service_.report_status (SERVICE_STOPPED); - ACE_DEBUG ((LM_DEBUG, "Reported service stoped\n")); -} - - -TAO_NT_Naming_Service::TAO_NT_Naming_Service (void) - : argc_ (0), - argc_save_ (0), - argv_ (0), - argv_save_ (0) -{ -} - -TAO_NT_Naming_Service::~TAO_NT_Naming_Service (void) -{ - if (argv_save_) - { - for (int i = 0; i < argc_save_; i++) - ACE_OS::free (argv_save_[i]); - - ACE_OS::free (argv_save_); - } -} - -void -TAO_NT_Naming_Service::handle_control (DWORD control_code) -{ - if (control_code == SERVICE_CONTROL_SHUTDOWN - || control_code == SERVICE_CONTROL_STOP) - { - // Just in case any of the following method calls - // throws in a way we do not expect. - // This instance's destructor will notify the OS. - AutoFinalizer afinalizer (*this); - - report_status (SERVICE_STOP_PENDING); - - // This must be all that needs to be done since this method is executing - // in a separate thread from the one running the reactor. - // When the reactor is stopped it calls ORB::destroy(), which in turn - // calls ORB::shutdown(1) *and* unbinds the ORB from the ORB table. - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - TAO_ORB_Core_instance ()->orb ()->shutdown (1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // What should we do here? Even the log messages are not - // showing up, since the thread that runs this is not an ACE - // thread. It is allways spawned/controlled by Windows ... - } - ACE_ENDTRY; - } - else - { - ACE_NT_Service::handle_control (control_code); - } -} - -int -TAO_NT_Naming_Service::handle_exception (ACE_HANDLE) -{ - return 0; -} - -int -TAO_NT_Naming_Service::init (int argc, - ACE_TCHAR *argv[]) -{ - HKEY hkey = 0; - BYTE buf[ACE_DEFAULT_ARGV_BUFSIZ]; - - *buf = '\0'; - - // This solution is very kludgy. It looks in the NT Registry under - // \\HKEY_LOCAL_MACHINE\SOFTWARE\ACE\TAO for the value of - // "TaoNamingServiceOptions" for any Naming Service options such as - // "-ORBEndpoint". - - // Get Naming Service options from the NT Registry. - - ACE_TEXT_RegOpenKeyEx (REGISTRY_KEY_ROOT, - TAO_REGISTRY_SUBKEY, - 0, - KEY_READ, - &hkey); - - DWORD type; - DWORD bufSize = sizeof (buf); - - ACE_TEXT_RegQueryValueEx (hkey, - TAO_NAMING_SERVICE_OPTS_NAME, - NULL, - &type, - buf, - &bufSize); - - RegCloseKey (hkey); - - // Add options to the args list (if any). - - if (ACE_OS::strlen ((char *) buf) > 0) - { - ACE_ARGV args ((const char*) buf); - // Allocate the internal args list to be one bigger than the - // args list passed into the function. We use a 'save' list in - // case we use a 'destructive' args list processor - this way we - // maintain the correct argv and argc for memory freeing - // operations in the destructor. - argv_save_ = (char **) ACE_OS::malloc (sizeof (char *) * (argc + args.argc ())); - - // Copy the values into the internal args buffer. - int i; - for (i = 0; i < argc; i++) - argv_save_[i] = ACE_OS::strdup (argv[i]); - - int j = 0; - for (i = argc; i < static_cast<int> ((args.argc () + argc)); i++) - argv_save_[i] = ACE_OS::strdup (args.argv ()[j++]); - - // Set the arg counter. - argc_save_ = argc + args.argc (); - argc_ = argc_save_; - argv_ = argv_save_; - } - else - { - argc_ = argc; - argv_ = argv; - } - - return 0; -} - -int -TAO_NT_Naming_Service::svc (void) -{ - TAO_Naming_Service naming_service; - - if (naming_service.init (argc_, - argv_) == -1) - return -1; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Just in case handle_control does not get the chance - // to execute, or is never called by Windows. This instance's - // destructor will inform the OS of our demise. - AutoFinalizer afinalizer (*this); - - ACE_DEBUG ((LM_INFO, "Notifying Windows of service startup\n")); - report_status (SERVICE_RUNNING); - - naming_service.run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_INFO, "Exception in service - exitting\n")); - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO NT Naming Service"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (1); - - ACE_DEBUG ((LM_INFO, "Exiting gracefully\n")); - return 0; -} - -#endif /* ACE_WIN32 */ diff --git a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h b/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h deleted file mode 100644 index 7d0ced9acf7..00000000000 --- a/TAO/orbsvcs/Naming_Service/NT_Naming_Service.h +++ /dev/null @@ -1,97 +0,0 @@ -// -*- C++ -*- - -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// NT_Naming_Service.h -// -// -// = DESCRIPTION -// Run the TAO Naming Service as a Windows NT Service. -// -// = AUTHORS -// John Tucker <jtucker@infoglide.com> and -// Mike Vitalo <mvitalo@infoglide.com> -// -// ============================================================================ - -#ifndef TAO_NT_NAMING_SERVICE_H -#define TAO_NT_NAMING_SERVICE_H - -#include /**/ "ace/OS.h" - -#if defined (ACE_WIN32) - -#include /**/ "ace/NT_Service.h" -#include /**/ "ace/Singleton.h" -#include /**/ "ace/Synch.h" -#include /**/ "tao/orbconf.h" - -class TAO_NT_Naming_Service : public ACE_NT_Service -{ - // = TITLE - // Run the TAO Naming Service as a Windows NT Service. -public: - typedef TAO_SYNCH_RECURSIVE_MUTEX MUTEX; - - // = Initialization and termination hooks. - TAO_NT_Naming_Service (void); - virtual ~TAO_NT_Naming_Service (void); - - virtual void handle_control (DWORD control_code); - // We override <handle_control> because it handles stop requests - // privately. - - virtual int handle_exception (ACE_HANDLE h); - // We override <handle_exception> so a 'stop' control code can pop - // the reactor off of its wait. - - virtual int svc (void); - // This is a virtual method inherited from ACE_NT_Service. - - virtual int init (int argc, - ACE_TCHAR *argv[]); - // Initialize the objects argc_ and argv_ attributes values. - -private: - // = Keep track of the "command-line" arguments. - int argc_; - int argc_save_; - // Argument count. - - char **argv_; - char **argv_save_; - // Argument list. - - friend class ACE_Singleton<TAO_NT_Naming_Service, MUTEX>; - friend class AutoFinalizer; - -}; - -/** - * A class with a "magic" constructor/desructor to call the inherited - * from ACE_NT_Service report_status() when an instance of it goes out - * of scope, should an exception occurs. - */ -class AutoFinalizer -{ - -public: - AutoFinalizer (TAO_NT_Naming_Service &service); - ~AutoFinalizer (); - -private: - TAO_NT_Naming_Service &service_; -}; - - - -typedef ACE_Singleton<TAO_NT_Naming_Service, TAO_NT_Naming_Service::MUTEX> SERVICE; - -#endif /* ACE_WIN32 */ -#endif /* TAO_NT_NAMING_SERVER_H */ diff --git a/TAO/orbsvcs/Naming_Service/Naming_Server.cpp b/TAO/orbsvcs/Naming_Service/Naming_Server.cpp deleted file mode 100644 index 65631eb726e..00000000000 --- a/TAO/orbsvcs/Naming_Service/Naming_Server.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// $Id$ - -#include "Naming_Service.h" -#include "ace/OS_main.h" - -#include "orbsvcs/Shutdown_Utilities.h" -#include "tao/debug.h" - -#include "tao/ImR_Client/ImR_Client.h" - -class Naming_Svc_Shutdown : public Shutdown_Functor -{ -public: - Naming_Svc_Shutdown(TAO_Naming_Service& ns); - - void operator() (int which_signal); -private: - TAO_Naming_Service& ns_; -}; - -Naming_Svc_Shutdown::Naming_Svc_Shutdown (TAO_Naming_Service &ns) - : ns_(ns) -{ -} - -void -Naming_Svc_Shutdown::operator() (int which_signal) -{ - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "Name Service: shutting down on signal %d\n", - which_signal)); - (void) this->ns_.shutdown (); -} - -// Driver function for the TAO Naming Service. - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - TAO_Naming_Service naming_service; - - // Stuff to insure that we're gracefully shut down... - Naming_Svc_Shutdown killer (naming_service); - Service_Shutdown kill_contractor(killer); - - if (naming_service.init (argc, argv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT("Failed to start the Naming Service.\n")), - 1); - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - naming_service.run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "NamingService"); - return 1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (1); - - naming_service.fini (); - - return 0; -} diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp b/TAO/orbsvcs/Naming_Service/Naming_Service.cpp deleted file mode 100644 index 22e055649e3..00000000000 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// $Id$ - -#include "Naming_Service.h" - -#include "ace/Get_Opt.h" -#include "ace/Argv_Type_Converter.h" - -ACE_RCSID(Naming_Service, Naming_Service, "$Id$") - -// Default Constructor. - -TAO_Naming_Service::TAO_Naming_Service (void) - : time_ (0) -{ -} - -// Constructor taking command-line arguments. -TAO_Naming_Service::TAO_Naming_Service (int argc, - ACE_TCHAR* argv[]) - : time_ (0) -{ - this->init (argc, argv); -} - - -// Initialize the state of the TAO_Naming_Service object -int -TAO_Naming_Service::init (int argc, - ACE_TCHAR* argv[]) -{ - int result; - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - // Copy command line parameter. - ACE_Argv_Type_Converter command_line(argc, argv); - - // Initialize the ORB - this->orb_ = - CORBA::ORB_init (command_line.get_argc(), command_line.get_ASCII_argv(), 0 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse the args for '-t' option. If '-t' option is passed, do - // the needful and then remove the option from the list of - // arguments. - this->parse_args (command_line.get_argc(), command_line.get_TCHAR_argv()); - - // This function call initializes the naming service and returns - // '-1' in case of an exception. - result = this->my_naming_server_.init_with_orb (command_line.get_argc(), - command_line.get_TCHAR_argv(), - this->orb_.in ()); - - if (result == -1) - return result; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Service::init"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - -int -TAO_Naming_Service::parse_args (int &argc, - ACE_TCHAR* argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("-t:")); - int c; - - while ((c = get_opts ()) != -1) - { - switch (c) - { - case 't': - { - int time = ACE_OS::atoi (get_opts.opt_arg ()); - if (time >= 0) - this->time_ = time; - - // Remove the option '-t' from argv [] - // to avoid any confusion that might result. - for (int i = get_opts.opt_ind (); i != argc; ++i) - argv [i-2 ] = argv [i]; - - // Decrement the value of argc to reflect the removal - // of '-t' option. - argc = argc - 2; - break; - } - case '?': - default: - // Don't do anything. The TAO_Naming_Server::parse_args () - // takes care of indicating an error in case of error. - break; - } - } - return 0; -} - -// Run the ORB event loop. -int -TAO_Naming_Service::run (ACE_ENV_SINGLE_ARG_DECL) -{ - if (time_ == 0) - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - } - else - { - ACE_Time_Value tv (time_); - this->orb_->run (tv ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - } - - return 0; -} - -void -TAO_Naming_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -int -TAO_Naming_Service::fini (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - this->my_naming_server_.fini(); - - ACE_TRY - { - // destroy implies shutdown - this->orb_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Service::fini"); - return -1; - } - ACE_ENDTRY; - return 0; -} - -// Destructor. -TAO_Naming_Service::~TAO_Naming_Service (void) -{ - // Destructor -} diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.h b/TAO/orbsvcs/Naming_Service/Naming_Service.h deleted file mode 100644 index 2ad9cb1f7dd..00000000000 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.h +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// orbsvcs/Naming_Service/Naming_Service -// -// = FILENAME -// Naming_Service.h -// -// = DESCRIPTION -// This class implements the functionality of a Naming_Service in -// a stand-alone process. -// -// = AUTHORS -// Nagarajan Surendran (naga@cs.wustl.edu) -// Marina Spivak <marina@cs.wustl.edu> -// ============================================================================ - -#ifndef TAO_NAMING_SERVICE_H -#define TAO_NAMING_SERVICE_H - -#include "orbsvcs/Naming/Naming_Server.h" - -class TAO_Naming_Service -{ - // = TITLE - // Defines a class that encapsulates the implementation of the - // COS Naming Service. - // - // = DESCRIPTION - // This class makes use of the <TAO_Naming_Server> and - // <TAO_ORB_Manager> class to implement the COS Naming Service. -public: - TAO_Naming_Service (void); - // Default Constructor. - - TAO_Naming_Service (int argc, ACE_TCHAR* argv[]); - // Constructor taking the command-line arguments. - - virtual int init (int argc, ACE_TCHAR* argv[]); - // Initialize the Naming Service with the arguments. - - virtual int fini (void); - // The opposite of init(). - - int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Run the TAO_Naming_Service. - - void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); - // Shut down the TAO_Naming_Service; you must still call fini(). - - virtual ~TAO_Naming_Service (void); - // Destructor. - -protected: - - int parse_args (int &argc, ACE_TCHAR* argv[]); - // Parse the command line arguments to find - // the timeout period. - - CORBA::ORB_var orb_; - // The ORB. - - // PortableServer::POA_var root_poa_; - // The Root POA. - - TAO_Naming_Server my_naming_server_; - // Naming Server instance. - - long time_; - // After how long the server should stop listening to requests (in - // seconds). -}; - -#endif /* TAO_NAMING_SERVICE_H */ diff --git a/TAO/orbsvcs/Naming_Service/Naming_Service.mpc b/TAO/orbsvcs/Naming_Service/Naming_Service.mpc deleted file mode 100644 index 9382d787a92..00000000000 --- a/TAO/orbsvcs/Naming_Service/Naming_Service.mpc +++ /dev/null @@ -1,21 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project : orbsvcsexe, core, naming_serv, imr_client { - exename = Naming_Service - Source_Files { - Naming_Server.cpp - Naming_Service.cpp - } -} - -project(NT_Naming_Service) : orbsvcsexe, core, naming_serv { - requires += winnt - exename = NT_Naming_Service - Source_Files { - Naming_Service.cpp - NT_Naming_Server.cpp - NT_Naming_Service.cpp - } -} - diff --git a/TAO/orbsvcs/Naming_Service/README b/TAO/orbsvcs/Naming_Service/README deleted file mode 100644 index 9cc96f8575d..00000000000 --- a/TAO/orbsvcs/Naming_Service/README +++ /dev/null @@ -1,409 +0,0 @@ -// README,v 1.19 2001/02/02 20:21:38 schmidt Exp - -This directory contains files that implement a server for the TAO -Naming Service. In addition, it contains files that run the TAO -Naming Service as a Windows NT Service. Both of these services are -described below. - -How to Run the TAO Naming Service -================================= - -The following describes how to run the TAO Naming Service. - -1. Syntax - - % Naming_Service [-ORBNameServicePort nsport] - [-o ior_output_file] - [-p pid_file_name] - [-s context_size] - [-t time] - [-f persistence_file_name] - [-b base_address] - [-m (1=enable multicast responses,0=disable(default)] - [-z time] - [-d ] - [-u directory] - [-r directory] - - -2. Optional Command-line Arguments - - -ORBNameServicePort nsport - Multicast port for listening for requests from clients - trying to bootstrap to a Naming Service through the - use of multicast. This is only used when multicast - responding is enabled via '-m 1'. - - -o ior_output_file - The name of the file, in which to store the IOR of the - root Naming Service context. - - -p pid_file_name - The name of the file, in which to store the process id - of the Naming Service server. - - -s context_size - Size of the hash table allocated for the root Naming - Context (if one is created). All contexts created - under the root will use the same size for their hash - tables. The default is 1024. - - -t time - How long (in seconds) the server should listen for - client requests before terminating. - - -f persistence_file_name - The name of the file to use to store/retrieve - persistent state of the Naming Service. Without this - option, Naming Service is started in non-persistent - mode. - - -b base_address - The address used for memory mapping the file specified - with the "-f" option above. The value supplied with - this option is only used when the Naming Service runs - in persistent mode, i.e., "-f" option is present. - - -m <0|1> - TAO offers a simple, very non-standard method for - clients to discover the initial reference for the - Naming Service. However, since it can be inadequate and cause - unexpected results if, for example, there are multiple - naming services running on the network, the DEFAULT - behavior is for the Naming Service to NOT RESPOND to - such multicast queries (use the Interoperable Naming - Service bootstrap options instead). - - -z time - A relative round trip timeout value (in seconds) that - the service should wait for when trying to progress an - operation through a federated naming context before - timing out and throwing a 'Cannot proceed' exception - to the client. If no value is set this will never occur. - - -d - Provides Naming Service specific debug information. By default - no diagnostics are given. - - -u directory - Use a flat-file persistence implementation that stores object - reference information in a file per context. Each context file - is placed in the directory specified. - - -r directory - Use redundant flat-file persistnece; same as the -u option, - except more than one instance of the TAO Naming Service server - can run, each using the same set of disk files, to achieve a - degree of fault tolerence (as long as directory is accessible - to both servers). - - -3. Environment Variables - - NameServicePort - Multicast port for listening for requests from clients - trying to bootstrap to a Naming Service through the - use of multicast. This is only used when multicast - responding is enabled via '-m 1'. - -4. Persistence - - TAO Naming Service has an optional persistence capability. By - default, the Naming Service is started in a non-persistent - mode. Supplying "-f" command-line option to the server causes - a persistent version of the Naming Service to run. - - The file specified with the "-f" option is used to store the - persistent state of the Naming Service, i.e., all Naming - Contexts and their bindings. When "-f" option is specified: - - 1. If the specified file does not exist, it is created and - used to store the state of the Naming Service. An initial - (root) Naming Context is also created. - - 2. If the specified file exists, it is scanned and: - - a) If any inconsistency is detected in the stored - state, or the file is not recognized by the Naming - Service, the server exits. (This may happen, for - example, if a server or host crashed in the middle of - writing a record to this file on a previous run). A - noncorrupted version of the file must be used instead. - - b) If the file is recognized and is ok, the state - stored in the file becomes the current state of the - Naming Service. - - Internally, TAO uses memory mapped file to implement - persistence feature of the Naming Service. A default memory - address (ACE_DEFAULT_BASE_ADDR) is used for mapping the file. - Alternate mapping address can be specified at compile-time by - redefining TAO_NAMING_BASE_ADDR in tao/orbconf.h. Alternate - mapping address can also be specified at run-time - with the "-b" command-line option, which takes precedence over - TAO_NAMING_BASE_ADDR definition. - NOTE: Naming Service stores absolute pointers in its - memory-mapped file. Therefore, it is important to use the - same mapping address on each run for the same persistence file. - - -5. Implementation Policies - - a. Destroying Binding Iterators - - A binding iterator is destroyed when client invokes - <destroy> operation either on the iterator itself or - on the naming context it is iterating over. In both - cases, subsequent calls on the binding iterator object - will cause OBJECT_NOT_EXIST exception. - - b. Dealing with orphaned contexts - - This implementation of the Naming Service does not - include any form of 'garbage collection' for orphaned - naming contexts. It is solely the responsibility of - clients to clean up after themselves and not leak - server resources. All the resources, including - orphaned contexts, are released during the Naming - Server shutdown. - -6. Clients: ways to bootstrap to the Naming Service: - - There are several methods for a client to bootstrap to a - Naming Service, i.e., there are several mechanisms - <resolve_initial_references> can use when asked for - "NameService". In order of predictable behavior, they are: - - 1. Command-line options - - The "-ORBInitRef NameService=IOR:..." or environment - variable NameServiceIOR can be used on the client side - to specify the object that the call to - <resolve_initial_references> should return to the - client. (On the server side, -o option can be used to - get the ior). - - Example (Unix, same host): - - % $TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -o ior_file - % my_client -ORBInitRef NameService=file://ior_file - - On the first line, we start the Naming - Service, and output its ior to <ior_file>. On - the second line, we start some client, and - specify the ior <resolve_initial_references> - should return for the Naming Service in a file - format. - - 2. Interoperable Naming Service. - - TAO implements the standard CORBA Interoperable Naming - Service (ING). Therefore, most initialization options - provided by INS can be used to bootstrap to the Naming - Service (see TAO's release notes for the status of INS - implementation). - - 3. Multicast - - When started with the "respond to multicast queries" - option turned on ('-m 1'), clients can use IP - multicast to query for a Naming Service, and this - instance will respond. TAO Naming Server is listening - for client multicast requests on a specified port. On - the client side, <resolve_initial_references> sends - out a multicast request on the network, trying to - locate a Naming Service. When a Naming Server - receives a multicast request from a client, it replies - to the sender with the ior of its root Naming Context. - Note, the port used for this bootstrapping process, - i.e., 'multicast port', has nothing to do with the ORB - port used for CORBA communication. Other points worth - mentioning: - - - A client and a server will only click through this - multicast protocol if they are using the same - multicast port. For both client and server - -ORBnameserviceport command-line option and - NameServicePort environment variable can be used to - specify the multicast port to use. If none is - specified, the default port is used. (The ability - to specify multicast ports can be used to match - certain clients with certain Naming Servers, when - there are more than one Naming Server running on the - network). - - - If there are several Naming Servers running on the - network, each listening on the same port for - multicast requests, each will send a reply to a - client's request. The client's orb will use the - first response it receives, so the Naming Service - will, in fact, be selected at random. - - Since this mechanism is proprietary to TAO (i.e., - non-standard), it only works when both client and - server are written using TAO. There is no way to turn - multicasting off on the client side, but it is used - only as a last resort, i.e., any of the other options - will override it. - - When OS platform doesn't support multicast, or client - or server isn't written using TAO, or a more - reliable/predictable location method is desired, etc., - one of the other options can be used to bootstrap to - the Naming Service. - - -How to use the NT_Naming_Service -================================ - -To set the options for the TAO Naming Service, go to the Services icon -in the Settings group under the start menu (start menu -> settings -> -services). There, highlight the NT_Naming_Service, which is the name -used by the Naming Service when it is registered. After it's -highlighted, you should see at the bottom of the dialog box an area to -specify options. Just enter the options you wish in that edit box and -everything should just work. However, some options, such as --ORBDebugLevel, won't work since an NT service can't write output to -standard out. - -1. Syntax - - % NT_Naming_Server [-i value] - [-r] - [-s] - [-k] - [-t n] - [-d] - -2. Optional Command-line Arguments - - -i value - Install this program as an NT service, with specified startup - - -r - Remove this program from the Service Manager - -s - Start the service - - -k - Kill the service - - -t value - Set startup for an existing service - - -d - Debug; run as a regular application - -3. Usage - - To see different stages of an NT service application, you have - to run the program several times, with different options. - Please note: run with only one option at a time. - - a. First, you must initialize the service in the NT SCM - database. Run NT_Naming_Service with -in, where n is one of - the following startup options: - - // Start Type (from WinNT.h) - // - #define SERVICE_SYSTEM_START 0x00000001 - #define SERVICE_AUTO_START 0x00000002 - #define SERVICE_DEMAND_START 0x00000003 - #define SERVICE_DISABLED 0x00000004 - - If only -i is specified, SERVICE_DEMAND_START is default option. - - b. Now you are ready to run the actual service. Run - NT_Naming_Service again, this time with -s option. If the - service starts successfully, it will ring the system - bell every second or so until the service is stopped. - - c. To stop service execution, run NT_Naming_Service with the - -k option. - - d. To remove the service from the Service Control Manager - database, run NT_Naming_Service with -r. - - In addition, once you have initialized this service (by using - the -i option) you can change its startup type to one of the - other values above. To do this, run NT_Naming_Service with - -tn option. n is as explained above for -i. - - In order to debug the service's execution itself, use the -d - option. - -Troubleshooting -============================================ - -Q1. Error Message: "subscribe: no such device" - -A1. On starting, the error message "subscribe: no such device" is a -rather cryptic message saying that basically either you don't support -multicasting or there is no route for multicasting on one of your -network interfaces( e.g. eth0 ). - ---------------------------------------- -(Step 1) -Check to see if you have multicasting enabled. In the case of Linux -you will need to check the configuration of your kernel. RedHat users -have multicasting enabled by default. Once you are sure that you have -multicast enabled then move to the next step. Alternative is to start -Naming_Service with multicast disabled. - - ---------------------------------------- -(Step 2) -Check to see if you have the route for multicasting. Linux users can -do this by running: - - /sbin/route - -You should see something like this: - -Kernel IP routing table -Destination Gateway Genmask Flags Metric Ref Use Iface -10.0.0.0 * 255.255.255.0 U 0 0 0 eth0 -127.0.0.0 * 255.0.0.0 U 0 0 0 lo -224.0.0.0 * 240.0.0.0 U 0 0 0 eth0 - -If you don't see the line for multicast routing: - -224.0.0.0 * 240.0.0.0 U 0 0 0 eth0 - -You will need to add in the next step. If you do see that line and the -problem is still there then contact the tao-users list by using -email. Please remember to use the problem form. It helps developers to -have a more educated guess at the exact problem you are having. - - ---------------------------------------- -(Step 3) - -You can do this manually in a script that start the Naming service: - -(Linux/Unix): - - /sbin/route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 - -Alternatively for RedHat users you can add this into a file -"/etc/sysconfig/static-routes". As of Redhat 7, you might have to -create this file, you can make an entry: - - eth0 net 240.0.0.0 netmask 240.0.0.0 - -On startup when the network interfaces that will be supporting -multicast routing are started the route will be added. In my case it -adds multicasting routing to eth0 (the first NIC). - ----------------------------------------- -(Step 4) - -Double check that the route has been added correctly using /sbin/route. - -Kernel IP routing table -Destination Gateway Genmask Flags Metric Ref Use Iface -10.0.0.0 * 255.255.255.0 U 0 0 0 eth0 -127.0.0.0 * 255.0.0.0 U 0 0 0 lo -224.0.0.0 * 240.0.0.0 U 0 0 0 eth0 - -At this point you should be able to run Naming_Service. Have fun! |