From da3a85a44115149ee79f67eb5213756564d22d8c Mon Sep 17 00:00:00 2001 From: labancap Date: Wed, 23 Jan 2013 00:14:32 +0000 Subject: Added --count argument to tao_nslist --- TAO/OCI_RE_ChangeLog | 13 +++++- TAO/utils/nslist/nslist.cpp | 101 ++++++++++++++++++++++++++++++-------------- 2 files changed, 82 insertions(+), 32 deletions(-) diff --git a/TAO/OCI_RE_ChangeLog b/TAO/OCI_RE_ChangeLog index 86d35947d0c..b8a5bc53fac 100644 --- a/TAO/OCI_RE_ChangeLog +++ b/TAO/OCI_RE_ChangeLog @@ -1,3 +1,14 @@ +Wed Jan 23 00:05:57 UTC 2013 Phillip LaBanca + + * utils/nslist/nslist.cpp: + + Added --count argument to override the default maximum number of + entries to retrieve per request to the NameService. The tao_ft_naming + server returns CORBA:NO_IMPLEMENT when the number of entries is greater + than the how_many argument and the tao_ft_naming server was started + the -u or -r flags. The tao_ft_naming server is not able to support the + iterator interface in redundant mode (-u or -r flags). + Tue Jan 22 22:52:17 UTC 2013 Quynh Nguyen * orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp: @@ -7,7 +18,7 @@ Tue Jan 22 22:52:17 UTC 2013 Quynh Nguyen * tao/Utils: Fix bug 479 caused by the Activator, which truncated a - server's command line string it is more than 1024 bytes. + server's command line string it is more than 1024 bytes. Tue Jan 22 19:37:57 UTC 2013 Phillip LaBanca diff --git a/TAO/utils/nslist/nslist.cpp b/TAO/utils/nslist/nslist.cpp index 6ac49370a10..d93bb4657b0 100644 --- a/TAO/utils/nslist/nslist.cpp +++ b/TAO/utils/nslist/nslist.cpp @@ -48,8 +48,13 @@ namespace ACE_Time_Value rtt = ACE_Time_Value::zero; // relative roundtrip timeout for ctx + const CORBA::ULong MAX_COUNT_DEFAULT = 100; + CORBA::ULong max_count = MAX_COUNT_DEFAULT; + void list_context (const CosNaming::NamingContext_ptr, - int level); + int level, + CORBA::ULong max_count); + CORBA::Object_ptr set_rtt(CORBA::Object_ptr obj); //========================================================================== @@ -271,7 +276,7 @@ namespace ACE_DEBUG ((LM_DEBUG, "\n")); if (xc.in ()) { - list_context (xc.in (), level + 1); + list_context (xc.in (), level + 1, max_count); } } else @@ -301,14 +306,15 @@ namespace //========================================================================== void - list_context (const CosNaming::NamingContext_ptr nc, int level) + list_context (const CosNaming::NamingContext_ptr nc, + int level, + CORBA::ULong max_count) { CosNaming::BindingIterator_var it; CosNaming::BindingList_var bl; - CORBA::ULong const CHUNK = 100; NestedNamingContexts::add (nc); - nc->list (CHUNK, bl, it); + nc->list (max_count, bl, it); show_chunk (nc, bl.in (), level); @@ -318,7 +324,7 @@ namespace do { - more = it->next_n (CHUNK, bl); + more = it->next_n (max_count, bl); show_chunk (nc, bl.in (), level); } while (more); @@ -567,14 +573,15 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) else if (1 != ACE_OS::strlen(*(++argv))) { ACE_DEBUG ((LM_DEBUG, - "Error: --kindsep takes a single character (not %s)\n", *argv)); + ACE_TEXT ("Error: --kindsep takes a single ") + ACE_TEXT ("character (not %s)\n"), *argv)); failed = true; } else if (showNSonly) { ACE_DEBUG ((LM_DEBUG, - "Error: --nsior and --kindsep are " - "both specified\n")); + ACE_TEXT ("Error: --nsior and --kindsep are ") + ACE_TEXT ("both specified\n"))); failed = true; } else @@ -591,14 +598,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) else if (!--argc || !ACE_OS::ace_isdigit (ACE_TEXT_ALWAYS_CHAR (*(++argv))[0])) { ACE_DEBUG ((LM_DEBUG, - "Error: --max requires a number\n")); + ACE_TEXT ("Error: --max requires a number\n"))); failed = true; } else if (showNSonly) { ACE_DEBUG ((LM_DEBUG, - "Error: --nsior and --max are " - "both specified\n")); + ACE_TEXT ("Error: --nsior and --max are ") + ACE_TEXT ("both specified\n"))); failed = true; } else @@ -609,22 +616,53 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) if (rtt != ACE_Time_Value::zero) { ACE_DEBUG ((LM_DEBUG, - "Error: --rtt given more than once\n")); + ACE_TEXT ("Error: --rtt given more than once\n"))); + failed = true; + } + else if (!--argc || !ACE_OS::ace_isdigit (ACE_TEXT_ALWAYS_CHAR (*(++argv))[0])) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Error: --rtt requires a number\n"))); + failed = true; + } + else + rtt.set (ACE_OS::atoi (*argv), 0); + } + else if (0 == ACE_OS::strcmp(*argv, ACE_TEXT ("--count"))) + { + if (max_count != MAX_COUNT_DEFAULT) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Error: --count given more than once\n"))); failed = true; } else if (!--argc || !ACE_OS::ace_isdigit (ACE_TEXT_ALWAYS_CHAR (*(++argv))[0])) { ACE_DEBUG ((LM_DEBUG, - "Error: --rtt requires a number\n")); + ACE_TEXT ("Error: --count requires a number\n"))); failed = true; } else - rtt.set(ACE_OS::atoi (*argv), 0); + { + CORBA::ULong count = ACE_OS::atoi (*argv); + if (count > 0) + { + max_count = count; + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Error: --count requires a number") + ACE_TEXT (" greater than 0\n"))); + failed = true; + } + } } else { ACE_DEBUG ((LM_DEBUG, - "Unknown option %s\n", *argv)); + ACE_TEXT ("Unknown option %s\n"), + *argv)); failed = true; } } @@ -632,20 +670,21 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) if (failed) { - ACE_DEBUG ((LM_DEBUG, "\n%s options:\n" - " --nsior {Display the naming service IOR and exit}\n" - "or:\n" - " --ns {Defaults to standard NameService}\n" - " --ior {Display ior for end points}\n" - " --ctxior {Display ior for naming contexts}\n" - " --tree \"xx\" {Defaults to | for drawing tramlines}\n" - " --node \"xx\" {Defaults to + for drawing nodes}\n" - " --noloops {Inhibit drawing of naming context loops}\n" - " --name {Lists sub-set, defaults to root}\n" - " --ctxsep { Context separation character, default /}\n" - " --kindsep { ID/Kind separation character, default .}\n" - " --max {If given, limits displayed sub-context depth}\n", - " --rtt {If given, sets the relative round trip timeout policy}\n", + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n%s options:\n") + ACE_TEXT (" --nsior {Display the naming service IOR and exit}\n") + ACE_TEXT ("or:\n") + ACE_TEXT (" --ns {Defaults to standard NameService}\n") + ACE_TEXT (" --ior {Display ior for end points}\n") + ACE_TEXT (" --ctxior {Display ior for naming contexts}\n") + ACE_TEXT (" --tree \"xx\" {Defaults to | for drawing tramlines}\n") + ACE_TEXT (" --node \"xx\" {Defaults to + for drawing nodes}\n") + ACE_TEXT (" --noloops {Inhibit drawing of naming context loops}\n") + ACE_TEXT (" --name {Lists sub-set, defaults to root}\n") + ACE_TEXT (" --ctxsep { Context separation character, default /}\n") + ACE_TEXT (" --kindsep { ID/Kind separation character, default .}\n") + ACE_TEXT (" --max {If given, limits displayed sub-context depth}\n") + ACE_TEXT (" --rtt {If given, sets the relative round trip timeout policy}\n") + ACE_TEXT (" --count {If given, sets the maximum number of entries per request from the NameService}\n"), pname)); orb->destroy (); return 1; @@ -718,7 +757,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "Naming Service: %C\n---------------\n", ((showCtxIOR)? str.in () : ""))); - list_context (root_nc.in (), 1); + list_context (root_nc.in (), 1, max_count); } } catch (const CORBA::Exception& ex) -- cgit v1.2.1