X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkissweb%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fservlet%2FApplication.java;fp=crawler%2Fkissweb%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fservlet%2FApplication.java;h=0000000000000000000000000000000000000000;hb=62f165891f08ae532b5a794af11d7338a93f9a43;hp=9220a62f741ee8cbd0c222675eff63cc5a08280f;hpb=07cedd3f0730646ea35a7f668b3e1e872a4605d9;p=utils diff --git a/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java b/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java deleted file mode 100644 index 9220a62f..00000000 --- a/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wamblee.crawler.kiss.servlet; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -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. - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ - public void contextInitialized(ServletContextEvent aEvent) { - aEvent.getServletContext().log("KiSS Crawler initializing"); - try { - getScheduler().initialize(); - } catch (Exception e) { - aEvent.getServletContext().log("Error scheduling job", e); - return; - } - aEvent.getServletContext().log("KiSS Crawler initialized"); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ - public void contextDestroyed(ServletContextEvent aEvent) { - aEvent.getServletContext().log("KiSS Crawler shutting down"); - try { - getScheduler().shutdown(); - } catch (Exception e) { - aEvent.getServletContext().log("Error scheduling job", e); - return; - } - aEvent.getServletContext().log("KiSS Crawler shut down complete"); - } - - /** - * Gets the scheduler from Spring. - * @return Scheduler. - */ - private CrawlerScheduler getScheduler() { - return BeanKernel.getBeanFactory().find(CrawlerScheduler.class); - } - - public static void main(String[] aArgs) throws Exception { - Application application = new Application(); - application.getScheduler().initialize(); - } -}