Textual changes in parameter notifications
authorarjen <arjen>
Tue, 31 May 2005 05:51:41 +0000 (05:51 +0000)
committerarjen <arjen>
Tue, 31 May 2005 05:51:41 +0000 (05:51 +0000)
src/gcm_input/message.cpp

index 7e727ff..24364b6 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : message.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.16 $
+**      VERSION NUMBER : $Revision: 1.17 $
 **
 **  DESCRIPTION      :  Implementation of the message handling classes
 **
 
 /*****************************
    $Log: message.cpp,v $
-   Revision 1.16  2003-12-04 10:38:09  arjen
+   Revision 1.17  2005-05-31 05:51:41  arjen
+   Textual changes in parameter notifications
+
+   Revision 1.16  2003/12/04 10:38:09  arjen
    Major redesign. All input is handled through XML. Raw input data is first
    transformed into an XML document for further processing.
    A collection of polymorphic classes handle the transformation of various
 
 *****************************/
 
-static const char *RCSID = "$Id: message.cpp,v 1.16 2003-12-04 10:38:09 arjen Exp $";
+static const char *RCSID = "$Id: message.cpp,v 1.17 2005-05-31 05:51:41 arjen Exp $";
 
 #include <algorithm>
 #include <libxml/xpath.h>
@@ -333,6 +336,10 @@ double client_message::classify(String host, UTC arriv, String serv)
 
    double uncertainty;
 
+#ifdef DEBUG
+   *Log << "Checking for a mail header.\n";
+#endif
+
    /*  First, check if the message has a mail header. */
 
    if (input >> line && line == re_uxmail_from)
@@ -359,6 +366,10 @@ double client_message::classify(String host, UTC arriv, String serv)
     *  out what the content of the message is.
     */
 
+#ifdef DEBUG
+   *Log << "Classifying message.\n";
+#endif
+
 
    uncertainty = 1.0;
 
@@ -404,6 +415,9 @@ double client_message::classify(String host, UTC arriv, String serv)
          classification = COOKER_OBJECT;
       }
    }
+
+   //TODO: If uncertainty is still too great, pick the least uncertain.
+
    input.rewind();
 
    certainty = 1.0 - uncertainty;
@@ -620,6 +634,9 @@ void client_message::enterXML()
          bool     initial_entry = false;
          String   param_class((const char *)xmlGetProp(node, (const xmlChar *)"class"));
 
+#ifdef DEBUG
+         *Log << "Entering a list of " << param_class << " parameters.\n";
+#endif
          pathcontext->node = node;
 
          //  If we don;t have any parameters of this class, this will be
@@ -637,6 +654,9 @@ void client_message::enterXML()
             {
                String param_name((const char *)xmlGetProp(node, (const xmlChar *)"name"));
 
+#ifdef DEBUG
+               *Log << "Parameter with name " << param_name << "\n";
+#endif
                std::list<param_property>  properties;
                param_property             prop;
                xmlNodePtr                 item;
@@ -728,7 +748,7 @@ void client_message::enterXML()
                   {
                      if (change_notification == "")
                      {
-                        remark = "Gnucomo detected a different version for package parameter(s) ";
+                        remark = "Gnucomo detected a different property for parameter(s) ";
                         change_notification = database.new_notification(objectid,
                                                            "property modified", remark);
                      }
@@ -796,7 +816,7 @@ void client_message::enterXML()
                   {
                      if (create_notification == "")
                      {
-                        remark = "Gnucomo detected new parameter(s) of class package";
+                        remark = "Gnucomo detected new parameter(s) of class " + param_class;
                         create_notification = database.new_notification(objectid,
                                                          "parameter created", remark);
                      }
@@ -843,6 +863,9 @@ void client_message::enterXML()
                {
                   // The parameter is in the database but not in the report
 
+#ifdef DEBUG
+                  *Log << "Could not find " << XPath << " in XML tree.\n";
+#endif
                   paramid = database.Field(parameter_set, i, "paramid");
                   qry ="select change_nature from history where paramid='";
                   qry += paramid + "' order by modified desc";
@@ -867,7 +890,8 @@ void client_message::enterXML()
 
                      if (remove_notification == "")
                      {
-                        remark = "Gnucomo detected that package(s) have disappeared ";
+                        remark = "Gnucomo detected that " + param_class
+                               + " parameters(s) have disappeared ";
                         remove_notification = database.new_notification(objectid,
                                                          "parameter removed", remark);
                      }