(no commit message)
[utils] / crawler / kiss / src / org / wamblee / crawler / kiss / main / ProgramConfigurationParser.java
index c5fd56023e4fd971f3c7285b888493ad8214d89a..fc41cde40aae4340b1f338f523a875433fdcc875 100644 (file)
@@ -30,9 +30,6 @@ import org.wamblee.conditions.AndCondition;
 import org.wamblee.conditions.Condition;
 import org.wamblee.conditions.PropertyRegexCondition;
 import org.wamblee.crawler.kiss.guide.Program;
-import org.wamblee.crawler.kiss.notification.MailNotifier;
-import org.wamblee.crawler.kiss.notification.MailServer;
-import org.wamblee.crawler.kiss.notification.Notifier;
 import org.wamblee.xml.XslTransformer;
 
 /**
@@ -43,14 +40,6 @@ class ProgramConfigurationParser {
     
     private static final int DEFAULT_PRIORITY = 1; 
 
-    private static final String ELEM_PASSWORD = "password";
-
-    private static final String ELEM_USERNAME = "username";
-
-    private static final String ELEM_PORT = "port";
-
-    private static final String ELEM_HOST = "host";
-
     // Formatting configuration.
     private static final String ELEM_FORMAT = "format";
 
@@ -58,18 +47,6 @@ class ProgramConfigurationParser {
 
     private static final String ELEM_HTML = "html";
 
-    // Mail server configuration.
-
-    private static final String ELEM_NOTIFICATION = "notification";
-
-    private static final String ELEM_SMTP = "smtp";
-
-    private static final String ELEM_SUBJECT = "subject";
-
-    private static final String ELEM_TO = "to";
-
-    private static final String ELEM_FROM = "from";
-
     // Configuration of interesting programs.
 
     private static final String ELEM_PROGRAM = "program";
@@ -88,11 +65,8 @@ class ProgramConfigurationParser {
     
     private XslTransformer _transformer;
 
-    private Notifier _notifier;
-
     ProgramConfigurationParser(XslTransformer aTransformer) {
         _filters = null;
-        _notifier = null;
         _transformer = aTransformer;
     }
 
@@ -151,56 +125,11 @@ class ProgramConfigurationParser {
                 filters.add(new ProgramFilter(condition, action));
             }
             _filters = filters;
-
-            Element notifier = root.element(ELEM_NOTIFICATION);
-            _notifier = parseNotifier(notifier);
-
         } catch (DocumentException e) {
             throw new RuntimeException("Error parsing program configuraiton", e);
         }
     }
 
-    /**
-     * Parses the notifier
-     * 
-     * @return Notifier
-     */
-    private Notifier parseNotifier(Element aNotifier) {
-        String from = aNotifier.elementTextTrim(ELEM_FROM);
-        String to = aNotifier.elementTextTrim(ELEM_TO);
-        String subject = aNotifier.elementTextTrim(ELEM_SUBJECT);
-
-        Element smtp = aNotifier.element(ELEM_SMTP);
-        MailServer server = parseMailServer(smtp);
-
-        Element format = aNotifier.element(ELEM_FORMAT);
-        String htmlXslt = format.elementTextTrim(ELEM_HTML);
-        String textXslt = format.elementTextTrim(ELEM_TEXT);
-
-        return new MailNotifier(from, to, subject, htmlXslt, textXslt, server, _transformer);
-    }
-
-    /**
-     * Parses the mail server from the XML.
-     * 
-     * @param aSmtp
-     *            Mail server configuration.
-     * @return Mail server.
-     */
-    private MailServer parseMailServer(Element aSmtp) {
-        String host = aSmtp.elementTextTrim(ELEM_HOST);
-        Element portElem = aSmtp.element(ELEM_PORT);
-        int port = DEFAULT_SMTP_PORT;
-        if (portElem != null) {
-            port = Integer.valueOf(portElem.getTextTrim());
-        }
-        String username = aSmtp.elementTextTrim(ELEM_USERNAME);
-        String password = aSmtp.elementTextTrim(ELEM_PASSWORD);
-
-        MailServer server = new MailServer(host, port, username, password);
-        return server;
-    }
-
     /**
      * Returns the list of program filters.
      * 
@@ -209,13 +138,4 @@ class ProgramConfigurationParser {
     public List<ProgramFilter> getFilters() {
         return _filters;
     }
-
-    /**
-     * Returns the notifier to use.
-     * 
-     * @return Notifier.
-     */
-    public Notifier getNotifier() {
-        return _notifier;
-    }
 }