private void loadConnectionFactory(ActionRequest actionRequest, String adapterName, String factoryName, PoolData data) {
AbstractName abstractAdapterName = new AbstractName(URI.create(adapterName));
AbstractName abstractFactoryName = new AbstractName(URI.create(factoryName));
ResourceAdapterModule adapter = (ResourceAdapterModule) PortletManager.getManagedBean(actionRequest,abstractAdapterName);
JCAManagedConnectionFactory factory = (JCAManagedConnectionFactory) PortletManager.getManagedBean(actionRequest, abstractFactoryName);
data.adapterDisplayName = adapter.getDisplayName();
data.adapterDescription = adapter.getDescription();
try {
data.name = (String)abstractFactoryName.getName().get("name");
if(data.isGeneric()) {
data.url = (String) factory.getConfigProperty("ConnectionURL");
data.driverClass = (String) factory.getConfigProperty("Driver");
data.user = (String) factory.getConfigProperty("UserName");
data.password = (String) factory.getConfigProperty("Password");
} else {
ResourceAdapterParams params = getRARConfiguration(actionRequest, data.getRarPath(), data.getAdapterDisplayName(), adapterName);
for(int i=0; i<params.getConfigParams().length; i++) {
ConfigParam cp = params.getConfigParams()[i];
Object value = factory.getConfigProperty(cp.getName());
data.properties.put("property-"+cp.getName(), value == null ? null : value.toString());
}
}
} catch (Exception e) {
log.error("Unable to look up connection property", e);
}
//todo: push the lookup into ManagementHelper
PoolingAttributes pool = (PoolingAttributes) factory.getConnectionManager();
data.minSize = Integer.toString(pool.getPartitionMinSize());
data.maxSize = Integer.toString(pool.getPartitionMaxSize());
data.blockingTimeout = Integer.toString(pool.getBlockingTimeoutMilliseconds());
data.idleTimeout = Integer.toString(pool.getIdleTimeoutMinutes());