version 1.127.4.1, 2007/11/13 18:53:24
|
version 1.129.12.3, 2009/03/17 13:59:13
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/Constants.h> |
#include <errno.h> | #include <errno.h> |
#include <cctype> | #include <cctype> |
#include <cstdio> | #include <cstdio> |
|
|
if (!entry.getAttributeValue("CLASSORIGIN", name)) | if (!entry.getAttributeValue("CLASSORIGIN", name)) |
return CIMName(); | return CIMName(); |
| |
|
/* Interoperability hack to make the C++ client of OpenPegasus able |
|
to deal with the wbemservices CIMOM delivered with Sun Solaris. |
|
The issue is that the wbemservices delivers Xml responses with |
|
CLASSORIGIN="" |
|
Originally this had been reported with Bug#537. |
|
*/ |
|
if (name.size()==0) |
|
{ |
|
return CIMName(); |
|
} |
|
|
if (!CIMName::legal(name)) | if (!CIMName::legal(name)) |
{ | { |
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
|
|
buffer); | buffer); |
throw XmlSemanticError(lineNumber, mlParms); | throw XmlSemanticError(lineNumber, mlParms); |
} | } |
|
// The CIMName was already checked with legal() + String() |
return name; |
return CIMNameUnchecked(name); |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// getEmbeddedObjectAttribute() | // getEmbeddedObjectAttribute() |
// | // |
// <!ENTITY % EmbeddedObject "EMBEDDEDOBJECT (object | instance) #IMPLIED"> |
// <!ENTITY % EmbeddedObject "EmbeddedObject (object | instance) #IMPLIED"> |
|
// |
|
// EmbeddedObjectAttributeType: |
|
// NO_EMBEDDED_OBJECT = 0, |
|
// EMBEDDED_OBJECT_ATTR = 1, |
|
// EMBEDDED_INSTANCE_ATTR = 2 |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
String XmlReader::getEmbeddedObjectAttribute( |
XmlReader::EmbeddedObjectAttributeType XmlReader::getEmbeddedObjectAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName) |
const char* tagName) |
{ | { |
String embeddedObject; |
const char* embeddedObject; |
| |
if (!entry.getAttributeValue("EMBEDDEDOBJECT", embeddedObject)) |
// Check for both upper case and mixed case "EmbeddedObject" |
return String(); |
// because of an error in an earlier pegasus version where we |
|
// used upper case in the generation of the attribute name |
|
// whereas the DMTF spec calls for mixed case. |
|
if (!entry.getAttributeValue("EmbeddedObject", embeddedObject) && |
|
!entry.getAttributeValue("EMBEDDEDOBJECT", embeddedObject)) |
|
return NO_EMBEDDED_OBJECT; |
| |
// The embeddedObject attribute, if present, must have the string | // The embeddedObject attribute, if present, must have the string |
// value "object" or "instance". | // value "object" or "instance". |
if (!(String::equal(embeddedObject, "object") || |
if (strcmp(embeddedObject, "object") == 0) |
String::equal(embeddedObject, "instance"))) |
{ |
|
return EMBEDDED_OBJECT_ATTR; |
|
} |
|
|
|
if (strcmp(embeddedObject, "instance") == 0) |
{ | { |
|
return EMBEDDED_INSTANCE_ATTR; |
|
} |
|
|
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
sprintf(buffer, "%s.EMBEDDEDOBJECT", elementName); |
sprintf(buffer, "%s.EmbeddedObject", tagName); |
| |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.ILLEGAL_VALUE_FOR_ATTRIBUTE", | "Common.XmlReader.ILLEGAL_VALUE_FOR_ATTRIBUTE", |
"Illegal value for $0 attribute", | "Illegal value for $0 attribute", |
buffer); | buffer); |
throw XmlSemanticError(lineNumber, mlParms); | throw XmlSemanticError(lineNumber, mlParms); |
} |
|
| |
return embeddedObject; |
return NO_EMBEDDED_OBJECT; |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
buffer); | buffer); |
throw XmlSemanticError(lineNumber, mlParms); | throw XmlSemanticError(lineNumber, mlParms); |
} | } |
|
// The CIMName was already checked with legal() + String() |
return name; |
return CIMNameUnchecked(name); |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
buffer); | buffer); |
throw XmlSemanticError(lineNumber, mlParms); | throw XmlSemanticError(lineNumber, mlParms); |
} | } |
|
// The CIMName was already checked with legal() + String() |
return superClass; |
return CIMNameUnchecked(superClass); |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
const char* valueString, | const char* valueString, |
CIMType type) | CIMType type) |
{ | { |
|
return stringToValue(lineNumber, valueString, strlen(valueString), type); |
|
} |
|
|
|
CIMValue XmlReader::stringToValue( |
|
Uint32 lineNumber, |
|
const char* valueString, |
|
Uint32 valueStringLen, |
|
CIMType type) |
|
{ |
// ATTN-B: accepting only UTF-8 for now! (affects string and char16): | // ATTN-B: accepting only UTF-8 for now! (affects string and char16): |
| |
|
// Char string must have been null terminated. |
|
PEGASUS_ASSERT (!valueString[valueStringLen]); |
|
|
// Create value per type | // Create value per type |
switch (type) | switch (type) |
{ | { |
|
|
| |
case CIMTYPE_STRING: | case CIMTYPE_STRING: |
{ | { |
return CIMValue(String(valueString)); |
return CIMValue(String(valueString, valueStringLen)); |
} | } |
| |
case CIMTYPE_CHAR16: | case CIMTYPE_CHAR16: |
{ | { |
// Converts UTF-8 to UTF-16 | // Converts UTF-8 to UTF-16 |
String tmp(valueString); |
String tmp(valueString, valueStringLen); |
if (tmp.size() != 1) | if (tmp.size() != 1) |
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
|
|
// Bugzilla 137 Adds the following if line. | // Bugzilla 137 Adds the following if line. |
// Expect this to become permanent but test only for now | // Expect this to become permanent but test only for now |
#ifdef PEGASUS_SNIA_INTEROP_TEST | #ifdef PEGASUS_SNIA_INTEROP_TEST |
if (strlen(valueString) != 0) |
if (valueStringLen != 0) |
#endif | #endif |
tmp.set(valueString); | tmp.set(valueString); |
} | } |
|
|
// just the value of the Embedded Object in String | // just the value of the Embedded Object in String |
// representation. | // representation. |
AutoArrayPtr<char> tmp_buffer( | AutoArrayPtr<char> tmp_buffer( |
new char[strlen(valueString) + 1]); |
new char[valueStringLen + 1]); |
strcpy(tmp_buffer.get(), valueString); |
memcpy(tmp_buffer.get(), valueString, valueStringLen + 1); |
XmlParser tmp_parser(tmp_buffer.get()); | XmlParser tmp_parser(tmp_buffer.get()); |
| |
// The next bit of logic constructs a CIMObject from the | // The next bit of logic constructs a CIMObject from the |
|
|
Boolean empty = entry.type == XmlEntry::EMPTY_TAG; | Boolean empty = entry.type == XmlEntry::EMPTY_TAG; |
| |
const char* valueString = ""; | const char* valueString = ""; |
|
Uint32 valueStringLen = 0; |
if (!empty) | if (!empty) |
{ | { |
if (testContentOrCData(parser, entry)) | if (testContentOrCData(parser, entry)) |
{ | { |
valueString = entry.text; | valueString = entry.text; |
|
valueStringLen = entry.textLen; |
} | } |
| |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
|
|
// Bugzilla tbd | // Bugzilla tbd |
if (!empty) | if (!empty) |
#endif | #endif |
value = stringToValue(parser.getLine(), valueString,type); |
value = stringToValue( |
|
parser.getLine(), |
|
valueString, |
|
valueStringLen, |
|
type); |
| |
return true; | return true; |
} | } |
|
|
Boolean empty = entry.type == XmlEntry::EMPTY_TAG; | Boolean empty = entry.type == XmlEntry::EMPTY_TAG; |
| |
const char* valueString = ""; | const char* valueString = ""; |
|
Uint32 valueStringLen = 0; |
| |
if (!empty) | if (!empty) |
{ | { |
if (testContentOrCData(parser, entry)) | if (testContentOrCData(parser, entry)) |
|
{ |
valueString = entry.text; | valueString = entry.text; |
|
valueStringLen = entry.textLen; |
|
} |
| |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
} | } |
| |
str = String(valueString); |
str = String(valueString, valueStringLen); |
return true; | return true; |
} | } |
| |
|
|
template<class T> | template<class T> |
CIMValue StringArrayToValueAux( | CIMValue StringArrayToValueAux( |
Uint32 lineNumber, | Uint32 lineNumber, |
const Array<const char*>& stringArray, |
const Array<CharString>& stringArray, |
CIMType type, | CIMType type, |
T*) | T*) |
{ | { |
|
|
for (Uint32 i = 0, n = stringArray.size(); i < n; i++) | for (Uint32 i = 0, n = stringArray.size(); i < n; i++) |
{ | { |
CIMValue value = XmlReader::stringToValue( | CIMValue value = XmlReader::stringToValue( |
lineNumber, stringArray[i], type); |
lineNumber, |
|
stringArray[i].value, |
|
stringArray[i].length, |
|
type); |
| |
T x; | T x; |
value.get(x); | value.get(x); |
|
|
const Array<const char*>& array, | const Array<const char*>& array, |
CIMType type) | CIMType type) |
{ | { |
|
Array<CharString> strArray; |
|
|
|
for (Uint32 i = 0, n = array.size() ; i < n ; ++i) |
|
{ |
|
strArray.append(CharString(array[i], strlen(array[i]))); |
|
} |
|
|
|
return _stringArrayToValue(lineNumber, strArray, type); |
|
} |
|
|
|
CIMValue XmlReader::_stringArrayToValue( |
|
Uint32 lineNumber, |
|
const Array<CharString> &array, |
|
CIMType type) |
|
{ |
switch (type) | switch (type) |
{ | { |
case CIMTYPE_BOOLEAN: | case CIMTYPE_BOOLEAN: |
|
|
// Get VALUE.ARRAY open tag: | // Get VALUE.ARRAY open tag: |
| |
XmlEntry entry; | XmlEntry entry; |
Array<const char*> stringArray; |
Array<CharString> stringArray; |
| |
// If no VALUE.ARRAY start tag, return false | // If no VALUE.ARRAY start tag, return false |
if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY")) | if (!testStartTagOrEmptyTag(parser, entry, "VALUE.ARRAY")) |
|
|
| |
while (testStartTagOrEmptyTag(parser, entry, "VALUE")) | while (testStartTagOrEmptyTag(parser, entry, "VALUE")) |
{ | { |
|
// ATTN: NULL values in array will have VALUE.NULL subelement |
|
// See DSP0201 Version 2.3.0, Section 5.2.3.2 |
if (entry.type == XmlEntry::EMPTY_TAG) | if (entry.type == XmlEntry::EMPTY_TAG) |
{ | { |
stringArray.append(""); |
stringArray.append(CharString("", 0)); |
continue; | continue; |
} | } |
| |
if (testContentOrCData(parser, entry)) | if (testContentOrCData(parser, entry)) |
stringArray.append(entry.text); |
{ |
|
stringArray.append(CharString(entry.text, entry.textLen)); |
|
} |
else | else |
stringArray.append(""); |
{ |
|
stringArray.append(CharString("", 0)); |
|
} |
expectEndTag(parser, "VALUE"); | expectEndTag(parser, "VALUE"); |
} | } |
| |
expectEndTag(parser, "VALUE.ARRAY"); | expectEndTag(parser, "VALUE.ARRAY"); |
} | } |
| |
value = stringArrayToValue(parser.getLine(), stringArray, type); |
value = _stringArrayToValue(parser.getLine(), stringArray, type); |
return true; | return true; |
} | } |
| |
|
|
Boolean propagated = getCimBooleanAttribute( | Boolean propagated = getCimBooleanAttribute( |
parser.getLine(), entry, "PROPERTY", "PROPAGATED", false, false); | parser.getLine(), entry, "PROPERTY", "PROPAGATED", false, false); |
| |
// Get PROPERTY.EMBEDDEDOBJECT attribute: |
// Get PROPERTY.EmbeddedObject attribute: |
| |
String embeddedObject = getEmbeddedObjectAttribute( |
EmbeddedObjectAttributeType embeddedObject = |
parser.getLine(), entry, "PROPERTY"); |
getEmbeddedObjectAttribute(parser.getLine(), entry, "PROPERTY"); |
| |
// Get PROPERTY.TYPE attribute: | // Get PROPERTY.TYPE attribute: |
| |
|
|
} | } |
| |
Boolean embeddedObjectQualifierValue = false; | Boolean embeddedObjectQualifierValue = false; |
Uint32 ix = property.findQualifier(CIMName("EmbeddedObject")); |
Uint32 ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT); |
if (ix != PEG_NOT_FOUND) | if (ix != PEG_NOT_FOUND) |
{ | { |
property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue); | property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue); |
} | } |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
String embeddedInstanceQualifierValue; | String embeddedInstanceQualifierValue; |
ix = property.findQualifier(CIMName("EmbeddedInstance")); |
ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE); |
if (ix != PEG_NOT_FOUND) | if (ix != PEG_NOT_FOUND) |
{ | { |
property.getQualifier(ix).getValue().get( | property.getQualifier(ix).getValue().get( |
embeddedInstanceQualifierValue); | embeddedInstanceQualifierValue); |
} | } |
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
// If the EMBEDDEDOBJECT attribute is present with value "object" |
// If the EmbeddedObject attribute is present with value "object" |
// or the EmbeddedObject qualifier exists on this property with value "true" | // or the EmbeddedObject qualifier exists on this property with value "true" |
// then |
// then convert the EmbeddedObject-encoded string into a CIMObject |
// Convert the EmbeddedObject-encoded string into a CIMObject |
|
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
Boolean isEmbeddedObject = String::equal(embeddedObject, "object") || |
Boolean isEmbeddedObject = (embeddedObject == EMBEDDED_OBJECT_ATTR) || |
embeddedObjectQualifierValue; | embeddedObjectQualifierValue; |
Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") || |
Boolean isEmbeddedInstance = (embeddedObject == EMBEDDED_INSTANCE_ATTR) || |
embeddedInstanceQualifierValue.size() > 0; | embeddedInstanceQualifierValue.size() > 0; |
if (isEmbeddedObject || isEmbeddedInstance) | if (isEmbeddedObject || isEmbeddedInstance) |
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Properties of type |
// The EmbeddedObject attribute is only valid on Properties of type |
// string | // string |
if (type == CIMTYPE_STRING) | if (type == CIMTYPE_STRING) |
{ | { |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string types."); |
"The EmbeddedObject attribute is only valid on string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
#else | #else |
if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue) |
if ((embeddedObject == EMBEDDED_OBJECT_ATTR)|| embeddedObjectQualifierValue) |
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Properties of type |
// The EmbeddedObject attribute is only valid on Properties of type |
// string | // string |
if (type == CIMTYPE_STRING) | if (type == CIMTYPE_STRING) |
{ | { |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string types."); |
"The EmbeddedObject attribute is only valid on string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
|
|
false, | false, |
false); | false); |
| |
// Get PROPERTY.EMBEDDEDOBJECT attribute: |
// Get PROPERTY.EmbeddedObject attribute: |
| |
String embeddedObject = getEmbeddedObjectAttribute( |
EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute( |
parser.getLine(), entry, "PROPERTY.ARRAY"); | parser.getLine(), entry, "PROPERTY.ARRAY"); |
| |
// Create property: | // Create property: |
|
|
} | } |
| |
Boolean embeddedObjectQualifierValue = false; | Boolean embeddedObjectQualifierValue = false; |
Uint32 ix = property.findQualifier(CIMName("EmbeddedObject")); |
Uint32 ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT); |
if (ix != PEG_NOT_FOUND) | if (ix != PEG_NOT_FOUND) |
{ | { |
property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue); | property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue); |
} | } |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
String embeddedInstanceQualifierValue; | String embeddedInstanceQualifierValue; |
ix = property.findQualifier(CIMName("EmbeddedInstance")); |
ix = property.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE); |
if (ix != PEG_NOT_FOUND) | if (ix != PEG_NOT_FOUND) |
{ | { |
property.getQualifier(ix).getValue().get( | property.getQualifier(ix).getValue().get( |
embeddedInstanceQualifierValue); | embeddedInstanceQualifierValue); |
} | } |
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
// If the EMBEDDEDOBJECT attribute is present with value "object" |
// If the EmbeddedObject attribute is present with value "object" |
// or the EmbeddedObject qualifier exists on this property with value "true" | // or the EmbeddedObject qualifier exists on this property with value "true" |
// then | // then |
// Convert the EmbeddedObject-encoded string into a CIMObject | // Convert the EmbeddedObject-encoded string into a CIMObject |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
Boolean isEmbeddedObject = String::equal(embeddedObject, "object") || |
Boolean isEmbeddedObject = (embeddedObject == EMBEDDED_OBJECT_ATTR) || |
embeddedObjectQualifierValue; | embeddedObjectQualifierValue; |
Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") || |
Boolean isEmbeddedInstance = (embeddedObject == EMBEDDED_INSTANCE_ATTR) || |
embeddedInstanceQualifierValue.size() > 0; | embeddedInstanceQualifierValue.size() > 0; |
if (isEmbeddedObject || isEmbeddedInstance) | if (isEmbeddedObject || isEmbeddedInstance) |
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Properties of type |
// The EmbeddedObject attribute is only valid on Properties of type |
// string | // string |
if (type == CIMTYPE_STRING) | if (type == CIMTYPE_STRING) |
{ | { |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string types."); |
"The EmbeddedObject attribute is only valid on string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
#else | #else |
if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue) |
if ((embeddedObject == EMBEDDED_OBJECT_ATTR)||embeddedObjectQualifierValue) |
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Properties of type |
// The EmbeddedObject attribute is only valid on Properties of type |
// string | // string |
if (type == CIMTYPE_STRING) | if (type == CIMTYPE_STRING) |
{ | { |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string types."); |
"The EmbeddedObject attribute is only valid on string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
|
|
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName) | const char* elementName) |
{ | { |
String tmp; |
const char* tmp; |
| |
if (!entry.getAttributeValue("VALUETYPE", tmp)) | if (!entry.getAttributeValue("VALUETYPE", tmp)) |
return CIMKeyBinding::STRING; | return CIMKeyBinding::STRING; |
| |
if (String::equal(tmp, "string")) |
if (strcmp(tmp, "string") == 0) |
return CIMKeyBinding::STRING; | return CIMKeyBinding::STRING; |
else if (String::equal(tmp, "boolean")) |
else if (strcmp(tmp, "boolean") == 0) |
return CIMKeyBinding::BOOLEAN; | return CIMKeyBinding::BOOLEAN; |
else if (String::equal(tmp, "numeric")) |
else if (strcmp(tmp, "numeric") == 0) |
return CIMKeyBinding::NUMERIC; | return CIMKeyBinding::NUMERIC; |
| |
char buffer[MESSAGE_SIZE]; | char buffer[MESSAGE_SIZE]; |
|
|
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
| |
// Get PROPERTY.EMBEDDEDOBJECT |
// Get PROPERTY.EmbeddedObject |
| |
String embeddedObject = getEmbeddedObjectAttribute( |
EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute( |
parser.getLine(), entry, "PARAMVALUE"); | parser.getLine(), entry, "PARAMVALUE"); |
| |
// Get PARAMVALUE.PARAMTYPE attribute: | // Get PARAMVALUE.PARAMTYPE attribute: |
|
|
effectiveType = type; | effectiveType = type; |
} | } |
| |
// If the EMBEDDEDOBJECT attribute is present with value "object" |
// If the EmbeddedObject attribute is present with value "object" |
// then | // then |
// Convert the EmbeddedObject-encoded string into a CIMObject | // Convert the EmbeddedObject-encoded string into a CIMObject |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
Boolean isEmbeddedObject = String::equal(embeddedObject, "object"); |
if (embeddedObject != NO_EMBEDDED_OBJECT) |
Boolean isEmbeddedInstance = |
|
String::equal(embeddedObject, "instance"); |
|
if (isEmbeddedObject || isEmbeddedInstance) |
|
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Parameters |
// The EmbeddedObject attribute is only valid on Parameters |
// of type string | // of type string |
// The type must have been specified. | // The type must have been specified. |
if (gotType && (type == CIMTYPE_STRING)) | if (gotType && (type == CIMTYPE_STRING)) |
{ | { |
if (isEmbeddedObject) |
if (embeddedObject == EMBEDDED_OBJECT_ATTR) |
// Used below by getValueElement() or | // Used below by getValueElement() or |
// getValueArrayElement() | // getValueArrayElement() |
effectiveType = CIMTYPE_OBJECT; | effectiveType = CIMTYPE_OBJECT; |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on " |
"The EmbeddedObject attribute is only valid on " |
"string types."); | "string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
#else | #else |
if (String::equal(embeddedObject, "object")) |
if (embeddedObject == EMBEDDED_OBJECT_ATTR) |
{ | { |
// The EMBEDDEDOBJECT attribute is only valid on Parameters |
// The EmbeddedObject attribute is only valid on Parameters |
// of type string | // of type string |
// The type must have been specified. | // The type must have been specified. |
if (gotType && (type == CIMTYPE_STRING)) | if (gotType && (type == CIMTYPE_STRING)) |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on " |
"The EmbeddedObject attribute is only valid on " |
"string types."); | "string types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
|
|
if (!testStartTag(parser, entry, "RETURNVALUE")) | if (!testStartTag(parser, entry, "RETURNVALUE")) |
return false; | return false; |
| |
// Get PROPERTY.EMBEDDEDOBJECT |
// Get PROPERTY.EmbeddedObject |
| |
String embeddedObject = getEmbeddedObjectAttribute( |
EmbeddedObjectAttributeType embeddedObject = getEmbeddedObjectAttribute( |
parser.getLine(), entry, "RETURNVALUE"); | parser.getLine(), entry, "RETURNVALUE"); |
| |
// Get RETURNVALUE.PARAMTYPE attribute: | // Get RETURNVALUE.PARAMTYPE attribute: |
|
|
type = CIMTYPE_STRING; | type = CIMTYPE_STRING; |
} | } |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT | #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
Boolean isEmbeddedObject = String::equal(embeddedObject, "object"); |
if (embeddedObject != NO_EMBEDDED_OBJECT) |
Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance"); |
|
if (isEmbeddedObject || isEmbeddedInstance) |
|
{ | { |
if (gotType && (type == CIMTYPE_STRING)) | if (gotType && (type == CIMTYPE_STRING)) |
{ | { |
if (isEmbeddedObject) |
if (embeddedObject == EMBEDDED_OBJECT_ATTR) |
// Used below by getValueElement() or getValueArrayElement() | // Used below by getValueElement() or getValueArrayElement() |
type = CIMTYPE_OBJECT; | type = CIMTYPE_OBJECT; |
else | else |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string " |
"The EmbeddedObject attribute is only valid on string " |
"types."); | "types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |
} | } |
#else | #else |
if (String::equal(embeddedObject, "object")) |
if (embeddedObject == EMBEDDED_OBJECT_ATTR) |
{ | { |
if (gotType && (type == CIMTYPE_STRING)) | if (gotType && (type == CIMTYPE_STRING)) |
{ | { |
|
|
{ | { |
MessageLoaderParms mlParms( | MessageLoaderParms mlParms( |
"Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", | "Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE", |
"The EMBEDDEDOBJECT attribute is only valid on string " |
"The EmbeddedObject attribute is only valid on string " |
"types."); | "types."); |
throw XmlValidationError(parser.getLine(), mlParms); | throw XmlValidationError(parser.getLine(), mlParms); |
} | } |