#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/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_Protocols_Hooks.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, char **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, char **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, char **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) |
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. |
|
||||||||||||||||||||||||
|
Initialize ORB-local (private) ACE Service Configurator repository.
Referenced by TAO::ORB::open_services(). |
|
||||||||||||||||||||
|
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 778 of file TAO_Internal.cpp. References ACE_Arg_Shifter, ACE_DEBUG, ACE_TCHAR, ACE_TEXT, ACE_OS::atoi(), ACE::debug(), ACE_OS::getenv(), TAO::details::unbounded_basic_string_sequence< char >::length(), LM_DEBUG, negotiate_codesets, CORBA::string_dup(), and TAO_debug_level. Referenced by TAO::ORB::open_services().
00782 {
00783 // NOTE: When adding new global arguments, ensure they are only
00784 // applied when apply_values is true, but that they are always
00785 // consumed, if they need to be consumed.
00786 #if defined (TAO_DEBUG) && !defined (ACE_HAS_WINCE)
00787 // Make it a little easier to debug programs using this code.
00788 if (apply_values)
00789 {
00790 TAO_debug_level = ACE_Env_Value<u_int> ("TAO_ORB_DEBUG", 0);
00791
00792 char * const value = ACE_OS::getenv ("TAO_ORB_DEBUG");
00793
00794 if (value != 0)
00795 {
00796 TAO_debug_level = ACE_OS::atoi (value);
00797
00798 if (TAO_debug_level <= 0)
00799 {
00800 TAO_debug_level = 1;
00801 }
00802
00803 ACE_DEBUG ((LM_DEBUG,
00804 ACE_TEXT ("TAO_debug_level == %d\n"),
00805 TAO_debug_level));
00806 }
00807 }
00808 #endif /* TAO_DEBUG && !ACE_HAS_WINCE */
00809
00810
00811 // Extract the Service Configurator ORB options from the argument
00812 // vector.
00813 ACE_Arg_Shifter arg_shifter (argc, argv);
00814 CORBA::ULong len = 0;
00815
00816 while (arg_shifter.is_anything_left ())
00817 {
00818 const ACE_TCHAR *current_arg = 0;
00819 int strcmp_result =
00820 arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug"));
00821
00822 if (0 == strcmp_result)
00823 {
00824 if (apply_values)
00825 {
00826 // Later, replace all of these
00827 // warning this turns on a daemon.
00828 ACE::debug (1);
00829 }
00830
00831 arg_shifter.consume_arg ();
00832 }
00833 else
00834 {
00835 current_arg =
00836 arg_shifter.get_the_parameter (
00837 ACE_TEXT ("-ORBNegotiateCodesets"));
00838
00839 if (0 != current_arg)
00840 {
00841 if (apply_values)
00842 {
00843 // Don't consume, the ORB_Core::init will use it again.
00844 negotiate_codesets = (ACE_OS::atoi (current_arg));
00845 }
00846 }
00847 else
00848 {
00849 current_arg =
00850 arg_shifter.get_the_parameter (
00851 ACE_TEXT ("-ORBDebugLevel"));
00852
00853 if (0 != current_arg)
00854 {
00855 if (apply_values)
00856 {
00857 TAO_debug_level =
00858 ACE_OS::atoi (current_arg);
00859 }
00860
00861 arg_shifter.consume_arg ();
00862 }
00863 else
00864 {
00865 strcmp_result =
00866 arg_shifter.cur_arg_strncasecmp (
00867 ACE_TEXT ("-ORBDaemon"));
00868
00869 if (0 == strcmp_result)
00870 {
00871 // Be a daemon.
00872 if (apply_values)
00873 {
00874 len = svc_config_argv.length ();
00875 svc_config_argv.length (len + 1);
00876
00877 svc_config_argv[len] =
00878 CORBA::string_dup ("-b");
00879 }
00880
00881 arg_shifter.consume_arg ();
00882 }
00883 // Can't interpret this argument.
00884 // Move on to the next argument.
00885 else
00886 {
00887 // Any arguments that don't match are ignored so
00888 // that the caller can still use them.
00889 arg_shifter.ignore_arg ();
00890 }
00891 }
00892 }
00893 }
00894 }
00895
00896 return 0;
00897 } /* 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 701 of file TAO_Internal.cpp. References ACE_Arg_Shifter, ACE_TCHAR, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, TAO::details::unbounded_basic_string_sequence< char >::length(), and CORBA::string_dup(). Referenced by TAO::ORB::open_services().
00705 {
00706 // Extract the Service Configurator ORB options from the argument
00707 // vector.
00708 ACE_Arg_Shifter arg_shifter (argc, argv);
00709 CORBA::ULong len = 0;
00710
00711 while (arg_shifter.is_anything_left ())
00712 {
00713 const ACE_TCHAR *current_arg = 0;
00714 int result =
00715 arg_shifter.cur_arg_strncasecmp (
00716 ACE_TEXT ("-ORBSkipServiceConfigOpen"));
00717
00718 if (0 == result) // Start with the parameterless flags.
00719 {
00720 skip_service_config_open = true;
00721
00722 arg_shifter.consume_arg ();
00723 }
00724 else // Continue with flags that accept parameters.
00725 {
00726 current_arg =
00727 arg_shifter.get_the_parameter (
00728 ACE_TEXT ("-ORBSvcConfDirective"));
00729
00730 if (0 != current_arg)
00731 {
00732 len = svc_config_argv.length ();
00733 svc_config_argv.length (len + 2); // 2 arguments to add
00734
00735 // This is used to pass arguments to the Service
00736 // Configurator using the "command line" to provide
00737 // configuration information rather than using a svc.conf
00738 // file. Pass the "-S" to the service configurator.
00739 svc_config_argv[len] = CORBA::string_dup ("-S");
00740 svc_config_argv[len + 1] =
00741 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
00742
00743 arg_shifter.consume_arg ();
00744 }
00745 else
00746 {
00747 current_arg =
00748 arg_shifter.get_the_parameter (
00749 ACE_TEXT ("-ORBServiceConfigLoggerKey"));
00750
00751 if (0 != current_arg)
00752 {
00753 len = svc_config_argv.length ();
00754 svc_config_argv.length (len + 2); // 2 arguments to add
00755
00756 svc_config_argv[len] = CORBA::string_dup ("-k");
00757 svc_config_argv[len + 1] =
00758 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
00759
00760 arg_shifter.consume_arg ();
00761 }
00762 // Can't interpret this argument.
00763 // Move on to the next argument.
00764 else
00765 {
00766 // Any arguments that don't match are ignored so that
00767 // the caller can still use them.
00768 arg_shifter.ignore_arg ();
00769 }
00770 }
00771 }
00772 }
00773
00774 return 0;
00775 } /* 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 638 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(), TAO::details::unbounded_basic_string_sequence< char >::length(), LM_ERROR, and CORBA::string_dup(). Referenced by TAO::ORB::open_services().
00641 {
00642 // Extract the Service Configurator ORB options from the argument
00643 // vector.
00644 ACE_Arg_Shifter arg_shifter (argc, argv);
00645 CORBA::ULong len = 0;
00646
00647 while (arg_shifter.is_anything_left ())
00648 {
00649 const ACE_TCHAR *current_arg =
00650 arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf"));
00651
00652 if (0 != current_arg)
00653 {
00654 // Specify the name of the svc.conf file to be used.
00655
00656 // Proceeds only if the configuration file exists.
00657 FILE * const conf_file =
00658 ACE_OS::fopen (current_arg, ACE_TEXT ("r"));
00659
00660 if (0 == conf_file)
00661 {
00662 // Assigning EINVAL to errno to make an exception
00663 // thrown. calling code does not throw an exception if
00664 // the errno is set to ENOENT for some reason.
00665 errno = EINVAL;
00666
00667 ACE_ERROR_RETURN ((LM_ERROR,
00668 ACE_TEXT ("TAO (%P|%t) Service ")
00669 ACE_TEXT ("Configurator ")
00670 ACE_TEXT ("unable to open file %s\n"),
00671 current_arg),
00672 -1);
00673 }
00674 else
00675 {
00676 ACE_OS::fclose (conf_file);
00677 }
00678
00679 len = svc_config_argv.length ();
00680 svc_config_argv.length (len + 2); // 2 arguments to add
00681
00682 svc_config_argv[len] = CORBA::string_dup ("-f");
00683 svc_config_argv[len + 1] =
00684 CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
00685
00686 arg_shifter.consume_arg ();
00687 }
00688 // Can't interpret this argument. Move on to the next argument.
00689 else
00690 {
00691 // Any arguments that don't match are ignored so that the
00692 // caller can still use them.
00693 arg_shifter.ignore_arg ();
00694 }
00695 }
00696
00697 return 0;
00698 } /* parse_svcconf_args_i */
|
|
|
Definition at line 546 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().
00547 {
00548 // @@ What the heck do these things do and do we need to avoid
00549 // calling them if we're not invoking the svc.conf file?
00550 // @@ They are needed for platforms that have no file system,
00551 // like VxWorks.
00552
00553 if (resource_factory_args != 0)
00554 {
00555 pcfg->process_directive(
00556 ACE_TEXT_CHAR_TO_TCHAR (resource_factory_args));
00557 }
00558
00559 if (client_strategy_factory_args != 0)
00560 {
00561 pcfg->process_directive
00562 (ACE_TEXT_CHAR_TO_TCHAR (client_strategy_factory_args));
00563 }
00564
00565 if (server_strategy_factory_args != 0)
00566 {
00567 pcfg->process_directive
00568 (ACE_TEXT_CHAR_TO_TCHAR (server_strategy_factory_args));
00569 }
00570
00571 // If available, allow the Adapter Factory to setup.
00572 ACE_Service_Object *adapter_factory =
00573 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00574 pcfg,
00575 TAO_ORB_Core::poa_factory_name ().c_str ());
00576
00577 if (adapter_factory != 0)
00578 {
00579 adapter_factory->init (0, 0);
00580 }
00581
00582 ACE_Service_Object * const pi_server_loader =
00583 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00584 pcfg,
00585 "PI_Server_Loader");
00586
00587 if (pi_server_loader != 0)
00588 {
00589 pi_server_loader->init (0, 0);
00590 }
00591
00592 ACE_Service_Object * const bidir_loader =
00593 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00594 pcfg,
00595 "BiDirGIOP_Loader");
00596
00597 if (bidir_loader != 0)
00598 {
00599 bidir_loader->init (0, 0);
00600 }
00601
00602 ACE_Service_Object * const messaging_loader =
00603 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00604 pcfg,
00605 "Messaging_Loader");
00606
00607 if (messaging_loader != 0)
00608 {
00609 messaging_loader->init (0, 0);
00610 }
00611
00612 // Handle RTCORBA library special case. Since RTCORBA needs
00613 // its init method call to register several hooks, call it
00614 // here if it hasn't already been called.
00615 ACE_Service_Object * const rt_loader =
00616 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00617 pcfg,
00618 "RT_ORB_Loader");
00619
00620 if (rt_loader != 0)
00621 {
00622 rt_loader->init (0, 0);
00623 }
00624
00625 ACE_Service_Object * const rtscheduler_loader =
00626 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00627 pcfg,
00628 "RTScheduler_Loader");
00629
00630 if (rtscheduler_loader != 0)
00631 {
00632 rtscheduler_loader->init (0, 0);
00633 }
00634
00635 } /* 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 463 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().
00464 {
00465 // This has to be done before intializing the resource
00466 // factory. Codesets is a special library since its configuration
00467 // is optional and it may be linked statically.
00468 if (negotiate_codesets)
00469 {
00470 TAO_Codeset_Manager_Factory_Base *factory =
00471 ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance (
00472 "TAO_Codeset");
00473
00474 if (factory == 0 || factory->is_default ())
00475 {
00476 #if !defined (TAO_AS_STATIC_LIBS)
00477 // only for dynamic libs, check to see if default factory
00478 // and if so, remove it
00479 ACE_Service_Config::process_directive (
00480 ACE_REMOVE_SERVICE_DIRECTIVE ("TAO_Codeset"));
00481
00482 ACE_Service_Config::process_directive (
00483 ACE_DYNAMIC_SERVICE_DIRECTIVE (
00484 "TAO_Codeset",
00485 "TAO_Codeset",
00486 "_make_TAO_Codeset_Manager_Factory",
00487 ""));
00488
00489 factory =
00490 ACE_Dynamic_Service<
00491 TAO_Codeset_Manager_Factory_Base
00492 >::instance ("TAO_Codeset");
00493 #endif
00494 }
00495
00496 if (factory == 0)
00497 {
00498 if (TAO_debug_level > 0)
00499 {
00500 ACE_ERROR ((LM_ERROR,
00501 ACE_TEXT ("(%P|%t) ORB_Core: ")
00502 ACE_TEXT ("Unable to initialize ")
00503 ACE_TEXT ("Codeset Manager\n")));
00504 }
00505 }
00506 }
00507
00508 pcfg->process_directive (
00509 ace_svc_desc_TAO_Default_Resource_Factory);
00510 pcfg->process_directive (
00511 ace_svc_desc_TAO_Default_Client_Strategy_Factory);
00512 pcfg->process_directive (
00513 ace_svc_desc_TAO_Default_Server_Strategy_Factory);
00514
00515 // Configure the IIOP factory. You do *NOT* need modify this
00516 // code to add your own protocol, instead simply add the
00517 // following to your svc.conf file:
00518 //
00519 // dynamic PN_Factory Service_Object * LIB:_make_PN_Protocol_Factory() ""
00520 // static Resource_Factory "-ORBProtocolFactory PN_Factory"
00521 //
00522 // where PN is the name of your protocol and LIB is the base
00523 // name of the shared library that implements the protocol.
00524
00525 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
00526 pcfg->process_directive (ace_svc_desc_TAO_IIOP_Protocol_Factory);
00527 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
00528
00529 // add descriptor to list of static objects.
00530 pcfg->process_directive (ace_svc_desc_TAO_MCAST_Parser);
00531 pcfg->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
00532 pcfg->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);
00533 pcfg->process_directive (ace_svc_desc_TAO_FILE_Parser);
00534 pcfg->process_directive (ace_svc_desc_TAO_DLL_Parser);
00535 pcfg->process_directive (ace_svc_desc_TAO_Default_Stub_Factory);
00536 pcfg->process_directive (
00537 ace_svc_desc_TAO_Default_Endpoint_Selector_Factory);
00538 pcfg->process_directive (ace_svc_desc_TAO_Default_Protocols_Hooks);
00539 pcfg->process_directive (
00540 ace_svc_desc_TAO_Default_Thread_Lane_Resources_Manager_Factory);
00541 pcfg->process_directive (ace_svc_desc_TAO_Default_Collocation_Resolver);
00542
00543 } /* 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_global_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(). |
1.3.6