#include "tao/TAO_Internal.h"
#include "tao/TAO_Singleton.h"
#include "tao/default_server.h"
#include "tao/default_client.h"
#include "tao/default_resource.h"
#include "tao/IIOP_Factory.h"
#include "tao/MCAST_Parser.h"
#include "tao/CORBANAME_Parser.h"
#include "tao/CORBALOC_Parser.h"
#include "tao/FILE_Parser.h"
#include "tao/HTTP_Parser.h"
#include "tao/DLL_Parser.h"
#include "tao/ORB_Core.h"
#include "tao/Adapter_Factory.h"
#include "tao/Default_Stub_Factory.h"
#include "tao/Default_Endpoint_Selector_Factory.h"
#include "tao/Default_Thread_Lane_Resources_Manager.h"
#include "tao/Default_Collocation_Resolver.h"
#include "tao/Codeset_Manager_Factory_Base.h"
#include "tao/Codeset_Manager.h"
#include "tao/debug.h"
#include "tao/StringSeqC.h"
#include "ace/Dynamic_Service.h"
#include "ace/Arg_Shifter.h"
#include "ace/Argv_Type_Converter.h"
#include "ace/Env_Value_T.h"
#include "ace/ACE.h"
#include "ace/OS_NS_stdio.h"
#include "ace/Static_Object_Lock.h"
Include dependency graph for TAO_Internal.cpp:
Go to the source code of this file.
Namespaces | |
namespace | TAO_END_VERSIONED_NAMESPACE_DECL |
Classes | |
class | TAO_Ubergestalt_Ready_Condition |
Defines | |
#define | TAO_DEFAULT_RESOURCE_FACTORY_ARGS 0 |
#define | TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS 0 |
#define | TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS 0 |
Functions | |
int | parse_global_args_i (int &argc, ACE_TCHAR **argv, CORBA::StringSeq &svc_config_argv, bool apply_values) |
Modifies the argc to reflect any arguments it has "consumed". | |
int | parse_svcconf_args_i (int &argc, ACE_TCHAR **argv, CORBA::StringSeq &svc_config_argv) |
Modifies the argc to reflect any arguments it has "consumed". | |
void | register_global_services_i (ACE_Service_Gestalt *pcfg) |
registers all process-wide (global) services, available to all ORBs | |
void | register_additional_services_i (ACE_Service_Gestalt *pcfg) |
int | parse_private_args_i (int &argc, ACE_TCHAR **argv, CORBA::StringSeq &svc_config_argv, bool &skip_service_config_open) |
Modifies the argc to reflect any arguments it has "consumed". | |
int | open_private_services_i (ACE_Service_Gestalt *pcfg, int &argc, char **argv, bool skip_service_config_open=false, bool ignore_default_svc_conf_file=false) |
Open services, belonging to the gestalt instance. | |
Variables | |
long | service_open_count = 0 |
bool | is_ubergestalt_ready = false |
char const * | resource_factory_args |
char const * | server_strategy_factory_args |
char const * | client_strategy_factory_args |
bool | negotiate_codesets = true |
|
Definition at line 47 of file TAO_Internal.cpp. |
|
Definition at line 39 of file TAO_Internal.cpp. |
|
Definition at line 43 of file TAO_Internal.cpp. |
|
Open services, belonging to the gestalt instance. Initialize ORB-local (private) ACE Service Configurator repository.
Definition at line 453 of file TAO_Internal.cpp. References ACE_DEFAULT_LOGGER_KEY, ACE_Argv_Type_Converter::get_argc(), ACE_Argv_Type_Converter::get_TCHAR_argv(), and ACE_Service_Gestalt::open(). Referenced by TAO::ORB::open_services().
00458 { 00459 00460 if (skip_service_config_open) 00461 { 00462 return 0; 00463 } 00464 00465 #if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP) 00466 ignore_default_svc_conf_file = true; 00467 #endif /* TAO_PLATFORM_SVC_CONF_FILE_NOTSUP */ 00468 00469 // Copy command line parameter to allow conversion 00470 ACE_Argv_Type_Converter command_line (argc, argv); 00471 00472 return pcfg->open (command_line.get_argc (), 00473 command_line.get_TCHAR_argv (), 00474 ACE_DEFAULT_LOGGER_KEY, 00475 0, // Don't ignore static services. 00476 ignore_default_svc_conf_file); 00477 } |
|
Modifies the argc to reflect any arguments it has "consumed". Parses the supplied command-line arguments to extract any that apply to the process (globally) When multiple ORBs are being configured, the global options are only processed for the first ORB loaded. However subsequent ORBs may be supplied with some of these options, so they need to be eliminated as though they were processed. For this reason, this function is called for every ORB, but only the first call sets apply_values to true Definition at line 834 of file TAO_Internal.cpp. References ACE_Arg_Shifter, ACE_DEBUG, ACE_TEXT, ACE_OS::atoi(), ACE::debug(), ACE_OS::getenv(), LM_DEBUG, CORBA::string_dup(), CORBA::StringSeq, and TAO_debug_level. Referenced by TAO::ORB::open_services().
00838 { 00839 // NOTE: When adding new global arguments, ensure they are only 00840 // applied when apply_values is true, but that they are always 00841 // consumed, if they need to be consumed. 00842 #if defined (TAO_DEBUG) && !defined (ACE_HAS_WINCE) 00843 // Make it a little easier to debug programs using this code. 00844 if (apply_values) 00845 { 00846 TAO_debug_level = ACE_Env_Value<u_int> ("TAO_ORB_DEBUG", 0); 00847 00848 char * const value = ACE_OS::getenv ("TAO_ORB_DEBUG"); 00849 00850 if (value != 0) 00851 { 00852 TAO_debug_level = ACE_OS::atoi (value); 00853 00854 if (TAO_debug_level <= 0) 00855 { 00856 TAO_debug_level = 1; 00857 } 00858 00859 ACE_DEBUG ((LM_DEBUG, 00860 ACE_TEXT ("TAO_debug_level == %d\n"), 00861 TAO_debug_level)); 00862 } 00863 } 00864 #endif /* TAO_DEBUG && !ACE_HAS_WINCE */ 00865 00866 // Extract the Service Configurator ORB options from the argument 00867 // vector. 00868 ACE_Arg_Shifter arg_shifter (argc, argv); 00869 CORBA::ULong len = 0; 00870 00871 while (arg_shifter.is_anything_left ()) 00872 { 00873 if (0 == arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug"))) 00874 { 00875 if (apply_values) 00876 { 00877 // Later, replace all of these 00878 // warning this turns on a daemon. 00879 ACE::debug (1); 00880 } 00881 00882 arg_shifter.consume_arg (); 00883 } 00884 else if (0 == arg_shifter.cur_arg_strncasecmp 00885 (ACE_TEXT ("-ORBDaemon"))) 00886 { 00887 // Be a daemon. 00888 if (apply_values) 00889 { 00890 len = svc_config_argv.length (); 00891 svc_config_argv.length (len + 1); 00892 00893 svc_config_argv[len] = 00894 CORBA::string_dup ("-b"); 00895 } 00896 00897 arg_shifter.consume_arg (); 00898 } 00899 // Can't interpret this argument. 00900 // Move on to the next argument. 00901 else 00902 { 00903 // Any arguments that don't match are ignored so 00904 // that the caller can still use them. 00905 arg_shifter.ignore_arg (); 00906 } 00907 } 00908 return 0; 00909 } /* parse_global_args_i */ |
|
Modifies the argc to reflect any arguments it has "consumed". Parses the supplied command-line arguments to extract any instance-specific ones. Definition at line 750 of file TAO_Internal.cpp. References ACE_Arg_Shifter, ACE_TCHAR, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_OS::atoi(), negotiate_codesets, CORBA::string_dup(), CORBA::StringSeq, and TAO_debug_level. Referenced by TAO::ORB::open_services().
00754 { 00755 // Extract the Service Configurator ORB options from the argument 00756 // vector. 00757 ACE_Arg_Shifter arg_shifter (argc, argv); 00758 CORBA::ULong len = 0; 00759 00760 while (arg_shifter.is_anything_left ()) 00761 { 00762 const ACE_TCHAR *current_arg = 0; 00763 if (0 == arg_shifter.cur_arg_strncasecmp 00764 (ACE_TEXT ("-ORBSkipServiceConfigOpen"))) 00765 { 00766 skip_service_config_open = true; 00767 00768 arg_shifter.consume_arg (); 00769 } 00770 else if (0 != (current_arg = arg_shifter.get_the_parameter 00771 (ACE_TEXT ("-ORBSvcConfDirective")))) 00772 { 00773 len = svc_config_argv.length (); 00774 svc_config_argv.length (len + 2); // 2 arguments to add 00775 00776 // This is used to pass arguments to the Service 00777 // Configurator using the "command line" to provide 00778 // configuration information rather than using a svc.conf 00779 // file. Pass the "-S" to the service configurator. 00780 svc_config_argv[len] = CORBA::string_dup ("-S"); 00781 svc_config_argv[len + 1] = 00782 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg)); 00783 00784 arg_shifter.consume_arg (); 00785 } 00786 else if (0 != (current_arg = arg_shifter.get_the_parameter 00787 (ACE_TEXT ("-ORBServiceConfigLoggerKey")))) 00788 { 00789 len = svc_config_argv.length (); 00790 svc_config_argv.length (len + 2); // 2 arguments to add 00791 00792 svc_config_argv[len] = CORBA::string_dup ("-k"); 00793 svc_config_argv[len + 1] = 00794 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg)); 00795 00796 arg_shifter.consume_arg (); 00797 } 00798 else if (0 == arg_shifter.cur_arg_strncasecmp 00799 (ACE_TEXT ("-ORBNegotiateCodesets"))) 00800 { 00801 // Negotiate codesets must be evaluated prior to calling 00802 // register_global_services_i. 00803 00804 // Don't consume, the ORB_Core::init will use it again. 00805 arg_shifter.ignore_arg(); 00806 00807 if (0 != (current_arg = arg_shifter.get_current())) 00808 negotiate_codesets = (ACE_OS::atoi (current_arg)); 00809 arg_shifter.ignore_arg(); 00810 } 00811 else if (0 != (current_arg = 00812 arg_shifter.get_the_parameter 00813 (ACE_TEXT ("-ORBDebugLevel")))) 00814 { 00815 // Allowing different ORBs to change the global debug 00816 // level may be unexpected, but since this 00817 TAO_debug_level = ACE_OS::atoi (current_arg); 00818 00819 arg_shifter.consume_arg (); 00820 } 00821 else 00822 { 00823 // Can't interpret this argument. Move on to the next 00824 // argument. Any arguments that don't match are ignored 00825 // so that the caller can still use them. 00826 arg_shifter.ignore_arg (); 00827 } 00828 } 00829 00830 return 0; 00831 } /* parse_private_args_i */ |
|
Modifies the argc to reflect any arguments it has "consumed". Parses the supplied command-line arguments to extract any that specify a Service Configurator file (-ORBSvcConf). This is done separately, because depending on the context, the configuration file may apply to the process-wide service repository, or to the orb-specific (private) one. Definition at line 687 of file TAO_Internal.cpp. References ACE_Arg_Shifter, ACE_ERROR_RETURN, ACE_TCHAR, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_OS::fclose(), ACE_OS::fopen(), LM_ERROR, CORBA::string_dup(), and CORBA::StringSeq. Referenced by TAO::ORB::open_services().
00690 { 00691 // Extract the Service Configurator ORB options from the argument 00692 // vector. 00693 ACE_Arg_Shifter arg_shifter (argc, argv); 00694 CORBA::ULong len = 0; 00695 00696 while (arg_shifter.is_anything_left ()) 00697 { 00698 const ACE_TCHAR *current_arg = 00699 arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf")); 00700 00701 if (0 != current_arg) 00702 { 00703 // Specify the name of the svc.conf file to be used. 00704 00705 // Proceeds only if the configuration file exists. 00706 FILE * const conf_file = 00707 ACE_OS::fopen (current_arg, ACE_TEXT ("r")); 00708 00709 if (0 == conf_file) 00710 { 00711 // Assigning EINVAL to errno to make an exception 00712 // thrown. calling code does not throw an exception if 00713 // the errno is set to ENOENT for some reason. 00714 errno = EINVAL; 00715 00716 ACE_ERROR_RETURN ((LM_ERROR, 00717 ACE_TEXT ("TAO (%P|%t) Service ") 00718 ACE_TEXT ("Configurator ") 00719 ACE_TEXT ("unable to open file %s\n"), 00720 current_arg), 00721 -1); 00722 } 00723 else 00724 { 00725 ACE_OS::fclose (conf_file); 00726 } 00727 00728 len = svc_config_argv.length (); 00729 svc_config_argv.length (len + 2); // 2 arguments to add 00730 00731 svc_config_argv[len] = CORBA::string_dup ("-f"); 00732 svc_config_argv[len + 1] = 00733 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg)); 00734 00735 arg_shifter.consume_arg (); 00736 } 00737 // Can't interpret this argument. Move on to the next argument. 00738 else 00739 { 00740 // Any arguments that don't match are ignored so that the 00741 // caller can still use them. 00742 arg_shifter.ignore_arg (); 00743 } 00744 } 00745 00746 return 0; 00747 } /* parse_svcconf_args_i */ |
|
Definition at line 577 of file TAO_Internal.cpp. References ACE_TEXT_CHAR_TO_TCHAR, client_strategy_factory_args, ACE_Shared_Object::init(), ACE_Dynamic_Service< TYPE >::instance(), ACE_Service_Gestalt::process_directive(), resource_factory_args, and server_strategy_factory_args. Referenced by TAO::ORB::open_services().
00578 { 00579 // @@ What the heck do these things do and do we need to avoid 00580 // calling them if we're not invoking the svc.conf file? 00581 // @@ They are needed for platforms that have no file system, 00582 // like VxWorks. 00583 00584 if (resource_factory_args != 0) 00585 { 00586 pcfg->process_directive( 00587 ACE_TEXT_CHAR_TO_TCHAR (resource_factory_args)); 00588 } 00589 00590 if (client_strategy_factory_args != 0) 00591 { 00592 pcfg->process_directive 00593 (ACE_TEXT_CHAR_TO_TCHAR (client_strategy_factory_args)); 00594 } 00595 00596 if (server_strategy_factory_args != 0) 00597 { 00598 pcfg->process_directive 00599 (ACE_TEXT_CHAR_TO_TCHAR (server_strategy_factory_args)); 00600 } 00601 00602 ACE_Service_Object * const pi_server_loader = 00603 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00604 pcfg, 00605 "PI_Server_Loader"); 00606 00607 if (pi_server_loader != 0) 00608 { 00609 pi_server_loader->init (0, 0); 00610 } 00611 00612 ACE_Service_Object * const bidir_loader = 00613 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00614 pcfg, 00615 "BiDirGIOP_Loader"); 00616 00617 if (bidir_loader != 0) 00618 { 00619 bidir_loader->init (0, 0); 00620 } 00621 00622 ACE_Service_Object * const messaging_loader = 00623 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00624 pcfg, 00625 "Messaging_Loader"); 00626 00627 if (messaging_loader != 0) 00628 { 00629 messaging_loader->init (0, 0); 00630 } 00631 00632 // Handle RTCORBA library special case. Since RTCORBA needs 00633 // its init method call to register several hooks, call it 00634 // here if it hasn't already been called. 00635 ACE_Service_Object * const rt_loader = 00636 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00637 pcfg, 00638 "RT_ORB_Loader"); 00639 00640 if (rt_loader != 0) 00641 { 00642 rt_loader->init (0, 0); 00643 } 00644 00645 ACE_Service_Object * const rtscheduler_loader = 00646 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00647 pcfg, 00648 "RTScheduler_Loader"); 00649 00650 if (rtscheduler_loader != 0) 00651 { 00652 rtscheduler_loader->init (0, 0); 00653 } 00654 00655 ACE_Service_Object * const csd_framework_loader = 00656 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00657 pcfg, 00658 "CSD_Framework_Loader"); 00659 00660 if (csd_framework_loader != 0) 00661 { 00662 csd_framework_loader->init (0, 0); 00663 } 00664 00665 ACE_Service_Object * const endpoint_policy_loader = 00666 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00667 pcfg, 00668 "EndpointPolicy_Initializer"); 00669 00670 if (endpoint_policy_loader != 0) 00671 { 00672 endpoint_policy_loader->init (0, 0); 00673 } 00674 00675 ACE_Service_Object * const diffserv_policy_loader = 00676 ACE_Dynamic_Service<ACE_Service_Object>::instance ( 00677 pcfg, 00678 "DiffservPolicy_Initializer"); 00679 00680 if (diffserv_policy_loader != 0) 00681 { 00682 diffserv_policy_loader->init (0, 0); 00683 } 00684 } /* register_additional_services_i */ |
|
registers all process-wide (global) services, available to all ORBs Initialize the ACE Service Configurator with the process-global services (available to any ORB).
Definition at line 482 of file TAO_Internal.cpp. References ACE_DYNAMIC_SERVICE_DIRECTIVE, ACE_ERROR, ACE_REMOVE_SERVICE_DIRECTIVE, ACE_TEXT, ACE_Dynamic_Service< TYPE >::instance(), TAO_Codeset_Manager_Factory_Base::is_default(), LM_ERROR, negotiate_codesets, ACE_Service_Config::process_directive(), ACE_Service_Gestalt::process_directive(), and TAO_debug_level. Referenced by TAO::ORB::open_services().
00483 { 00484 // This has to be done before intializing the resource 00485 // factory. Codesets is a special library since its configuration 00486 // is optional and it may be linked statically. 00487 if (negotiate_codesets) 00488 { 00489 TAO_Codeset_Manager_Factory_Base *factory = 00490 ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance ( 00491 "TAO_Codeset"); 00492 00493 if (factory == 0 || factory->is_default ()) 00494 { 00495 #if !defined (TAO_AS_STATIC_LIBS) 00496 // only for dynamic libs, check to see if default factory 00497 // and if so, remove it 00498 ACE_Service_Config::process_directive ( 00499 ACE_REMOVE_SERVICE_DIRECTIVE ("TAO_Codeset")); 00500 00501 ACE_Service_Config::process_directive ( 00502 ACE_DYNAMIC_SERVICE_DIRECTIVE ( 00503 "TAO_Codeset", 00504 "TAO_Codeset", 00505 "_make_TAO_Codeset_Manager_Factory", 00506 "")); 00507 00508 factory = 00509 ACE_Dynamic_Service< 00510 TAO_Codeset_Manager_Factory_Base 00511 >::instance ("TAO_Codeset"); 00512 #endif 00513 } 00514 00515 if (factory == 0) 00516 { 00517 if (TAO_debug_level > 0) 00518 { 00519 ACE_ERROR ((LM_ERROR, 00520 ACE_TEXT ("(%P|%t) ORB_Core: ") 00521 ACE_TEXT ("Unable to initialize ") 00522 ACE_TEXT ("Codeset Manager\n"))); 00523 } 00524 } 00525 } 00526 00527 pcfg->process_directive ( 00528 ace_svc_desc_TAO_Default_Resource_Factory); 00529 pcfg->process_directive ( 00530 ace_svc_desc_TAO_Default_Client_Strategy_Factory); 00531 pcfg->process_directive ( 00532 ace_svc_desc_TAO_Default_Server_Strategy_Factory); 00533 00534 // Configure the IIOP factory. You do *NOT* need modify this 00535 // code to add your own protocol, instead simply add the 00536 // following to your svc.conf file: 00537 // 00538 // dynamic PN_Factory Service_Object * LIB:_make_PN_Protocol_Factory() "" 00539 // static Resource_Factory "-ORBProtocolFactory PN_Factory" 00540 // 00541 // where PN is the name of your protocol and LIB is the base 00542 // name of the shared library that implements the protocol. 00543 00544 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0) 00545 pcfg->process_directive (ace_svc_desc_TAO_IIOP_Protocol_Factory); 00546 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */ 00547 00548 // add descriptor to list of static objects. 00549 #if (TAO_HAS_MCAST_PARSER == 1) 00550 pcfg->process_directive (ace_svc_desc_TAO_MCAST_Parser); 00551 #endif /* TAO_HAS_MCAST_PARSER == 1 */ 00552 #if (TAO_HAS_CORBANAME_PARSER == 1) 00553 pcfg->process_directive (ace_svc_desc_TAO_CORBANAME_Parser); 00554 #endif /* TAO_HAS_CORBANAME_PARSER == 1 */ 00555 #if (TAO_HAS_CORBALOC_PARSER == 1) 00556 pcfg->process_directive (ace_svc_desc_TAO_CORBALOC_Parser); 00557 #endif /* TAO_HAS_CORBALOC_PARSER == 1 */ 00558 #if (TAO_HAS_FILE_PARSER == 1) 00559 pcfg->process_directive (ace_svc_desc_TAO_FILE_Parser); 00560 #endif /* TAO_HAS_FILE_PARSER == 1 */ 00561 #if (TAO_HAS_DDL_PARSER == 1) 00562 pcfg->process_directive (ace_svc_desc_TAO_DLL_Parser); 00563 #endif /* TAO_HAS_DDL_PARSER == 1 */ 00564 #if (TAO_HAS_HTTP_PARSER == 1) 00565 pcfg->process_directive (ace_svc_desc_TAO_HTTP_Parser); 00566 #endif /* TAO_HAS_HTTP_PARSER */ 00567 pcfg->process_directive (ace_svc_desc_TAO_Default_Stub_Factory); 00568 pcfg->process_directive ( 00569 ace_svc_desc_TAO_Default_Endpoint_Selector_Factory); 00570 pcfg->process_directive ( 00571 ace_svc_desc_TAO_Default_Thread_Lane_Resources_Manager_Factory); 00572 pcfg->process_directive (ace_svc_desc_TAO_Default_Collocation_Resolver); 00573 00574 } /* register_global_services_i */ |
|
Initial value: Definition at line 156 of file TAO_Internal.cpp. Referenced by TAO::ORB::default_svc_conf_entries(), and TAO_END_VERSIONED_NAMESPACE_DECL::register_additional_services_i(). |
|
Part of a condition variable, which helps to ensure non-default ORBs can not proceed with their initialization, until the globaly required services have been instantiated by the default ORB. Usually, the first ORB to be created is designated the default ORB (reference the CORBA spec) Definition at line 150 of file TAO_Internal.cpp. Referenced by TAO::ORB::open_services(). |
|
Definition at line 160 of file TAO_Internal.cpp. Referenced by TAO_END_VERSIONED_NAMESPACE_DECL::parse_private_args_i(), and TAO_END_VERSIONED_NAMESPACE_DECL::register_global_services_i(). |
|
Initial value: Definition at line 152 of file TAO_Internal.cpp. Referenced by TAO::ORB::default_svc_conf_entries(), and TAO_END_VERSIONED_NAMESPACE_DECL::register_additional_services_i(). |
|
Initial value: Definition at line 154 of file TAO_Internal.cpp. Referenced by TAO::ORB::default_svc_conf_entries(), and TAO_END_VERSIONED_NAMESPACE_DECL::register_additional_services_i(). |
|
Number of times open_services() has been called. Incremented by open_global_services_i(), and decremented by close_services().
Definition at line 141 of file TAO_Internal.cpp. Referenced by TAO::ORB::close_services(), and TAO::ORB::open_services(). |