X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkiss%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2FProgramConfigurationParser.java;h=e9ba272e3ec33fe25497c6637d87974af91075f8;hb=8baad2389febcbcd9132fbb62e6329247275a000;hp=2c05b827233a82888c34be1452ef07e8ed5ff269;hpb=a3c7e2e0c9d0e51fe93ae955f387ebd83f8ed00c;p=utils diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/ProgramConfigurationParser.java b/crawler/kiss/src/org/wamblee/crawler/kiss/ProgramConfigurationParser.java index 2c05b827..e9ba272e 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/ProgramConfigurationParser.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/ProgramConfigurationParser.java @@ -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> regexConditions = new ArrayList>(); for (Iterator j = program.elementIterator(ELEM_PATTERN); j.hasNext(); ) {