(no commit message)
[utils] / crawler / kiss / src / org / wamblee / crawler / kiss / ProgramConfigurationParser.java
index 2c05b827233a82888c34be1452ef07e8ed5ff269..e9ba272e3ec33fe25497c6637d87974af91075f8 100644 (file)
@@ -29,7 +29,6 @@ import org.dom4j.io.SAXReader;
 import org.wamblee.conditions.AndCondition;
 import org.wamblee.conditions.Condition;
 import org.wamblee.conditions.PropertyRegexCondition;
-import org.wamblee.crawler.kiss.ProgramFilter.ProgramAction;
 
 /**
  * Parse the configuration of desired programs.
@@ -41,6 +40,8 @@ class ProgramConfigurationParser {
     private static final String ELEM_PATTERN = "match";
 
     private static final String ELEM_ACTION = "action";
+    
+    private static final String ELEM_CATEGORY = "category";
 
     private static final String ACTION_NOTIFY = "notify";
 
@@ -62,13 +63,20 @@ class ProgramConfigurationParser {
             for (Iterator i = root.elementIterator(ELEM_PROGRAM); i.hasNext();) {
                 Element program = (Element) i.next();
 
+                Element categoryElem = program.element(ELEM_CATEGORY);
+                String category = "";
+                if ( categoryElem != null ) { 
+                    category = categoryElem.getText().trim(); 
+                }
+                
                 Element actionElem = program.element(ELEM_ACTION);
-                ProgramAction action = ProgramAction.RECORD;
+                ProgramAction action = new RecordProgramAction();
                 if (actionElem != null) {
                     if (actionElem.getText().equals(ACTION_NOTIFY)) {
-                        action = ProgramAction.NOTIFY;
+                        action = new InterestingProgramAction(category);
                     }
                 }
+              
                 List<Condition<Program>> regexConditions = 
                     new ArrayList<Condition<Program>>();
                 for (Iterator j = program.elementIterator(ELEM_PATTERN); j.hasNext(); ) {