// list-jmsdest
public JMSDestinationInfo [] listJMSDestinations(String tgtName, String destType)
throws JMSAdminException {
sLogger.log(Level.FINE, "listJMSDestination ...");
MQJMXConnectorInfo mqInfo = getMQJMXConnectorInfo(tgtName);
//MBeanServerConnection mbsc = getMBeanServerConnection(tgtName);
try {
MBeanServerConnection mbsc = mqInfo.getMQMBeanServerConnection();
ObjectName on = new ObjectName(
MQObjectName.DESTINATION_MANAGER_CONFIG_MBEAN_NAME);
String [] signature = null;
Object [] params = null;
ObjectName [] dests = (ObjectName [])mbsc.invoke(on, "getDestinations", params, signature);
if ((dests != null) && (dests.length > 0)) {
List<JMSDestinationInfo> jmsdi = new ArrayList<JMSDestinationInfo>();
for (int i=0; i<dests.length; i++) {
on = dests[i];
String jdiType = DestinationType.toStringLabel(on.getKeyProperty("desttype"));
String jdiName = on.getKeyProperty("name");
// check if the destination name has double quotes at the beginning
// and end, if yes strip them
if ((jdiName != null) && (jdiName.length() > 1)) {
if (jdiName.indexOf('"') == 0) {
jdiName = jdiName.substring(1);
}
if (jdiName.lastIndexOf('"') == (jdiName.length() - 1)) {
jdiName = jdiName.substring(0, jdiName.lastIndexOf('"'));
}
}
JMSDestinationInfo jdi = new JMSDestinationInfo(jdiName, jdiType);
if(destType == null) {
jmsdi.add(jdi);
} else if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC)
|| destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE)) {
//Physical Destination Type specific listing
if (jdiType.equalsIgnoreCase(destType)) {
jmsdi.add(jdi);
}
}
}
return (JMSDestinationInfo[]) jmsdi.toArray(new JMSDestinationInfo[]{});
}
} catch (Exception e) {
//log JMX Exception trace as WARNING
logAndHandleException(e, "admin.mbeans.rmb.error_listing_jms_dest");
} finally {
try {
if(mqInfo != null) {
mqInfo.closeMQMBeanServerConnection();
}
} catch (Exception e) {
handleException(e);
}
}