Iterator iterator = (mserver.queryMBeans(rname, null).iterator());
ArrayList results = new ArrayList();
while (iterator.hasNext()) {
ObjectInstance instance = (ObjectInstance) iterator.next();
ObjectName oname = instance.getObjectName();
try {
// only add resource mbean if definition exists
mserver.getAttribute(oname, "driverClassName");
results.add(oname.toString());
} catch (AttributeNotFoundException ex) {
// if context resource definition doesn't exist
// get the global resource definition
if (resourcetype.equals("Context")) {
rname = new ObjectName( domain + RESOURCE_TYPE +
GLOBAL_TYPE + ",class=" + DATASOURCE_CLASS + ",*");
Iterator globalIter = (mserver.queryMBeans(rname, null).iterator());
while (globalIter.hasNext()) {
ObjectInstance globalInstance =
(ObjectInstance) globalIter.next();
ObjectName globalOname = globalInstance.getObjectName();
mserver.getAttribute(globalOname, "driverClassName");
results.add(globalOname.toString());
}
}
}