final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory.newInstance(DbAdapter.class,
JdbcAdapter.class.getName()) : (DbAdapter) objectFactory.newInstance(DbAdapter.class, adapter);
// Load the data map and run the db generator.
DataMap dataMap = loadDataMap();
DbGenerator generator = new DbGenerator(adapterInst, dataMap, NoopJdbcEventLogger.getInstance());
generator.setShouldCreateFKConstraints(createFK);
generator.setShouldCreatePKSupport(createPK);
generator.setShouldCreateTables(createTables);
generator.setShouldDropPKSupport(dropPK);
generator.setShouldDropTables(dropTables);
// load driver taking custom CLASSPATH into account...
DriverDataSource dataSource = new DriverDataSource((Driver) Class.forName(driver).newInstance(), url,
username, password);
generator.runGenerator(dataSource);
} catch (Exception ex) {
Throwable th = Util.unwindException(ex);
String message = "Error generating database";