View Javadoc

1   /*$Id: LifecycleListener.java,v 1.2 2004/11/05 16:52:42 jdt Exp $
2    * Created on 16-Sep-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.jes.servlet;
12  
13  import org.astrogrid.jes.component.JesComponentManagerFactory;
14  
15  import org.apache.commons.logging.Log;
16  import org.apache.commons.logging.LogFactory;
17  
18  import javax.servlet.ServletContextEvent;
19  import javax.servlet.ServletContextListener;
20  
21  /*** receives notifications of the servlet context (i.e. the cea webapp) starting up and shutting down. passes this on to the component manager.
22   * @author Noel Winstanley nw@jb.man.ac.uk 16-Sep-2004
23   *
24   */
25  public class LifecycleListener implements ServletContextListener {
26      /***
27       * Commons Logger for this class
28       */
29      private static final Log logger = LogFactory
30              .getLog(LifecycleListener.class);
31  
32      /*** Construct a new LifecycleListener
33       * 
34       */
35      public LifecycleListener() {
36          super();
37      }
38  
39      /***
40       * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
41       */
42      public void contextInitialized(ServletContextEvent arg0) {
43          // don't now if this helps - leave off for now.
44         // logger.info("Starting component manager");
45         // logger.info(JesComponentManagerFactory.getInstance().information()); // this does the 'start'
46      }
47  
48      /***
49       * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
50       */
51      public void contextDestroyed(ServletContextEvent arg0) {
52          logger.info("Stopping component manager");
53          JesComponentManagerFactory.getInstance().stop();
54          logger.info("Stopped component manager");
55      }
56  
57  }
58  
59  
60  /* 
61  $Log: LifecycleListener.java,v $
62  Revision 1.2  2004/11/05 16:52:42  jdt
63  Merges from branch nww-itn07-scratchspace
64  
65  Revision 1.1.18.1  2004/11/05 15:45:26  nw
66  tidied imports
67  
68  Revision 1.1  2004/09/16 21:44:14  nw
69  added lifecycle listener to shut things down cleanly
70   
71  */