Search in sources :

Example 1 with HasKeystore

use of nl.nn.adapterframework.encryption.HasKeystore 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<>(totalPipes);
    for (int i = 0; i < totalPipes; i++) {
        Map<String, Object> pipesInfo = new HashMap<>();
        IPipe pipe = pipeline.getPipe(i);
        Map<String, PipeForward> pipeForwards = pipe.getForwards();
        String pipename = pipe.getName();
        Map<String, String> forwards = new HashMap<>();
        for (PipeForward fwrd : pipeForwards.values()) {
            forwards.put(fwrd.getName(), fwrd.getPath());
        }
        pipesInfo.put("name", pipename);
        pipesInfo.put("forwards", forwards);
        if (pipe instanceof HasKeystore) {
            HasKeystore s = (HasKeystore) pipe;
            Map<String, Object> certInfo = addCertificateInfo(s);
            if (certInfo != null)
                pipesInfo.put("certificate", certInfo);
        }
        if (pipe instanceof MessageSendingPipe) {
            MessageSendingPipe msp = (MessageSendingPipe) pipe;
            ISender sender = msp.getSender();
            pipesInfo.put("sender", ClassUtils.nameOf(sender));
            if (sender instanceof HasKeystore) {
                HasKeystore s = (HasKeystore) 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) {
                mapPipeMessageLog(messageLog, pipesInfo);
            } else if (sender instanceof ITransactionalStorage) {
                // in case no message log specified
                ITransactionalStorage<?> store = (ITransactionalStorage<?>) sender;
                mapPipeMessageLog(store, pipesInfo);
                pipesInfo.put("isSenderTransactionalStorage", true);
            }
        }
        pipes.add(pipesInfo);
    }
    return pipes;
}
Also used : MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) HasKeystore(nl.nn.adapterframework.encryption.HasKeystore) PipeForward(nl.nn.adapterframework.core.PipeForward) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage) ISender(nl.nn.adapterframework.core.ISender) PipeLine(nl.nn.adapterframework.core.PipeLine) IPipe(nl.nn.adapterframework.core.IPipe) JdbcSenderBase(nl.nn.adapterframework.jdbc.JdbcSenderBase) HasPhysicalDestination(nl.nn.adapterframework.core.HasPhysicalDestination)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)1 IPipe (nl.nn.adapterframework.core.IPipe)1 ISender (nl.nn.adapterframework.core.ISender)1 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)1 PipeForward (nl.nn.adapterframework.core.PipeForward)1 PipeLine (nl.nn.adapterframework.core.PipeLine)1 HasKeystore (nl.nn.adapterframework.encryption.HasKeystore)1 JdbcSenderBase (nl.nn.adapterframework.jdbc.JdbcSenderBase)1 MessageSendingPipe (nl.nn.adapterframework.pipes.MessageSendingPipe)1