Search in sources :

Example 61 with ConfigurationException

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

the class CoolGenWrapperPipe method createProxy.

public CoolGenXMLProxy createProxy(String proxyName) throws ConfigurationException {
    CoolGenXMLProxy proxy;
    try {
        Class<?> klass = Class.forName(proxyName);
        proxy = (CoolGenXMLProxy) klass.newInstance();
        proxy.setClientId(getClientId());
        proxy.setClientPassword(getClientPassword());
        if (log.isDebugEnabled())
            proxy.setTracing(1);
        else
            proxy.setTracing(0);
    } catch (Exception e) {
        throw new ConfigurationException(getLogPrefix(null) + "could not create proxy [" + proxyName + "]", e);
    }
    return proxy;
}
Also used : CoolGenXMLProxy(nl.nn.coolgen.proxy.CoolGenXMLProxy) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) PipeRunException(nl.nn.adapterframework.core.PipeRunException) PipeStartException(nl.nn.adapterframework.core.PipeStartException) TransformerException(javax.xml.transform.TransformerException) XmlProxyException(nl.nn.coolgen.proxy.XmlProxyException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) PropertyVetoException(java.beans.PropertyVetoException) SAXException(org.xml.sax.SAXException)

Example 62 with ConfigurationException

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

the class RecordTransformer method addOutputField.

/**
 * translates a functiondeclaration to an function instance
 */
public void addOutputField(String fieldDef) throws ConfigurationException {
    StringTokenizer st = new StringTokenizer(fieldDef, "(),");
    String def = nextToken(st, "Function in outputFields must be parameterized [" + fieldDef + "]").trim().toUpperCase();
    if ("STRING".equals(def)) {
        addFixedOutput(nextToken(st, "Fixed function expects a value"));
    } else if ("NOW".equals(def)) {
        addDateOutput(nextToken(st, "Now function expects an outformat"));
    } else if ("INCOPY".equals(def)) {
        addOutputInput(Integer.parseInt(nextToken(st, "In function expects a numeric value")));
    } else if ("INDATE".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "Indate function expects a fieldnummer"));
        addDateOutput(field, nextToken(st, "Indate function expects an in and outformat, seperated with ~"), nextToken(st, "Indate function expects an in and outformat, seperated with ~"));
    } else if ("FILL".equals(def)) {
        int length = Integer.parseInt(nextToken(st, "Fill function expects a fieldlength"));
        char fillChar = nextToken(st, "Fill function expects a fillcharacter").charAt(0);
        addFillOutput(length, fillChar);
    } else if ("LOOKUP".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "Lookup function expects a fieldnummer"));
        Map<String, String> keyValues = convertToKeyValueMap(st, '=');
        addLookup(field, keyValues);
    } else if ("SUBSTR".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "Substr function expects a fieldnummer"));
        int startIndex = Integer.parseInt(nextToken(st, "Substr function expects a startindex"));
        int endIndex = Integer.parseInt(nextToken(st, "Substr function expects an endindex"));
        addSubstring(field, startIndex, endIndex);
    } else if ("ALIGN".equals(def)) {
        String fixedValue = nextToken(st, "Align function expects a fixed value");
        int length = Integer.parseInt(nextToken(st, "Align function expects a fieldlength"));
        boolean leftAlign = "LEFT".equals(nextToken(st, "Align function expects alignment left").toUpperCase());
        char fillChar = nextToken(st, "Align function expects a fillcharacter").charAt(0);
        addAlignedOutput(fixedValue, length, leftAlign, fillChar);
    } else if ("INALIGN".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "Inalign function expects a fieldnumber"));
        int length = Integer.parseInt(nextToken(st, "Inalign function expects a fieldlength"));
        boolean leftAlign = "LEFT".equals(nextToken(st, "Inalign function expects alignment left").toUpperCase());
        char fillChar = nextToken(st, "Inalign function expects a fillcharacter").charAt(0);
        addAlignedInput(field, length, leftAlign, fillChar);
    } else if ("EXTERNAL".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "External function expects a fieldnumber"));
        String delegateName = nextToken(st, "External function expects a type name for the delegate");
        String params = nextToken(st, "External function expects a parameter string");
        addExternal(field, delegateName, params);
    } else if ("IF".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "If function expects a fieldnummer"));
        String comparator = nextToken(st, "If function expects a comparator (EQ | NE | SW | NS)");
        String compareValue = nextToken(st, "If function expects a compareValue");
        addIf(field, comparator, compareValue);
    } else if ("ELSEIF".equals(def)) {
        int field = Integer.parseInt(nextToken(st, "If function expects a fieldnummer"));
        String comparator = nextToken(st, "If function expects a comparator (EQ | NE | SW | NS)");
        String compareValue = nextToken(st, "If function expects a compareValue");
        addElseIf(field, comparator, compareValue);
    } else if ("ENDIF".equals(def)) {
        addEndIf();
    } else {
        throw new ConfigurationException("Unexpected function [" + def + "] defined in outputFields");
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 63 with ConfigurationException

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

the class StatisticsKeeperStore method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    createQueries();
    String instance = AppConstants.getInstance().getString("instance.name", "");
    try (Connection connection = getConnection()) {
        instanceKey = instances.findOrInsert(connection, instance);
    } catch (JdbcException | SQLException e) {
        throw new ConfigurationException("could not find instancekey for instance [" + instance + "]", e);
    }
}
Also used : SQLException(java.sql.SQLException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Connection(java.sql.Connection) JdbcException(nl.nn.adapterframework.jdbc.JdbcException)

Example 64 with ConfigurationException

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

the class StatisticsParser method digestStatistics.

public void digestStatistics(Reader reader, String sysid) throws ConfigurationException {
    Reader fileReader = new EncapsulatingReader(reader, "<" + ROOT_ELEM_NAME + ">", "</" + ROOT_ELEM_NAME + ">", false);
    Digester digester = new Digester();
    digester.setUseContextClassLoader(true);
    // push config on the stack
    digester.push(this);
    try {
        // String prefix="/"+ROOT_ELEM_NAME+"/";
        String prefix = "*/";
        // timestamp info
        digester.addSetProperties(prefix + "statisticsCollection");
        // instance info
        digester.addSetProperties(prefix + "statisticsCollection/statgroup");
        // adapterinfo
        digester.addObjectCreate(prefix + "statisticsCollection/statgroup/statgroup", SummaryRecord.class);
        digester.addSetProperties(prefix + "statisticsCollection/statgroup/statgroup");
        digester.addSetNext(prefix + "statisticsCollection/statgroup/statgroup", "registerRecord");
        // adapterinfo
        digester.addObjectCreate(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item", Item.class);
        digester.addSetProperties(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item");
        digester.addSetNext(prefix + "statisticsCollection/statgroup/statgroup/stat/interval/item", "registerItem");
        InputSource is = new InputSource(fileReader);
        digester.parse(is);
    } catch (Exception e) {
        // wrap exception to be sure it gets rendered via the IbisException-renderer
        throw new ConfigurationException("error during parsing of file [" + sysid + "]", e);
    }
}
Also used : EncapsulatingReader(nl.nn.adapterframework.util.EncapsulatingReader) InputSource(org.xml.sax.InputSource) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Digester(org.apache.commons.digester.Digester) Reader(java.io.Reader) EncapsulatingReader(nl.nn.adapterframework.util.EncapsulatingReader) FileReader(java.io.FileReader) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) FileNotFoundException(java.io.FileNotFoundException)

Example 65 with ConfigurationException

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

the class ShadowSender method configure.

@Override
public void configure() throws ConfigurationException {
    boolean hasShadowSender = false;
    boolean hasResultSender = false;
    boolean hasOriginalSender = false;
    if (originalSender == null)
        throw new ConfigurationException("no originalSender defined");
    if (resultSender == null)
        throw new ConfigurationException("no resultSender defined");
    for (ISender sender : getSenders()) {
        if (sender.getName() != null && sender.getName().equalsIgnoreCase(getOriginalSender())) {
            if (hasOriginalSender)
                throw new ConfigurationException("originalSender can only be defined once");
            hasOriginalSender = true;
        } else if (sender.getName() != null && sender.getName().equalsIgnoreCase(getResultSender())) {
            if (hasResultSender)
                throw new ConfigurationException("resultSender can only be defined once");
            hasResultSender = true;
            resultISender = sender;
        } else
            hasShadowSender = true;
    }
    if (!hasOriginalSender)
        throw new ConfigurationException("no originalSender found");
    if (!hasResultSender)
        throw new ConfigurationException("no resultSender found");
    if (!hasShadowSender)
        throw new ConfigurationException("no shadowSender found");
    if (getSenderList().size() == 0)
        throw new ConfigurationException("this is not supposed to happen, like ever");
    super.configure();
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ISender(nl.nn.adapterframework.core.ISender)

Aggregations

ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)187 IOException (java.io.IOException)52 PipeRunException (nl.nn.adapterframework.core.PipeRunException)25 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)24 Parameter (nl.nn.adapterframework.parameters.Parameter)20 ArrayList (java.util.ArrayList)19 URL (java.net.URL)17 ParameterList (nl.nn.adapterframework.parameters.ParameterList)16 SAXException (org.xml.sax.SAXException)14 TransformerException (javax.xml.transform.TransformerException)12 Test (org.junit.Test)12 CredentialFactory (nl.nn.adapterframework.util.CredentialFactory)11 HashMap (java.util.HashMap)10 File (java.io.File)9 StringTokenizer (java.util.StringTokenizer)8 Connection (java.sql.Connection)7 Map (java.util.Map)7 ListenerException (nl.nn.adapterframework.core.ListenerException)7 ParameterException (nl.nn.adapterframework.core.ParameterException)7 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)7