Search in sources :

Example 31 with ConfigurationWarnings

use of nl.nn.adapterframework.configuration.ConfigurationWarnings in project iaf by ibissource.

the class EsbSoapValidator method configure.

@Override
public void configure() throws ConfigurationException {
    if (mode == EsbSoapWrapperPipe.Mode.REG) {
        if (cmhVersion == 0) {
            cmhVersion = 1;
        } else if (cmhVersion < 0 || cmhVersion > 2) {
            ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
            String msg = getLogPrefix(null) + "cmhVersion [" + cmhVersion + "] for mode [" + mode.toString() + "] should be set to '1' or '2', assuming '1'";
            configWarnings.add(log, msg);
            cmhVersion = 1;
        }
    } else {
        if (cmhVersion != 0) {
            ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
            String msg = getLogPrefix(null) + "cmhVersion [" + cmhVersion + "] for mode [" + mode.toString() + "] should not be set, assuming '0'";
            configWarnings.add(log, msg);
            cmhVersion = 0;
        }
    }
    super.setSchemaLocation(schemaLocation + " " + GENERIC_HEADER.get(getModeKey()).xmlns + " " + GENERIC_HEADER.get(getModeKey()).xsd);
    super.setSoapHeader(GENERIC_HEADER.get(getModeKey()).tag.getLocalPart());
    if (mode == EsbSoapWrapperPipe.Mode.I2T) {
        super.setImportedSchemaLocationsToIgnore("CommonMessageHeader.xsd");
        super.setUseBaseImportedSchemaLocationsToIgnore(true);
    } else if (mode == EsbSoapWrapperPipe.Mode.REG) {
        if (cmhVersion == 1) {
            super.setImportedSchemaLocationsToIgnore("CommonMessageHeader.xsd");
        } else {
            super.setImportedSchemaLocationsToIgnore("CommonMessageHeader_2.xsd");
        }
        super.setUseBaseImportedSchemaLocationsToIgnore(true);
    }
    super.configure();
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings)

Example 32 with ConfigurationWarnings

use of nl.nn.adapterframework.configuration.ConfigurationWarnings in project iaf by ibissource.

the class BisJmsListener method configure.

public void configure() throws ConfigurationException {
    ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
    String msg = getLogPrefix() + "The class [" + getClass().getName() + "] has been deprecated. Please change to JmsListener combined with BisWrapperPipe";
    configWarnings.add(log, msg);
    super.configure();
    if (!isSoap()) {
        throw new ConfigurationException(getLogPrefix() + "soap must be true");
    }
    try {
        bisUtils = BisUtils.getInstance();
        requestTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(StringUtils.isNotEmpty(getRequestNamespaceDefs()) ? bisUtils.getSoapNamespaceDefs() + "\n" + getRequestNamespaceDefs() : bisUtils.getSoapNamespaceDefs(), StringUtils.isNotEmpty(getRequestXPath()) ? bisUtils.getSoapBodyXPath() + "/" + getRequestXPath() : bisUtils.getSoapBodyXPath() + "/*", "xml"));
    } catch (TransformerConfigurationException e) {
        throw new ConfigurationException(getLogPrefix() + "cannot create transformer", e);
    }
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 33 with ConfigurationWarnings

use of nl.nn.adapterframework.configuration.ConfigurationWarnings in project iaf by ibissource.

the class BisJmsSender method configure.

public void configure() throws ConfigurationException {
    ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
    String msg = getLogPrefix() + "The class [" + getClass().getName() + "] has been deprecated. Please change to JmsSender combined with BisWrapperPipe";
    configWarnings.add(log, msg);
    super.configure();
    if (!isSoap()) {
        throw new ConfigurationException(getLogPrefix() + "soap must be true");
    }
    try {
        bisUtils = BisUtils.getInstance();
        bisErrorTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisUtils.getSoapNamespaceDefs() + "\n" + bisUtils.getBisNamespaceDefs(), (isResultInPayload() ? bisUtils.getBisErrorXPath() : bisUtils.getOldBisErrorXPath()), "text"));
        responseTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(StringUtils.isNotEmpty(getResponseNamespaceDefs()) ? bisUtils.getSoapNamespaceDefs() + "\n" + getResponseNamespaceDefs() : bisUtils.getSoapNamespaceDefs(), StringUtils.isNotEmpty(getResponseXPath()) ? bisUtils.getSoapBodyXPath() + "/" + getResponseXPath() : bisUtils.getSoapBodyXPath() + "/*", "xml"));
        bisErrorListTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisUtils.getSoapNamespaceDefs() + "\n" + bisUtils.getBisNamespaceDefs(), (isResultInPayload() ? bisUtils.getBisErrorListXPath() : bisUtils.getOldBisErrorListXPath()), "xml"));
    } catch (TransformerConfigurationException e) {
        throw new ConfigurationException(getLogPrefix() + "cannot create transformer", e);
    }
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 34 with ConfigurationWarnings

use of nl.nn.adapterframework.configuration.ConfigurationWarnings in project iaf by ibissource.

the class PipeLine method configure.

/**
 * Configures the pipes of this Pipeline and does some basic checks. It also
 * registers the <code>PipeLineSession</code> object at the pipes.
 * @see IPipe
 */
public void configure() throws ConfigurationException {
    INamedObject owner = getOwner();
    IAdapter adapter = null;
    if (owner instanceof IAdapter) {
        adapter = (IAdapter) owner;
    }
    if (cache != null) {
        cache.configure(owner.getName() + "-Pipeline");
    }
    for (int i = 0; i < pipes.size(); i++) {
        IPipe pipe = getPipe(i);
        log.debug("Pipeline of [" + owner.getName() + "] configuring Pipe [" + pipe.getName() + "]");
        // forward is defined, it is not overwritten by the globals
        for (String gfName : globalForwards.keySet()) {
            PipeForward pipeForward = globalForwards.get(gfName);
            pipe.registerForward(pipeForward);
        }
        if (pipe instanceof FixedForwardPipe) {
            FixedForwardPipe ffpipe = (FixedForwardPipe) pipe;
            if (ffpipe.findForward("success") == null) {
                int i2 = i + 1;
                if (i2 < pipes.size()) {
                    String nextPipeName = getPipe(i2).getName();
                    PipeForward pf = new PipeForward();
                    pf.setName("success");
                    pf.setPath(nextPipeName);
                    pipe.registerForward(pf);
                } else {
                    PipeLineExit plexit = findExitByState("success");
                    if (plexit != null) {
                        PipeForward pf = new PipeForward();
                        pf.setName("success");
                        pf.setPath(plexit.getPath());
                        pipe.registerForward(pf);
                    }
                }
            }
        }
        configure(pipe);
    }
    if (pipeLineExits.size() < 1) {
        throw new ConfigurationException("no PipeLine Exits specified");
    }
    if (this.firstPipe == null) {
        throw new ConfigurationException("no firstPipe defined");
    }
    if (getPipe(firstPipe) == null) {
        throw new ConfigurationException("no pipe found for firstPipe [" + firstPipe + "]");
    }
    IPipe inputValidator = getInputValidator();
    IPipe outputValidator = getOutputValidator();
    if (inputValidator != null && outputValidator == null && inputValidator instanceof IDualModeValidator) {
        outputValidator = ((IDualModeValidator) inputValidator).getResponseValidator();
        setOutputValidator(outputValidator);
    }
    if (inputValidator != null) {
        log.debug("Pipeline of [" + owner.getName() + "] configuring InputValidator");
        PipeForward pf = new PipeForward();
        pf.setName("success");
        inputValidator.registerForward(pf);
        inputValidator.setName(INPUT_VALIDATOR_NAME);
        configure(inputValidator);
    }
    if (outputValidator != null) {
        log.debug("Pipeline of [" + owner.getName() + "] configuring OutputValidator");
        PipeForward pf = new PipeForward();
        pf.setName("success");
        outputValidator.registerForward(pf);
        outputValidator.setName(OUTPUT_VALIDATOR_NAME);
        configure(outputValidator);
    }
    if (getInputWrapper() != null) {
        log.debug("Pipeline of [" + owner.getName() + "] configuring InputWrapper");
        PipeForward pf = new PipeForward();
        pf.setName("success");
        getInputWrapper().registerForward(pf);
        getInputWrapper().setName(INPUT_WRAPPER_NAME);
        configure(getInputWrapper());
    }
    if (getOutputWrapper() != null) {
        log.debug("Pipeline of [" + owner.getName() + "] configuring OutputWrapper");
        PipeForward pf = new PipeForward();
        pf.setName("success");
        if (getOutputWrapper() instanceof AbstractPipe && adapter instanceof Adapter) {
            ((AbstractPipe) getOutputWrapper()).setRecoverAdapter(((Adapter) adapter).isRecover());
        }
        getOutputWrapper().registerForward(pf);
        getOutputWrapper().setName(OUTPUT_WRAPPER_NAME);
        if (getOutputWrapper() instanceof EsbSoapWrapperPipe) {
            EsbSoapWrapperPipe eswPipe = (EsbSoapWrapperPipe) getOutputWrapper();
            boolean stop = false;
            Iterator<IReceiver> recIt = adapter.getReceiverIterator();
            if (recIt.hasNext()) {
                while (recIt.hasNext() && !stop) {
                    IReceiver receiver = recIt.next();
                    if (receiver instanceof ReceiverBase) {
                        ReceiverBase rb = (ReceiverBase) receiver;
                        IListener listener = rb.getListener();
                        try {
                            if (eswPipe.retrievePhysicalDestinationFromListener(listener)) {
                                stop = true;
                            }
                        } catch (JmsException e) {
                            throw new ConfigurationException(e);
                        }
                    }
                }
            }
        }
        configure(getOutputWrapper());
    }
    requestSizeStats = new SizeStatisticsKeeper("- pipeline in");
    if (isTransacted() && getTransactionTimeout() > 0) {
        String systemTransactionTimeout = Misc.getSystemTransactionTimeout();
        if (systemTransactionTimeout != null && StringUtils.isNumeric(systemTransactionTimeout)) {
            int stt = Integer.parseInt(systemTransactionTimeout);
            if (getTransactionTimeout() > stt) {
                ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
                String msg = "Pipeline of [" + owner.getName() + "] has a transaction timeout [" + getTransactionTimeout() + "] which exceeds the system transaction timeout [" + stt + "]";
                configWarnings.add(log, msg);
            }
        }
    }
    int txOption = this.getTransactionAttributeNum();
    if (log.isDebugEnabled())
        log.debug("creating TransactionDefinition for transactionAttribute [" + getTransactionAttribute() + "], timeout [" + getTransactionTimeout() + "]");
    txDef = SpringTxManagerProxy.getTransactionDefinition(txOption, getTransactionTimeout());
    log.debug("Pipeline of [" + owner.getName() + "] successfully configured");
}
Also used : ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) EsbSoapWrapperPipe(nl.nn.adapterframework.extensions.esb.EsbSoapWrapperPipe) ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) JmsException(nl.nn.adapterframework.jms.JmsException) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) ICacheAdapter(nl.nn.adapterframework.cache.ICacheAdapter) AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) FixedForwardPipe(nl.nn.adapterframework.pipes.FixedForwardPipe)

Example 35 with ConfigurationWarnings

use of nl.nn.adapterframework.configuration.ConfigurationWarnings in project iaf by ibissource.

the class PipeLine method setTransacted.

public void setTransacted(boolean transacted) {
    // this.transacted = transacted;
    ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
    if (transacted) {
        String msg = "Pipeline of [" + owner.getName() + "] implementing setting of transacted=true as transactionAttribute=Required";
        configWarnings.add(log, msg);
        setTransactionAttributeNum(TransactionDefinition.PROPAGATION_REQUIRED);
    } else {
        String msg = "Pipeline of [" + owner.getName() + "] implementing setting of transacted=false as transactionAttribute=Supports";
        configWarnings.add(log, msg);
        setTransactionAttributeNum(TransactionDefinition.PROPAGATION_SUPPORTS);
    }
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings)

Aggregations

ConfigurationWarnings (nl.nn.adapterframework.configuration.ConfigurationWarnings)58 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)16 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)5 ArrayList (java.util.ArrayList)4 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)3 PipeForward (nl.nn.adapterframework.core.PipeForward)3 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)3 URL (java.net.URL)2 BaseConfigurationWarnings (nl.nn.adapterframework.configuration.BaseConfigurationWarnings)2 Configuration (nl.nn.adapterframework.configuration.Configuration)2 HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)2 ISender (nl.nn.adapterframework.core.ISender)2 EsbSoapWrapperPipe (nl.nn.adapterframework.extensions.esb.EsbSoapWrapperPipe)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Connection (java.sql.Connection)1 DatabaseMetaData (java.sql.DatabaseMetaData)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1