package org.wamblee.crawler.kiss.servlet;
-import java.util.Date;
-
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
-import org.quartz.JobDetail;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.SchedulerFactory;
-import org.quartz.Trigger;
-import org.quartz.TriggerUtils;
-import org.quartz.core.QuartzScheduler;
-import org.quartz.impl.StdSchedulerFactory;
-import org.wamblee.crawler.kiss.scheduling.quartz.CrawlerJob;
-import org.wamblee.crawler.kiss.scheduling.quartz.QuartzCrawlerScheduler;
+import org.wamblee.crawler.kiss.scheduling.CrawlerScheduler;
import org.wamblee.general.BeanKernel;
/**
* The mechanism for kick starting the scheduling of the KiSS crawler.
*/
public class Application implements ServletContextListener {
-
+
+ /**
+ * Constructs the listener.
+ *
+ */
public Application() {
// Empty.
}
aEvent.getServletContext().log("KiSS Crawler initializing");
try {
getScheduler().initialize();
- } catch (SchedulerException e) {
+ } catch (Exception e) {
aEvent.getServletContext().log("Error scheduling job", e);
+ return;
}
aEvent.getServletContext().log("KiSS Crawler initialized");
}
aEvent.getServletContext().log("KiSS Crawler shutting down");
try {
getScheduler().shutdown();
- } catch (SchedulerException e) {
+ } catch (Exception e) {
aEvent.getServletContext().log("Error scheduling job", e);
+ return;
}
aEvent.getServletContext().log("KiSS Crawler shut down complete");
}
- private QuartzCrawlerScheduler getScheduler() {
- return BeanKernel.getBeanFactory().find(QuartzCrawlerScheduler.class);
+ /**
+ * Gets the scheduler from Spring.
+ * @return Scheduler.
+ */
+ private CrawlerScheduler getScheduler() {
+ return BeanKernel.getBeanFactory().find(CrawlerScheduler.class);
}
- public static void main(String[] aArgs) throws SchedulerException {
+ public static void main(String[] aArgs) throws Exception {
Application application = new Application();
application.getScheduler().initialize();
}