use of nl.nn.adapterframework.jms.JmsException in project iaf by ibissource.
the class ShowSecurityItems method addJmsRealms.
private void addJmsRealms(XmlBuilder securityItems, String confResString) {
List jmsRealms = JmsRealmFactory.getInstance().getRegisteredRealmNamesAsList();
XmlBuilder jrs = new XmlBuilder("jmsRealms");
securityItems.addSubElement(jrs);
for (int j = 0; j < jmsRealms.size(); j++) {
String jmsRealm = (String) jmsRealms.get(j);
String dsName = null;
String qcfName = null;
String tcfName = null;
String dsInfo = null;
String qcfInfo = null;
DirectQuerySender qs = (DirectQuerySender) ibisManager.getIbisContext().createBeanAutowireByName(DirectQuerySender.class);
qs.setJmsRealm(jmsRealm);
try {
dsName = qs.getDataSourceNameToUse();
dsInfo = qs.getDatasourceInfo();
} catch (JdbcException jdbce) {
// no datasource
}
if (StringUtils.isNotEmpty(dsName)) {
XmlBuilder jr = new XmlBuilder("jmsRealm");
jrs.addSubElement(jr);
jr.addAttribute("name", jmsRealm);
jr.addAttribute("datasourceName", dsName);
XmlBuilder infoElem = new XmlBuilder("info");
infoElem.setValue(dsInfo);
jr.addSubElement(infoElem);
if (confResString != null) {
String connectionPoolProperties;
try {
connectionPoolProperties = Misc.getConnectionPoolProperties(confResString, "JDBC", dsName);
} catch (Exception e) {
connectionPoolProperties = "*** ERROR ***";
}
if (StringUtils.isNotEmpty(connectionPoolProperties)) {
infoElem = new XmlBuilder("info");
infoElem.setValue(connectionPoolProperties);
jr.addSubElement(infoElem);
}
}
}
JmsSender js = new JmsSender();
js.setJmsRealm(jmsRealm);
try {
qcfName = js.getConnectionFactoryName();
qcfInfo = js.getConnectionFactoryInfo();
} catch (JmsException jmse) {
// no connectionFactory
}
if (StringUtils.isNotEmpty(qcfName)) {
XmlBuilder jr = new XmlBuilder("jmsRealm");
jrs.addSubElement(jr);
jr.addAttribute("name", jmsRealm);
jr.addAttribute("queueConnectionFactoryName", qcfName);
XmlBuilder infoElem = new XmlBuilder("info");
infoElem.setValue(qcfInfo);
jr.addSubElement(infoElem);
if (confResString != null) {
String connectionPoolProperties;
try {
connectionPoolProperties = Misc.getConnectionPoolProperties(confResString, "JMS", qcfName);
} catch (Exception e) {
connectionPoolProperties = "*** ERROR ***";
}
if (StringUtils.isNotEmpty(connectionPoolProperties)) {
infoElem = new XmlBuilder("info");
infoElem.setValue(connectionPoolProperties);
jr.addSubElement(infoElem);
}
}
}
tcfName = js.getTopicConnectionFactoryName();
if (StringUtils.isNotEmpty(tcfName)) {
XmlBuilder jr = new XmlBuilder("jmsRealm");
jrs.addSubElement(jr);
jr.addAttribute("name", jmsRealm);
jr.addAttribute("topicConnectionFactoryName", tcfName);
}
}
}
Aggregations