java.util.Map<String,JmsHost> hostMap =
rep.getResolvedLocalJmsHostsInCluster(target);
if ( hostMap.size() == 0 ) {
String msg = sm.getString("mqjmx.no_jms_hosts");
throw new ConnectorRuntimeException(msg);
}
list = new MQAddressList();
for (JmsHost host : hostMap.values()) {
list.addMQUrl(host);
}
}
String connectionUrl = list.toString();
String adminUserName = null;
String adminPassword = null;
JmsHost jmsHost = getDefaultJmsHost(jmsService);
if (jmsHost != null && jmsHost.isEnabled()) {
adminUserName = jmsHost.getAdminUserName();
adminPassword = jmsHost.getAdminPassword();
} else {
logFine(" _getMQJMXConnectorInfo, using default jms admin user and password ");
}
raInstance = getConfiguredRA(mqRAClassName, connectionUrl,
adminUserName, adminPassword);
} catch (Exception e) {
e.printStackTrace();
ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
cre.initCause(e);
throw cre;
}
try {
String jmxServiceURL = null, jmxServiceURLList = null;
Map<String, ?> jmxConnectorEnv = null;
Method[] methds = raInstance.getClass().getMethods();
for (int i = 0; i < methds.length; i++) {
Method m = methds[i];
if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("")){
jmxServiceURL = getFirstJMXServiceURL(jmxServiceURLList);
}
} else if (m.getName().equalsIgnoreCase("get" + JMXCONNECTORENV)){
jmxConnectorEnv = (Map<String,?>)m.invoke(raInstance, new Object[]{});
}
}
MQJMXConnectorInfo mqInfo = new MQJMXConnectorInfo(target,
ActiveJmsResourceAdapter.getBrokerInstanceName(jmsService) ,
jmsService.getType(), jmxServiceURL, jmxConnectorEnv);
return mqInfo;
} catch (Exception e) {
e.printStackTrace();
ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
cre.initCause(e);
throw cre;
}
}