version 1.70, 2002/08/25 06:43:56
|
version 1.76, 2002/10/02 20:35:06
|
|
|
#include "CIMInstance.h" | #include "CIMInstance.h" |
#include "CIMObject.h" | #include "CIMObject.h" |
#include "CIMParamValue.h" | #include "CIMParamValue.h" |
|
#include "System.h" |
| |
//#define PEGASUS_SINT64_MIN (-PEGASUS_SINT64_LITERAL(9223372036854775808)) |
#define PEGASUS_SINT64_MIN (-PEGASUS_SINT64_LITERAL(0x8000000000000000)) |
//#define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL(18446744073709551615) |
#define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF) |
#define PEGASUS_SINT64_MIN (-PEGASUS_SINT64_LITERAL((Sint64) 0x8000000000000000)) |
|
#define PEGASUS_UINT64_MAX PEGASUS_UINT64_LITERAL((Uint64) 0xFFFFFFFFFFFFFFFF) |
|
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
String XmlReader::getCimNameAttribute( |
CIMName XmlReader::getCimNameAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName, | const char* elementName, |
|
|
} | } |
| |
if (acceptNull && name.size() == 0) | if (acceptNull && name.size() == 0) |
return name; |
return CIMName (); |
| |
if (!CIMName::legal(name)) | if (!CIMName::legal(name)) |
{ | { |
|
|
throw XmlSemanticError(lineNumber, buffer); | throw XmlSemanticError(lineNumber, buffer); |
} | } |
| |
return name; |
return CIMName (name); |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
if (!entry.getAttributeValue("CLASSORIGIN", name)) | if (!entry.getAttributeValue("CLASSORIGIN", name)) |
return CIMName(); | return CIMName(); |
| |
|
// KS 200209 This may be temp but we are adding test for form |
|
// CLASSNAME = "" for Wbemservices interoperability. Returns same |
|
// as if attribute did not exist. |
|
if (name.size() == 0) |
|
return CIMName(); |
|
|
if (!CIMName::legal(name)) | if (!CIMName::legal(name)) |
{ | { |
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
|
|
{ | { |
case CIMTYPE_BOOLEAN: | case CIMTYPE_BOOLEAN: |
{ | { |
if (CompareNoCase(valueString, "TRUE") == 0) |
if (System::strcasecmp(valueString, "TRUE") == 0) |
return CIMValue(true); | return CIMValue(true); |
else if (CompareNoCase(valueString, "FALSE") == 0) |
else if (System::strcasecmp(valueString, "FALSE") == 0) |
return CIMValue(false); | return CIMValue(false); |
else | else |
throw XmlSemanticError( | throw XmlSemanticError( |
|
|
| |
try | try |
{ | { |
|
// KS 20021002 - Exception if no datatime value. Test for |
|
// zero length and leave the NULL value in the variable |
|
// Bugzilla 137 Adds the following if line. |
|
#ifdef PEGASUS_SNIA_INTEROP_TEST |
|
if (strlen(valueString) != 0) |
|
#endif |
tmp.set(valueString); | tmp.set(valueString); |
} | } |
catch (InvalidDateTimeFormatException&) | catch (InvalidDateTimeFormatException&) |
{ | { |
|
cout << "KSTESTSNIA Invalid date time" << strlen(valueString) << "xx" << valueString << endl; |
throw XmlSemanticError(lineNumber, "Invalid datetime value"); | throw XmlSemanticError(lineNumber, "Invalid datetime value"); |
} | } |
| |
|
|
| |
// Get QUALIFIER.NAME attribute: | // Get QUALIFIER.NAME attribute: |
| |
String name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER"); |
CIMName name = getCimNameAttribute(parser.getLine(), entry, "QUALIFIER"); |
| |
// Get QUALIFIER.TYPE attribute: | // Get QUALIFIER.TYPE attribute: |
| |
|
|
| |
// Get PROPERTY.NAME attribute: | // Get PROPERTY.NAME attribute: |
| |
String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); |
CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); |
| |
// Get PROPERTY.CLASSORIGIN attribute: | // Get PROPERTY.CLASSORIGIN attribute: |
| |
|
|
| |
// Get PROPERTY.NAME attribute: | // Get PROPERTY.NAME attribute: |
| |
String name = |
CIMName name = |
getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY"); | getCimNameAttribute(parser.getLine(), entry, "PROPERTY.ARRAY"); |
| |
// Get PROPERTY.TYPE attribute: | // Get PROPERTY.TYPE attribute: |
|
|
| |
Boolean XmlReader::getNameSpaceElement( | Boolean XmlReader::getNameSpaceElement( |
XmlParser& parser, | XmlParser& parser, |
String& nameSpaceComponent) |
CIMName& nameSpaceComponent) |
{ | { |
XmlEntry entry; | XmlEntry entry; |
| |
|
|
if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH")) | if (!testStartTag(parser, entry, "LOCALNAMESPACEPATH")) |
return false; | return false; |
| |
String nameSpaceComponent; |
CIMName nameSpaceComponent; |
| |
while (getNameSpaceElement(parser, nameSpaceComponent)) | while (getNameSpaceElement(parser, nameSpaceComponent)) |
{ | { |
if (nameSpace.size()) | if (nameSpace.size()) |
nameSpace += '/'; |
nameSpace.append('/'); |
| |
nameSpace += nameSpaceComponent; |
nameSpace.append(nameSpaceComponent.getString()); |
} | } |
| |
if (!nameSpace.size()) | if (!nameSpace.size()) |
|
|
| |
Boolean XmlReader::getClassNameElement( | Boolean XmlReader::getClassNameElement( |
XmlParser& parser, | XmlParser& parser, |
String& className, |
CIMName& className, |
Boolean required) | Boolean required) |
{ | { |
XmlEntry entry; | XmlEntry entry; |
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
KeyBinding::Type XmlReader::getValueTypeAttribute( |
CIMKeyBinding::Type XmlReader::getValueTypeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName) | const char* elementName) |
|
|
String tmp; | String tmp; |
| |
if (!entry.getAttributeValue("VALUETYPE", tmp)) | if (!entry.getAttributeValue("VALUETYPE", tmp)) |
return KeyBinding::STRING; |
return CIMKeyBinding::STRING; |
| |
if (String::equal(tmp, "string")) | if (String::equal(tmp, "string")) |
return KeyBinding::STRING; |
return CIMKeyBinding::STRING; |
else if (String::equal(tmp, "boolean")) | else if (String::equal(tmp, "boolean")) |
return KeyBinding::BOOLEAN; |
return CIMKeyBinding::BOOLEAN; |
else if (String::equal(tmp, "numeric")) | else if (String::equal(tmp, "numeric")) |
return KeyBinding::NUMERIC; |
return CIMKeyBinding::NUMERIC; |
| |
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
| |
|
|
elementName); | elementName); |
| |
throw XmlSemanticError(lineNumber, buffer); | throw XmlSemanticError(lineNumber, buffer); |
return KeyBinding::BOOLEAN; |
return CIMKeyBinding::BOOLEAN; |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
| |
Boolean XmlReader::getKeyValueElement( | Boolean XmlReader::getKeyValueElement( |
XmlParser& parser, | XmlParser& parser, |
KeyBinding::Type& type, |
CIMKeyBinding::Type& type, |
String& value) | String& value) |
{ | { |
XmlEntry entry; | XmlEntry entry; |
|
|
| |
Boolean XmlReader::getKeyBindingElement( | Boolean XmlReader::getKeyBindingElement( |
XmlParser& parser, | XmlParser& parser, |
String& name, |
CIMName& name, |
String& value, | String& value, |
KeyBinding::Type& type) |
CIMKeyBinding::Type& type) |
{ | { |
XmlEntry entry; | XmlEntry entry; |
| |
|
|
"Expected KEYVALUE or VALUE.REFERENCE element"); | "Expected KEYVALUE or VALUE.REFERENCE element"); |
} | } |
| |
type = KeyBinding::REFERENCE; |
type = CIMKeyBinding::REFERENCE; |
value = reference.toString(); | value = reference.toString(); |
} | } |
| |
|
|
Boolean XmlReader::getInstanceNameElement( | Boolean XmlReader::getInstanceNameElement( |
XmlParser& parser, | XmlParser& parser, |
String& className, | String& className, |
Array<KeyBinding>& keyBindings) |
Array<CIMKeyBinding>& keyBindings) |
{ | { |
className.clear(); | className.clear(); |
keyBindings.clear(); | keyBindings.clear(); |
|
|
return true; | return true; |
} | } |
| |
String name; |
CIMName name; |
KeyBinding::Type type; |
CIMKeyBinding::Type type; |
String value; | String value; |
CIMObjectPath reference; | CIMObjectPath reference; |
| |
if (getKeyValueElement(parser, type, value)) | if (getKeyValueElement(parser, type, value)) |
{ | { |
// Use empty key name because none was specified | // Use empty key name because none was specified |
keyBindings.append(KeyBinding(name, value, type)); |
keyBindings.append(CIMKeyBinding(name, value, type)); |
} | } |
else if (getValueReferenceElement(parser, reference)) | else if (getValueReferenceElement(parser, reference)) |
{ | { |
// Use empty key name because none was specified | // Use empty key name because none was specified |
type = KeyBinding::REFERENCE; |
type = CIMKeyBinding::REFERENCE; |
value = reference.toString(); | value = reference.toString(); |
keyBindings.append(KeyBinding(name, value, type)); |
keyBindings.append(CIMKeyBinding(name, value, type)); |
} | } |
else | else |
{ | { |
while (getKeyBindingElement(parser, name, value, type)) | while (getKeyBindingElement(parser, name, value, type)) |
keyBindings.append(KeyBinding(name, value, type)); |
keyBindings.append(CIMKeyBinding(name, value, type)); |
} | } |
| |
expectEndTag(parser, "INSTANCENAME"); | expectEndTag(parser, "INSTANCENAME"); |
|
|
CIMObjectPath& instanceName) | CIMObjectPath& instanceName) |
{ | { |
String className; | String className; |
Array<KeyBinding> keyBindings; |
Array<CIMKeyBinding> keyBindings; |
| |
if (!XmlReader::getInstanceNameElement(parser, className, keyBindings)) | if (!XmlReader::getInstanceNameElement(parser, className, keyBindings)) |
return false; | return false; |
|
|
} | } |
| |
String className; | String className; |
Array<KeyBinding> keyBindings; |
Array<CIMKeyBinding> keyBindings; |
| |
if (!getInstanceNameElement(parser, className, keyBindings)) | if (!getInstanceNameElement(parser, className, keyBindings)) |
{ | { |
|
|
} | } |
| |
String className; | String className; |
Array<KeyBinding> keyBindings; |
Array<CIMKeyBinding> keyBindings; |
| |
if (!getInstanceNameElement(parser, className, keyBindings)) | if (!getInstanceNameElement(parser, className, keyBindings)) |
{ | { |
|
|
"expected NAMESPACEPATH element"); | "expected NAMESPACEPATH element"); |
} | } |
| |
String className; |
CIMName className; |
| |
if (!getClassNameElement(parser, className)) | if (!getClassNameElement(parser, className)) |
{ | { |
|
|
"expected LOCALNAMESPACEPATH element"); | "expected LOCALNAMESPACEPATH element"); |
} | } |
| |
String className; |
CIMName className; |
| |
if (!getClassNameElement(parser, className)) | if (!getClassNameElement(parser, className)) |
{ | { |
|
|
else if (strcmp(entry.text, "CLASSNAME") == 0) | else if (strcmp(entry.text, "CLASSNAME") == 0) |
{ | { |
parser.putBack(entry); | parser.putBack(entry); |
String className; |
CIMName className; |
getClassNameElement(parser, className); | getClassNameElement(parser, className); |
reference.set(String(), CIMNamespaceName(), className); | reference.set(String(), CIMNamespaceName(), className); |
} | } |
|
|
{ | { |
parser.putBack(entry); | parser.putBack(entry); |
String className; | String className; |
Array<KeyBinding> keyBindings; |
Array<CIMKeyBinding> keyBindings; |
getInstanceNameElement(parser, className, keyBindings); | getInstanceNameElement(parser, className, keyBindings); |
reference.set(String(), CIMNamespaceName(), className, keyBindings); | reference.set(String(), CIMNamespaceName(), className, keyBindings); |
} | } |
|
|
| |
// Get PROPERTY.NAME attribute: | // Get PROPERTY.NAME attribute: |
| |
String name = getCimNameAttribute( |
CIMName name = getCimNameAttribute( |
parser.getLine(), entry, "PROPERTY.REFERENCE"); | parser.getLine(), entry, "PROPERTY.REFERENCE"); |
| |
// Get PROPERTY.REFERENCECLASS attribute: | // Get PROPERTY.REFERENCECLASS attribute: |
|
|
| |
// Get PARAMETER.NAME attribute: | // Get PARAMETER.NAME attribute: |
| |
String name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER"); |
CIMName name = getCimNameAttribute(parser.getLine(), entry, "PARAMETER"); |
| |
// Get PARAMETER.TYPE attribute: | // Get PARAMETER.TYPE attribute: |
| |
|
|
| |
// Get PARAMETER.ARRAY.NAME attribute: | // Get PARAMETER.ARRAY.NAME attribute: |
| |
String name = getCimNameAttribute( |
CIMName name = getCimNameAttribute( |
parser.getLine(), entry, "PARAMETER.ARRAY"); | parser.getLine(), entry, "PARAMETER.ARRAY"); |
| |
// Get PARAMETER.ARRAY.TYPE attribute: | // Get PARAMETER.ARRAY.TYPE attribute: |
|
|
| |
// Get PARAMETER.NAME attribute: | // Get PARAMETER.NAME attribute: |
| |
String name = getCimNameAttribute( |
CIMName name = getCimNameAttribute( |
parser.getLine(), entry, "PARAMETER.REFERENCE"); | parser.getLine(), entry, "PARAMETER.REFERENCE"); |
| |
// Get PARAMETER.REFERENCECLASS attribute: | // Get PARAMETER.REFERENCECLASS attribute: |
|
|
| |
// Get PARAMETER.NAME attribute: | // Get PARAMETER.NAME attribute: |
| |
String name = getCimNameAttribute( |
CIMName name = getCimNameAttribute( |
parser.getLine(), entry, "PARAMETER.REFARRAY"); | parser.getLine(), entry, "PARAMETER.REFARRAY"); |
| |
// Get PARAMETER.REFERENCECLASS attribute: | // Get PARAMETER.REFERENCECLASS attribute: |
|
|
| |
// Get NAME attribute: | // Get NAME attribute: |
| |
String name = getCimNameAttribute( |
CIMName name = getCimNameAttribute( |
parser.getLine(), entry, "QUALIFIER.DECLARATION"); | parser.getLine(), entry, "QUALIFIER.DECLARATION"); |
| |
// Get TYPE attribute: | // Get TYPE attribute: |
|
|
| |
Boolean empty = entry.type == XmlEntry::EMPTY_TAG; | Boolean empty = entry.type == XmlEntry::EMPTY_TAG; |
| |
String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); |
CIMName name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); |
| |
CIMType type; | CIMType type; |
getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY"); | getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY"); |
|
|
if (!testStartTag(parser, entry, "CLASS")) | if (!testStartTag(parser, entry, "CLASS")) |
return false; | return false; |
| |
String name = getCimNameAttribute(parser.getLine(), entry, "CLASS"); |
CIMName name = getCimNameAttribute(parser.getLine(), entry, "CLASS"); |
| |
CIMName superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS"); | CIMName superClass = getSuperClassAttribute(parser.getLine(), entry,"CLASS"); |
| |
|
|
| |
expectContentOrCData(parser, entry); | expectContentOrCData(parser, entry); |
| |
if (CompareNoCase(entry.text, "TRUE") == 0) |
if (System::strcasecmp(entry.text, "TRUE") == 0) |
result = true; | result = true; |
else if (CompareNoCase(entry.text, "FALSE") == 0) |
else if (System::strcasecmp(entry.text, "FALSE") == 0) |
result = false; | result = false; |
else | else |
throw XmlSemanticError(parser.getLine(), | throw XmlSemanticError(parser.getLine(), |
|
|
XmlParser& parser, | XmlParser& parser, |
CIMObjectPath& objectName) | CIMObjectPath& objectName) |
{ | { |
String className; |
CIMName className; |
| |
if (getClassNameElement(parser, className, false)) | if (getClassNameElement(parser, className, false)) |
{ | { |