public class TomcatJdbcPoolDatasourceAccessor implements DatasourceAccessor {
public DataSourceInfo getInfo(Object resource) throws Exception {
DataSourceInfo dataSourceInfo = null;
if (canMap(resource)) {
DataSource source = (DataSource) resource;
dataSourceInfo = new DataSourceInfo();
dataSourceInfo.setBusyConnections(source.getNumActive());
dataSourceInfo.setEstablishedConnections(source.getNumIdle() + source.getNumActive());
dataSourceInfo.setMaxConnections(source.getMaxActive());
dataSourceInfo.setJdbcURL(source.getUrl());
dataSourceInfo.setUsername(source.getUsername());
dataSourceInfo.setResettable(false);
}
return dataSourceInfo;
}