}
// the xapool wrapper class
String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class");
StandardXADataSource ds = null;
try {
//ds = new StandardXADataSource();
ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass);
pds = new StandardXAPoolDataSource();
} catch (NoClassDefFoundError e) {
throw new GenericEntityException("Cannot find xapool.jar");
} catch (ClassNotFoundException e) {
throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e);
} catch (InstantiationException e) {
throw new GenericEntityException("Unable to instantiate " + wrapperClass, e);
} catch (IllegalAccessException e) {
throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);
}
if (ds == null)
throw new GenericEntityException("StandardXaDataSource was not created, big problem!");
ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver"));
ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri"));
ds.setUser(jotmJdbcElement.getAttribute("jdbc-username"));
ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password"));
ds.setDescription(helperName);
ds.setTransactionManager(TransactionFactory.getTransactionManager());
String transIso = jotmJdbcElement.getAttribute("isolation-level");
if (transIso != null && transIso.length() > 0) {
if ("Serializable".equals(transIso)) {
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
} else if ("RepeatableRead".equals(transIso)) {
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
} else if ("ReadUncommitted".equals(transIso)) {
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
} else if ("ReadCommitted".equals(transIso)) {
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
} else if ("None".equals(transIso)) {
((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
}
}
// set the datasource in the pool
pds.setDataSource(ds);
pds.setDescription(ds.getDescription());
pds.setUser(ds.getUser());
pds.setPassword(ds.getPassword());
Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);
// set the transaction manager in the pool
pds.setTransactionManager(TransactionFactory.getTransactionManager());
// configure the pool settings