Search in sources :

Example 1 with JdbcSenderBase

use of nl.nn.adapterframework.jdbc.JdbcSenderBase in project iaf by ibissource.

the class ShowConfigurationStatus method mapAdapterPipes.

private ArrayList<Object> mapAdapterPipes(Adapter adapter) {
    if (!adapter.configurationSucceeded())
        return null;
    PipeLine pipeline = adapter.getPipeLine();
    int totalPipes = pipeline.getPipes().size();
    ArrayList<Object> pipes = new ArrayList<Object>(totalPipes);
    for (int i = 0; i < totalPipes; i++) {
        Map<String, Object> pipesInfo = new HashMap<String, Object>();
        IPipe pipe = pipeline.getPipe(i);
        Map<String, PipeForward> pipeForwards = pipe.getForwards();
        String pipename = pipe.getName();
        Map<String, String> forwards = new HashMap<String, String>();
        for (PipeForward fwrd : pipeForwards.values()) {
            forwards.put(fwrd.getName(), fwrd.getPath());
        }
        pipesInfo.put("name", pipename);
        pipesInfo.put("type", pipe.getType());
        pipesInfo.put("forwards", forwards);
        if (pipe instanceof MessageSendingPipe) {
            MessageSendingPipe msp = (MessageSendingPipe) pipe;
            ISender sender = msp.getSender();
            pipesInfo.put("sender", ClassUtils.nameOf(sender));
            if (sender instanceof WebServiceSender) {
                WebServiceSender s = (WebServiceSender) sender;
                Map<String, Object> certInfo = addCertificateInfo(s);
                if (certInfo != null)
                    pipesInfo.put("certificate", certInfo);
            }
            if (sender instanceof HttpSender) {
                HttpSender s = (HttpSender) sender;
                Map<String, Object> certInfo = addCertificateInfo(s);
                if (certInfo != null)
                    pipesInfo.put("certificate", certInfo);
            }
            if (sender instanceof FtpSender) {
                FtpSender s = (FtpSender) sender;
                Map<String, Object> certInfo = addCertificateInfo(s);
                if (certInfo != null)
                    pipesInfo.put("certificate", certInfo);
            }
            if (sender instanceof HasPhysicalDestination) {
                pipesInfo.put("destination", ((HasPhysicalDestination) sender).getPhysicalDestinationName());
            }
            if (sender instanceof JdbcSenderBase) {
                pipesInfo.put("isJdbcSender", true);
            }
            IListener listener = msp.getListener();
            if (listener != null) {
                pipesInfo.put("listenerName", listener.getName());
                pipesInfo.put("listenerClass", ClassUtils.nameOf(listener));
                if (listener instanceof HasPhysicalDestination) {
                    String pd = ((HasPhysicalDestination) listener).getPhysicalDestinationName();
                    pipesInfo.put("listenerDestination", pd);
                }
            }
            ITransactionalStorage messageLog = msp.getMessageLog();
            if (messageLog != null) {
                pipesInfo.put("hasMessageLog", true);
                String messageLogCount;
                try {
                    if (showCountMessageLog) {
                        messageLogCount = "" + messageLog.getMessageCount();
                    } else {
                        messageLogCount = "?";
                    }
                } catch (Exception e) {
                    log.warn(e);
                    messageLogCount = "error";
                }
                pipesInfo.put("messageLogCount", messageLogCount);
                Map<String, Object> message = new HashMap<String, Object>();
                message.put("name", messageLog.getName());
                message.put("type", "log");
                message.put("slotId", messageLog.getSlotId());
                message.put("count", messageLogCount);
                pipesInfo.put("message", message);
            }
        }
        pipes.add(pipesInfo);
    }
    return pipes;
}
Also used : MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) IListener(nl.nn.adapterframework.core.IListener) ArrayList(java.util.ArrayList) FtpSender(nl.nn.adapterframework.ftp.FtpSender) HttpSender(nl.nn.adapterframework.http.HttpSender) PipeForward(nl.nn.adapterframework.core.PipeForward) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage) ISender(nl.nn.adapterframework.core.ISender) WebServiceSender(nl.nn.adapterframework.http.WebServiceSender) PipeLine(nl.nn.adapterframework.core.PipeLine) IPipe(nl.nn.adapterframework.core.IPipe) JdbcSenderBase(nl.nn.adapterframework.jdbc.JdbcSenderBase) HasPhysicalDestination(nl.nn.adapterframework.core.HasPhysicalDestination)

Example 2 with JdbcSenderBase

use of nl.nn.adapterframework.jdbc.JdbcSenderBase in project iaf by ibissource.

the class ShowConfigurationStatus method toPipesXml.

private XmlBuilder toPipesXml(Adapter adapter) {
    XmlBuilder pipesElem = new XmlBuilder("pipes");
    PipeLine pipeline = adapter.getPipeLine();
    for (int i = 0; i < pipeline.getPipes().size(); i++) {
        IPipe pipe = pipeline.getPipe(i);
        String pipename = pipe.getName();
        if (pipe instanceof MessageSendingPipe) {
            MessageSendingPipe msp = (MessageSendingPipe) pipe;
            XmlBuilder pipeElem = new XmlBuilder("pipe");
            pipeElem.addAttribute("name", pipename);
            pipesElem.addSubElement(pipeElem);
            ISender sender = msp.getSender();
            pipeElem.addAttribute("sender", ClassUtils.nameOf(sender));
            if (sender instanceof HasPhysicalDestination) {
                pipeElem.addAttribute("destination", ((HasPhysicalDestination) sender).getPhysicalDestinationName());
            }
            if (sender instanceof JdbcSenderBase) {
                pipeElem.addAttribute("isJdbcSender", "true");
            }
            IListener listener = msp.getListener();
            if (listener != null) {
                pipeElem.addAttribute("listenerName", listener.getName());
                pipeElem.addAttribute("listenerClass", ClassUtils.nameOf(listener));
                if (listener instanceof HasPhysicalDestination) {
                    String pd = ((HasPhysicalDestination) listener).getPhysicalDestinationName();
                    pipeElem.addAttribute("listenerDestination", pd);
                }
            }
            ITransactionalStorage messageLog = msp.getMessageLog();
            if (messageLog != null) {
                pipeElem.addAttribute("hasMessageLog", "true");
                String messageLogCount;
                try {
                    if (SHOW_COUNT_MESSAGELOG) {
                        messageLogCount = "" + messageLog.getMessageCount();
                    } else {
                        messageLogCount = "?";
                    }
                } catch (Exception e) {
                    log.warn(e);
                    messageLogCount = "error";
                }
                pipeElem.addAttribute("messageLogCount", messageLogCount);
                XmlBuilder browserElem = new XmlBuilder("browser");
                browserElem.addAttribute("name", messageLog.getName());
                browserElem.addAttribute("type", "log");
                browserElem.addAttribute("slotId", messageLog.getSlotId());
                browserElem.addAttribute("count", messageLogCount);
                pipeElem.addSubElement(browserElem);
            }
        }
    }
    return pipesElem;
}
Also used : MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) ISender(nl.nn.adapterframework.core.ISender) IListener(nl.nn.adapterframework.core.IListener) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder) PipeLine(nl.nn.adapterframework.core.PipeLine) IPipe(nl.nn.adapterframework.core.IPipe) JdbcSenderBase(nl.nn.adapterframework.jdbc.JdbcSenderBase) PipeRunException(nl.nn.adapterframework.core.PipeRunException) HasPhysicalDestination(nl.nn.adapterframework.core.HasPhysicalDestination) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage)

Aggregations

HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)2 IListener (nl.nn.adapterframework.core.IListener)2 IPipe (nl.nn.adapterframework.core.IPipe)2 ISender (nl.nn.adapterframework.core.ISender)2 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)2 PipeLine (nl.nn.adapterframework.core.PipeLine)2 JdbcSenderBase (nl.nn.adapterframework.jdbc.JdbcSenderBase)2 MessageSendingPipe (nl.nn.adapterframework.pipes.MessageSendingPipe)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 PipeForward (nl.nn.adapterframework.core.PipeForward)1 PipeRunException (nl.nn.adapterframework.core.PipeRunException)1 FtpSender (nl.nn.adapterframework.ftp.FtpSender)1 HttpSender (nl.nn.adapterframework.http.HttpSender)1 WebServiceSender (nl.nn.adapterframework.http.WebServiceSender)1 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)1