org.springbyexample.jdbc.core
Class SqlScriptProcessor

java.lang.Object
  extended by org.springbyexample.jdbc.core.SqlScriptProcessor
All Implemented Interfaces:
InitializingBean, ResourceLoaderAware

public class SqlScriptProcessor
extends Object
implements InitializingBean, ResourceLoaderAware

Processes sql scripts. A list of scripts or script locations can be set. Spring ResourceLoader is used so valid scripts locations are classpath, file, http, ftp. etc.

Author:
David Winterfeldt

Field Summary
protected  boolean initOnStartup
           
protected  List<String> lSqlScripts
           
protected  ResourceLoader resourceLoader
           
protected  JdbcTemplate template
           
 
Constructor Summary
SqlScriptProcessor()
           
 
Method Summary
 void afterPropertiesSet()
          Implementation of IntializingBean.
 List<String> getSqlScripts()
          Gets SQL scripts.
 boolean isInitOnStartup()
          Whether or not SQL scripts on startup.
 void process()
          Initializes SQL scripts.
 void setDataSource(DataSource dataSource)
          Sets DataSource.
 void setInitOnStartup(boolean initOnStartup)
          Sets whether or not SQL scripts run on statup.
 void setResourceLoader(ResourceLoader resourceLoader)
          Implementation of ResourceLoaderAware.
 void setSqlScripts(List<String> lSqlScripts)
          Sets SQL scripts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

protected JdbcTemplate template

resourceLoader

protected ResourceLoader resourceLoader

initOnStartup

protected boolean initOnStartup

lSqlScripts

protected List<String> lSqlScripts
Constructor Detail

SqlScriptProcessor

public SqlScriptProcessor()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
Sets DataSource.


isInitOnStartup

public boolean isInitOnStartup()
Whether or not SQL scripts on startup. Default is false.


setInitOnStartup

public void setInitOnStartup(boolean initOnStartup)
Sets whether or not SQL scripts run on statup. Default is false.


getSqlScripts

public List<String> getSqlScripts()
Gets SQL scripts.


setSqlScripts

public void setSqlScripts(List<String> lSqlScripts)
Sets SQL scripts.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Implementation of IntializingBean.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

setResourceLoader

public void setResourceLoader(ResourceLoader resourceLoader)
Implementation of ResourceLoaderAware.

Specified by:
setResourceLoader in interface ResourceLoaderAware

process

public void process()
             throws IOException
Initializes SQL scripts.

Throws:
IOException


Copyright © 2008 Spring by Example. All Rights Reserved.