org.apache.shale.examples.mailreader
Class ApplicationListener

java.lang.Object
  extended by org.apache.shale.examples.mailreader.ApplicationListener
All Implemented Interfaces:
EventListener, ServletContextListener

public final class ApplicationListener
extends Object
implements ServletContextListener

ServletContextListener that initializes and finalizes the persistent storage of User and Subscription information for the Struts Demonstration Application, using an in-memory database backed by an XML file.

IMPLEMENTATION WARNING - If this web application is run from a WAR file, or in another environment where reading and writing of the web application resource is impossible, the initial contents will be copied to a file in the web application temporary directory provided by the container. This is for demonstration purposes only - you should NOT assume that files written here will survive a restart of your servlet container.


Field Summary
static String DATABASE_KEY
          Appication scope attribute key under which the in-memory version of our database is stored.
static String PROTOCOLS_KEY
          Application scope attribute key under which the valid selection items for the protocol property is stored.
 
Constructor Summary
ApplicationListener()
           
 
Method Summary
 void contextDestroyed(ServletContextEvent event)
          Gracefully shut down this database, releasing any resources that were allocated at initialization.
 void contextInitialized(ServletContextEvent event)
          Initialize and load our initial database from persistent storage.
 String getPathname()
           
 void setPathname(String pathname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_KEY

public static final String DATABASE_KEY

Appication scope attribute key under which the in-memory version of our database is stored.

See Also:
Constant Field Values

PROTOCOLS_KEY

public static final String PROTOCOLS_KEY

Application scope attribute key under which the valid selection items for the protocol property is stored.

See Also:
Constant Field Values
Constructor Detail

ApplicationListener

public ApplicationListener()
Method Detail

getPathname

public String getPathname()

setPathname

public void setPathname(String pathname)

contextDestroyed

public void contextDestroyed(ServletContextEvent event)

Gracefully shut down this database, releasing any resources that were allocated at initialization.

Specified by:
contextDestroyed in interface ServletContextListener
Parameters:
event - ServletContextEvent to process

contextInitialized

public void contextInitialized(ServletContextEvent event)

Initialize and load our initial database from persistent storage.

Specified by:
contextInitialized in interface ServletContextListener
Parameters:
event - The context initialization event
Throws:
ServletException - if we cannot configure ourselves correctly


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.