diff options
author | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-10-28 14:51:54 +0000 |
---|---|---|
committer | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-10-28 14:51:54 +0000 |
commit | 214f917f4f4e5f54b653a65b3a147bd99098413c (patch) | |
tree | 3a28cb3d1854617539f56c7927bb737042be5278 /TAO | |
parent | 1fcd34a27cf81981f0a1ed8ddf0b35e1e28cc952 (diff) | |
download | ATCD-214f917f4f4e5f54b653a65b3a147bd99098413c.tar.gz |
ChangeLogTag:Thu Oct 28 14:45:27 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 23 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader.cpp | 76 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader.h | 18 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader_Utils.cpp | 8 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/TT_Info.cpp | 10 |
7 files changed, 125 insertions, 22 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index b742002189e..be71aacab85 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,26 @@ +Thu Oct 28 14:45:27 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp: + * orbsvcs/orbsvcs/Trader/Trader.cpp: + * orbsvcs/orbsvcs/Trader/Trader.h: + * orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp: + * orbsvcs/orbsvcs/Trader/Trader_Utils.cpp: + + Thanks to patch from Bill Somerville <bill@classdesign.com> + which allows scoped names (::) for ServiceRepository. The change + does the following + + (1) Addition of a static function that checks for valid service + type names. + + (2) Addition of a static function that checks for link names + (this implementation internally calls is_valid_property_name + ()). + + * orbsvcs/tests/Trading/TT_Info.cpp: + + The test now checks for scoped names. + Thu Oct 28 07:39:15 2004 Chad Elliott <elliott_c@ociweb.com> * performance-tests/Latency/AMI/run_test.pl: diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp index cfd3f3e8139..d91740eb668 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp @@ -514,7 +514,7 @@ validate_properties (Prop_Map &prop_map, i++) { const char *n = props[i].name; - if (TAO_Trader_Base::is_valid_identifier_name (n) == 0) + if (TAO_Trader_Base::is_valid_property_name (n) == 0) ACE_THROW (CosTrading::IllegalPropertyName (n)); else { diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp index 54ce76db8d1..03998188899 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp @@ -5,8 +5,8 @@ #include "ace/Thread_Mutex.h" #include "ace/RW_Thread_Mutex.h" #include "ace/OS_NS_strings.h" -#include "ace/os_include/os_ctype.h" #include "ace/OS_NS_string.h" +#include "ace/OS_NS_ctype.h" // The following #include is needed only for the instantiation pragmas. #include "Trader_Interfaces.h" @@ -76,22 +76,22 @@ TAO_Trader_Base::trading_components (void) const } CORBA::Boolean -TAO_Trader_Base::is_valid_identifier_name (const char* ident) +TAO_Trader_Base::is_valid_property_name (const char* ident) { - int return_value = 0; + bool return_value = false; if (ident == 0) return return_value; size_t length = ACE_OS::strlen (ident); - if (length >= 1 && isalpha (ident[0])) + if (length >= 1 && ACE_OS::ace_isalpha (ident[0])) { - return_value = 1; + return_value = true; for (size_t i = 0; i < length; i++) { - if (! (isalnum (ident[i]) || ident[i] == '_')) + if (! (ACE_OS::ace_isalnum (ident[i]) || ident[i] == '_')) { - return_value = 0; + return_value = false; break; } } @@ -100,6 +100,68 @@ TAO_Trader_Base::is_valid_identifier_name (const char* ident) return return_value; } +CORBA::Boolean +TAO_Trader_Base::is_valid_identifier_name (const char* ident) +{ + static char const * const double_colon = "::"; + + if (ident == 0) + return 0; + + int return_value = 1; + + // Allow scoped identifiers + CORBA::Boolean done = 0; + char const * pos = + ACE_OS::strstr (ident, + double_colon); + + do + { + if ('_' == ident[0]) + { + // Treat escaped identifiers the same way as IDL + ++ident; + } + + size_t length = + pos ? pos - ident : ACE_OS::strlen (ident); + + if (length >= 1 && isalpha (ident[0])) + { + // First character must be alpha + for (size_t i = 0; i < length; ++i) + { + if (! (ACE_OS::ace_isalnum (ident[i]) + || ident[i] == '_')) + { + // Subsequent characters is not alpha, numeric, or '_' + return_value = 0; + break; + } + } + } + else + return_value = 0; + + if (pos) + { + // More identifiers + ident = pos + 2; + pos = ACE_OS::strstr (ident, double_colon); + } + else + { + // Last or only identifier + done = 1; + } + } + while (!done); + + return return_value; +} + + TAO_Support_Attributes_i:: TAO_Support_Attributes_i (TAO_Lockable &locker) : locker_ (locker), diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.h b/TAO/orbsvcs/orbsvcs/Trader/Trader.h index 1dabb8587b5..8028730474f 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.h @@ -435,9 +435,27 @@ public: * Determine whether the identifier is a valid one (i.e., if the * first character is a letter, and the subsequent ones letter, * numbers, or underscores.) + * + * IDL identifier scoping and escaping rules apply. */ static CORBA::Boolean is_valid_identifier_name (const char* ident); + /** + * Determine whether the identifier is a valid one (i.e., if the + * first character is a letter, and the subsequent ones letter, + * numbers, or underscores.) + */ + static CORBA::Boolean is_valid_property_name (const char* ident); + + /** + * Determine whether the link name is a valid one + * currently defined the same as property name. + */ + static CORBA::Boolean is_valid_link_name (const char* ident) + { + return is_valid_property_name (ident); + } + protected: // = Objects determining current configuration of a trader. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp index 8124dac618e..e2ce0a10940 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader_Interfaces.cpp @@ -1168,7 +1168,7 @@ resolve (const CosTrading::TraderName &name CosTrading::Register::RegisterNotSupported)) { // Determine if the first link is a legal link name. - if (! TAO_Trader_Base::is_valid_identifier_name (name[0])) + if (! TAO_Trader_Base::is_valid_link_name (name[0])) ACE_THROW_RETURN (CosTrading::Register::IllegalTraderName (name), CosTrading::Register::_nil ()); @@ -1680,7 +1680,7 @@ add_link (const char *name, CosTrading::Link::LimitingFollowTooPermissive)) { // Ensure the link name is valid. - if (! TAO_Trader_Base::is_valid_identifier_name (name)) + if (! TAO_Trader_Base::is_valid_link_name (name)) ACE_THROW (CosTrading::Link::IllegalLinkName (name)); // Ensure this isn't a duplicate link name. @@ -1730,7 +1730,7 @@ remove_link (const char *name CosTrading::Link::UnknownLinkName)) { // Ensure the link name is valid. - if (! TAO_Trader_Base::is_valid_identifier_name (name)) + if (! TAO_Trader_Base::is_valid_link_name (name)) ACE_THROW (CosTrading::Link::IllegalLinkName (name)); // Ensure this isn't a duplicate link name. @@ -1751,7 +1751,7 @@ TAO_Link<TRADER_LOCK_TYPE,MAP_LOCK_TYPE>::describe_link (const char *name CosTrading::Link::UnknownLinkName)) { // Ensure the link name is valid. - if (! TAO_Trader_Base::is_valid_identifier_name (name)) + if (! TAO_Trader_Base::is_valid_link_name (name)) ACE_THROW_RETURN (CosTrading::Link::IllegalLinkName (name), 0); // Ensure this isn't a duplicate link name. @@ -1820,7 +1820,7 @@ modify_link (const char *name, CosTrading::Link::LimitingFollowTooPermissive)) { // Ensure the link name is valid. - if (! TAO_Trader_Base::is_valid_identifier_name (name)) + if (! TAO_Trader_Base::is_valid_link_name (name)) ACE_THROW (CosTrading::Link::IllegalLinkName (name)); // Ensure this isn't a duplicate link name. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader_Utils.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trader_Utils.cpp index c7af45a8df1..e32d8f31182 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader_Utils.cpp @@ -339,7 +339,7 @@ TAO_Property_Evaluator_By_Name (const CosTrading::PropertySeq& properties { const CosTrading::Property& prop = this->props_[i]; - if (! TAO_Trader_Base::is_valid_identifier_name (prop.name)) + if (! TAO_Trader_Base::is_valid_property_name (prop.name)) ACE_THROW (CosTrading::IllegalPropertyName (prop.name)); TAO_String_Hash_Key prop_name = prop.name.in (); @@ -1103,7 +1103,7 @@ delete_properties (const CosTrading::PropertyNameSeq& deletes for (i = 0; i < length; i++) { const char* dname = ACE_static_cast (const char*, deletes[i]); - if (! TAO_Trader_Base::is_valid_identifier_name (dname)) + if (! TAO_Trader_Base::is_valid_property_name (dname)) ACE_THROW (CosTrading::IllegalPropertyName (dname)); else { @@ -1145,7 +1145,7 @@ merge_properties (const CosTrading::PropertySeq& modifies for (i = 0, length = modifies.length (); i < length; i++) { const char* mname = modifies[i].name; - if (TAO_Trader_Base::is_valid_identifier_name (mname)) + if (TAO_Trader_Base::is_valid_property_name (mname)) { TAO_String_Hash_Key prop_name (mname); if (this->readonly_.find (prop_name) == 0) @@ -1442,7 +1442,7 @@ TAO_Property_Filter (const SPECIFIED_PROPS& desired_props const char* pname = prop_seq[i]; // Check for errors or duplicates - if (TAO_Trader_Base::is_valid_identifier_name (pname)) + if (TAO_Trader_Base::is_valid_property_name (pname)) { TAO_String_Hash_Key prop_name (pname); if (this->props_.insert (prop_name) == 1) diff --git a/TAO/orbsvcs/tests/Trading/TT_Info.cpp b/TAO/orbsvcs/tests/Trading/TT_Info.cpp index dfd8d90740e..acf42e8b9bc 100644 --- a/TAO/orbsvcs/tests/Trading/TT_Info.cpp +++ b/TAO/orbsvcs/tests/Trading/TT_Info.cpp @@ -9,11 +9,11 @@ ACE_RCSID(Trading, TT_Info, "$Id$") const char* TT_Info::INTERFACE_NAMES[] = { - "Remote_IO", - "Plotter", - "Printer", - "File_System", - "PostScript_Printer" + "TAO_Trader_Test::Remote_IO", + "TAO_Trader_Test::Plotter", + "TAO_Trader_Test::Printer", + "TAO_Trader_Test::File_System", + "TAO_Trader_Test::PostScript_Printer" }; const char* TT_Info::REMOTE_IO_NAME = "Remote_IO"; |