org.formaria.data.sql
Class DatabaseLifecycleListener

java.lang.Object
  extended by org.formaria.data.sql.DatabaseLifecycleListener
All Implemented Interfaces:
LifeCycleListener

public class DatabaseLifecycleListener
extends java.lang.Object
implements LifeCycleListener

A shutdown/lifecycle listener designed for database like the standalone or in-memory version of HSQLDB. The listener calls SHUTDOWN on the database so as to give the database a chance to save any modified tables and records before the JVM exits. The listener is added by referencing it in the startup properties vile via the LifeCycleListener entry.

Copyright (c) Formaria Ltd., 2008. See license.txt for license details

$Revision: 2.1 $


Field Summary
protected  Project currentProject
           
 
Constructor Summary
DatabaseLifecycleListener()
           
 
Method Summary
 boolean canClose(Project project)
          Can the current project close?
 void initialize(Project project)
          Called when the application/applet has been created and initialized.
 void shutdown()
          Called when the application/applet has been shutdown and is about to exit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentProject

protected Project currentProject
Constructor Detail

DatabaseLifecycleListener

public DatabaseLifecycleListener()
Method Detail

initialize

public void initialize(Project project)
Called when the application/applet has been created and initialized. Does nothing in this instance

Specified by:
initialize in interface LifeCycleListener
Parameters:
project - the owner project

shutdown

public void shutdown()
Called when the application/applet has been shutdown and is about to exit. Calls SHUTDOWN on the database

Specified by:
shutdown in interface LifeCycleListener

canClose

public boolean canClose(Project project)
Can the current project close?

Specified by:
canClose in interface LifeCycleListener
Parameters:
project - the project initiating the shutdown
Returns:
true if the application can close