Search in sources :

Example 11 with IAdapter

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

the class SlotIdRecord method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    IniDynaActionForm showIbisstoreSummaryForm = (IniDynaActionForm) form;
    // Initialize action
    initAction(request);
    if (ibisManager == null)
        return (mapping.findForward("noIbisContext"));
    String jmsRealm = (String) showIbisstoreSummaryForm.get("jmsRealm");
    String cookieName = AppConstants.getInstance().getString(SHOWIBISSTORECOOKIE, SHOWIBISSTORECOOKIE);
    if (StringUtils.isEmpty(jmsRealm)) {
        // get jmsRealm value from cookie
        Cookie[] cookies = request.getCookies();
        if (null != cookies) {
            for (int i = 0; i < cookies.length; i++) {
                Cookie aCookie = cookies[i];
                if (aCookie.getName().equals(cookieName)) {
                    jmsRealm = aCookie.getValue();
                    log.debug("jmsRealm from cookie [" + jmsRealm + "]");
                }
            }
        }
    }
    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);
                        }
                    }
                }
            }
        }
    }
    List jmsRealms = JmsRealmFactory.getInstance().getRegisteredRealmNamesAsList();
    if (jmsRealms.size() == 0) {
        jmsRealms.add("no realms defined");
    } else {
        if (StringUtils.isEmpty(jmsRealm)) {
            jmsRealm = (String) jmsRealms.get(0);
        }
    }
    showIbisstoreSummaryForm.set("jmsRealms", jmsRealms);
    if (StringUtils.isNotEmpty(jmsRealm)) {
        String result = "<none/>";
        try {
            IbisstoreSummaryQuerySender qs;
            qs = (IbisstoreSummaryQuerySender) ibisManager.getIbisContext().createBeanAutowireByName(IbisstoreSummaryQuerySender.class);
            qs.setSlotmap(slotmap);
            try {
                qs.setName("QuerySender");
                qs.setJmsRealm(jmsRealm);
                qs.setQueryType("select");
                qs.setBlobSmartGet(true);
                qs.configure(true);
                qs.open();
                result = qs.sendMessage("dummy", qs.getDbmsSupport().getIbisStoreSummaryQuery());
            } catch (Throwable t) {
                error("error occured on executing jdbc query", t);
            } finally {
                qs.close();
            }
        } catch (Exception e) {
            error("error occured on creating or closing connection", e);
        }
        if (log.isDebugEnabled())
            log.debug("result [" + result + "]");
        request.setAttribute("result", result);
    }
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
        return (mapping.findForward("success"));
    }
    // Successfull: store cookie
    String cookieValue = jmsRealm;
    Cookie cookie = new Cookie(cookieName, cookieValue);
    cookie.setMaxAge(Integer.MAX_VALUE);
    log.debug("Store cookie for " + request.getServletPath() + " cookieName[" + cookieName + "] " + " cookieValue[" + cookieValue + "]");
    try {
        response.addCookie(cookie);
    } catch (Throwable t) {
        log.warn("unable to add cookie to request. cookie value [" + cookie.getValue() + "]", t);
    }
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : Cookie(javax.servlet.http.Cookie) ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) ServletException(javax.servlet.ServletException) JdbcException(nl.nn.adapterframework.jdbc.JdbcException) SQLException(java.sql.SQLException) IOException(java.io.IOException) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage) Iterator(java.util.Iterator) List(java.util.List) IniDynaActionForm(nl.nn.adapterframework.webcontrol.IniDynaActionForm) PipeLine(nl.nn.adapterframework.core.PipeLine) IAdapter(nl.nn.adapterframework.core.IAdapter) IPipe(nl.nn.adapterframework.core.IPipe)

Example 12 with IAdapter

use of nl.nn.adapterframework.core.IAdapter 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");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) FtpSender(nl.nn.adapterframework.ftp.FtpSender) HttpSender(nl.nn.adapterframework.http.HttpSender) HasSender(nl.nn.adapterframework.core.HasSender) URL(java.net.URL) IReceiver(nl.nn.adapterframework.core.IReceiver) ISender(nl.nn.adapterframework.core.ISender) Iterator(java.util.Iterator) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder) WebServiceSender(nl.nn.adapterframework.http.WebServiceSender) PipeLine(nl.nn.adapterframework.core.PipeLine) IAdapter(nl.nn.adapterframework.core.IAdapter) IPipe(nl.nn.adapterframework.core.IPipe)

Example 13 with IAdapter

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

the class WsdlGeneratorPipe method doPipe.

public PipeRunResult doPipe(Object input, IPipeLineSession session) throws PipeRunException {
    String result = null;
    IAdapter adapter;
    if ("input".equals(getFrom())) {
        adapter = ((Adapter) getAdapter()).getConfiguration().getIbisManager().getRegisteredAdapter((String) input);
        if (adapter == null) {
            throw new PipeRunException(this, "Could not find adapter: " + input);
        }
    } else {
        adapter = getPipeLine().getAdapter();
    }
    try {
        Wsdl wsdl = new Wsdl(((Adapter) adapter).getPipeLine());
        wsdl.setDocumentation("Generated at " + AppConstants.getInstance().getResolvedProperty("otap.stage") + "-" + AppConstants.getInstance().getResolvedProperty("otap.side") + " on " + DateUtils.getIsoTimeStamp() + ".");
        wsdl.init();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        wsdl.wsdl(outputStream, null);
        result = outputStream.toString("UTF-8");
    } catch (Exception e) {
        throw new PipeRunException(this, "Could not generate WSDL for adapter '" + adapter.getName() + "'", e);
    }
    return new PipeRunResult(getForward(), result);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) PipeRunException(nl.nn.adapterframework.core.PipeRunException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IAdapter(nl.nn.adapterframework.core.IAdapter) Wsdl(nl.nn.adapterframework.soap.Wsdl) PipeRunException(nl.nn.adapterframework.core.PipeRunException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 14 with IAdapter

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

the class CorePipeLineProcessor method processPipeLine.

public PipeLineResult processPipeLine(PipeLine pipeLine, String messageId, String message, IPipeLineSession pipeLineSession, String firstPipe) throws PipeRunException {
    // Object is the object that is passed to and returned from Pipes
    Object object = (Object) message;
    PipeRunResult pipeRunResult;
    // the PipeLineResult
    PipeLineResult pipeLineResult = new PipeLineResult();
    if (object == null || (object instanceof String && StringUtils.isEmpty(object.toString()))) {
        if (StringUtils.isNotEmpty(pipeLine.getAdapterToRunBeforeOnEmptyInput())) {
            log.debug("running adapterBeforeOnEmptyInput");
            IAdapter adapter = pipeLine.getAdapter().getConfiguration().getIbisManager().getRegisteredAdapter(pipeLine.getAdapterToRunBeforeOnEmptyInput());
            if (adapter == null) {
                log.warn("adapterToRunBefore with specified name [" + pipeLine.getAdapterToRunBeforeOnEmptyInput() + "] could not be retrieved");
            } else {
                PipeLineResult plr = adapter.processMessage(messageId, message, pipeLineSession);
                if (plr == null || !plr.getState().equals("success")) {
                    throw new PipeRunException(null, "adapterToRunBefore [" + pipeLine.getAdapterToRunBeforeOnEmptyInput() + "] ended with state [" + plr.getState() + "]");
                }
                message = plr.getResult();
                log.debug("input after running adapterBeforeOnEmptyInput [" + message + "]");
                object = (Object) message;
            }
        }
    }
    // ready indicates wether the pipeline processing is complete
    boolean ready = false;
    // get the first pipe to run
    IPipe pipeToRun = pipeLine.getPipe(pipeLine.getFirstPipe());
    boolean inputValidateError = false;
    IPipe inputValidator = pipeLine.getInputValidator();
    if (inputValidator != null) {
        log.debug("validating input");
        PipeRunResult validationResult = pipeProcessor.processPipe(pipeLine, inputValidator, messageId, message, pipeLineSession);
        if (validationResult != null) {
            if (!validationResult.getPipeForward().getName().equals("success")) {
                PipeForward validationForward = validationResult.getPipeForward();
                if (validationForward.getPath() == null) {
                    throw new PipeRunException(pipeToRun, "forward [" + validationForward.getName() + "] of inputValidator has emtpy forward path");
                }
                log.warn("setting first pipe to [" + validationForward.getPath() + "] due to validation fault");
                inputValidateError = true;
                pipeToRun = pipeLine.getPipe(validationForward.getPath());
                if (pipeToRun == null) {
                    throw new PipeRunException(pipeToRun, "forward [" + validationForward.getName() + "], path [" + validationForward.getPath() + "] does not correspond to a pipe");
                }
            }
            Object validatedMessage = validationResult.getResult();
            if (validatedMessage != null) {
                object = validatedMessage;
                message = validatedMessage.toString();
            }
        }
    }
    if (!inputValidateError) {
        IPipe inputWrapper = pipeLine.getInputWrapper();
        if (inputWrapper != null) {
            log.debug("wrapping input");
            PipeRunResult wrapResult = pipeProcessor.processPipe(pipeLine, inputWrapper, messageId, message, pipeLineSession);
            if (wrapResult != null && !wrapResult.getPipeForward().getName().equals("success")) {
                PipeForward wrapForward = wrapResult.getPipeForward();
                if (wrapForward.getPath() == null) {
                    throw new PipeRunException(pipeToRun, "forward [" + wrapForward.getName() + "] of inputWrapper has emtpy forward path");
                }
                log.warn("setting first pipe to [" + wrapForward.getPath() + "] due to wrap fault");
                pipeToRun = pipeLine.getPipe(wrapForward.getPath());
                if (pipeToRun == null) {
                    throw new PipeRunException(pipeToRun, "forward [" + wrapForward.getName() + "], path [" + wrapForward.getPath() + "] does not correspond to a pipe");
                }
            } else {
                message = wrapResult.getResult().toString();
            }
            log.debug("input after wrapping [" + message + "]");
            object = (Object) message;
        }
    }
    pipeLine.getRequestSizeStats().addValue(message.length());
    if (pipeLine.isStoreOriginalMessageWithoutNamespaces()) {
        if (XmlUtils.isWellFormed(message)) {
            String removeNamespaces_xslt = XmlUtils.makeRemoveNamespacesXslt(true, true);
            try {
                String xsltResult = null;
                Transformer transformer = XmlUtils.createTransformer(removeNamespaces_xslt);
                xsltResult = XmlUtils.transformXml(transformer, message);
                pipeLineSession.put("originalMessageWithoutNamespaces", xsltResult);
            } catch (IOException e) {
                throw new PipeRunException(pipeToRun, "cannot retrieve removeNamespaces", e);
            } catch (TransformerConfigurationException te) {
                throw new PipeRunException(pipeToRun, "got error creating transformer from removeNamespaces", te);
            } catch (TransformerException te) {
                throw new PipeRunException(pipeToRun, "got error transforming removeNamespaces", te);
            } catch (DomBuilderException te) {
                throw new PipeRunException(pipeToRun, "caught DomBuilderException", te);
            }
        } else {
            log.warn("original message is not well-formed");
            pipeLineSession.put("originalMessageWithoutNamespaces", message);
        }
    }
    boolean outputValidated = false;
    try {
        while (!ready) {
            pipeRunResult = pipeProcessor.processPipe(pipeLine, pipeToRun, messageId, object, pipeLineSession);
            object = pipeRunResult.getResult();
            if (!(pipeToRun instanceof AbstractPipe)) {
                if (object != null && object instanceof String) {
                    StatisticsKeeper sizeStat = pipeLine.getPipeSizeStatistics(pipeToRun);
                    if (sizeStat != null) {
                        sizeStat.addValue(((String) object).length());
                    }
                }
            }
            PipeForward pipeForward = pipeRunResult.getPipeForward();
            if (pipeForward == null) {
                throw new PipeRunException(pipeToRun, "Pipeline of [" + pipeLine.getOwner().getName() + "] received result from pipe [" + pipeToRun.getName() + "] without a pipeForward");
            }
            // get the next pipe to run
            String nextPath = pipeForward.getPath();
            if ((null == nextPath) || (nextPath.length() == 0)) {
                throw new PipeRunException(pipeToRun, "Pipeline of [" + pipeLine.getOwner().getName() + "] got an path that equals null or has a zero-length value from pipe [" + pipeToRun.getName() + "]. Check the configuration, probably forwards are not defined for this pipe.");
            }
            PipeLineExit plExit = pipeLine.getPipeLineExits().get(nextPath);
            if (null != plExit) {
                boolean outputWrapError = false;
                IPipe outputWrapper = pipeLine.getOutputWrapper();
                if (outputWrapper != null) {
                    log.debug("wrapping PipeLineResult");
                    PipeRunResult wrapResult = pipeProcessor.processPipe(pipeLine, outputWrapper, messageId, object, pipeLineSession);
                    if (wrapResult != null && !wrapResult.getPipeForward().getName().equals("success")) {
                        PipeForward wrapForward = wrapResult.getPipeForward();
                        if (wrapForward.getPath() == null) {
                            throw new PipeRunException(pipeToRun, "forward [" + wrapForward.getName() + "] of outputWrapper has emtpy forward path");
                        }
                        log.warn("setting next pipe to [" + wrapForward.getPath() + "] due to wrap fault");
                        outputWrapError = true;
                        pipeToRun = pipeLine.getPipe(wrapForward.getPath());
                        if (pipeToRun == null) {
                            throw new PipeRunException(pipeToRun, "forward [" + wrapForward.getName() + "], path [" + wrapForward.getPath() + "] does not correspond to a pipe");
                        }
                    } else {
                        log.debug("wrap succeeded");
                        object = wrapResult.getResult();
                    }
                    log.debug("PipeLineResult after wrapping [" + object.toString() + "]");
                }
                if (!outputWrapError) {
                    IPipe outputValidator = pipeLine.getOutputValidator();
                    if ((outputValidator != null) && !outputValidated) {
                        outputValidated = true;
                        log.debug("validating PipeLineResult");
                        PipeRunResult validationResult;
                        validationResult = pipeProcessor.processPipe(pipeLine, outputValidator, messageId, object, pipeLineSession);
                        if (validationResult != null && !validationResult.getPipeForward().getName().equals("success")) {
                            PipeForward validationForward = validationResult.getPipeForward();
                            if (validationForward.getPath() == null) {
                                throw new PipeRunException(pipeToRun, "forward [" + validationForward.getName() + "] of outputValidator has emtpy forward path");
                            }
                            log.warn("setting next pipe to [" + validationForward.getPath() + "] due to validation fault");
                            pipeToRun = pipeLine.getPipe(validationForward.getPath());
                            if (pipeToRun == null) {
                                throw new PipeRunException(pipeToRun, "forward [" + validationForward.getName() + "], path [" + validationForward.getPath() + "] does not correspond to a pipe");
                            }
                        } else {
                            log.debug("validation succeeded");
                            object = validationResult.getResult();
                            ready = true;
                        }
                    } else {
                        ready = true;
                    }
                } else {
                    ready = true;
                }
                if (ready) {
                    String state = plExit.getState();
                    pipeLineResult.setState(state);
                    pipeLineResult.setExitCode(plExit.getExitCode());
                    if (object != null && !plExit.getEmptyResult()) {
                        pipeLineResult.setResult(object.toString());
                    } else {
                        pipeLineResult.setResult(null);
                    }
                    ready = true;
                    if (log.isDebugEnabled()) {
                        // for performance reasons
                        String skString = "";
                        for (Iterator it = pipeLineSession.keySet().iterator(); it.hasNext(); ) {
                            String key = (String) it.next();
                            Object value = pipeLineSession.get(key);
                            skString = skString + "\n " + key + "=[" + value + "]";
                        }
                        log.debug("Available session keys at finishing pipeline of adapter [" + pipeLine.getOwner().getName() + "]:" + skString);
                        log.debug("Pipeline of adapter [" + pipeLine.getOwner().getName() + "] finished processing messageId [" + messageId + "] result: [" + object + "] with exit-state [" + state + "]");
                    }
                }
            } else {
                pipeToRun = pipeLine.getPipe(pipeForward.getPath());
                if (pipeToRun == null) {
                    throw new PipeRunException(null, "Pipeline of adapter [" + pipeLine.getOwner().getName() + "] got an erroneous definition. Pipe to execute [" + pipeForward.getPath() + "] is not defined.");
                }
            }
        }
    } finally {
        for (int i = 0; i < pipeLine.getExitHandlers().size(); i++) {
            IPipeLineExitHandler exitHandler = pipeLine.getExitHandlers().get(i);
            try {
                if (log.isDebugEnabled())
                    log.debug("processing ExitHandler [" + exitHandler.getName() + "]");
                exitHandler.atEndOfPipeLine(messageId, pipeLineResult, pipeLineSession);
            } catch (Throwable t) {
                log.warn("Caught Exception processing ExitHandler [" + exitHandler.getName() + "]", t);
            }
        }
    }
    return pipeLineResult;
}
Also used : Transformer(javax.xml.transform.Transformer) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IPipeLineExitHandler(nl.nn.adapterframework.core.IPipeLineExitHandler) IOException(java.io.IOException) PipeForward(nl.nn.adapterframework.core.PipeForward) PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) PipeLineResult(nl.nn.adapterframework.core.PipeLineResult) PipeRunException(nl.nn.adapterframework.core.PipeRunException) Iterator(java.util.Iterator) StatisticsKeeper(nl.nn.adapterframework.statistics.StatisticsKeeper) DomBuilderException(nl.nn.adapterframework.util.DomBuilderException) IAdapter(nl.nn.adapterframework.core.IAdapter) IPipe(nl.nn.adapterframework.core.IPipe) TransformerException(javax.xml.transform.TransformerException) PipeLineExit(nl.nn.adapterframework.core.PipeLineExit)

Example 15 with IAdapter

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

the class AbstractPipe method isRecoverAdapter.

protected boolean isRecoverAdapter() {
    boolean recover = false;
    IAdapter iAdapter = getAdapter();
    if (iAdapter == null) {
        recover = recoverAdapter;
    } else {
        if (iAdapter instanceof Adapter) {
            Adapter adapter = (Adapter) iAdapter;
            recover = adapter.isRecover();
        }
    }
    return recover;
}
Also used : 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