*/
public void initializeFactory() throws MappingException {
Enumeration params;
Param param;
DatabaseChoice dbChoice = getDatabase().getDatabaseChoice();
String driverName = dbChoice.getDriver().getClassName();
if (driverName != null) {
try {
Class.forName(driverName).newInstance();
} catch (InstantiationException e) {
String msg = Messages.format(
"jdo.engine.classNotInstantiable", driverName);
LOG.error(msg, e);
throw new MappingException(msg, e);
} catch (IllegalAccessException e) {
String msg = Messages.format(
"jdo.engine.classNotAccessable", driverName, "constructor");
LOG.error(msg, e);
throw new MappingException(msg, e);
} catch (ClassNotFoundException e) {
String msg = "Can not load class " + driverName;
LOG.error(msg, e);
throw new MappingException(msg, e);
}
}
try {
Driver driver = dbChoice.getDriver();
if (DriverManager.getDriver(driver.getUrl()) == null) {
String msg = Messages.format("jdo.missingDriver", driver.getUrl());
LOG.error(msg);
throw new MappingException(msg);
}
} catch (SQLException ex) {
throw new MappingException(ex);
}
_url = dbChoice.getDriver().getUrl();
_props = new Properties();
params = dbChoice.getDriver().enumerateParam();
while (params.hasMoreElements()) {
param = (Param) params.nextElement();
_props.put(param.getName(), param.getValue());
}