org.dbmaintain.script.runner.impl
Class JdbcScriptRunner

java.lang.Object
  extended by org.dbmaintain.script.runner.impl.JdbcScriptRunner
All Implemented Interfaces:
ScriptRunner

public class JdbcScriptRunner
extends Object
implements ScriptRunner

Default implementation of a script runner that uses JDBC to execute the script.

Author:
Filip Neven, Tim Ducheyne

Field Summary
protected  Map<String,ScriptParserFactory> databaseDialectScriptParserFactoryMap
           
protected  Databases databases
           
protected  SQLHandler sqlHandler
           
 
Constructor Summary
JdbcScriptRunner(Map<String,ScriptParserFactory> databaseDialectScriptParserFactoryMap, Databases databases, SQLHandler sqlHandler)
           
 
Method Summary
 void close()
          Stops the script runner, closing and cleaning up all open resources.
 void execute(Script script)
          Executes the given script.
protected  Database getTargetDatabaseDatabase(Script script)
           
 void initialize()
          Initializes the script runner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

databases

protected Databases databases

sqlHandler

protected SQLHandler sqlHandler

databaseDialectScriptParserFactoryMap

protected Map<String,ScriptParserFactory> databaseDialectScriptParserFactoryMap
Constructor Detail

JdbcScriptRunner

public JdbcScriptRunner(Map<String,ScriptParserFactory> databaseDialectScriptParserFactoryMap,
                        Databases databases,
                        SQLHandler sqlHandler)
Method Detail

execute

public void execute(Script script)
Executes the given script.

All statements should be separated with a semicolon (;). The last statement will be added even if it does not end with a semicolon.

Specified by:
execute in interface ScriptRunner
Parameters:
script - The script, not null

initialize

public void initialize()
Description copied from interface: ScriptRunner
Initializes the script runner.

Specified by:
initialize in interface ScriptRunner

close

public void close()
Description copied from interface: ScriptRunner
Stops the script runner, closing and cleaning up all open resources.

Specified by:
close in interface ScriptRunner

getTargetDatabaseDatabase

protected Database getTargetDatabaseDatabase(Script script)
Parameters:
script - The script, not null
Returns:
The db support to use for the script, not null


Copyright © 2011. All Rights Reserved.