use of nl.nn.adapterframework.core.IListener in project iaf by ibissource.
the class Webservices method list.
private String list(IbisManager ibisManager) {
XmlBuilder webservicesXML = new XmlBuilder("webservices");
// RestListeners
XmlBuilder restsXML = new XmlBuilder("rests");
for (IAdapter a : ibisManager.getRegisteredAdapters()) {
Adapter adapter = (Adapter) a;
Iterator recIt = adapter.getReceiverIterator();
while (recIt.hasNext()) {
IReceiver receiver = (IReceiver) recIt.next();
if (receiver instanceof ReceiverBase) {
ReceiverBase rb = (ReceiverBase) receiver;
IListener listener = rb.getListener();
if (listener instanceof RestListener) {
RestListener rl = (RestListener) listener;
if (rl.isView()) {
XmlBuilder restXML = new XmlBuilder("rest");
restXML.addAttribute("name", rb.getName());
restXML.addAttribute("uriPattern", rl.getUriPattern());
restsXML.addSubElement(restXML);
}
}
}
}
}
webservicesXML.addSubElement(restsXML);
// WSDL's
XmlBuilder wsdlsXML = new XmlBuilder("wsdls");
for (IAdapter a : ibisManager.getRegisteredAdapters()) {
XmlBuilder wsdlXML = new XmlBuilder("wsdl");
try {
Adapter adapter = (Adapter) a;
Wsdl wsdl = new Wsdl(adapter.getPipeLine());
wsdlXML.addAttribute("name", wsdl.getName());
wsdlXML.addAttribute("extention", getWsdlExtention());
} catch (Exception e) {
wsdlXML.addAttribute("name", a.getName());
XmlBuilder errorXML = new XmlBuilder("error");
if (e.getMessage() != null) {
errorXML.setCdataValue(e.getMessage());
} else {
errorXML.setCdataValue(e.toString());
}
wsdlXML.addSubElement(errorXML);
}
wsdlsXML.addSubElement(wsdlXML);
}
webservicesXML.addSubElement(wsdlsXML);
// ApiListeners
XmlBuilder apiListenerXML = new XmlBuilder("apiListeners");
SortedMap<String, ApiDispatchConfig> patternClients = ApiServiceDispatcher.getInstance().getPatternClients();
for (Entry<String, ApiDispatchConfig> client : patternClients.entrySet()) {
XmlBuilder apiXML = new XmlBuilder("apiListener");
ApiDispatchConfig config = client.getValue();
Set<String> methods = config.getMethods();
for (String method : methods) {
ApiListener listener = config.getApiListener(method);
XmlBuilder methodXML = new XmlBuilder(method);
String name = listener.getName();
if (name.contains("listener of ["))
name = name.substring(13, name.length() - 1);
methodXML.addAttribute("name", name);
methodXML.addAttribute("updateEtag", listener.getUpdateEtag());
methodXML.addAttribute("isRunning", listener.isRunning());
apiXML.addSubElement(methodXML);
}
apiXML.addAttribute("uriPattern", config.getUriPattern());
apiListenerXML.addSubElement(apiXML);
}
webservicesXML.addSubElement(apiListenerXML);
return webservicesXML.toXML();
}
Aggregations