use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class Trigger method getAdapterList.
public List<IAdapter> getAdapterList() {
List<IAdapter> result = new LinkedList<IAdapter>();
MonitorManager mm = MonitorManager.getInstance();
for (Iterator<String> it = adapterFilters.keySet().iterator(); it.hasNext(); ) {
String adapterName = (String) it.next();
IAdapter adapter = mm.findAdapterByName(adapterName);
if (adapter != null) {
result.add(adapter);
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "getAdapterList() returns adapter [" + adapterName + "]");
}
} else {
log.warn(getLogPrefix() + "getAdapterList() cannot find adapter [" + adapterName + "]");
}
}
return result;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class ShowConfigurationStatus method getAdapters.
@GET
@RolesAllowed({ "IbisObserver", "IbisDataAdmin", "IbisAdmin", "IbisTester" })
@Path("/adapters")
@Produces(MediaType.APPLICATION_JSON)
public Response getAdapters(@QueryParam("expanded") String expanded, @QueryParam("showPendingMsgCount") boolean showPendingMsgCount) throws ApiException {
initBase(servletConfig);
if (ibisManager == null) {
throw new ApiException("Config not found!");
}
Map<String, Object> adapterList = new HashMap<String, Object>();
List<IAdapter> registeredAdapters = ibisManager.getRegisteredAdapters();
for (Iterator<IAdapter> adapterIt = registeredAdapters.iterator(); adapterIt.hasNext(); ) {
Adapter adapter = (Adapter) adapterIt.next();
Map<String, Object> adapterInfo = mapAdapter(adapter);
if (expanded != null && !expanded.isEmpty()) {
if (expanded.equalsIgnoreCase("all")) {
adapterInfo.put("receivers", mapAdapterReceivers(adapter, showPendingMsgCount));
adapterInfo.put("pipes", mapAdapterPipes(adapter));
adapterInfo.put("messages", mapAdapterMessages(adapter));
} else if (expanded.equalsIgnoreCase("receivers")) {
adapterInfo.put("receivers", mapAdapterReceivers(adapter, showPendingMsgCount));
} else if (expanded.equalsIgnoreCase("pipes")) {
adapterInfo.put("pipes", mapAdapterPipes(adapter));
} else if (expanded.equalsIgnoreCase("messages")) {
adapterInfo.put("messages", mapAdapterMessages(adapter));
} else {
throw new ApiException("Invalid value [" + expanded + "] for parameter expanded supplied!");
}
}
adapterList.put((String) adapterInfo.get("name"), adapterInfo);
}
Response.ResponseBuilder response = null;
// Calculate the ETag on last modified date of user resource
EntityTag etag = new EntityTag(adapterList.hashCode() + "");
// Verify if it matched with etag available in http request
response = request.evaluatePreconditions(etag);
// If ETag matches the response will be non-null;
if (response != null) {
return response.tag(etag).build();
}
response = Response.status(Response.Status.CREATED).entity(adapterList).tag(etag);
return response.build();
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class SlotIdRecord method getSlotmap.
private Map<String, SlotIdRecord> getSlotmap() {
Map<String, SlotIdRecord> slotmap = new HashMap<String, SlotIdRecord>();
for (IAdapter iAdapter : ibisManager.getRegisteredAdapters()) {
Adapter adapter = (Adapter) iAdapter;
for (Iterator<?> receiverIt = adapter.getReceiverIterator(); receiverIt.hasNext(); ) {
ReceiverBase receiver = (ReceiverBase) receiverIt.next();
ITransactionalStorage errorStorage = receiver.getErrorStorage();
if (errorStorage != null) {
String slotId = errorStorage.getSlotId();
if (StringUtils.isNotEmpty(slotId)) {
SlotIdRecord sir = new SlotIdRecord(adapter.getName(), receiver.getName(), null);
String type = errorStorage.getType();
slotmap.put(type + "/" + slotId, sir);
}
}
ITransactionalStorage messageLog = receiver.getMessageLog();
if (messageLog != null) {
String slotId = messageLog.getSlotId();
if (StringUtils.isNotEmpty(slotId)) {
SlotIdRecord sir = new SlotIdRecord(adapter.getName(), receiver.getName(), null);
String type = messageLog.getType();
slotmap.put(type + "/" + slotId, sir);
}
}
}
PipeLine pipeline = adapter.getPipeLine();
if (pipeline != null) {
for (int i = 0; i < pipeline.getPipeLineSize(); i++) {
IPipe pipe = pipeline.getPipe(i);
if (pipe instanceof MessageSendingPipe) {
MessageSendingPipe msp = (MessageSendingPipe) pipe;
ITransactionalStorage messageLog = msp.getMessageLog();
if (messageLog != null) {
String slotId = messageLog.getSlotId();
if (StringUtils.isNotEmpty(slotId)) {
SlotIdRecord sir = new SlotIdRecord(adapter.getName(), null, msp.getName());
String type = messageLog.getType();
slotmap.put(type + "/" + slotId, sir);
slotmap.put(slotId, sir);
}
}
}
}
}
}
return slotmap;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class Webservices method getLogDirectory.
@GET
@RolesAllowed({ "IbisObserver", "IbisDataAdmin", "IbisAdmin", "IbisTester" })
@Path("/webservices")
@Relation("webservices")
@Produces(MediaType.APPLICATION_JSON)
public Response getLogDirectory() throws ApiException {
initBase(servletConfig);
Map<String, Object> returnMap = new HashMap<String, Object>();
List<Map<String, Object>> webServices = new ArrayList<Map<String, Object>>();
for (IAdapter a : ibisManager.getRegisteredAdapters()) {
Adapter adapter = (Adapter) a;
Iterator<IReceiver> recIt = adapter.getReceiverIterator();
while (recIt.hasNext()) {
IReceiver receiver = 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()) {
Map<String, Object> service = new HashMap<String, Object>(2);
service.put("name", rb.getName());
service.put("uriPattern", rl.getUriPattern());
webServices.add(service);
}
}
}
}
}
returnMap.put("services", webServices);
List<Map<String, Object>> wsdls = new ArrayList<Map<String, Object>>();
for (IAdapter a : ibisManager.getRegisteredAdapters()) {
Map<String, Object> wsdlMap = new HashMap<String, Object>(2);
try {
Adapter adapter = (Adapter) a;
Wsdl wsdl = new Wsdl(adapter.getPipeLine());
wsdlMap.put("name", wsdl.getName());
wsdlMap.put("extention", getWsdlExtention());
} catch (Exception e) {
wsdlMap.put("name", a.getName());
if (e.getMessage() != null) {
wsdlMap.put("error", e.getMessage());
} else {
wsdlMap.put("error", e.toString());
}
}
wsdls.add(wsdlMap);
}
returnMap.put("wsdls", wsdls);
return Response.status(Response.Status.OK).entity(returnMap).build();
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class ShowConfigurationStatus method doGet.
@Override
protected String doGet(IPipeLineSession session) throws PipeRunException {
IbisManager ibisManager = retrieveIbisManager();
String configurationName = null;
ShowConfigurationStatusManager showConfigurationStatusManager = new ShowConfigurationStatusManager();
String countStr = (String) session.get("count");
showConfigurationStatusManager.count = Boolean.parseBoolean(countStr);
String alertStr = (String) session.get("alert");
if (alertStr != null) {
showConfigurationStatusManager.alert = Boolean.parseBoolean(alertStr);
configurationName = CONFIG_ALL;
}
if (configurationName == null) {
configurationName = retrieveConfigurationName(session);
}
Configuration configuration = null;
boolean configAll;
if (configurationName == null || configurationName.equalsIgnoreCase(CONFIG_ALL)) {
configAll = true;
} else {
configuration = ibisManager.getConfiguration(configurationName);
if (configuration == null) {
configAll = true;
} else {
configAll = false;
}
}
List<Configuration> allConfigurations = ibisManager.getConfigurations();
XmlBuilder configurationsXml = toConfigurationsXml(allConfigurations);
List<IAdapter> registeredAdapters = retrieveRegisteredAdapters(ibisManager, configAll, configuration);
storeConfiguration(session, configAll, configuration);
XmlBuilder adapters = toAdaptersXml(ibisManager, allConfigurations, configuration, registeredAdapters, showConfigurationStatusManager);
XmlBuilder root = new XmlBuilder("root");
root.addSubElement(configurationsXml);
root.addSubElement(adapters);
return root.toXML();
}
Aggregations