Search in sources :

Example 26 with JdbcException

use of nl.nn.adapterframework.jdbc.JdbcException 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

JdbcException (nl.nn.adapterframework.jdbc.JdbcException)26 SQLException (java.sql.SQLException)19 IOException (java.io.IOException)15 PreparedStatement (java.sql.PreparedStatement)13 ResultSet (java.sql.ResultSet)9 JMSException (javax.jms.JMSException)9 DataFormatException (java.util.zip.DataFormatException)8 Connection (java.sql.Connection)7 InputStream (java.io.InputStream)6 SenderException (nl.nn.adapterframework.core.SenderException)6 FileNotFoundException (java.io.FileNotFoundException)5 File (java.io.File)4 FileInputStream (java.io.FileInputStream)4 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)4 InputStreamReader (java.io.InputStreamReader)3 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)3 FixedQuerySender (nl.nn.adapterframework.jdbc.FixedQuerySender)3 JmsException (nl.nn.adapterframework.jms.JmsException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2