(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 and 1.115.2.3

version 1.115, 2005/11/10 15:10:13 version 1.115.2.3, 2006/03/07 18:45:46
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 1589 
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(type, false, 0);
         }         }
         else         else
         {         {
Line 1614 
Line 1619 
  
             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 1626 
Line 1635 
  
                 // 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",                 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);
                   }
                   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",
                       "Expected INSTANCE or CLASS element"); // change "element" to "embedded object"
                   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 1921 
Line 1943 
 //  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 2278 
Line 2304 
     {     {
         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
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)  #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         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
         if (type == CIMTYPE_STRING)         if (type == CIMTYPE_STRING)
         {         {
               if(isEmbeddedObject)
             type = CIMTYPE_OBJECT;             type = CIMTYPE_OBJECT;
               else
                 type = CIMTYPE_INSTANCE;
             CIMValue new_value(type, false);             CIMValue new_value(type, false);
             CIMProperty new_property = CIMProperty(name, new_value, 0, CIMName(), classOrigin, propagated);             CIMProperty new_property = CIMProperty(name, new_value, 0, CIMName(), classOrigin, propagated);
  
Line 2320 
Line 2361 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
   #else
       if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)
       {
           // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
           if (type == CIMTYPE_STRING)
           {
               type = CIMTYPE_OBJECT;
               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);
           }
       }
   #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 2457 
Line 2536 
     {     {
         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
     if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)  #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         // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
         if (type == CIMTYPE_STRING)         if (type == CIMTYPE_STRING)
         {         {
               if(isEmbeddedObject)
             type = CIMTYPE_OBJECT;             type = CIMTYPE_OBJECT;
               else
                 type = CIMTYPE_INSTANCE;
             CIMValue new_value(type, true, arraySize);             CIMValue new_value(type, true, arraySize);
             CIMProperty new_property = CIMProperty(name, new_value, arraySize, CIMName(), classOrigin, propagated);             CIMProperty new_property = CIMProperty(name, new_value, arraySize, CIMName(), classOrigin, propagated);
  
Line 2499 
Line 2593 
             throw XmlValidationError(parser.getLine(), mlParms);             throw XmlValidationError(parser.getLine(), mlParms);
         }         }
     }     }
   #else
       if (String::equal(embeddedObject, "object") || embeddedObjectQualifierValue)
       {
           // The EMBEDDEDOBJECT attribute is only valid on Properties of type string
           if (type == CIMTYPE_STRING)
           {
               type = CIMTYPE_OBJECT;
               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);
           }
       }
   #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 4970 
Line 5102 
             // 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 4995 
Line 5158 
                     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 5080 
Line 5244 
             // 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 5103 
Line 5295 
                 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  
changed lines
  Added in v.1.115.2.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2