Search in sources :

Example 31 with IAdapter

use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.

the class DefaultIbisManager method startAdapters.

private void startAdapters(Configuration configuration) {
    log.info("Starting all autostart-configured adapters for configuation " + configuration.getName());
    for (IAdapter adapter : configuration.getAdapterService().getAdapters().values()) {
        if (adapter.isAutoStart()) {
            log.info("Starting adapter [" + adapter.getName() + "]");
            adapter.startRunning();
        }
    }
}
Also used : IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 32 with IAdapter

use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.

the class DefaultIbisManager method unload.

private void unload(Configuration configuration) {
    configuration.setUnloadInProgressOrDone(true);
    while (configuration.getStartAdapterThreads().size() > 0) {
        log.debug("Waiting for start threads to end: " + configuration.getStartAdapterThreads());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.warn("Interrupted waiting for start threads to end", e);
        }
    }
    stopAdapters(configuration);
    while (configuration.getStopAdapterThreads().size() > 0) {
        log.debug("Waiting for stop threads to end: " + configuration.getStopAdapterThreads());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.warn("Interrupted waiting for stop threads to end", e);
        }
    }
    // destroy all jmsContainers
    for (int i = 0; i < configuration.getRegisteredAdapters().size(); i++) {
        IAdapter adapter = configuration.getRegisteredAdapter(i);
        Iterator recIt = adapter.getReceiverIterator();
        if (recIt.hasNext()) {
            while (recIt.hasNext()) {
                IReceiver receiver = (IReceiver) recIt.next();
                if (receiver instanceof ReceiverBase) {
                    ReceiverBase rb = (ReceiverBase) receiver;
                    IListener listener = rb.getListener();
                    if (listener instanceof PushingJmsListener) {
                        PushingJmsListener pjl = (PushingJmsListener) listener;
                        pjl.destroy();
                    }
                }
            }
        }
    }
    while (configuration.getRegisteredAdapters().size() > 0) {
        IAdapter adapter = configuration.getRegisteredAdapter(0);
        AdapterService adapterService = configuration.getAdapterService();
        adapterService.unRegisterAdapter(adapter);
    }
    configurations.remove(configuration);
}
Also used : AdapterService(nl.nn.adapterframework.configuration.AdapterService) IReceiver(nl.nn.adapterframework.core.IReceiver) ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) IListener(nl.nn.adapterframework.core.IListener) Iterator(java.util.Iterator) PushingJmsListener(nl.nn.adapterframework.jms.PushingJmsListener) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 33 with IAdapter

use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.

the class DefaultIbisManager method stopAdapters.

private void stopAdapters(Configuration configuration) {
    configuration.dumpStatistics(HasStatistics.STATISTICS_ACTION_MARK_FULL);
    log.info("Stopping all adapters for configuation " + configuration.getName());
    List<IAdapter> adapters = new ArrayList<IAdapter>(configuration.getAdapterService().getAdapters().values());
    Collections.reverse(adapters);
    for (IAdapter adapter : adapters) {
        log.info("Stopping adapter [" + adapter.getName() + "]");
        adapter.stopRunning();
    }
}
Also used : ArrayList(java.util.ArrayList) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 34 with IAdapter

use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.

the class IbisSoapServlet method listWsdls.

protected void listWsdls(HttpServletRequest req, Writer w) throws IOException {
    w.write("<h2>Available WSDL's:</h2>");
    w.write("<ol>");
    int count = 0;
    for (IAdapter a : ibisManager.getRegisteredAdapters()) {
        count++;
        w.write("<li>");
        try {
            Adapter adapter = (Adapter) a;
            Wsdl wsdl = new Wsdl(adapter.getPipeLine());
            setDocumentation(wsdl, req);
            String url = req.getContextPath() + req.getServletPath() + "/" + wsdl.getName() + getWsdlExtention();
            w.write("<a href='" + url + "'>" + wsdl.getName() + "</a>");
            String useIncludes = req.getContextPath() + req.getServletPath() + "/" + wsdl.getName() + getWsdlExtention() + "?useIncludes=true";
            w.write(" (<a href='" + useIncludes + "'>using includes</a>");
            String zip = req.getContextPath() + req.getServletPath() + "/" + wsdl.getName() + ".zip";
            w.write(" <a href='" + zip + "'>zip</a>)");
        } catch (Exception e) {
            w.write(a.getName() + ": ");
            if (e.getMessage() != null) {
                w.write(e.getMessage());
            } else {
                w.write(e.toString());
            }
        }
        w.write("</li>");
    }
    w.write("</ol>");
    if (count == 0) {
        w.write("No registered listeners found");
    }
}
Also used : Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) IAdapter(nl.nn.adapterframework.core.IAdapter) ServletException(javax.servlet.ServletException) NamingException(javax.naming.NamingException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 35 with IAdapter

use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.

the class IbisSoapServlet method listRestServices.

protected void listRestServices(HttpServletRequest req, Writer w) throws IOException {
    w.write("<h2>Available REST services:</h2>");
    w.write("<ol>");
    int count = 0;
    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()) {
                        count++;
                        w.write("<li>");
                        w.write("<a href=../" + rl.getRestUriPattern() + ">" + rb.getName() + "</a>");
                        w.write("</li>");
                    }
                }
            }
        }
    }
    w.write("</ol>");
    if (count == 0) {
        w.write("No rest listeners found");
    }
}
Also used : RestListener(nl.nn.adapterframework.http.RestListener) IReceiver(nl.nn.adapterframework.core.IReceiver) ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) IListener(nl.nn.adapterframework.core.IListener) Iterator(java.util.Iterator) Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) IAdapter(nl.nn.adapterframework.core.IAdapter)

Aggregations

IAdapter (nl.nn.adapterframework.core.IAdapter)41 Adapter (nl.nn.adapterframework.core.Adapter)15 Iterator (java.util.Iterator)13 ArrayList (java.util.ArrayList)12 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)11 IReceiver (nl.nn.adapterframework.core.IReceiver)10 IOException (java.io.IOException)8 List (java.util.List)8 Configuration (nl.nn.adapterframework.configuration.Configuration)7 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)7 HashMap (java.util.HashMap)6 LinkedList (java.util.LinkedList)6 IListener (nl.nn.adapterframework.core.IListener)6 PipeRunException (nl.nn.adapterframework.core.PipeRunException)6 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)5 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 IPipe (nl.nn.adapterframework.core.IPipe)4 PipeLineResult (nl.nn.adapterframework.core.PipeLineResult)4 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)4