* @param jndiName the jndi name of the resource being used to get Connection from
* This resource can either be a pmf resource or a jdbc resource
* @return poolName of the pool that this resource directly/indirectly points to
*/
private PoolInfo getPoolNameFromResourceJndiName(ResourceInfo resourceInfo) {
PoolInfo poolInfo= null;
JdbcResource jdbcResource = null;
ResourceInfo actualResourceInfo = resourceInfo;
String jndiName = resourceInfo.getName();
actualResourceInfo =
new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
jdbcResource = (JdbcResource) runtime.getResources(actualResourceInfo).getResourceByName
(JdbcResource.class, actualResourceInfo.getName());
if(jdbcResource == null){
String suffix = ConnectorsUtil.getValidSuffix(jndiName);
if(suffix != null){
jndiName = jndiName.substring(0, jndiName.lastIndexOf(suffix));
actualResourceInfo =
new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
}
jdbcResource = (JdbcResource) runtime.getResources(actualResourceInfo).getResourceByName
(JdbcResource.class, actualResourceInfo.getName());
if (jdbcResource != null) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("jdbcRes is ---: " + jdbcResource.getJndiName());
_logger.fine("poolName is ---: " + jdbcResource.getPoolName());
}
}
if(jdbcResource != null){
poolInfo = new PoolInfo(jdbcResource.getPoolName(), actualResourceInfo.getApplicationName(),
actualResourceInfo.getModuleName());
}
return poolInfo;
}