use of nl.nn.adapterframework.ftp.FtpSender 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.ftp.FtpSender in project iaf by ibissource.
the class ShowSecurityItems method addRegisteredAdapters.
private void addRegisteredAdapters(XmlBuilder securityItems) {
XmlBuilder registeredAdapters = new XmlBuilder("registeredAdapters");
securityItems.addSubElement(registeredAdapters);
for (IAdapter iAdapter : ibisManager.getRegisteredAdapters()) {
Adapter adapter = (Adapter) iAdapter;
XmlBuilder adapterXML = new XmlBuilder("adapter");
registeredAdapters.addSubElement(adapterXML);
adapterXML.addAttribute("name", adapter.getName());
Iterator recIt = adapter.getReceiverIterator();
if (recIt.hasNext()) {
XmlBuilder receiversXML = new XmlBuilder("receivers");
while (recIt.hasNext()) {
IReceiver receiver = (IReceiver) recIt.next();
XmlBuilder receiverXML = new XmlBuilder("receiver");
receiversXML.addSubElement(receiverXML);
receiverXML.addAttribute("name", receiver.getName());
if (receiver instanceof HasSender) {
ISender sender = ((HasSender) receiver).getSender();
if (sender != null) {
receiverXML.addAttribute("senderName", sender.getName());
}
}
}
adapterXML.addSubElement(receiversXML);
}
// make list of pipes to be displayed in configuration status
XmlBuilder pipesElem = new XmlBuilder("pipes");
adapterXML.addSubElement(pipesElem);
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);
ISender sender = msp.getSender();
pipeElem.addAttribute("sender", ClassUtils.nameOf(sender));
pipesElem.addSubElement(pipeElem);
if (sender instanceof WebServiceSender) {
WebServiceSender s = (WebServiceSender) sender;
String certificate = s.getCertificate();
if (StringUtils.isNotEmpty(certificate)) {
XmlBuilder certElem = new XmlBuilder("certificate");
certElem.addAttribute("name", certificate);
String certificateAuthAlias = s.getCertificateAuthAlias();
certElem.addAttribute("authAlias", certificateAuthAlias);
URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
if (certificateUrl == null) {
certElem.addAttribute("url", "");
pipeElem.addSubElement(certElem);
XmlBuilder infoElem = new XmlBuilder("info");
infoElem.setCdataValue("*** ERROR ***");
certElem.addSubElement(infoElem);
} else {
certElem.addAttribute("url", certificateUrl.toString());
pipeElem.addSubElement(certElem);
String certificatePassword = s.getCertificatePassword();
CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
String keystoreType = s.getKeystoreType();
addCertificateInfo(certElem, certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain");
}
}
} else {
if (sender instanceof HttpSender) {
HttpSender s = (HttpSender) sender;
String certificate = s.getCertificate();
if (StringUtils.isNotEmpty(certificate)) {
XmlBuilder certElem = new XmlBuilder("certificate");
certElem.addAttribute("name", certificate);
String certificateAuthAlias = s.getCertificateAuthAlias();
certElem.addAttribute("authAlias", certificateAuthAlias);
URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
if (certificateUrl == null) {
certElem.addAttribute("url", "");
pipeElem.addSubElement(certElem);
XmlBuilder infoElem = new XmlBuilder("info");
infoElem.setCdataValue("*** ERROR ***");
certElem.addSubElement(infoElem);
} else {
certElem.addAttribute("url", certificateUrl.toString());
pipeElem.addSubElement(certElem);
String certificatePassword = s.getCertificatePassword();
CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
String keystoreType = s.getKeystoreType();
addCertificateInfo(certElem, certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain");
}
}
} else {
if (sender instanceof FtpSender) {
FtpSender s = (FtpSender) sender;
String certificate = s.getCertificate();
if (StringUtils.isNotEmpty(certificate)) {
XmlBuilder certElem = new XmlBuilder("certificate");
certElem.addAttribute("name", certificate);
String certificateAuthAlias = s.getCertificateAuthAlias();
certElem.addAttribute("authAlias", certificateAuthAlias);
URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
if (certificateUrl == null) {
certElem.addAttribute("url", "");
pipeElem.addSubElement(certElem);
XmlBuilder infoElem = new XmlBuilder("info");
infoElem.setCdataValue("*** ERROR ***");
certElem.addSubElement(infoElem);
} else {
certElem.addAttribute("url", certificateUrl.toString());
pipeElem.addSubElement(certElem);
String certificatePassword = s.getCertificatePassword();
CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
String keystoreType = s.getCertificateType();
addCertificateInfo(certElem, certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain");
}
}
}
}
}
}
}
}
}
Aggregations