net.sf.jabb.util.db
Class StartAndStopSQL
java.lang.Object
net.sf.jabb.util.db.StartAndStopSQL
- All Implemented Interfaces:
- org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle
public class StartAndStopSQL
- extends Object
- implements org.springframework.context.Lifecycle, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Helper class to execute SQL when Spring context starts and stops.
It should be used as singleton.
- Author:
- James Hu
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UNKNOWN
protected static final int UNKNOWN
- See Also:
- Constant Field Values
STARTING
protected static final int STARTING
- See Also:
- Constant Field Values
RUNNING
protected static final int RUNNING
- See Also:
- Constant Field Values
STOPPING
protected static final int STOPPING
- See Also:
- Constant Field Values
stateNames
protected static final String[] stateNames
state
protected AtomicInteger state
dataSource
protected DataSource dataSource
startSQL
protected String startSQL
stopSQL
protected String stopSQL
StartAndStopSQL
public StartAndStopSQL()
executeSQL
protected void executeSQL(String sql)
- Execute one SQL statement. RuntimeException will be thrown if SQLException was caught.
- Parameters:
sql - the statement to be executed
isRunning
public boolean isRunning()
- Specified by:
isRunning in interface org.springframework.context.Lifecycle
start
public void start()
- Specified by:
start in interface org.springframework.context.Lifecycle
stop
public void stop()
- Specified by:
stop in interface org.springframework.context.Lifecycle
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
- Throws:
Exception
destroy
public void destroy()
throws Exception
- Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
- Throws:
Exception
getDataSource
public DataSource getDataSource()
setDataSource
public void setDataSource(DataSource dataSource)
getStartSQL
public String getStartSQL()
setStartSQL
public void setStartSQL(String startSQL)
getStopSQL
public String getStopSQL()
setStopSQL
public void setStopSQL(String shutdownSQL)
Copyright © 2012. All Rights Reserved.