Class klass = Class.forName(createHandlerClassName);
if (klass != null)
{
CreateHandler createHandler = (CreateHandler) klass.newInstance();
createHandler.setConnection(connection);
createHandler.createTables(req, persistentFactory, connection, log);
}
else
{
log
.error("CreateDatabase: Unable to find create handler for module '"
+ moduleId + "'");
}
}
catch (ClassNotFoundException x)
{
log.error("CreateDatabase: Unable call create handler for module '" + moduleId + "': " + x);
}
catch (Exception x)
{
res.addOutput("databaseError", x.getMessage());
res.addOutput("databaseErrorStackTrace", StringTools.stackTraceToString(x).replaceAll("\n",
"<br>"));
return res;
}
}
}
}
catch (SQLException x)
{
log.error("Unable to create database connection", x);
}
finally
{
try
{
connection.close();
}
catch (SQLException x)
{
}
}
connection = null;
try
{
connection = dataSourceComponent.getConnection();
for (Configuration moduleConfig : moduleConfigs)
{
String moduleId = moduleConfig.getAttribute("id", "unkown");
String createHandlerClassName = moduleConfig.getChild("create").getAttribute("class", null);
if (createHandlerClassName != null)
{
try
{
System.out.println("CreateDatabase: Creating data of module '" + moduleId
+ "' with handler '" + createHandlerClassName + "'");
Class klass = Class.forName(createHandlerClassName);
if (klass != null)
{
CreateHandler createHandler = (CreateHandler) klass.newInstance();
createHandler.setConnection(connection);
createHandler.createData(persistentFactory, connection, log, req);
}
else
{
log
.error("CreateDatabase: Unable to find create handler for module '"