version 1.66, 2002/08/20 17:39:37
|
version 1.67, 2002/08/21 00:15:44
|
|
|
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
| |
CIMType XmlReader::getCimTypeAttribute( |
Boolean XmlReader::getCimTypeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
|
CIMType& cimType, // Output parameter |
const char* tagName, | const char* tagName, |
const char* attributeName, | const char* attributeName, |
Boolean required) | Boolean required) |
|
|
} | } |
else | else |
{ | { |
return CIMTYPE_NONE; |
return false; |
} | } |
} | } |
| |
CIMType type = CIMTYPE_NONE; |
CIMType type = CIMTYPE_BOOLEAN; |
|
Boolean unrecognizedType = false; |
| |
if (strcmp(typeName, "boolean") == 0) | if (strcmp(typeName, "boolean") == 0) |
type = CIMTYPE_BOOLEAN; | type = CIMTYPE_BOOLEAN; |
|
|
type = CIMTYPE_REAL64; | type = CIMTYPE_REAL64; |
else if (strcmp(typeName, "reference") == 0) | else if (strcmp(typeName, "reference") == 0) |
type = CIMTYPE_REFERENCE; | type = CIMTYPE_REFERENCE; |
|
else unrecognizedType = true; |
| |
if ((type == CIMTYPE_NONE) || |
if (unrecognizedType || |
((type == CIMTYPE_REFERENCE) && | ((type == CIMTYPE_REFERENCE) && |
(strcmp(attributeName, "PARAMTYPE") != 0))) | (strcmp(attributeName, "PARAMTYPE") != 0))) |
{ | { |
|
|
throw XmlSemanticError(lineNumber, message); | throw XmlSemanticError(lineNumber, message); |
} | } |
| |
return type; |
cimType = type; |
|
return true; |
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
| |
// Get QUALIFIER.TYPE attribute: | // Get QUALIFIER.TYPE attribute: |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "QUALIFIER"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER"); |
| |
// Get QUALIFIER.PROPAGATED | // Get QUALIFIER.PROPAGATED |
| |
|
|
| |
// Get PROPERTY.TYPE attribute: | // Get PROPERTY.TYPE attribute: |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY"); |
| |
// Create property: Sets type and !isarray | // Create property: Sets type and !isarray |
| |
|
|
| |
// Get PROPERTY.TYPE attribute: | // Get PROPERTY.TYPE attribute: |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY.ARRAY"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY.ARRAY"); |
| |
// Get PROPERTY.ARRAYSIZE attribute: | // Get PROPERTY.ARRAYSIZE attribute: |
| |
|
|
| |
// Get PARAMETER.TYPE attribute: | // Get PARAMETER.TYPE attribute: |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER"); |
| |
// Create parameter: | // Create parameter: |
| |
|
|
| |
// Get PARAMETER.ARRAY.TYPE attribute: | // Get PARAMETER.ARRAY.TYPE attribute: |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PARAMETER.ARRAY"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "PARAMETER.ARRAY"); |
| |
// Get PARAMETER.ARRAYSIZE attribute: | // Get PARAMETER.ARRAYSIZE attribute: |
| |
|
|
| |
// Get TYPE attribute: | // Get TYPE attribute: |
| |
CIMType type = getCimTypeAttribute( |
CIMType type; |
parser.getLine(), entry, "QUALIFIER.DECLARATION"); |
getCimTypeAttribute(parser.getLine(), entry, type, "QUALIFIER.DECLARATION"); |
| |
// Get ISARRAY attribute: | // Get ISARRAY attribute: |
| |
|
|
| |
CIMScope scope = CIMScope (); | CIMScope scope = CIMScope (); |
CIMValue value; | CIMValue value; |
|
Boolean gotValue = false; |
| |
if (!empty) | if (!empty) |
{ | { |
|
|
"VALUE.ARRAY size is not the same as " | "VALUE.ARRAY size is not the same as " |
"ARRAYSIZE attribute"); | "ARRAYSIZE attribute"); |
} | } |
|
|
|
gotValue = true; |
} | } |
else if (getValueElement(parser, type, value)) | else if (getValueElement(parser, type, value)) |
{ | { |
|
|
throw XmlSemanticError(parser.getLine(), | throw XmlSemanticError(parser.getLine(), |
"ISARRAY attribute used but VALUE element encountered"); | "ISARRAY attribute used but VALUE element encountered"); |
} | } |
|
|
|
gotValue = true; |
} | } |
| |
// Now get the closing tag: | // Now get the closing tag: |
|
|
expectEndTag(parser, "QUALIFIER.DECLARATION"); | expectEndTag(parser, "QUALIFIER.DECLARATION"); |
} | } |
| |
if (value.getType() == CIMTYPE_NONE) |
if (!gotValue) |
{ | { |
if (isArray) | if (isArray) |
value.setNullValue(type, true, arraySize); | value.setNullValue(type, true, arraySize); |
|
|
| |
String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); | String name = getCimNameAttribute(parser.getLine(), entry, "PROPERTY"); |
| |
CIMType type = getCimTypeAttribute(parser.getLine(), entry, "PROPERTY"); |
CIMType type; |
|
getCimTypeAttribute(parser.getLine(), entry, type, "PROPERTY"); |
| |
CIMName classOrigin = | CIMName classOrigin = |
getClassOriginAttribute(parser.getLine(), entry, "PROPERTY"); | getClassOriginAttribute(parser.getLine(), entry, "PROPERTY"); |
|
|
| |
// Get PARAMVALUE.PARAMTYPE attribute: | // Get PARAMVALUE.PARAMTYPE attribute: |
| |
type = getCimTypeAttribute(parser.getLine(), entry, "PARAMVALUE", |
Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type, |
"PARAMTYPE", false); |
"PARAMVALUE", "PARAMTYPE", false); |
| |
if (!empty) | if (!empty) |
{ | { |
// Parse VALUE.REFERENCE and VALUE.REFARRAY type | // Parse VALUE.REFERENCE and VALUE.REFARRAY type |
if ( (type == CIMTYPE_REFERENCE) || (type == CIMTYPE_NONE) ) |
if ( (type == CIMTYPE_REFERENCE) || !gotType ) |
{ | { |
CIMObjectPath reference; | CIMObjectPath reference; |
if (XmlReader::getValueReferenceElement(parser, reference)) | if (XmlReader::getValueReferenceElement(parser, reference)) |
{ | { |
value.set(reference); | value.set(reference); |
type = CIMTYPE_REFERENCE; | type = CIMTYPE_REFERENCE; |
|
gotType = true; |
} | } |
else if (XmlReader::getValueReferenceArrayElement(parser, value)) | else if (XmlReader::getValueReferenceArrayElement(parser, value)) |
{ | { |
type = CIMTYPE_REFERENCE; | type = CIMTYPE_REFERENCE; |
|
gotType = true; |
} | } |
// If type==reference but no VALUE.REFERENCE found, use null value | // If type==reference but no VALUE.REFERENCE found, use null value |
} | } |
|
|
// Parse non-reference value | // Parse non-reference value |
if ( type != CIMTYPE_REFERENCE ) | if ( type != CIMTYPE_REFERENCE ) |
{ | { |
// If we don't know what type the value is, read it as a String |
CIMType effectiveType; |
CIMType effectiveType = type; |
if (!gotType) |
if ( effectiveType == CIMTYPE_NONE) |
|
{ | { |
|
// If we don't know what type the value is, read it as a String |
effectiveType = CIMTYPE_STRING; | effectiveType = CIMTYPE_STRING; |
} | } |
|
else |
|
{ |
|
effectiveType = type; |
|
} |
| |
if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) && | if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) && |
!XmlReader::getValueElement(parser, effectiveType, value) ) | !XmlReader::getValueElement(parser, effectiveType, value) ) |
|
|
expectEndTag(parser, "PARAMVALUE"); | expectEndTag(parser, "PARAMVALUE"); |
} | } |
| |
paramValue = CIMParamValue(name, value, Boolean(type!=CIMTYPE_NONE)); |
paramValue = CIMParamValue(name, value, gotType); |
| |
return true; | return true; |
} | } |
|
|
// Get RETURNVALUE.PARAMTYPE attribute: | // Get RETURNVALUE.PARAMTYPE attribute: |
// NOTE: Array type return values are not allowed (2/20/02) | // NOTE: Array type return values are not allowed (2/20/02) |
| |
type = getCimTypeAttribute(parser.getLine(), entry, "RETURNVALUE", |
Boolean gotType = getCimTypeAttribute(parser.getLine(), entry, type, |
"PARAMTYPE", false); |
"RETURNVALUE", "PARAMTYPE", false); |
| |
// Parse VALUE.REFERENCE type | // Parse VALUE.REFERENCE type |
if ( (type == CIMTYPE_REFERENCE) || (type == CIMTYPE_NONE) ) |
if ( (type == CIMTYPE_REFERENCE) || !gotType ) |
{ | { |
CIMObjectPath reference; | CIMObjectPath reference; |
if (XmlReader::getValueReferenceElement(parser, reference)) | if (XmlReader::getValueReferenceElement(parser, reference)) |
{ | { |
returnValue.set(reference); | returnValue.set(reference); |
type = CIMTYPE_REFERENCE; | type = CIMTYPE_REFERENCE; |
|
gotType = true; |
} | } |
else if (type == CIMTYPE_REFERENCE) | else if (type == CIMTYPE_REFERENCE) |
{ | { |
|
|
// Parse non-reference return value | // Parse non-reference return value |
if ( type != CIMTYPE_REFERENCE ) | if ( type != CIMTYPE_REFERENCE ) |
{ | { |
// If we don't know what type the value is, read it as a String |
if (!gotType) |
if ( type == CIMTYPE_NONE) |
|
{ | { |
|
// If we don't know what type the value is, read it as a String |
type = CIMTYPE_STRING; | type = CIMTYPE_STRING; |
} | } |
| |