00001
00002
00003 #include "tao/TAO_Internal.h"
00004 #include "tao/TAO_Singleton.h"
00005 #include "tao/default_server.h"
00006 #include "tao/default_client.h"
00007 #include "tao/default_resource.h"
00008 #include "tao/IIOP_Factory.h"
00009 #include "tao/MCAST_Parser.h"
00010 #include "tao/CORBANAME_Parser.h"
00011 #include "tao/CORBALOC_Parser.h"
00012 #include "tao/FILE_Parser.h"
00013 #include "tao/HTTP_Parser.h"
00014 #include "tao/DLL_Parser.h"
00015 #include "tao/ORB_Core.h"
00016 #include "tao/Adapter_Factory.h"
00017 #include "tao/Default_Stub_Factory.h"
00018 #include "tao/Default_Endpoint_Selector_Factory.h"
00019 #include "tao/Default_Thread_Lane_Resources_Manager.h"
00020 #include "tao/Default_Collocation_Resolver.h"
00021 #include "tao/Codeset_Manager_Factory_Base.h"
00022 #include "tao/Codeset_Manager.h"
00023 #include "tao/debug.h"
00024
00025 #include "ace/Dynamic_Service.h"
00026 #include "ace/Arg_Shifter.h"
00027 #include "ace/Argv_Type_Converter.h"
00028 #include "ace/ARGV.h"
00029 #include "ace/Env_Value_T.h"
00030 #include "ace/ACE.h"
00031 #include "ace/OS_NS_stdio.h"
00032 #include "ace/Static_Object_Lock.h"
00033 #include "ace/OS_NS_sys_stat.h"
00034
00035 ACE_RCSID (tao,
00036 TAO_Internal,
00037 "$Id: TAO_Internal.cpp 91159 2010-07-21 15:57:54Z mesnier_p $")
00038
00039 #ifndef TAO_DEFAULT_RESOURCE_FACTORY_ARGS
00040 # define TAO_DEFAULT_RESOURCE_FACTORY_ARGS 0
00041 #endif
00042
00043 #ifndef TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS
00044 # define TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS 0
00045 #endif
00046
00047 #ifndef TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS
00048 # define TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS 0
00049 #endif
00050
00051 namespace
00052 {
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 int
00069 parse_global_args_i (int &argc,
00070 ACE_TCHAR **argv,
00071 ACE_ARGV &svc_config_argv,
00072 bool apply_values);
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 int
00085 parse_svcconf_args_i (int &argc,
00086 ACE_TCHAR **argv,
00087 ACE_ARGV &svc_config_argv);
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 bool
00101 using_global_gestalt_i (int &argc,
00102 ACE_TCHAR **argv,
00103 bool &skip_service_config_open);
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 void
00123 register_global_services_i (ACE_Service_Gestalt * pcfg);
00124 void
00125 register_additional_services_i (ACE_Service_Gestalt * pcfg);
00126
00127
00128
00129
00130
00131
00132
00133
00134 int
00135 parse_private_args_i (int &argc,
00136 ACE_TCHAR **argv,
00137 ACE_ARGV & svc_config_argv,
00138 bool & skip_service_config_open,
00139 bool & ignore_default_svc_conf_file);
00140
00141
00142
00143
00144
00145
00146
00147
00148 int
00149 open_private_services_i (ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> pcfg,
00150 int & argc,
00151 ACE_TCHAR **argv,
00152 bool skip_service_config_open = false,
00153 bool ignore_default_svc_conf_file = false);
00154
00155
00156
00157
00158
00159
00160
00161 long service_open_count = 0;
00162
00163
00164
00165
00166
00167
00168
00169
00170 bool is_ubergestalt_ready = false;
00171
00172 char const * resource_factory_args =
00173 TAO_DEFAULT_RESOURCE_FACTORY_ARGS;
00174 char const * server_strategy_factory_args =
00175 TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS;
00176 char const * client_strategy_factory_args =
00177 TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS;
00178
00179 #if (TAO_NEGOTIATE_CODESETS == 1)
00180 bool negotiate_codesets = true;
00181 #else
00182 bool negotiate_codesets = false;
00183 #endif
00184 }
00185
00186 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00187
00188 #if defined (ACE_HAS_THREADS)
00189
00190
00191
00192
00193 class TAO_Ubergestalt_Ready_Condition
00194 : public ACE_SYNCH_RECURSIVE_CONDITION
00195 {
00196 public:
00197 static TAO_Ubergestalt_Ready_Condition* instance (void)
00198 {
00199 return TAO_Singleton <TAO_Ubergestalt_Ready_Condition,
00200 TAO_SYNCH_RECURSIVE_MUTEX>::instance ();
00201 }
00202
00203 TAO_Ubergestalt_Ready_Condition (void)
00204 : ACE_SYNCH_RECURSIVE_CONDITION (mutex_)
00205 {
00206 }
00207
00208
00209 private:
00210
00211
00212
00213 ACE_Recursive_Thread_Mutex mutex_;
00214 };
00215 #endif // ACE_HAS_THREADS
00216
00217
00218
00219
00220
00221
00222 int
00223 TAO::ORB::open_global_services (int argc, ACE_TCHAR **argv)
00224 {
00225 {
00226
00227 static int orb_init_count = 0;
00228
00229
00230
00231 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00232 guard,
00233 *ACE_Static_Object_Lock::instance (),
00234 -1));
00235
00236
00237
00238
00239 if (TAO_Singleton_Manager::instance ()->init () == -1)
00240 return -1;
00241
00242
00243 if (++orb_init_count > 1)
00244 return 0;
00245 }
00246
00247
00248
00249 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00250 guard,
00251 TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00252 -1));
00253
00254 if (TAO_debug_level > 2)
00255 {
00256 ACE_DEBUG ((LM_DEBUG,
00257 ACE_TEXT ("TAO (%P|%t) Initializing the ")
00258 ACE_TEXT ("process-wide service context\n")));
00259 }
00260
00261 ACE_Service_Gestalt* theone = ACE_Service_Config::global ();
00262 ACE_Service_Config_Guard auto_config_guard (theone);
00263
00264
00265
00266
00267
00268 ACE_ARGV global_svc_config_argv (true);
00269
00270 global_svc_config_argv.add ((argc <= 0 || argv == 0) ?
00271 ACE_TEXT ("") : argv[0], true);
00272
00273
00274
00275
00276 ACE_ARGV copyargv (argc, argv, true, true);
00277
00278
00279 int tmpargc = argc;
00280 ACE_Argv_Type_Converter cvtargv (tmpargc, copyargv.argv());
00281
00282 tmpargc = cvtargv.get_argc ();
00283 ACE_TCHAR **tmpargv = cvtargv.get_TCHAR_argv ();
00284
00285
00286
00287 if (parse_global_args_i (tmpargc,
00288 tmpargv,
00289 global_svc_config_argv,
00290 true) == -1)
00291 return -1;
00292
00293 bool skip_service_config_open = false;
00294
00295 if (using_global_gestalt_i (tmpargc,
00296 tmpargv,
00297 skip_service_config_open))
00298 {
00299 if (parse_svcconf_args_i (tmpargc,
00300 tmpargv,
00301 global_svc_config_argv) == -1)
00302 return -1;
00303 }
00304
00305 bool ignore_default_svc_conf_file = false;
00306
00307 if (parse_private_args_i (tmpargc,
00308 tmpargv,
00309 global_svc_config_argv,
00310 skip_service_config_open,
00311 ignore_default_svc_conf_file) == -1)
00312 return -1;
00313
00314
00315
00316
00317
00318 register_global_services_i (theone);
00319
00320
00321 int global_svc_config_argc = global_svc_config_argv.argc ();
00322 int status = open_private_services_i (theone,
00323 global_svc_config_argc,
00324 global_svc_config_argv.argv (),
00325 skip_service_config_open,
00326 ignore_default_svc_conf_file);
00327
00328
00329 if (status == -1)
00330 {
00331 if (errno != ENOENT)
00332 {
00333 if (TAO_debug_level > 0)
00334 {
00335 ACE_ERROR ((LM_ERROR,
00336 ACE_TEXT ("TAO (%P|%t) - Failed to open process-")
00337 ACE_TEXT ("wide service configuration context\n")));
00338 }
00339 return -1;
00340 }
00341 else
00342 {
00343 if (TAO_debug_level > 4)
00344 ACE_DEBUG ((LM_DEBUG,
00345 ACE_TEXT ("TAO (%P|%t) - Did not find default ")
00346 ACE_TEXT ("svc.conf\n")));
00347 status = 0;
00348 }
00349 }
00350
00351 if (status > 0)
00352 {
00353
00354 if (TAO_debug_level > 0)
00355 {
00356 ACE_DEBUG ((LM_DEBUG,
00357 ACE_TEXT ("TAO (%P|%t) - process-wide service ")
00358 ACE_TEXT ("configuration context had %d failed ")
00359 ACE_TEXT ("directives\n"), status));
00360 }
00361 }
00362
00363 if (TAO_debug_level > 2)
00364 ACE_DEBUG ((LM_DEBUG,
00365 ACE_TEXT ("TAO (%P|%t) - Completed initializing the ")
00366 ACE_TEXT ("process-wide service context\n")));
00367
00368 if (TAO_debug_level > 4)
00369 ACE_DEBUG ((LM_DEBUG,
00370 ACE_TEXT ("TAO (%P|%t) - Default ORB services initialization begins\n")));
00371
00372
00373 register_additional_services_i (theone);
00374
00375 if (TAO_debug_level > 4)
00376 ACE_DEBUG ((LM_DEBUG,
00377 ACE_TEXT ("TAO (%P|%t) - Default ORB services initialization completed\n")));
00378
00379
00380
00381 is_ubergestalt_ready = true;
00382 ACE_MT (if (TAO_Ubergestalt_Ready_Condition::instance ()->
00383 broadcast () == -1)
00384 return -1);
00385
00386 return 0;
00387 }
00388
00389 int
00390 TAO::ORB::open_services (ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> pcfg,
00391 int &argc,
00392 ACE_TCHAR **argv)
00393 {
00394 {
00395 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00396 guard,
00397 TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00398 -1));
00399
00400
00401
00402 if (service_open_count == 1)
00403 {
00404 if (TAO_debug_level > 4)
00405 ACE_DEBUG ((LM_DEBUG,
00406 ACE_TEXT ("TAO (%P|%t) - Waiting for the default ")
00407 ACE_TEXT ("ORB to complete the global ")
00408 ACE_TEXT ("initialization\n")));
00409
00410 ACE_MT (while (!is_ubergestalt_ready)
00411 TAO_Ubergestalt_Ready_Condition::instance ()->wait ());
00412
00413 if (TAO_debug_level > 4)
00414 ACE_DEBUG ((LM_DEBUG,
00415 ACE_TEXT ("TAO (%P|%t) - The default ")
00416 ACE_TEXT ("ORB must have completed the global ")
00417 ACE_TEXT ("initialization...\n")));
00418
00419 }
00420 else
00421 {
00422 if (TAO_debug_level > 4)
00423 ACE_DEBUG ((LM_DEBUG,
00424 ACE_TEXT ("TAO (%P|%t) - We are%Cthe default ")
00425 ACE_TEXT ("ORB ...\n"),
00426 (service_open_count == 0) ? " " : " not "));
00427 }
00428
00429 ++service_open_count;
00430 }
00431
00432
00433
00434
00435 ACE_ARGV svc_config_argv (true);
00436
00437 svc_config_argv.add ((argc <= 0 || argv == 0) ? ACE_TEXT ("") : argv[0],
00438 true);
00439
00440
00441
00442 bool skip_service_config_open = false;
00443 bool ignore_default_svc_conf_file = false;
00444
00445
00446 if (parse_private_args_i (argc,
00447 argv,
00448 svc_config_argv,
00449 skip_service_config_open,
00450 ignore_default_svc_conf_file) == -1)
00451 {
00452 return -1;
00453 }
00454
00455
00456
00457 ACE_ARGV global_svc_config_argv;
00458
00459
00460
00461
00462
00463 int status = parse_global_args_i(argc, argv, global_svc_config_argv, false);
00464
00465 if (status == -1 && TAO_debug_level > 0)
00466 ACE_DEBUG ((LM_DEBUG,
00467 ACE_TEXT ("TAO (%P|%t) - Skipping the process-wide ")
00468 ACE_TEXT ("service configuration, service_open_count ")
00469 ACE_TEXT ("= %d, status = %d\n"),
00470 service_open_count,
00471 status));
00472
00473 if (TAO_debug_level > 2)
00474 ACE_DEBUG ((LM_DEBUG,
00475 ACE_TEXT ("TAO (%P|%t) - Initializing the ")
00476 ACE_TEXT ("orb-specific services\n")));
00477
00478 if (parse_svcconf_args_i (argc, argv, svc_config_argv) == -1)
00479 return -1;
00480
00481
00482 if (pcfg != ACE_Service_Config::global())
00483 {
00484 int svc_config_argc = svc_config_argv.argc ();
00485 status =
00486 open_private_services_i (pcfg,
00487 svc_config_argc,
00488 svc_config_argv.argv (),
00489 skip_service_config_open,
00490 ignore_default_svc_conf_file);
00491 }
00492
00493 if (status == -1)
00494 {
00495 if (errno != ENOENT)
00496 {
00497 if (TAO_debug_level > 0)
00498 ACE_ERROR ((LM_ERROR,
00499 ACE_TEXT ("TAO (%P|%t) - Failed to open ORB-specific ")
00500 ACE_TEXT ("service configuration\n")));
00501 return -1;
00502 }
00503 else
00504 {
00505 if (TAO_debug_level > 4)
00506 ACE_DEBUG ((LM_DEBUG,
00507 ACE_TEXT ("TAO (%P|%t) - Did not find default ")
00508 ACE_TEXT ("svc.conf\n")));
00509 status = 0;
00510 }
00511 }
00512
00513 if (status > 0)
00514 {
00515
00516 if (TAO_debug_level > 0)
00517 {
00518 ACE_DEBUG ((LM_DEBUG,
00519 ACE_TEXT ("TAO (%P|%t) - ORB-specific service ")
00520 ACE_TEXT ("configuration context had %d failed ")
00521 ACE_TEXT ("directives\n"), status));
00522 }
00523 }
00524
00525
00526 return status;
00527 }
00528
00529 int
00530 TAO::ORB::close_services (ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> pcfg)
00531 {
00532 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00533 guard,
00534 *ACE_Static_Object_Lock::instance (),
00535 -1));
00536 --service_open_count;
00537
00538 int result = 0;
00539
00540 if (pcfg != ACE_Service_Config::global())
00541 {
00542 result = pcfg->close ();
00543 }
00544
00545 return result;
00546 }
00547
00548 void
00549 TAO::ORB::default_svc_conf_entries (char const * rf_args,
00550 char const * ssf_args,
00551 char const * csf_args)
00552 {
00553 resource_factory_args = rf_args;
00554 server_strategy_factory_args = ssf_args;
00555 client_strategy_factory_args = csf_args;
00556 }
00557
00558 TAO_END_VERSIONED_NAMESPACE_DECL
00559
00560
00561 namespace
00562 {
00563
00564
00565 int
00566 open_private_services_i (ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> pcfg,
00567 int & argc,
00568 ACE_TCHAR ** argv,
00569 bool skip_service_config_open,
00570 bool ignore_default_svc_conf_file)
00571 {
00572
00573 if (skip_service_config_open)
00574 {
00575 return 0;
00576 }
00577
00578 #if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
00579 ignore_default_svc_conf_file = true;
00580 #endif
00581
00582
00583 ACE_Argv_Type_Converter command_line (argc, argv);
00584
00585 return pcfg->open (command_line.get_argc (),
00586 command_line.get_TCHAR_argv (),
00587 0,
00588 false,
00589 ignore_default_svc_conf_file);
00590 }
00591
00592
00593
00594 void
00595 register_global_services_i (ACE_Service_Gestalt * pcfg)
00596 {
00597
00598
00599
00600 if (negotiate_codesets)
00601 {
00602 TAO_Codeset_Manager_Factory_Base *factory =
00603 ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance (
00604 "TAO_Codeset");
00605
00606 if (factory == 0 || factory->is_default ())
00607 {
00608 #if !defined (TAO_AS_STATIC_LIBS) && !(defined (ACE_VXWORKS) && !defined (__RTP__))
00609
00610
00611 ACE_Service_Config::process_directive (
00612 ACE_REMOVE_SERVICE_DIRECTIVE ("TAO_Codeset"));
00613
00614 ACE_Service_Config::process_directive (
00615 ACE_DYNAMIC_SERVICE_DIRECTIVE (
00616 "TAO_Codeset",
00617 "TAO_Codeset",
00618 "_make_TAO_Codeset_Manager_Factory",
00619 ""));
00620
00621 factory =
00622 ACE_Dynamic_Service<
00623 TAO_Codeset_Manager_Factory_Base
00624 >::instance ("TAO_Codeset");
00625 #endif
00626 }
00627
00628 if (factory == 0)
00629 {
00630 if (TAO_debug_level > 0)
00631 {
00632 ACE_ERROR ((LM_ERROR,
00633 ACE_TEXT ("TAO (%P|%t) ORB_Core: ")
00634 ACE_TEXT ("Unable to initialize ")
00635 ACE_TEXT ("Codeset Manager\n")));
00636 }
00637 }
00638 }
00639
00640 pcfg->process_directive (
00641 ace_svc_desc_TAO_Default_Resource_Factory);
00642 pcfg->process_directive (
00643 ace_svc_desc_TAO_Default_Client_Strategy_Factory);
00644 pcfg->process_directive (
00645 ace_svc_desc_TAO_Default_Server_Strategy_Factory);
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
00658 pcfg->process_directive (ace_svc_desc_TAO_IIOP_Protocol_Factory);
00659 #endif
00660
00661
00662 #if (TAO_HAS_MCAST_PARSER == 1)
00663 pcfg->process_directive (ace_svc_desc_TAO_MCAST_Parser);
00664 #endif
00665 #if (TAO_HAS_CORBANAME_PARSER == 1)
00666 pcfg->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
00667 #endif
00668 #if (TAO_HAS_CORBALOC_PARSER == 1)
00669 pcfg->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);
00670 #endif
00671 #if (TAO_HAS_FILE_PARSER == 1)
00672 pcfg->process_directive (ace_svc_desc_TAO_FILE_Parser);
00673 #endif
00674 #if (TAO_HAS_DDL_PARSER == 1)
00675 pcfg->process_directive (ace_svc_desc_TAO_DLL_Parser);
00676 #endif
00677 #if (TAO_HAS_HTTP_PARSER == 1)
00678 pcfg->process_directive (ace_svc_desc_TAO_HTTP_Parser);
00679 #endif
00680 pcfg->process_directive (ace_svc_desc_TAO_Default_Stub_Factory);
00681 pcfg->process_directive (
00682 ace_svc_desc_TAO_Default_Endpoint_Selector_Factory);
00683 pcfg->process_directive (
00684 ace_svc_desc_TAO_Default_Thread_Lane_Resources_Manager_Factory);
00685 pcfg->process_directive (ace_svc_desc_TAO_Default_Collocation_Resolver);
00686
00687 }
00688
00689 void
00690 register_additional_services_i (ACE_Service_Gestalt * pcfg)
00691 {
00692
00693
00694
00695
00696
00697 if (resource_factory_args != 0)
00698 {
00699 pcfg->process_directive(
00700 ACE_TEXT_CHAR_TO_TCHAR (resource_factory_args));
00701 }
00702
00703 if (client_strategy_factory_args != 0)
00704 {
00705 pcfg->process_directive
00706 (ACE_TEXT_CHAR_TO_TCHAR (client_strategy_factory_args));
00707 }
00708
00709 if (server_strategy_factory_args != 0)
00710 {
00711 pcfg->process_directive
00712 (ACE_TEXT_CHAR_TO_TCHAR (server_strategy_factory_args));
00713 }
00714
00715 ACE_Service_Object * const pi_server_loader =
00716 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00717 pcfg,
00718 "PI_Server_Loader");
00719
00720 if (pi_server_loader != 0)
00721 {
00722 pi_server_loader->init (0, 0);
00723 }
00724
00725 ACE_Service_Object * const bidir_loader =
00726 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00727 pcfg,
00728 "BiDirGIOP_Loader");
00729
00730 if (bidir_loader != 0)
00731 {
00732 bidir_loader->init (0, 0);
00733 }
00734
00735 #if defined (TAO_HAS_ZIOP) && TAO_HAS_ZIOP == 1
00736 ACE_Service_Object * const ziop_loader =
00737 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00738 pcfg,
00739 "ZIOP_Loader");
00740
00741 if (ziop_loader != 0)
00742 {
00743 ziop_loader->init (0, 0);
00744 }
00745 #endif
00746
00747 ACE_Service_Object * const messaging_loader =
00748 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00749 pcfg,
00750 "Messaging_Loader");
00751
00752 if (messaging_loader != 0)
00753 {
00754 messaging_loader->init (0, 0);
00755 }
00756
00757
00758
00759
00760 ACE_Service_Object * const rt_loader =
00761 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00762 pcfg,
00763 "RT_ORB_Loader");
00764
00765 if (rt_loader != 0)
00766 {
00767 rt_loader->init (0, 0);
00768 }
00769
00770 ACE_Service_Object * const rtscheduler_loader =
00771 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00772 pcfg,
00773 "RTScheduler_Loader");
00774
00775 if (rtscheduler_loader != 0)
00776 {
00777 rtscheduler_loader->init (0, 0);
00778 }
00779
00780 ACE_Service_Object * const csd_framework_loader =
00781 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00782 pcfg,
00783 "CSD_Framework_Loader");
00784
00785 if (csd_framework_loader != 0)
00786 {
00787 csd_framework_loader->init (0, 0);
00788 }
00789
00790 ACE_Service_Object * const endpoint_policy_loader =
00791 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00792 pcfg,
00793 "EndpointPolicy_Initializer");
00794
00795 if (endpoint_policy_loader != 0)
00796 {
00797 endpoint_policy_loader->init (0, 0);
00798 }
00799
00800 ACE_Service_Object * const diffserv_policy_loader =
00801 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00802 pcfg,
00803 "DiffservPolicy_Initializer");
00804
00805 if (diffserv_policy_loader != 0)
00806 {
00807 diffserv_policy_loader->init (0, 0);
00808 }
00809 }
00810
00811 int
00812 parse_svcconf_args_i (int &argc,
00813 ACE_TCHAR **argv,
00814 ACE_ARGV &svc_config_argv)
00815 {
00816
00817
00818 ACE_Arg_Shifter arg_shifter (argc, argv);
00819
00820 while (arg_shifter.is_anything_left ())
00821 {
00822
00823 if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBSvcConf")) == 0)
00824 {
00825 const ACE_TCHAR *current_arg =
00826 arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf"));
00827 arg_shifter.consume_arg ();
00828
00829
00830 FILE * const conf_file =
00831 ACE_OS::fopen (current_arg, ACE_TEXT ("r"));
00832 if (0 == conf_file)
00833 {
00834
00835
00836
00837 errno = EINVAL;
00838
00839 ACE_ERROR_RETURN ((LM_ERROR,
00840 ACE_TEXT ("TAO (%P|%t) - Unable to open file <%s>")
00841 ACE_TEXT (", referenced by -ORBSvcConf option\n"),
00842 current_arg),
00843 -1);
00844 }
00845 else
00846 {
00847 ACE_OS::fclose (conf_file);
00848 }
00849
00850 svc_config_argv.add (ACE_TEXT ("-f"));
00851 svc_config_argv.add (current_arg, true);
00852 }
00853 else if (arg_shifter.cur_arg_strncasecmp
00854 (ACE_TEXT ("-ORBSvcConfDirective")) == 0)
00855 {
00856 const ACE_TCHAR *current_arg =
00857 arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConfDirective"));
00858
00859
00860
00861
00862
00863 svc_config_argv.add (ACE_TEXT ("-S"));
00864 svc_config_argv.add (current_arg, true);
00865
00866 arg_shifter.consume_arg ();
00867 }
00868 else
00869 {
00870
00871
00872 arg_shifter.ignore_arg ();
00873 }
00874 }
00875
00876 return 0;
00877 }
00878
00879 int
00880 parse_private_args_i (int &argc,
00881 ACE_TCHAR **argv,
00882 ACE_ARGV &svc_config_argv,
00883 bool & skip_service_config_open,
00884 bool & ignore_default_svc_conf_file)
00885 {
00886
00887
00888 ACE_Arg_Shifter arg_shifter (argc, argv);
00889
00890 while (arg_shifter.is_anything_left ())
00891 {
00892 const ACE_TCHAR *current_arg = 0;
00893 if (0 == arg_shifter.cur_arg_strncasecmp
00894 (ACE_TEXT ("-ORBSkipServiceConfigOpen")))
00895 {
00896 skip_service_config_open = true;
00897
00898 arg_shifter.consume_arg ();
00899 }
00900 if (0 == arg_shifter.cur_arg_strncasecmp
00901 (ACE_TEXT ("-ORBIgnoreDefaultSvcConfFile")))
00902 {
00903 ignore_default_svc_conf_file = true;
00904
00905 arg_shifter.consume_arg ();
00906 }
00907 else if (0 != (current_arg = arg_shifter.get_the_parameter
00908 (ACE_TEXT ("-ORBServiceConfigLoggerKey"))))
00909 {
00910 svc_config_argv.add (ACE_TEXT ("-k"));
00911 svc_config_argv.add (current_arg, true);
00912
00913 arg_shifter.consume_arg ();
00914 }
00915 else if (0 == arg_shifter.cur_arg_strncasecmp
00916 (ACE_TEXT ("-ORBNegotiateCodesets")))
00917 {
00918
00919
00920
00921
00922 arg_shifter.ignore_arg();
00923
00924 if (0 != (current_arg = arg_shifter.get_current()))
00925 negotiate_codesets = (ACE_OS::atoi (current_arg));
00926
00927 arg_shifter.ignore_arg();
00928 }
00929 else if (0 != (current_arg =
00930 arg_shifter.get_the_parameter
00931 (ACE_TEXT ("-ORBDebugLevel"))))
00932 {
00933
00934
00935 TAO_debug_level = ACE_OS::atoi (current_arg);
00936
00937 arg_shifter.consume_arg ();
00938 }
00939 else
00940 {
00941
00942
00943
00944 arg_shifter.ignore_arg ();
00945 }
00946 }
00947
00948 return 0;
00949 }
00950
00951 int
00952 parse_global_args_i (int &argc,
00953 ACE_TCHAR **argv,
00954 ACE_ARGV &svc_config_argv,
00955 bool apply_values)
00956 {
00957
00958
00959
00960 #if defined (TAO_DEBUG) && !defined (ACE_HAS_WINCE)
00961
00962 if (apply_values)
00963 {
00964 TAO_debug_level = ACE_Env_Value<u_int> ("TAO_ORB_DEBUG", 0);
00965
00966 char * const value = ACE_OS::getenv ("TAO_ORB_DEBUG");
00967
00968 if (value != 0)
00969 {
00970 TAO_debug_level = ACE_OS::atoi (value);
00971
00972 if (TAO_debug_level <= 0)
00973 {
00974 TAO_debug_level = 1;
00975 }
00976
00977 ACE_DEBUG ((LM_DEBUG,
00978 ACE_TEXT ("TAO_debug_level == %d\n"),
00979 TAO_debug_level));
00980 }
00981 }
00982 #endif
00983
00984
00985
00986 ACE_Arg_Shifter arg_shifter (argc, argv);
00987
00988 while (arg_shifter.is_anything_left ())
00989 {
00990 if (0 == arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug")))
00991 {
00992 if (apply_values)
00993 {
00994
00995
00996 ACE::debug (1);
00997 }
00998
00999 arg_shifter.consume_arg ();
01000 }
01001 else if (0 == arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBDaemon")))
01002 {
01003
01004 if (apply_values)
01005 {
01006 svc_config_argv.add (ACE_TEXT("-b"));
01007 }
01008
01009 arg_shifter.consume_arg ();
01010 }
01011
01012
01013 else
01014 {
01015
01016
01017 arg_shifter.ignore_arg ();
01018 }
01019 }
01020 return 0;
01021 }
01022
01023 bool
01024 using_global_gestalt_i (int &argc,
01025 ACE_TCHAR **argv,
01026 bool &skip_service_config_open)
01027 {
01028 bool with_global_gestalt = true;
01029
01030 ACE_Arg_Shifter arg_shifter (argc, argv);
01031
01032 while (arg_shifter.is_anything_left ())
01033 {
01034 if (0 == arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBGestalt")))
01035 {
01036
01037 arg_shifter.ignore_arg ();
01038
01039
01040 const ACE_TCHAR *current_arg = arg_shifter.get_current ();
01041
01042 if (0 != current_arg &&
01043 ACE_OS::strcasecmp (current_arg, ACE_TEXT("GLOBAL")) != 0)
01044 {
01045 with_global_gestalt = false;
01046
01047 ACE_stat exists;
01048 if (ACE_OS::stat (ACE_DEFAULT_SVC_CONF, &exists) == 0)
01049 {
01050
01051
01052
01053
01054
01055 skip_service_config_open = true;
01056 }
01057 }
01058
01059
01060 arg_shifter.ignore_arg ();
01061 }
01062
01063
01064 else
01065 {
01066
01067
01068 arg_shifter.ignore_arg ();
01069 }
01070 }
01071 return with_global_gestalt;
01072 }
01073 }