fr.ifremer.echobase.ui
Class EchoBaseApplicationListener

java.lang.Object
  extended by fr.ifremer.echobase.ui.EchoBaseApplicationListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class EchoBaseApplicationListener
extends Object
implements javax.servlet.ServletContextListener

To listen start or end of the application.

On start we will load the configuration and check connection to internal database, creates schema and create an admin user in none found in database.

On stop, just release the application configuration.

Since:
0.1
Author:
tchemit

Field Summary
protected static org.apache.commons.logging.Log log
          Logger.
 
Constructor Summary
EchoBaseApplicationListener()
           
 
Method Summary
protected  void closeTransaction(org.nuiton.topia.TopiaContext tx)
          Try to close the given transaction.
 void contextDestroyed(javax.servlet.ServletContextEvent sce)
           
 void contextInitialized(javax.servlet.ServletContextEvent sce)
           
protected  void createAdminUser(EchoBaseApplicationContext applicationContext)
          Creates the adminsitrator (admin/admin) on the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Logger.

Constructor Detail

EchoBaseApplicationListener

public EchoBaseApplicationListener()
Method Detail

contextInitialized

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

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent sce)
Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

createAdminUser

protected void createAdminUser(EchoBaseApplicationContext applicationContext)
                        throws org.nuiton.topia.TopiaException
Creates the adminsitrator (admin/admin) on the database.

Parameters:
applicationContext - application context
Throws:
org.nuiton.topia.TopiaException - if could not create the user.

closeTransaction

protected void closeTransaction(org.nuiton.topia.TopiaContext tx)
                         throws org.nuiton.topia.TopiaException
Try to close the given transaction.

Parameters:
tx - the transaction to close
Throws:
org.nuiton.topia.TopiaException - if could not close the transaction


Copyright © 2011-2012 Ifremer. All Rights Reserved.