version 1.22, 2002/09/20 19:40:11
|
version 1.26.10.1, 2003/08/13 19:39:50
|
|
|
{ | { |
Uint32 n = x.size(); | Uint32 n = x.size(); |
| |
|
// |
|
// If the key is a reference, the keys in the reference must also be |
|
// sorted |
|
// |
|
for (Uint32 k = 0; k < n ; k++) |
|
if (x[k].getType () == CIMKeyBinding::REFERENCE) |
|
{ |
|
CIMObjectPath tmp (x[k].getValue ()); |
|
Array <CIMKeyBinding> keyBindings = tmp.getKeyBindings (); |
|
_BubbleSort (keyBindings); |
|
tmp.setKeyBindings (keyBindings); |
|
x[k].setValue (tmp.toString ()); |
|
} |
|
|
if (n < 2) | if (n < 2) |
return; | return; |
| |
|
|
p += 2; | p += 2; |
| |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Validate the hostname. Hostnames must match the following |
// Validate the hostname. A domain is allowed after the hostname. |
// regular expression: "[A-Za-z][A-Za-z0-9-]*" |
// Eg. xyz.company.com |
|
// Hostnames must match the following regular expression: |
|
// ^([A-Za-z][A-Za-z0-9-]*)(\.[A-Za-z][A-Za-z0-9-]*)*$ |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
| |
char* q = p; | char* q = p; |
| |
|
Boolean foundDot = true; |
|
while (foundDot == true) |
|
{ |
|
foundDot = false; |
|
|
if (!isalpha(*q)) | if (!isalpha(*q)) |
throw MalformedObjectNameException(objectName); | throw MalformedObjectNameException(objectName); |
| |
q++; | q++; |
| |
while (isalnum(*q) || *q == '-') | while (isalnum(*q) || *q == '-') |
|
{ |
q++; | q++; |
|
} |
|
|
|
if (*q == '.') |
|
{ |
|
q++; |
|
foundDot = true; |
|
} |
|
} |
| |
// We now expect a port (or default the port). | // We now expect a port (or default the port). |
| |
|
|
return false; | return false; |
} | } |
| |
|
// A ':' as part of a keybinding value should not be interpreted as |
|
// a namespace delimiter. Since keybinding pairs follow the first '.' |
|
// in the object path string, the ':' delimiter only counts if it |
|
// appears before the '.'. |
|
|
|
char* dot = strchr(p, '.'); |
|
if (dot && (dot < colon)) |
|
{ |
|
return false; |
|
} |
|
|
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Validate the namespace path. Namespaces must match the following | // Validate the namespace path. Namespaces must match the following |
// regular expression: "[A-Za-z_]+(/[A-Za-z_]+)*" | // regular expression: "[A-Za-z_]+(/[A-Za-z_]+)*" |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
| |
String namespaceName = String(p, colon - p); |
String namespaceName = String(p, (Uint32)(colon - p)); |
if (!CIMNamespaceName::legal(namespaceName)) | if (!CIMNamespaceName::legal(namespaceName)) |
{ | { |
throw MalformedObjectNameException(objectName); | throw MalformedObjectNameException(objectName); |
|
|
| |
// Convert to a C String first: | // Convert to a C String first: |
| |
char* p = strdup(objectName.getCString()); |
CString pCString = objectName.getCStringUTF8(); |
Destroyer<char> destroyer(p); |
char* p = const_cast<char*>((const char*) pCString); |
Boolean gotHost; | Boolean gotHost; |
Boolean gotNamespace; | Boolean gotNamespace; |
| |
|
|
return; | return; |
} | } |
| |
String className = String(p, dot - p); |
String className = String(p, (Uint32)(dot - p)); |
if (!CIMName::legal(className)) | if (!CIMName::legal(className)) |
{ | { |
throw MalformedObjectNameException(objectName); | throw MalformedObjectNameException(objectName); |
|
|
// ATTN-RK-P2-20020510: Need to make hostname and namespace lower case? | // ATTN-RK-P2-20020510: Need to make hostname and namespace lower case? |
| |
String classNameLower = ref._rep->_className.getString (); | String classNameLower = ref._rep->_className.getString (); |
classNameLower.toLower(); |
classNameLower.toLower(); // ICU_TODO: |
ref._rep->_className = classNameLower; | ref._rep->_className = classNameLower; |
| |
for (Uint32 i = 0, n = ref._rep->_keyBindings.size(); i < n; i++) | for (Uint32 i = 0, n = ref._rep->_keyBindings.size(); i < n; i++) |