public List getApplicationResources() throws NamingException {
List resources = new ArrayList();
MBeanServer server = getMBeanServer();
if (server != null) {
try {
Set dsNames = server.queryNames(new ObjectName("jboss.jca:service=ManagedConnectionPool,*"), null);
for (Iterator it = dsNames.iterator(); it.hasNext();) {
ObjectName managedConnectionPoolOName = (ObjectName) it.next();
ApplicationResource resource = new ApplicationResource();
resource.setName(managedConnectionPoolOName.getKeyProperty("name"));
resource.setType("jboss");
String criteria = (String) server.getAttribute(managedConnectionPoolOName, "Criteria");
if ("ByApplication".equals(criteria)) {
resource.setAuth("Application");
} else if ("ByContainerAndApplication".equals(criteria)) {
resource.setAuth("Both");
} else {
resource.setAuth("Container");
}
DataSourceInfo dsInfo = new DataSourceInfo();
dsInfo.setMaxConnections(((Integer) server.getAttribute(managedConnectionPoolOName, "MaxSize")).intValue());
dsInfo.setEstablishedConnections(((Integer) server.getAttribute(managedConnectionPoolOName, "ConnectionCount")).intValue());
dsInfo.setBusyConnections(((Long) server.getAttribute(managedConnectionPoolOName, "InUseConnectionCount")).intValue());
ObjectName connectionFactoryOName = new ObjectName("jboss.jca:service=ManagedConnectionFactory,name=" + resource.getName());
Element elm = (Element) server.getAttribute(connectionFactoryOName, "ManagedConnectionFactoryProperties");
if (elm != null) {
NodeList nl = elm.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node n = nl.item(i);