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

Diff for /pegasus/src/Pegasus/Common/CIMResponseData.cpp between version 1.4 and 1.5.2.3

version 1.4, 2010/01/28 09:16:45 version 1.5.2.3, 2011/10/11 18:18:08
Line 41 
Line 41 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   #define LOCAL_MIN(a, b) ((a < b) ? a : b)
 // C++ objects interface handling // C++ objects interface handling
  
   void CIMResponseData::SVALID()
   {
       PEGASUS_ASSERT(valid());
       if (_size > 100000)
       {
           PEG_TRACE((TRC_XML, Tracer::LEVEL4,
                      "CIMResponseData::SVALID() _size too big ",_size ));
           PEGASUS_ASSERT(false);
       }
       PEG_TRACE((TRC_XML, Tracer::LEVEL4,
           "CIMResponseData Size _size=%u", _size));
       Uint32 size = _size;
   }
 // Instance Names handling // Instance Names handling
 Array<CIMObjectPath>& CIMResponseData::getInstanceNames() Array<CIMObjectPath>& CIMResponseData::getInstanceNames()
 { {
       SVALID();
     PEGASUS_DEBUG_ASSERT(     PEGASUS_DEBUG_ASSERT(
     (_dataType==RESP_INSTNAMES || _dataType==RESP_OBJECTPATHS));     (_dataType==RESP_INSTNAMES || _dataType==RESP_OBJECTPATHS));
     _resolveToCIM();     _resolveToCIM();
Line 53 
Line 68 
     return _instanceNames;     return _instanceNames;
 } }
  
 // Instance handling  // Get a single instance as a CIM instance.
   // This converts all of the objects in the response data to
   // CIM form as part of the conversion.
   // If there are no instances in the object, returns CIMInstance(),
   // an empty instance.
 CIMInstance& CIMResponseData::getInstance() CIMInstance& CIMResponseData::getInstance()
 { {
     PEGASUS_DEBUG_ASSERT(_dataType == RESP_INSTANCE);     PEGASUS_DEBUG_ASSERT(_dataType == RESP_INSTANCE);
Line 73 
Line 92 
     return _instances;     return _instances;
 } }
  
   // Instances handling specifically for the client where the call may
   // get either instances or objects and must convert them to instances
   // NOTE: This is a temporary solution to satisfy the BinaryCodec passing
   // of data to the client where the data could be either instances or
   // objects.  The correct solution is to convert back when the provider, etc.
   // returns the data to the server.  We must convert to that solution but
   // this keeps it working for the moment.
   Array<CIMInstance>& CIMResponseData::getInstancesFromInstancesOrObjects()
   {
       if (_dataType == RESP_INSTANCES)
       {
           _resolveToCIM();
           return _instances;
       }
       else if (_dataType == RESP_OBJECTS)
       {
           _resolveToCIM();
           for (Uint32 i = 0 ; i < _objects.size() ; i++)
           {
               _instances.append((CIMInstance)_objects[i]);
           }
           return _instances;
   
       }
       PEGASUS_DEBUG_ASSERT(false);
   }
   
 // Objects handling // Objects handling
 Array<CIMObject>& CIMResponseData::getObjects() Array<CIMObject>& CIMResponseData::getObjects()
 { {
Line 89 
Line 135 
     return _scmoInstances;     return _scmoInstances;
 } }
  
   // set an array of SCMOInstances into the response data object
 void CIMResponseData::setSCMO(const Array<SCMOInstance>& x) void CIMResponseData::setSCMO(const Array<SCMOInstance>& x)
 { {
       SVALID();
     _scmoInstances=x;     _scmoInstances=x;
     _encoding |= RESP_ENC_SCMO;     _encoding |= RESP_ENC_SCMO;
       _size += x.size();
 } }
  
   
 // Binary data is just a data stream // Binary data is just a data stream
 Array<Uint8>& CIMResponseData::getBinary() Array<Uint8>& CIMResponseData::getBinary()
 { {
Line 103 
Line 151 
     return _binaryData;     return _binaryData;
 } }
  
 bool CIMResponseData::setBinary(CIMBuffer& in, bool hasLen)  bool CIMResponseData::setBinary(CIMBuffer& in)
 { {
     PEG_METHOD_ENTER(TRC_DISPATCHER,      PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setBinary");
         "CIMResponseData::setBinary");  
  
     if (hasLen)      // Append all serial data from the CIMBuffer to the local data store.
     {      // Returns error if input not a serialized Uint8A
         if (!in.getUint8A(_binaryData))         if (!in.getUint8A(_binaryData))
         {         {
             PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,             PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,
                 "Failed to get binary object path data!");              "Failed to get binary input data!");
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return false;             return false;
         }         }
       _encoding |= RESP_ENC_BINARY;
       PEG_METHOD_EXIT();
       return true;
     }     }
     else  
   bool CIMResponseData::setRemainingBinaryData(CIMBuffer& in)
     {     {
         size_t remainingDataLength = in.capacity() - in.size();      PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setRemainingBinaryData");
   
       // Append any data that has not been deserialized already from
       // the CIMBuffer.
       size_t remainingDataLength = in.remainingDataLength();
         _binaryData.append((Uint8*)in.getPtr(), remainingDataLength);         _binaryData.append((Uint8*)in.getPtr(), remainingDataLength);
     }  
     _encoding |= RESP_ENC_BINARY;     _encoding |= RESP_ENC_BINARY;
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return true;     return true;
Line 130 
Line 185 
  
 bool CIMResponseData::setXml(CIMBuffer& in) bool CIMResponseData::setXml(CIMBuffer& in)
 { {
       SVALID();
     switch (_dataType)     switch (_dataType)
     {     {
         case RESP_INSTANCE:         case RESP_INSTANCE:
Line 166 
Line 222 
                 return false;                 return false;
             }             }
             _nameSpacesData.insert(0,ns);             _nameSpacesData.insert(0,ns);
               _size++;
             break;             break;
         }         }
         case RESP_INSTANCES:         case RESP_INSTANCES:
Line 212 
Line 269 
                 _hostsData.append(host);                 _hostsData.append(host);
                 _nameSpacesData.append(ns);                 _nameSpacesData.append(ns);
             }             }
               _size += count;
             break;             break;
         }         }
         case RESP_OBJECTS:         case RESP_OBJECTS:
Line 258 
Line 316 
                 _hostsData.append(host);                 _hostsData.append(host);
                 _nameSpacesData.append(ns);                 _nameSpacesData.append(ns);
             }             }
               _size += count;
             break;             break;
         }         }
         // internal xml encoding of instance names and object paths not         // internal xml encoding of instance names and object paths not
Line 273 
Line 332 
     return true;     return true;
 } }
  
   // Move the number of objects defined by the input parameter from
   // one CIMResponse Object to another CIMResponse Object.
   Uint32 CIMResponseData::moveObjects(CIMResponseData & from, Uint32 count)
   {
       PEG_TRACE((TRC_XML, Tracer::LEVEL3,
           "CIMResponseData::move(%u)", count));
   
       PEGASUS_ASSERT(valid());                 // KS_TEMP
       if (_dataType != from._dataType)         // KS_TEMP
       {
           printf("ERROR moveObjects _dataType %u. from._dataType %u\n",
           _dataType, from._dataType);
       }
       PEGASUS_DEBUG_ASSERT(_dataType == from._dataType);
       Uint32 rtnSize = 0;
       Uint32 toMove = count;
   //  printf("count to move = %u encoding %u from.size %u to.size %u\n",
   //          count, from._encoding, from._size, _size);
   
       if (RESP_ENC_XML == (from._encoding & RESP_ENC_XML))
       {
           switch (_dataType)
           {
               case RESP_OBJECTPATHS:
               case RESP_INSTNAMES:
                   break;
               case RESP_INSTANCE:
                   {
                       Uint32 moveCount = toMove;
                       if (from._instanceData.size() > 0)
                       {
                           // temp test to assure all sizes are the same.
                           PEGASUS_ASSERT(from._hostsData.size() ==
                                           from._instanceData.size());
                           PEGASUS_ASSERT(from._referencesData.size() ==
                                           from._instanceData.size());
                           PEGASUS_ASSERT(from._nameSpacesData.size() ==
                                           from._instanceData.size());
                           _instanceData.append(from._instanceData.getData(),1);
                           from._instanceData.remove(0, 1);
                           _referencesData.append(
                               from._referencesData.getData(),1);
                           from._referencesData.remove(0, 1);
                           if (_hostsData.size())
                           {
                               _hostsData.append(from._hostsData.getData(),1);
                               from._hostsData.remove(0, 1);
                           }
                           if (_nameSpacesData.size())
                           {
                               _nameSpacesData.append(
                                   from._nameSpacesData.getData(),1);
                               from._nameSpacesData.remove(0, 1);
                           }
                           rtnSize += 1;
                           toMove--;
                           _encoding |= RESP_ENC_XML;
                       }
                   }
                   break;
   
               // The above should probably be folded into the following.
               // Need something like an assert if there is ever more than
               // one instance in _instanceData for type RESP_INSTANCE
               case RESP_INSTANCES:
               case RESP_OBJECTS:
                   {
                       Uint32 moveCount = LOCAL_MIN(toMove,
                                                    from._instanceData.size());
   
                       PEGASUS_ASSERT(from._referencesData.size() ==
                                       from._instanceData.size());
                       _instanceData.append(from._instanceData.getData(),
                                            moveCount);
                       from._instanceData.remove(0, moveCount);
                       _referencesData.append(from._referencesData.getData(),
                                              moveCount);
                       from._referencesData.remove(0, moveCount);
                       rtnSize += moveCount;
                       toMove -= moveCount;
                       _encoding |= RESP_ENC_XML;
                   }
                   break;
           }
       }
       if (RESP_ENC_BINARY == (from._encoding & RESP_ENC_BINARY))
       {
           // KS_PULL TBD Add binary move function
           // Cannot resolve this one without actually processing
           // the data since it is a stream.
           rtnSize += 0;
           PEGASUS_ASSERT(false);
       }
   
       if (RESP_ENC_SCMO == (from._encoding & RESP_ENC_SCMO))
       {
           Uint32 moveCount = LOCAL_MIN(toMove, from._scmoInstances.size());
   
           _scmoInstances.append(from._scmoInstances.getData(), moveCount);
           from._scmoInstances.remove(0, moveCount);
           rtnSize += moveCount;
           toMove -= moveCount;
           _encoding |= RESP_ENC_SCMO;
       }
   
       if (RESP_ENC_CIM == (from._encoding & RESP_ENC_CIM))
       {
           switch (_dataType)
           {
               case RESP_OBJECTPATHS:
               case RESP_INSTNAMES:
                   {
                       Uint32 moveCount = LOCAL_MIN(toMove,
                                                    from._instanceNames.size());
   
                       _instanceNames.append(
                           from._instanceNames.getData(), moveCount);
                       from._instanceNames.remove(0, moveCount);
                       rtnSize += moveCount;
                       toMove -= moveCount;
                       _encoding |= RESP_ENC_CIM;
                   }
                   break;
               case RESP_INSTANCE:
               case RESP_INSTANCES:
                   {
   
                       Uint32 moveCount = LOCAL_MIN(toMove,
                                                    from._instances.size());
   
                       _instances.append(from._instances.getData(), moveCount);
                       from._instances.remove(0, moveCount);
                       rtnSize += moveCount;
                       toMove -= moveCount;
                       _encoding |= RESP_ENC_CIM;
                   }
                   break;
               case RESP_OBJECTS:
                   {
                       Uint32 moveCount = LOCAL_MIN(toMove,
                                                    from._objects.size());
                       _objects.append(from._objects.getData(), moveCount);
                       from._objects.remove(0, moveCount);
                       rtnSize += moveCount;
                       toMove -= moveCount;
                       _encoding |= RESP_ENC_CIM;
                   }
                   break;
           }
       }
       PEGASUS_ASSERT(rtnSize == (count - toMove));
   
       _size += rtnSize;
       from._size -= rtnSize;
   
       if (rtnSize != _size)
       {
           PEG_TRACE((TRC_XML, Tracer::LEVEL1,
               "Size calc error _size %u rtnSWize = %u", _size, rtnSize));
       }
       //PEGASUS_ASSERT(rtnSize == _size);
   
       return rtnSize;
   }
   
   // Return the number of CIM objects in the CIM Response data object
   //
   #define TEMPLOG PEG_TRACE((TRC_XML, Tracer::LEVEL4, \
    "rtnSize %u size %u", rtnSize, _size))
   
   Uint32 CIMResponseData::size()
   {
       PEG_METHOD_ENTER(TRC_XML,"CIMResponseData::size()");
       SVALID();
   // If debug mode, add up all the individual size components to
   // determine overall size of this object.  Then compare this with
   // the _size variable.  this is a good check on the completeness of the
   // size computations.  We should be able to remove this at some point
   // but there are many sources of size info and we need to be sure we
   // have covered them all.
   #ifdef PEGASUS_DEBUG
       PEGASUS_ASSERT(valid());            //KS_TEMP
   
       Uint32 rtnSize = 0;
       TEMPLOG;
       if (RESP_ENC_XML == (_encoding & RESP_ENC_XML))
       {
           TEMPLOG;
           switch (_dataType)
           {
               case RESP_OBJECTPATHS:
               case RESP_INSTNAMES:
                   break;
               case RESP_INSTANCE:
                   rtnSize +=1;
                   break;
               case RESP_INSTANCES:
               case RESP_OBJECTS:
                   rtnSize += _instanceData.size();
                   break;
           }
           SVALID();
           TEMPLOG;
       }
       if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))
       {
           TEMPLOG;
           // KS_PULL_TODO
           // Cannot resolve this one without actually processing
           // the data since it is a stream.
           rtnSize += 0;
           //PEGASUS_ASSERT(false);
           TEMPLOG;
       }
   
       if (RESP_ENC_SCMO == (_encoding & RESP_ENC_SCMO))
       {
           SVALID();
           TEMPLOG;
           rtnSize += _scmoInstances.size();
           TEMPLOG;
       }
   
       if (RESP_ENC_CIM == (_encoding & RESP_ENC_CIM))
       {
           SVALID();
           TEMPLOG;
           switch (_dataType)
           {
               case RESP_OBJECTPATHS:
               case RESP_INSTNAMES:
                   rtnSize += _instanceNames.size();
                   break;
               case RESP_INSTANCE:
               case RESP_INSTANCES:
                   rtnSize += _instances.size();
                   break;
               case RESP_OBJECTS:
                   rtnSize += _objects.size();
                   break;
           }
           SVALID();
           TEMPLOG;
       }
       // Test of actual count against _size variable.
       if (rtnSize != _size)
       {
           SVALID();
           TEMPLOG;
           PEG_TRACE((TRC_XML, Tracer::LEVEL1,
           "CIMResponseData::size ERROR. debug size mismatch."
               "Computed = %u. variable = %u",rtnSize, _size ));
           // KS_TEMP
           cout << "Size err " << rtnSize << " " << _size << endl;
           TEMPLOG;
       }
       //PEGASUS_TEST_ASSERT(rtnSize == _size);
   #endif
       PEG_METHOD_EXIT();
       return _size;
   }
   
 // function used by OperationAggregator to aggregate response data in a // function used by OperationAggregator to aggregate response data in a
 // single ResponseData object  // single ResponseData object. Adds all data in the from ResponseData object
   // input variable to the target ResponseData object
   // target array
 void CIMResponseData::appendResponseData(const CIMResponseData & x) void CIMResponseData::appendResponseData(const CIMResponseData & x)
 { {
     // as the Messages set the data types, this should be impossible      // Confirm that the CIMResponseData type matches the type
       // of the data being appended
   
       PEGASUS_ASSERT(valid());            // KS_TEMP
     PEGASUS_DEBUG_ASSERT(_dataType == x._dataType);     PEGASUS_DEBUG_ASSERT(_dataType == x._dataType);
     _encoding |= x._encoding;     _encoding |= x._encoding;
  
     // add all binary data     // add all binary data
     _binaryData.appendArray(x._binaryData);     _binaryData.appendArray(x._binaryData);
       // KS_TBD TODO PULL Add the counter incrementer for binary
  
     // add all the C++ stuff     // add all the C++ stuff
     _instanceNames.appendArray(x._instanceNames);     _instanceNames.appendArray(x._instanceNames);
       _size += x._instanceNames.size();
     _instances.appendArray(x._instances);     _instances.appendArray(x._instances);
       _size += x._instances.size();
     _objects.appendArray(x._objects);     _objects.appendArray(x._objects);
       _size += x._objects.size();
  
     // add the SCMO instances     // add the SCMO instances
     _scmoInstances.appendArray(x._scmoInstances);     _scmoInstances.appendArray(x._scmoInstances);
       _size += x._scmoInstances.size();
  
     // add Xml encodings too      // add Xml encodings
       // KS_TBD - FIX _Size stuff here also.
     _referencesData.appendArray(x._referencesData);     _referencesData.appendArray(x._referencesData);
     _instanceData.appendArray(x._instanceData);     _instanceData.appendArray(x._instanceData);
     _hostsData.appendArray(x._hostsData);     _hostsData.appendArray(x._hostsData);
Line 305 
Line 637 
     PEG_METHOD_ENTER(TRC_DISPATCHER,     PEG_METHOD_ENTER(TRC_DISPATCHER,
         "CIMResponseData::encodeBinaryResponse");         "CIMResponseData::encodeBinaryResponse");
  
       SVALID();
   
     // Need to do a complete job here by transferring all contained data     // Need to do a complete job here by transferring all contained data
     // into binary format and handing it out in the CIMBuffer     // into binary format and handing it out in the CIMBuffer
       // KS_TODO
     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))
     {     {
           PEGASUS_ASSERT(false);   // KS_TEMP
         // Binary does NOT need a marker as it consists of C++ and SCMO         // Binary does NOT need a marker as it consists of C++ and SCMO
         const Array<Uint8>& data = _binaryData;         const Array<Uint8>& data = _binaryData;
         out.putBytes(data.getData(), data.size());         out.putBytes(data.getData(), data.size());
     }     }
   
     if (RESP_ENC_CIM == (_encoding & RESP_ENC_CIM))     if (RESP_ENC_CIM == (_encoding & RESP_ENC_CIM))
     {     {
         out.putTypeMarker(BIN_TYPE_MARKER_CPPD);         out.putTypeMarker(BIN_TYPE_MARKER_CPPD);
Line 395 
Line 732 
                         p.setNameSpace(nsName);                         p.setNameSpace(nsName);
                     }                     }
                 }                 }
                   break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
             {             {
Line 456 
Line 794 
     }     }
 } }
  
   
 void CIMResponseData::completeHostNameAndNamespace( void CIMResponseData::completeHostNameAndNamespace(
     const String & hn,     const String & hn,
     const CIMNamespaceName & ns)     const CIMNamespaceName & ns)
 { {
       PEG_METHOD_ENTER(TRC_DISPATCHER,
           "CIMResponseData::completeHostNameAndNamespace");
   
       PEGASUS_ASSERT(valid());            // KS_TEMP
   
     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))     if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY))
     {     {
         // On binary need remember hostname and namespace in case someone         // On binary need remember hostname and namespace in case someone
Line 489 
Line 831 
     {     {
         switch (_dataType)         switch (_dataType)
         {         {
               // Instances added to account for namedInstance in Pull operations.
               case RESP_INSTANCES:
   
                   for (Uint32 j = 0, n = _instances.size(); j < n; j++)
                   {
                       const CIMInstance& instance = _instances[j];
                       CIMObjectPath& p =
                           const_cast<CIMObjectPath&>(instance.getPath());
                       if (p.getHost().size()==0)
                       {
                           p.setHost(hn);
                       }
                       if (p.getNameSpace().isNull())
                       {
                           p.setNameSpace(ns);
                       }
                   }
             case RESP_OBJECTS:             case RESP_OBJECTS:
             {             {
                 for (Uint32 j = 0, n = _objects.size(); j < n; j++)                 for (Uint32 j = 0, n = _objects.size(); j < n; j++)
Line 507 
Line 866 
                 }                 }
                 break;                 break;
             }             }
               // INSTNAMES added to account for instance paths in pull name
               // operations
               case RESP_INSTNAMES:
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
             {             {
                 for (Uint32 j = 0, n = _instanceNames.size(); j < n; j++)                 for (Uint32 j = 0, n = _instanceNames.size(); j < n; j++)
Line 535 
Line 897 
         Uint32 nsLen = strlen(nsChars);         Uint32 nsLen = strlen(nsChars);
         switch (_dataType)         switch (_dataType)
         {         {
               // KS_PULL add Instances and InstNames to cover pull operations
               // KS_PULL - Confirm that this OK.
               case RESP_INSTNAMES:
               case RESP_INSTANCES:
             case RESP_OBJECTS:             case RESP_OBJECTS:
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
             {             {
Line 558 
Line 924 
             }             }
         }         }
     }     }
       PEG_METHOD_EXIT();
 } }
  
 void CIMResponseData::encodeXmlResponse(Buffer& out)  // NOTE: The reason for the isPullResponse variable is that there are
   // some variations in ouput to Xml depending on whether the responses
   // are one of the pull responses or the original responsed
   void CIMResponseData::encodeXmlResponse(Buffer& out, Boolean isPullResponse)
 { {
     PEG_TRACE((TRC_XML, Tracer::LEVEL3,     PEG_TRACE((TRC_XML, Tracer::LEVEL3,
         "CIMResponseData::encodeXmlResponse(encoding=%X,content=%X)",         "CIMResponseData::encodeXmlResponse(encoding=%X,content=%X)",
Line 592 
Line 962 
  
                 for (Uint32 i = 0, n = a.size(); i < n; i++)                 for (Uint32 i = 0, n = a.size(); i < n; i++)
                 {                 {
                       if (isPullResponse)
                       {
                           out << STRLIT("<VALUE.INSTANCEWITHPATH>\n");
                       }
                       else
                       {
                     out << STRLIT("<VALUE.NAMEDINSTANCE>\n");                     out << STRLIT("<VALUE.NAMEDINSTANCE>\n");
                       }
                     out.append((char*)b[i].getData(), b[i].size() - 1);                     out.append((char*)b[i].getData(), b[i].size() - 1);
                     out.append((char*)a[i].getData(), a[i].size() - 1);                     out.append((char*)a[i].getData(), a[i].size() - 1);
                       if (isPullResponse)
                       {
                           out << STRLIT("</VALUE.INSTANCEWITHPATH>\n");
                       }
                       else
                       {
                     out << STRLIT("</VALUE.NAMEDINSTANCE>\n");                     out << STRLIT("</VALUE.NAMEDINSTANCE>\n");
                 }                 }
                   }
                 break;                 break;
             }             }
             case RESP_OBJECTS:             case RESP_OBJECTS:
Line 643 
Line 1027 
             {             {
                 for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++)                 for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++)
                 {                 {
                     XmlWriter::appendInstanceNameElement(out,_instanceNames[i]);                      // Element type is different for Pull responses
                       if (isPullResponse)
                       {
                           XmlWriter::appendInstancePathElement(out,
                               _instanceNames[i]);
                       }
                       else
                       {
                           XmlWriter::appendInstanceNameElement(out,
                               _instanceNames[i]);
                       }
                 }                 }
                 break;                 break;
             }             }
Line 651 
Line 1045 
             {             {
                 if (_instances.size() > 0)                 if (_instances.size() > 0)
                 {                 {
                     XmlWriter::appendInstanceElement(out, _instances[0]);                      XmlWriter::appendInstanceElement(
                           out,
                           _instances[0],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 659 
Line 1058 
             {             {
                 for (Uint32 i = 0, n = _instances.size(); i < n; i++)                 for (Uint32 i = 0, n = _instances.size(); i < n; i++)
                 {                 {
                       if (isPullResponse)
                       {
                           XmlWriter::appendValueInstanceWithPathElement(
                               out,
                               _instances[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                       }
                       else
                       {
                     XmlWriter::appendValueNamedInstanceElement(                     XmlWriter::appendValueNamedInstanceElement(
                         out, _instances[i]);                              out,
                               _instances[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                       }
   
                 }                 }
                 break;                 break;
             }             }
Line 668 
Line 1084 
             {             {
                 for (Uint32 i = 0; i < _objects.size(); i++)                 for (Uint32 i = 0; i < _objects.size(); i++)
                 {                 {
                       // If pull, map to instances
                       if (isPullResponse)
                       {
                           CIMInstance x = (CIMInstance)_objects[i];
                           XmlWriter::appendValueInstanceWithPathElement(
                               out, x,
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                       }
                       else
                       {
                     XmlWriter::appendValueObjectWithPathElement(                     XmlWriter::appendValueObjectWithPathElement(
                         out,                         out,
                         _objects[i]);                              _objects[i],
                               _includeQualifiers,
                               _includeClassOrigin,
                               _propertyList);
                       }
   
                 }                 }
                 break;                 break;
             }             }
Line 678 
Line 1111 
             {             {
                 for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++)                 for (Uint32 i = 0, n = _instanceNames.size(); i < n; i++)
                 {                 {
                       // ObjectPaths come from providers for pull operations
                       // but are encoded as instancePathElements
                       if (isPullResponse)
   
                       {
                           XmlWriter::appendInstancePathElement(out,
                              _instanceNames[i]);
                       }
                       else
                       {
                     out << "<OBJECTPATH>\n";                     out << "<OBJECTPATH>\n";
                     XmlWriter::appendValueReferenceElement(                     XmlWriter::appendValueReferenceElement(
                         out,                         out,
Line 685 
Line 1128 
                         false);                         false);
                     out << "</OBJECTPATH>\n";                     out << "</OBJECTPATH>\n";
                 }                 }
                   }
                 break;                 break;
             }             }
             default:             default:
Line 704 
Line 1148 
                     SCMOXmlWriter::appendInstanceNameElement(                     SCMOXmlWriter::appendInstanceNameElement(
                         out,                         out,
                         _scmoInstances[i]);                         _scmoInstances[i]);
   
                 }                 }
                 break;                 break;
             }             }
Line 711 
Line 1156 
             {             {
                 if (_scmoInstances.size() > 0)                 if (_scmoInstances.size() > 0)
                 {                 {
                     SCMOXmlWriter::appendInstanceElement(out,_scmoInstances[0]);                      if(_propertyList.isNull())
                       {
                           Array<Uint32> emptyNodes;
                           SCMOXmlWriter::appendInstanceElement(
                               out,
                               _scmoInstances[0],
                               false,
                               emptyNodes);
                       }
                       else
                       {
                           Array<propertyFilterNodesArray_t> propFilterNodesArrays;
                           // This searches for an already created array of nodes,
                           //if not found, creates it inside propFilterNodesArrays
                           const Array<Uint32> & nodes=
                               SCMOXmlWriter::getFilteredNodesArray(
                                   propFilterNodesArrays,
                                   _scmoInstances[0],
                                   _propertyList);
                           SCMOXmlWriter::appendInstanceElement(
                               out,
                               _scmoInstances[0],
                               true,
                               nodes);
                       }
                 }                 }
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
             {             {
                 for (Uint32 i = 0, n = _scmoInstances.size(); i < n; i++)                  if (isPullResponse)
                 {                 {
                     SCMOXmlWriter::appendValueSCMOInstanceElement(                      SCMOXmlWriter::appendValueSCMOInstanceWithPathElements(
                         out,                          out, _scmoInstances, _propertyList);
                         _scmoInstances[i]);  
                 }                 }
                   else
                   {
                       SCMOXmlWriter::appendValueSCMOInstanceElements(
                           out, _scmoInstances, _propertyList);
                   }
   
                 break;                 break;
             }             }
             case RESP_OBJECTS:             case RESP_OBJECTS:
             {             {
                 for (Uint32 i = 0; i < _scmoInstances.size(); i++)                  if (isPullResponse)
                 {                 {
                       SCMOXmlWriter::appendValueSCMOInstanceWithPathElements(
                           out,_scmoInstances, _propertyList);
                   }
                   else
                   {
                       // KS_TODO why is this one named element rather than
                       // elements
                     SCMOXmlWriter::appendValueObjectWithPathElement(                     SCMOXmlWriter::appendValueObjectWithPathElement(
                         out,                          out, _scmoInstances, _propertyList);
                         _scmoInstances[i]);  
                 }                 }
   
                 break;                 break;
             }             }
             case RESP_OBJECTPATHS:             case RESP_OBJECTPATHS:
             {             {
                 for (Uint32 i = 0, n = _scmoInstances.size(); i < n; i++)                 for (Uint32 i = 0, n = _scmoInstances.size(); i < n; i++)
                 {                 {
                       if (isPullResponse)
                       {
                           SCMOXmlWriter::appendInstancePathElement(out,
                               _scmoInstances[i]);
                       }
                       else
                       {
                     out << "<OBJECTPATH>\n";                     out << "<OBJECTPATH>\n";
                     SCMOXmlWriter::appendValueReferenceElement(                     SCMOXmlWriter::appendValueReferenceElement(
                         out,                              out, _scmoInstances[i],
                         _scmoInstances[i],  
                         false);                         false);
                     out << "</OBJECTPATH>\n";                     out << "</OBJECTPATH>\n";
                 }                 }
                   }
                 break;                 break;
             }             }
             default:             default:
Line 787 
Line 1275 
                 if (0 == _instances.size())                 if (0 == _instances.size())
                 {                 {
                     _instances.append(CIMInstance());                     _instances.append(CIMInstance());
                       CIMInternalXmlEncoder::_putXMLInstance(
                           out,
                           _instances[0]);
                       break;
                 }                 }
                 CIMInternalXmlEncoder::_putXMLInstance(out, _instances[0]);                  CIMInternalXmlEncoder::_putXMLInstance(
                       out,
                       _instances[0],
                       _includeQualifiers,
                       _includeClassOrigin,
                       _propertyList);
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
Line 800 
Line 1297 
                 {                 {
                     CIMInternalXmlEncoder::_putXMLNamedInstance(                     CIMInternalXmlEncoder::_putXMLNamedInstance(
                         out,                         out,
                         _instances[i]);                          _instances[i],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 811 
Line 1311 
                 out.putUint32(totalSize);                 out.putUint32(totalSize);
                 for (Uint32 i = 0; i < n; i++)                 for (Uint32 i = 0; i < n; i++)
                 {                 {
                     CIMInternalXmlEncoder::_putXMLObject(out, _objects[i]);                      CIMInternalXmlEncoder::_putXMLObject(
                           out,
                           _objects[i],
                           _includeQualifiers,
                           _includeClassOrigin,
                           _propertyList);
                 }                 }
                 break;                 break;
             }             }
Line 835 
Line 1340 
                 {                 {
                     _scmoInstances.append(SCMOInstance());                     _scmoInstances.append(SCMOInstance());
                 }                 }
                 SCMOInternalXmlEncoder::_putXMLInstance(out, _scmoInstances[0]);                  SCMOInternalXmlEncoder::_putXMLInstance(
                       out,
                       _scmoInstances[0],
                       _propertyList);
                 break;                 break;
             }             }
             case RESP_INSTANCES:             case RESP_INSTANCES:
Line 846 
Line 1354 
                 {                 {
                     out.putUint32(n);                     out.putUint32(n);
                 }                 }
                 for (Uint32 i = 0; i < n; i++)  
                 {  
                     SCMOInternalXmlEncoder::_putXMLNamedInstance(                     SCMOInternalXmlEncoder::_putXMLNamedInstance(
                             out,                             out,
                             _scmoInstances[i]);                      _scmoInstances,
                 }                      _propertyList);
                 break;                 break;
             }             }
             case RESP_OBJECTS:             case RESP_OBJECTS:
Line 862 
Line 1368 
                 {                 {
                     out.putUint32(n);                     out.putUint32(n);
                 }                 }
                 for (Uint32 i = 0; i < n; i++)  
                 {  
                     SCMOInternalXmlEncoder::_putXMLObject(                     SCMOInternalXmlEncoder::_putXMLObject(
                         out,                         out,
                         _scmoInstances[i]);                      _scmoInstances,
                 }                      _propertyList);
                 break;                 break;
             }             }
             // internal xml encoding of instance names and object paths not             // internal xml encoding of instance names and object paths not
Line 880 
Line 1384 
             }             }
         }         }
     }     }
   
 } }
  
 void CIMResponseData::_resolveToCIM() void CIMResponseData::_resolveToCIM()
Line 1361 
Line 1866 
     _encoding |=RESP_ENC_SCMO;     _encoding |=RESP_ENC_SCMO;
 } }
  
   /**
    * Validate the magic object for this CIMResponseData. This
    * compiles only in debug mode and can be use to validate the
    * CIMResponseData object
    *
    * @return Boolean True if valid object.
    */
   Boolean CIMResponseData::valid()
   {
       return _magic;
   }
   
   void CIMResponseData::setRequestProperties(
       const Boolean includeQualifiers,
       const Boolean includeClassOrigin,
       const CIMPropertyList& propertyList)
   {
       _includeQualifiers = includeQualifiers;
       _includeClassOrigin = includeClassOrigin;
       _propertyList = propertyList;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5.2.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2