public CommonDataSource pool(final String name, final String driver, final Properties properties) {
// bonecp already have a kind of ObjectRecipe so simply giving it the values
final Properties props = new Properties();
props.put("properties", prefixedProps(properties));
final BoneCPDataSource ds = build(BoneCPDataSource.class, props);
if (ds.getDriverClass() == null || ds.getDriverClass().isEmpty()) {
ds.setDriverClass(driver);
}
if (ds.getPoolName() == null || ds.getPoolName().isEmpty()) {
ds.setPoolName(name);
}
final String xa = String.class.cast(properties.remove("XaDataSource"));
if (xa != null) {
cleanProperty(ds, "xadatasource");
final XADataSource xaDs = XADataSourceResource.proxy(Thread.currentThread().getContextClassLoader(), xa);
ds.setDatasourceBean(new ManagedXADataSource(xaDs, OpenEJB.getTransactionManager()));
}
return ds;
}