throw new CPAConfigException("No engine specified "
+ "in database config '" + db + "'.");
}
String engine = database.getEngine().toString();
DatabaseChoice choice = database.getDatabaseChoice();
if (choice == null) {
throw new CPAConfigException("Neither driver, datasource nor jndi specified "
+ "in database config '" + db + "'.");
}
if (choice.getDriver() != null) {
return JDOConfFactory.createDatabase(name, engine,
createDriver(db, choice.getDriver()), mappings);
} else if (choice.getDataSource() != null) {
return JDOConfFactory.createDatabase(name, engine,
createDataSource(db, choice.getDataSource()), mappings);
} else if (choice.getJndi() != null) {
return JDOConfFactory.createDatabase(name, engine,
createJNDI(db, choice.getJndi()), mappings);
} else {
throw new CPAConfigException("Neither driver, datasource nor jndi specified "
+ "in database config '" + db + "'.");
}
}