net.sf.xsnapshot.web
Class XSnapshotContextLoader

java.lang.Object
  extended bynet.sf.xsnapshot.web.XSnapshotContextLoader
All Implemented Interfaces:
EventListener, ServletContextListener

public class XSnapshotContextLoader
extends Object
implements ServletContextListener

this file configures an instance of XSnapshotRegistry based on an xsnapshot properties file, and by default saves it in XSnapshotRegistrySingleton. it expects that there is a servlet context init-param named xsnapshot.properties which specifies the location of the properties file. This can either be a URL, a classpath pseudo-url (that starts with classpath:), or a location under the web application root (must start with / in that case)

Author:
Daniel Kokotov

Constructor Summary
XSnapshotContextLoader()
           
 
Method Summary
 void contextDestroyed(ServletContextEvent arg0)
           
 void contextInitialized(ServletContextEvent sce)
           
protected  URL getConfigurationURL(ServletContextEvent sce)
          Obtains a URL pointing to the configuration xml file
protected  String getContextParameter()
          returns the string "xsnapshot.properties"
protected  void handleRegistry(XSnapshotRegistry registry, ServletContextEvent sce)
          Called after the registry has been configured.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSnapshotContextLoader

public XSnapshotContextLoader()
Method Detail

getContextParameter

protected String getContextParameter()
returns the string "xsnapshot.properties"


contextInitialized

public void contextInitialized(ServletContextEvent sce)
Specified by:
contextInitialized in interface ServletContextListener

getConfigurationURL

protected URL getConfigurationURL(ServletContextEvent sce)
                           throws RuntimeException,
                                  MalformedURLException
Obtains a URL pointing to the configuration xml file

Throws:
RuntimeException - if the input stream cannot be opened.
MalformedURLException
See Also:
getContextParameter()

handleRegistry

protected void handleRegistry(XSnapshotRegistry registry,
                              ServletContextEvent sce)
Called after the registry has been configured. This default implementation stores the configured registry in XSnapshotRegistrySingleton. default implementation stores it in the XSnapshotRegistrySingleton.

Parameters:
registry -
sce -

contextDestroyed

public void contextDestroyed(ServletContextEvent arg0)
Specified by:
contextDestroyed in interface ServletContextListener