Search in sources :

Example 16 with ConfigurationException

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

the class CompareStringPipe method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    if (null == findForward(LESSTHANFORWARD))
        throw new ConfigurationException(getLogPrefix(null) + "forward [" + LESSTHANFORWARD + "] is not defined");
    if (null == findForward(GREATERTHANFORWARD))
        throw new ConfigurationException(getLogPrefix(null) + "forward [" + GREATERTHANFORWARD + "] is not defined");
    if (null == findForward(EQUALSFORWARD))
        throw new ConfigurationException(getLogPrefix(null) + "forward [" + EQUALSFORWARD + "] is not defined");
    if (StringUtils.isEmpty(sessionKey1) && StringUtils.isEmpty(sessionKey2)) {
        boolean operand1Exists = false;
        boolean operand2Exists = false;
        ParameterList parameterList = getParameterList();
        for (int i = 0; i < parameterList.size(); i++) {
            Parameter parameter = parameterList.getParameter(i);
            if (parameter.getName().equalsIgnoreCase(OPERAND1)) {
                operand1Exists = true;
            } else {
                if (parameter.getName().equalsIgnoreCase(OPERAND2)) {
                    operand2Exists = true;
                }
            }
        }
        if (!operand1Exists && !operand2Exists) {
            throw new ConfigurationException(getLogPrefix(null) + "has neither parameter [" + OPERAND1 + "] nor parameter [" + OPERAND2 + "] specified");
        }
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ParameterList(nl.nn.adapterframework.parameters.ParameterList) Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 17 with ConfigurationException

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

the class DigesterPipe method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    try {
        rulesURL = ClassUtils.getResourceURL(classLoader, digesterRulesFile);
        // load rules to check if they can be loaded when needed
        DigesterLoader.createDigester(rulesURL);
    } catch (Exception e) {
        throw new ConfigurationException(getLogPrefix(null) + "Digester rules file [" + digesterRulesFile + "] not found", e);
    }
    log.debug(getLogPrefix(null) + "End of configuration");
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) PipeRunException(nl.nn.adapterframework.core.PipeRunException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 18 with ConfigurationException

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

the class ParameterResolutionContext method getValues.

/**
 * @param parameters
 * @return arraylist of <link>ParameterValue<link> objects
 */
public ParameterValueList getValues(ParameterList parameters) throws ParameterException {
    if (parameters == null)
        return null;
    ParameterValueList result = new ParameterValueList();
    for (Iterator<Parameter> parmIterator = parameters.iterator(); parmIterator.hasNext(); ) {
        Parameter parm = parmIterator.next();
        String parmSessionKey = parm.getSessionKey();
        if ("*".equals(parmSessionKey)) {
            String parmName = parm.getName();
            for (Iterator<String> keyIterator = session.keySet().iterator(); keyIterator.hasNext(); ) {
                String key = keyIterator.next();
                if (!PipeLineSessionBase.tsReceivedKey.equals(key)) {
                    if ((key.startsWith(parmName) || "*".equals(parmName))) {
                        Parameter newParm = new Parameter();
                        newParm.setName(key);
                        newParm.setSessionKey(key);
                        try {
                            newParm.configure();
                        } catch (ConfigurationException e) {
                            throw new ParameterException(e);
                        }
                        result.add(getValue(result, newParm));
                    }
                }
            }
        } else {
            result.add(getValue(result, parm));
        }
    }
    return result;
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) ParameterException(nl.nn.adapterframework.core.ParameterException)

Example 19 with ConfigurationException

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

the class AbstractPipe method configure.

/**
 * <code>configure()</code> is called after the {@link nl.nn.adapterframework.core.PipeLine Pipeline} is registered
 * at the {@link nl.nn.adapterframework.core.Adapter Adapter}. Purpose of this method is to reduce
 * creating connections to databases etc. in the {@link #doPipe(Object) doPipe()} method.
 * As much as possible class-instantiating should take place in the
 * <code>configure()</code> method, to improve performance.
 */
@Override
public void configure() throws ConfigurationException {
    ParameterList params = getParameterList();
    if (params != null) {
        try {
            params.configure();
        } catch (ConfigurationException e) {
            throw new ConfigurationException(getLogPrefix(null) + "while configuring parameters", e);
        }
    }
    if (!StringUtils.isEmpty(getElementToMove()) && !StringUtils.isEmpty(getElementToMoveChain())) {
        throw new ConfigurationException(getLogPrefix(null) + "cannot have both an elementToMove and an elementToMoveChain specified");
    }
    if (pipeForwards.isEmpty()) {
        ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
        String msg = getLogPrefix(null) + "has no forwards defined.";
        configWarnings.add(log, msg);
    } else {
        for (Iterator<String> it = pipeForwards.keySet().iterator(); it.hasNext(); ) {
            String forwardName = it.next();
            PipeForward forward = pipeForwards.get(forwardName);
            if (forward != null) {
                String path = forward.getPath();
                if (path != null) {
                    PipeLineExit plExit = pipeline.getPipeLineExits().get(path);
                    if (plExit == null) {
                        if (pipeline.getPipe(path) == null) {
                            ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
                            String msg = getLogPrefix(null) + "has a forward of which the pipe to execute [" + path + "] is not defined.";
                            configWarnings.add(log, msg);
                        }
                    }
                }
            }
        }
    }
    if (getLocker() != null) {
        getLocker().configure();
    }
    eventHandler = MonitorManager.getEventHandler();
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ParameterList(nl.nn.adapterframework.parameters.ParameterList) PipeForward(nl.nn.adapterframework.core.PipeForward) PipeLineExit(nl.nn.adapterframework.core.PipeLineExit)

Example 20 with ConfigurationException

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

the class IteratingPipe method configure.

public void configure() throws ConfigurationException {
    super.configure();
    msgTransformerPool = TransformerPool.configureTransformer(getLogPrefix(null), classLoader, getNamespaceDefs(), getXpathExpression(), getStyleSheetName(), getOutputType(), !isOmitXmlDeclaration(), getParameterList(), false);
    try {
        if (StringUtils.isNotEmpty(getStopConditionXPathExpression())) {
            stopConditionTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(null, getStopConditionXPathExpression(), "xml", false));
        }
    } catch (TransformerConfigurationException e) {
        throw new ConfigurationException(e);
    }
}
Also used : TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Aggregations

ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)113 IOException (java.io.IOException)26 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)20 PipeRunException (nl.nn.adapterframework.core.PipeRunException)17 ConfigurationWarnings (nl.nn.adapterframework.configuration.ConfigurationWarnings)16 URL (java.net.URL)13 ArrayList (java.util.ArrayList)12 Parameter (nl.nn.adapterframework.parameters.Parameter)12 ParameterList (nl.nn.adapterframework.parameters.ParameterList)11 File (java.io.File)7 Iterator (java.util.Iterator)6 ListenerException (nl.nn.adapterframework.core.ListenerException)6 PipeForward (nl.nn.adapterframework.core.PipeForward)6 PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 StringTokenizer (java.util.StringTokenizer)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 FileNotFoundException (java.io.FileNotFoundException)4 LinkedList (java.util.LinkedList)4