(file) Return to XmlReader.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/XmlReader.cpp between version 1.115.2.2 and 1.117

version 1.115.2.2, 2006/02/10 16:09:39 version 1.117, 2006/03/03 20:31:25
Line 1591 
Line 1591 
 //  Pegasus internal representation of an embedded object. However, this case is //  Pegasus internal representation of an embedded object. However, this case is
 //  used when decoding string representations of embedded objects. //  used when decoding string representations of embedded objects.
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     case CIMTYPE_INSTANCE:  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     {     {
         CIMObject x;         CIMObject x;
  
         if (*valueString == '\0')         if (*valueString == '\0')
         {         {
             x = CIMObject();              return CIMValue(CIMTYPE_OBJECT, false, 0);
         }         }
         else         else
         {         {
Line 1619 
Line 1616 
  
             if (XmlReader::getInstanceElement(tmp_parser, cimInstance))             if (XmlReader::getInstanceElement(tmp_parser, cimInstance))
             {             {
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                 if(type == CIMTYPE_INSTANCE)  
                   return CIMValue(cimInstance);  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                 x = CIMObject(cimInstance);                 x = CIMObject(cimInstance);
             }             }
             else if (XmlReader::getClassElement(tmp_parser, cimClass))             else if (XmlReader::getClassElement(tmp_parser, cimClass))
Line 1635 
Line 1628 
  
                 // throw XmlValidationError(parser.getLine(),                 // throw XmlValidationError(parser.getLine(),
                 //   "Expected INSTANCE or CLASS element");                 //   "Expected INSTANCE or CLASS element");
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
                 if(type == CIMTYPE_OBJECT)  
                 {  
                     MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",  
                         "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"  
  
                     throw XmlValidationError(lineNumber, mlParms);  
                 }  
                 else  
                 {  
                     MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_ELEMENT",  
                         "Expected INSTANCE element"); // change "element" to "embedded object"  
                     throw XmlValidationError(lineNumber, mlParms);  
                 }  
 #else  
                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",
                     "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"                     "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"
   
                 throw XmlValidationError(lineNumber, mlParms);                 throw XmlValidationError(lineNumber, mlParms);
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
             }             }
             // Ok, now we can delete the storage for the temporary XmlParser.             // Ok, now we can delete the storage for the temporary XmlParser.
             tmp_buffer.reset();             tmp_buffer.reset();
Line 1943 
Line 1923 
 //  used when decoding string representations of embedded objects. //  used when decoding string representations of embedded objects.
     case CIMTYPE_OBJECT:     case CIMTYPE_OBJECT:
             return StringArrayToValueAux(lineNumber, array, type, (CIMObject*)0);             return StringArrayToValueAux(lineNumber, array, type, (CIMObject*)0);
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     case CIMTYPE_INSTANCE:  
             return StringArrayToValueAux(lineNumber, array, type, (CIMInstance*)0);  
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
  
         default:         default:
             break;             break;
Line 2304 
Line 2280 
     {     {
         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);
     }     }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     String embeddedInstanceQualifierValue;  
     ix = property.findQualifier(CIMName("EmbeddedInstance"));  
     if (ix != PEG_NOT_FOUND)  
     {  
         property.getQualifier(ix).getValue().get(embeddedInstanceQualifierValue);  
     }  
 #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  
     Boolean isEmbeddedObject = String::equal(embeddedObject, "object") ||  
       embeddedObjectQualifierValue;  
     Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") ||  
       embeddedInstanceQualifierValue.size() > 0;  
     if (isEmbeddedObject || isEmbeddedInstance)  
     {  
         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string  
         if (type == CIMTYPE_STRING)  
         {  
             if(isEmbeddedObject)  
               type = CIMTYPE_OBJECT;  
             else  
               type = CIMTYPE_INSTANCE;  
             CIMValue new_value(type, false);  
             CIMProperty new_property = CIMProperty(name, new_value, 0, CIMName(), classOrigin, propagated);  
   
             // Copy the qualifiers from the String property to the CIMObject property.  
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)  
             {  
                 // All properties are copied, including the EmbeddedObject qualifier.  
                 // This way we don't have to keep track to know that the EmbeddedObject  
                 // qualifier needs to be added back during the encode step.  
                 new_property.addQualifier(property.getQualifier(ix));  
             }  
   
             value = new_value;  
             property = new_property;  
         }  
         else  
         {  
             // Error -- throw exception  
             // (the EmbeddedObject attribute may be applied only to entities that have the type String)  
   
             // l10n  
   
             // throw XmlValidationError(parser.getLine(),  
             //   "expected string type");  
   
             MessageLoaderParms mlParms("Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                              "The EMBEDDEDOBJECT attribute is only valid on string types.");  
   
             throw XmlValidationError(parser.getLine(), mlParms);  
         }  
     }  
 #else  
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)
     {     {
         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
Line 2399 
Line 2322 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // Continue on to get property value, if not empty.     // Continue on to get property value, if not empty.
     if (!empty)     if (!empty)
     {     {
Line 2536 
Line 2459 
     {     {
         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);         property.getQualifier(ix).getValue().get(embeddedObjectQualifierValue);
     }     }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     String embeddedInstanceQualifierValue;  
     ix = property.findQualifier(CIMName("EmbeddedInstance"));  
     if (ix != PEG_NOT_FOUND)  
     {  
         property.getQualifier(ix).getValue().get(embeddedInstanceQualifierValue);  
     }  
 #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  
     Boolean isEmbeddedObject = String::equal(embeddedObject, "object") ||  
       embeddedObjectQualifierValue;  
     Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance") ||  
       embeddedInstanceQualifierValue.size() > 0;  
     if (isEmbeddedObject || isEmbeddedInstance)  
     {  
         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string  
         if (type == CIMTYPE_STRING)  
         {  
             if(isEmbeddedObject)  
               type = CIMTYPE_OBJECT;  
             else  
               type = CIMTYPE_INSTANCE;  
             CIMValue new_value(type, true, arraySize);  
             CIMProperty new_property = CIMProperty(name, new_value, arraySize, CIMName(), classOrigin, propagated);  
   
             // Copy the qualifiers from the String property to the CIMObject property.  
             for (Uint32 ix = 0; ix < property.getQualifierCount(); ++ix)  
             {  
                 // All properties are copied, including the EmbeddedObject qualifier.  
                 // This way we don't have to keep track to know that the EmbeddedObject  
                 // qualifier needs to be added back during the encode step.  
                 new_property.addQualifier(property.getQualifier(ix));  
             }  
   
             value = new_value;  
             property = new_property;  
         }  
         else  
         {  
             // Error -- throw exception  
             // (the EmbeddedObject attribute may be applied only to entities that have the type String)  
   
             // l10n  
   
             // throw XmlValidationError(parser.getLine(),  
             //   "expected string type");  
   
             MessageLoaderParms mlParms("Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                              "The EMBEDDEDOBJECT attribute is only valid on string types.");  
   
             throw XmlValidationError(parser.getLine(), mlParms);  
         }  
     }  
 #else  
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)
     {     {
         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
Line 2631 
Line 2501 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
     // Continue on to get property array value, if not empty.     // Continue on to get property array value, if not empty.
     // Else not an embedded object, if not empty, get the property array value.     // Else not an embedded object, if not empty, get the property array value.
     if (!empty)     if (!empty)
Line 5102 
Line 4972 
             // 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  
             Boolean isEmbeddedObject = String::equal(embeddedObject, "object");  
             Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance");  
             if(isEmbeddedObject || isEmbeddedInstance)  
             {  
                 // The EMBEDDEDOBJECT attribute is only valid on Parameters of type string  
                 // The type must have been specified.  
                 if (gotType && (type == CIMTYPE_STRING))  
                 {  
                   if(isEmbeddedObject)  
                     effectiveType = CIMTYPE_OBJECT; // Used below by getValueElement() or getValueArrayElement()  
                   else  
                     effectiveType = CIMTYPE_INSTANCE;  
                 }  
                 else  
                 {  
                     // Error -- throw exception  
                     // (the EmbeddedObject attribute may be applied only to entities that have the type String)  
   
                     // l10n  
   
                     // throw XmlValidationError(parser.getLine(),  
                     //   "expected string type");  
   
                     MessageLoaderParms mlParms("Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                                      "The EMBEDDEDOBJECT attribute is only valid on string types.");  
   
                     throw XmlValidationError(parser.getLine(), mlParms);  
                 }  
             }  
 #else  
             if (String::equal(embeddedObject, "object"))             if (String::equal(embeddedObject, "object"))
             {             {
                 // The EMBEDDEDOBJECT attribute is only valid on Parameters of type string                 // The EMBEDDEDOBJECT attribute is only valid on Parameters of type string
Line 5158 
Line 4997 
                     throw XmlValidationError(parser.getLine(), mlParms);                     throw XmlValidationError(parser.getLine(), mlParms);
                 }                 }
             }             }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
  
             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&             if ( !XmlReader::getValueArrayElement(parser, effectiveType, value) &&
                  !XmlReader::getValueElement(parser, effectiveType, value) )                  !XmlReader::getValueElement(parser, effectiveType, value) )
Line 5244 
Line 5082 
             // If we don't know what type the value is, read it as a String             // If we don't know what type the value is, read it as a String
             type = CIMTYPE_STRING;             type = CIMTYPE_STRING;
         }         }
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         Boolean isEmbeddedObject = String::equal(embeddedObject, "object");  
         Boolean isEmbeddedInstance = String::equal(embeddedObject, "instance");  
         if(isEmbeddedObject || isEmbeddedInstance)  
         {  
             if (gotType && (type == CIMTYPE_STRING))  
             {  
                 if(isEmbeddedObject)  
                   type = CIMTYPE_OBJECT; // Used below by getValueElement() or getValueArrayElement()  
                 else  
                   type = CIMTYPE_INSTANCE;  
             }  
             else  
             {  
                 // Error -- throw exception  
                 // (the EmbeddedObject attribute may be applied only to entities that have the type String)  
   
                 // l10n  
   
                 // throw XmlValidationError(parser.getLine(),  
                 //   "expected string type");  
  
                 MessageLoaderParms mlParms("Common.XmlReader.INVALID_EMBEDDEDOBJECT_TYPE",  
                                  "The EMBEDDEDOBJECT attribute is only valid on string types.");  
   
                 throw XmlValidationError(parser.getLine(), mlParms);  
             }  
         }  
 #else  
         if (String::equal(embeddedObject, "object"))         if (String::equal(embeddedObject, "object"))
         {         {
             if (gotType && (type == CIMTYPE_STRING))             if (gotType && (type == CIMTYPE_STRING))
Line 5295 
Line 5105 
                 throw XmlValidationError(parser.getLine(), mlParms);                 throw XmlValidationError(parser.getLine(), mlParms);
             }             }
         }         }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         if ( !XmlReader::getValueElement(parser, type, returnValue) )         if ( !XmlReader::getValueElement(parser, type, returnValue) )
         {         {
  


Legend:
Removed from v.1.115.2.2  
changed lines
  Added in v.1.117

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2