Search in sources :

Example 1 with JmsRealm

use of nl.nn.adapterframework.jms.JmsRealm in project iaf by ibissource.

the class ShowSecurityItems method retrieveUsedJmsDestinations.

private List<JmsDestination> retrieveUsedJmsDestinations() throws DomBuilderException {
    List<JmsDestination> usedJmsDestinations = new ArrayList<JmsDestination>();
    StringBuilder config = new StringBuilder("<config>");
    for (Configuration configuration : ibisManager.getConfigurations()) {
        config.append(configuration.getLoadedConfiguration());
    }
    config.append("</config>");
    Document document = XmlUtils.buildDomDocument(config.toString());
    NodeList nodeList = document.getElementsByTagName("*");
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) node;
            if (element.hasAttribute("destinationName") && !"false".equalsIgnoreCase(element.getAttribute("lookupDestination"))) {
                JmsRealm jmsRealm = JmsRealmFactory.getInstance().getJmsRealm(element.getAttribute("jmsRealm"));
                if (jmsRealm != null) {
                    String connectionFactory = jmsRealm.retrieveConnectionFactoryName();
                    usedJmsDestinations.add(new JmsDestination(connectionFactory, element.getAttribute("destinationName")));
                }
            }
        }
    }
    return usedJmsDestinations;
}
Also used : JmsRealm(nl.nn.adapterframework.jms.JmsRealm) Configuration(nl.nn.adapterframework.configuration.Configuration) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document)

Aggregations

ArrayList (java.util.ArrayList)1 Configuration (nl.nn.adapterframework.configuration.Configuration)1 JmsRealm (nl.nn.adapterframework.jms.JmsRealm)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1