(no commit message)
[utils] / crawler / kiss / src / org / wamblee / crawler / kiss / main / ProgramConfigurationParser.java
index 103ec0702c6caea299ca6583e265797c6e7cc8ee..c16f4f93df34043fe9fde22297cff6cc81559944 100644 (file)
@@ -38,11 +38,9 @@ import org.wamblee.crawler.kiss.notification.Notifier;
  * Parse the configuration of desired programs.
  */
 class ProgramConfigurationParser {
-
-    /**
-     * 
-     */
     private static final int DEFAULT_SMTP_PORT = 25;
+    
+    private static final int DEFAULT_PRIORITY = 1; 
 
     private static final String ELEM_PASSWORD = "password";
 
@@ -74,6 +72,8 @@ class ProgramConfigurationParser {
     // Configuration of interesting programs.
 
     private static final String ELEM_PROGRAM = "program";
+    
+    private static final String ELEM_PRIORITY = "priority";
 
     private static final String ELEM_PATTERN = "match";
 
@@ -117,7 +117,12 @@ class ProgramConfigurationParser {
                 }
 
                 Element actionElem = program.element(ELEM_ACTION);
-                ProgramAction action = new RecordProgramAction(1);
+                int priority = DEFAULT_PRIORITY; 
+                String priorityString = program.elementTextTrim(ELEM_PRIORITY);
+                if ( priorityString != null ) { 
+                    priority = Integer.valueOf(priorityString);
+                }
+                ProgramAction action = new RecordProgramAction(priority);
                 if (actionElem != null) {
                     if (actionElem.getText().equals(ACTION_NOTIFY)) {
                         action = new InterestingProgramAction(category);