Search in sources :

Example 6 with JmsException

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);
        }
    }
}
Also used : JmsException(nl.nn.adapterframework.jms.JmsException) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder) DirectQuerySender(nl.nn.adapterframework.jdbc.DirectQuerySender) List(java.util.List) ArrayList(java.util.ArrayList) NodeList(org.w3c.dom.NodeList) JmsSender(nl.nn.adapterframework.jms.JmsSender) JdbcException(nl.nn.adapterframework.jdbc.JdbcException) ServletException(javax.servlet.ServletException) DomBuilderException(nl.nn.adapterframework.util.DomBuilderException) TransformerException(javax.xml.transform.TransformerException) JdbcException(nl.nn.adapterframework.jdbc.JdbcException) JmsException(nl.nn.adapterframework.jms.JmsException) IOException(java.io.IOException)

Aggregations

JmsException (nl.nn.adapterframework.jms.JmsException)6 IOException (java.io.IOException)3 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)3 ArrayList (java.util.ArrayList)2 JMSException (javax.jms.JMSException)2 Session (javax.jms.Session)2 DirectQuerySender (nl.nn.adapterframework.jdbc.DirectQuerySender)2 JmsSender (nl.nn.adapterframework.jms.JmsSender)2 BitronixTransactionManager (bitronix.tm.BitronixTransactionManager)1 PoolingDataSource (bitronix.tm.resource.jdbc.PoolingDataSource)1 PoolingConnectionFactory (bitronix.tm.resource.jms.PoolingConnectionFactory)1 Serializable (java.io.Serializable)1 SQLException (java.sql.SQLException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Destination (javax.jms.Destination)1 Message (javax.jms.Message)1 MessageConsumer (javax.jms.MessageConsumer)1 Queue (javax.jms.Queue)1