import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
-import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
import javax.xml.transform.TransformerException;
import org.apache.commons.httpclient.HttpClient;
try {
HttpClient client = new HttpClient();
- // client.getHostConfiguration().setProxy("127.0.0.1", 3128);
+ //client.getHostConfiguration().setProxy("127.0.0.1", 3128);
Crawler crawler = createCrawler(aCrawlerConfig, os, client);
InputStream programConfigFile = new FileInputStream(new File(
aProgramConfig));
- List<ProgramFilter> programFilters = new ProgramConfigurationParser()
- .parse(programConfigFile);
-
+ ProgramConfigurationParser parser = new ProgramConfigurationParser();
+ parser.parse(programConfigFile);
+ List<ProgramFilter> programFilters = parser.getFilters();
+
Page page = getStartPage(aStartUrl, crawler);
TVGuide guide = createGuide(page);
PrintVisitor printer = new PrintVisitor(System.out);
guide.accept(printer);
- processResults(programFilters, guide);
+ processResults(programFilters, guide, parser.getNotifier());
} finally {
os.flush();
os.close();
* In case of problems sending a summary mail.
*/
private void processResults(List<ProgramFilter> aProgramCondition,
- TVGuide aGuide) throws MessagingException {
+ TVGuide aGuide, Notifier aNotifier) throws MessagingException {
ProgramActionExecutor executor = new ProgramActionExecutor();
for (ProgramFilter filter : aProgramCondition) {
List<Program> programs = filter.apply(aGuide);
}
}
executor.commit();
- sendMail(executor);
+ try {
+ aNotifier.send(executor.getXmlReport());
+ } catch (NotificationException e) {
+ throw new RuntimeException(e);
+ }
}
/**