if ((data != null && dataURL == null) || tablesURL == null)
return;
// set up log buffers for capturing DbLoader output.
Configuration config = new Configuration();
StringWriter logBfr = new StringWriter();
PrintWriter logWriter = new PrintWriter(logBfr);
config.setLog(logWriter);
StringWriter scriptLog = null;
if (createScript)
{
scriptLog = new StringWriter();
PrintWriter scriptWriter = new PrintWriter(scriptLog);
config.setScriptWriter(scriptWriter);
}
// load default config
DbLoader.loadConfiguration(config);
// set overrides for car table loading
config.setCreateTables(createTables);
config.setDropTables(dropTables);
config.setPopulateTables(populateTables);
config.setTablesURL(tablesURL);
config.setDataURL(dataURL);
DbLoader loader = new DbLoader(config);
String dataString = "(no data definition)";
if (dataURL != null) {
dataString = dataURL.toString();
}
try
{
loader.process();
logWriter.flush();
if (config.getScriptWriter() != null )
config.getScriptWriter().flush();
if (log.isInfoEnabled())
log.info(
"***** Successfully processed *****\n"
+ tablesURL
+ " and \n"