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

Diff for /pegasus/src/Pegasus/DynListener/ConsumerManager.cpp between version 1.10 and 1.11

version 1.10, 2005/11/01 20:44:54 version 1.11, 2005/11/01 22:47:07
Line 64 
Line 64 
 static const Uint32 DEFAULT_MAX_RETRY_COUNT = 5; static const Uint32 DEFAULT_MAX_RETRY_COUNT = 5;
 static const Uint32 DEFAULT_RETRY_LAPSE = 300000;  //ms = 5 minutes static const Uint32 DEFAULT_RETRY_LAPSE = 300000;  //ms = 5 minutes
  
   //constant for fake property that is added to instances when serializing to track the full URL
   static const String URL_PROPERTY = "URLString";
  
  
 ConsumerManager::ConsumerManager(const String& consumerDir, const String& consumerConfigDir, Boolean enableConsumerUnload, Uint32 idleTimeout) : ConsumerManager::ConsumerManager(const String& consumerDir, const String& consumerConfigDir, Boolean enableConsumerUnload, Uint32 idleTimeout) :
Line 364 
Line 366 
         consumer->waitForEventThread();         consumer->waitForEventThread();
  
         //load any outstanding requests         //load any outstanding requests
         Array<CIMInstance> outstandingIndications = _deserializeOutstandingIndications(consumerName);          Array<IndicationDispatchEvent> outstandingIndications = _deserializeOutstandingIndications(consumerName);
         if (outstandingIndications.size())         if (outstandingIndications.size())
         {         {
             //the consumer will signal itself in _loadOustandingIndications             //the consumer will signal itself in _loadOustandingIndications
Line 718 
Line 720 
  
 /** Serializes oustanding indications to a <MyConsumer>.dat file /** Serializes oustanding indications to a <MyConsumer>.dat file
  */  */
 void ConsumerManager::_serializeOutstandingIndications(const String& consumerName, Array<CIMInstance> indications)  void ConsumerManager::_serializeOutstandingIndications(const String& consumerName, Array<IndicationDispatchEvent> indications)
 { {
     PEG_METHOD_ENTER(TRC_LISTENER, "ConsumerManager::_serializeOutstandingIndications");     PEG_METHOD_ENTER(TRC_LISTENER, "ConsumerManager::_serializeOutstandingIndications");
  
Line 751 
Line 753 
         //we have to put the array of instances under a valid root element or the parser complains         //we have to put the array of instances under a valid root element or the parser complains
         XmlWriter::append(buffer, "<IRETURNVALUE>\n");         XmlWriter::append(buffer, "<IRETURNVALUE>\n");
  
                   CIMInstance cimInstance;
         for (Uint32 i = 0; i < indications.size(); i++)         for (Uint32 i = 0; i < indications.size(); i++)
         {         {
             XmlWriter::appendValueNamedInstanceElement(buffer, indications[i]);                          //set the URL string property on the serializable instance
                           CIMValue cimValue(CIMTYPE_STRING, false);
                           cimValue.set(indications[i].getURL());
                           cimInstance = indications[i].getIndicationInstance();
                           CIMProperty cimProperty(URL_PROPERTY, cimValue);
                           cimInstance.addProperty(cimProperty);
   
               XmlWriter::appendValueNamedInstanceElement(buffer, cimInstance);
         }         }
  
         XmlWriter::append(buffer, "</IRETURNVALUE>\0");         XmlWriter::append(buffer, "</IRETURNVALUE>\0");
Line 768 
Line 778 
  
 /** Reads outstanding indications from a <MyConsumer>.dat file /** Reads outstanding indications from a <MyConsumer>.dat file
  */  */
 Array<CIMInstance> ConsumerManager::_deserializeOutstandingIndications(const String& consumerName)  Array<IndicationDispatchEvent> ConsumerManager::_deserializeOutstandingIndications(const String& consumerName)
 { {
     PEG_METHOD_ENTER(TRC_LISTENER, "ConsumerManager::_deserializeOutstandingIndications");     PEG_METHOD_ENTER(TRC_LISTENER, "ConsumerManager::_deserializeOutstandingIndications");
  
Line 776 
Line 786 
     PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer dat file: " + fileName);     PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer dat file: " + fileName);
  
     Array<CIMInstance> cimInstances;     Array<CIMInstance> cimInstances;
           Array<String>      urlStrings;
           Array<IndicationDispatchEvent> indications;
  
     // Open the log file and serialize remaining indications     // Open the log file and serialize remaining indications
     if (FileSystem::exists(fileName)  && FileSystem::canRead(fileName))     if (FileSystem::exists(fileName)  && FileSystem::canRead(fileName))
     {     {
         Buffer text;         Buffer text;
         CIMInstance cimInstance;         CIMInstance cimInstance;
                   CIMProperty cimProperty;
                   CIMValue cimValue;
                   String urlString;
         XmlEntry entry;         XmlEntry entry;
  
         try         try
Line 795 
Line 810 
  
             while (XmlReader::getNamedInstanceElement(parser, cimInstance))             while (XmlReader::getNamedInstanceElement(parser, cimInstance))
             {             {
                 cimInstances.append(cimInstance);                                  Uint32 index = cimInstance.findProperty(URL_PROPERTY);
                                   if (index != PEG_NOT_FOUND)
                                   {
                                           //get the URL string property from the serialized instance and remove the property
                                           cimProperty = cimInstance.getProperty(index);
                                           cimValue = cimProperty.getValue();
                                           cimValue.get(urlString);
                                           cimInstance.removeProperty(index);
                                   }
                                   IndicationDispatchEvent* indicationEvent = new IndicationDispatchEvent(OperationContext(), urlString, cimInstance);
                   indications.append(*indicationEvent);
             }             }
  
             XmlReader::expectEndTag(parser, "IRETURNVALUE");             XmlReader::expectEndTag(parser, "IRETURNVALUE");
Line 803 
Line 828 
             Tracer::trace(__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3,             Tracer::trace(__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3,
                           "Consumer %s has %d outstanding indications",                           "Consumer %s has %d outstanding indications",
                           (const char*)consumerName.getCString(),                           (const char*)consumerName.getCString(),
                           cimInstances.size());                            indications.size());
  
             //delete the file             //delete the file
             FileSystem::removeFile(fileName);             FileSystem::removeFile(fileName);
Line 819 
Line 844 
     }     }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return cimInstances;      return indications;
 } }
  
  


Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2