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;
}
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;
}
Aggregations