Search in sources :

Example 31 with ConfigurationException

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

the class IfsaSimulatorJmsSender method configure.

public void configure() throws ConfigurationException {
    if (!getMessageType().equalsIgnoreCase(RR_REQUEST) && !getMessageType().equalsIgnoreCase(RR_REPLY) && !getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        throw new ConfigurationException(getLogPrefix() + "illegal value for messageType [" + getMessageType() + "], must be '" + RR_REQUEST + "', '" + RR_REPLY + "'" + "' or '" + FF_REQUEST + "'");
    }
    Parameter p = new Parameter();
    p.setName("ifsa");
    p.setValue("_IFSA_HEADER_");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_api");
    p.setValue("jms_wrapper");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_api_version");
    p.setValue("22.30.020");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_auth_flag");
    p.setValue("1");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_bif_id");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        String iad = AppConstants.getInstance().getProperty("IFSAApplicationID", "");
        p.setPattern(iad + "#{ifsa_destination}#{uid}");
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setSessionKey("ifsa_bif_id");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        String iad = AppConstants.getInstance().getProperty("IFSAApplicationID", "");
        p.setPattern(iad + "#{ifsa_destination}#{uid}");
    }
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_bif_type");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue("0");
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setValue("0");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setValue("2");
    }
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_bulk");
    p.setValue("0");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_bulk_auth_flag");
    p.setValue("0");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_cil_version");
    p.setValue("22.30.009");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_comp_algo");
    p.setDefaultValue("");
    p.setSessionKey("null");
    addParameter(p);
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
    // overruled in IBIS configuration
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p = new Parameter();
        p.setName("ifsa_destination");
        p.setSessionKey("ifsa_source");
        addParameter(p);
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
    // overruled in IBIS configuration
    }
    p = new Parameter();
    p.setName("ifsa_expiry");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("timeOutIFSARR", ""));
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setValue(AppConstants.getInstance().getProperty("timeOutIFSARR", ""));
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setValue("0");
    }
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_header_version");
    p.setValue("02.02.000");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_hop_count");
    p.setValue("000");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_node_id");
    p.setValue(AppConstants.getInstance().getProperty("ifsa_node_id", ""));
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_ori_area");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("ifsa_ori_area", ""));
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setValue(AppConstants.getInstance().getProperty("ifsa_ori_area", ""));
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setDefaultValue("");
        p.setSessionKey("null");
    }
    p.setMinLength(60);
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_ori_format");
    p.setDefaultValue("");
    p.setSessionKey("null");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_ori_length");
    p.setDefaultValue("");
    p.setSessionKey("null");
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_ori_rtq");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("ifsa_ori_rtq", ""));
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setDefaultValue("");
        p.setSessionKey("null");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setDefaultValue("");
        p.setSessionKey("null");
    }
    p.setMinLength(48);
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_ori_rtqm");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("ifsa_ori_rtqm", ""));
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setDefaultValue("");
        p.setSessionKey("null");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setDefaultValue("");
        p.setSessionKey("null");
    }
    p.setMinLength(48);
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_priority");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue("3");
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setValue("3");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setValue("2");
    }
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_source");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("IFSAApplicationID", ""));
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        String iad = AppConstants.getInstance().getProperty("IFSAApplicationID", "");
        p.setPattern(iad + "#{ifsa_destination}");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setValue(AppConstants.getInstance().getProperty("IFSAApplicationID", ""));
    }
    addParameter(p);
    p = new Parameter();
    p.setName("ifsa_unique_id");
    p.setPattern("{uid}");
    addParameter(p);
    p = new Parameter();
    p.setName("JMS_IBM_MsgType");
    if (getMessageType().equalsIgnoreCase(RR_REQUEST)) {
        p.setValue("1");
    } else if (getMessageType().equalsIgnoreCase(RR_REPLY)) {
        p.setValue("2");
    } else if (getMessageType().equalsIgnoreCase(FF_REQUEST)) {
        p.setValue("8");
    }
    p.setType(Parameter.TYPE_INTEGER);
    addParameter(p);
    if (getMessageType().equalsIgnoreCase(RR_REPLY) && getDestinationName() == null) {
        if (paramList != null) {
            paramList.configure();
        }
    } else {
        super.configure();
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 32 with ConfigurationException

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

the class RekenBoxCaller method configure.

public void configure() throws ConfigurationException {
    super.configure();
    if (StringUtils.isEmpty(getCommandLineType()) || !(getCommandLineType().equals("straight") || getCommandLineType().equals("switches") || getCommandLineType().equals("redirected"))) {
        throw new ConfigurationException(getLogPrefix(null) + "commandLineType [" + getCommandLineType() + "] must be one of 'straigth', 'switches' or 'redirected'");
    }
    inputOutputDir = new File(getInputOutputDirectory());
    if (!inputOutputDir.exists()) {
        throw new ConfigurationException(getLogPrefix(null) + "inputOutputDirectory [" + getInputOutputDirectory() + "] does not exist");
    }
    if (!inputOutputDir.isDirectory()) {
        throw new ConfigurationException(getLogPrefix(null) + "inputOutputDirectory [" + getInputOutputDirectory() + "] is not a directory");
    }
    formatter = new DecimalFormat("000000000000".substring(0, Long.toString(getMaxRequestNumber()).length()));
    String baseFileName = getBaseFileName();
    log.debug(getLogPrefix(null) + "first filename will be [" + baseFileName + "]");
    requestCounter.decrease();
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) DecimalFormat(java.text.DecimalFormat) File(java.io.File)

Example 33 with ConfigurationException

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

the class WsdlGeneratorPipe method createValidator.

private EsbSoapValidator createValidator(File xsdFile, String namespace, String root, int rootPosition, int cmhVersion) throws ConfigurationException {
    if (xsdFile != null) {
        EsbSoapValidator esbSoapValidator = new EsbSoapValidator();
        esbSoapValidator.setWarn(false);
        esbSoapValidator.setCmhVersion(cmhVersion);
        if (StringUtils.isEmpty(namespace)) {
            String xsdTargetNamespace = null;
            try {
                TransformerPool tp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource("*/@targetNamespace", "text"));
                xsdTargetNamespace = tp.transform(Misc.fileToString(xsdFile.getPath()), null);
                if (StringUtils.isNotEmpty(xsdTargetNamespace)) {
                    log.debug("found target namespace [" + xsdTargetNamespace + "] in xsd file [" + xsdFile.getName() + "]");
                } else {
                    // default namespace to prevent
                    // "(IllegalArgumentException) The schema attribute isn't supported"
                    xsdTargetNamespace = "urn:wsdlGenerator";
                    log.warn("could not find target namespace in xsd file [" + xsdFile.getName() + "], assuming namespace [" + xsdTargetNamespace + "]");
                }
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }
            if (StringUtils.isEmpty(xsdTargetNamespace)) {
                esbSoapValidator.setSchema(xsdFile.getName());
            } else {
                esbSoapValidator.setSchemaLocation(xsdTargetNamespace + "\t" + xsdFile.getName());
                esbSoapValidator.setAddNamespaceToSchema(true);
            }
        } else {
            esbSoapValidator.setSchemaLocation(namespace + "\t" + xsdFile.getName());
            esbSoapValidator.setAddNamespaceToSchema(true);
        }
        if (StringUtils.isEmpty(root)) {
            String xsdRoot = null;
            try {
                String rootXPath = "*/*[local-name()='element'][" + rootPosition + "]/@name";
                TransformerPool tp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(rootXPath, "text"));
                xsdRoot = tp.transform(Misc.fileToString(xsdFile.getPath()), null);
                if (StringUtils.isNotEmpty(xsdRoot)) {
                    log.debug("found root element [" + xsdRoot + "] in xsd file [" + xsdFile.getName() + "]");
                    esbSoapValidator.setSoapBody(xsdRoot);
                }
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }
        } else {
            esbSoapValidator.setSoapBody(root);
        }
        esbSoapValidator.setForwardFailureToSuccess(true);
        PipeForward pf = new PipeForward();
        pf.setName("success");
        esbSoapValidator.registerForward(pf);
        esbSoapValidator.configure();
        return esbSoapValidator;
    }
    return null;
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) PipeForward(nl.nn.adapterframework.core.PipeForward) TransformerPool(nl.nn.adapterframework.util.TransformerPool) PipeRunException(nl.nn.adapterframework.core.PipeRunException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 34 with ConfigurationException

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

the class MqttFacade method configure.

public void configure() throws ConfigurationException {
    if (StringUtils.isEmpty(getClientId())) {
        throw new ConfigurationException("clientId must be specified");
    }
    if (StringUtils.isEmpty(getBrokerUrl())) {
        throw new ConfigurationException("brokerUrl must be specified");
    }
    if (StringUtils.isEmpty(getTopic())) {
        throw new ConfigurationException("topic must be specified");
    }
    if (StringUtils.isEmpty(getPersistenceDirectory())) {
        throw new ConfigurationException("persistenceDirectory must be specified");
    }
    connectOptions = new MqttConnectOptions();
    connectOptions.setCleanSession(isCleanSession());
    connectOptions.setAutomaticReconnect(isAutomaticReconnect());
    connectOptions.setConnectionTimeout(getTimeout());
    connectOptions.setKeepAliveInterval(getKeepAliveInterval());
    // Default: 0, V3.1: 3, V3.1.1: 4
    connectOptions.setMqttVersion(MqttConnectOptions.MQTT_VERSION_DEFAULT);
    if (!StringUtils.isEmpty(getAuthAlias()) || (!StringUtils.isEmpty(getUsername()) && !StringUtils.isEmpty(getPassword()))) {
        CredentialFactory credentialFactory = new CredentialFactory(getAuthAlias(), getUsername(), getPassword());
        connectOptions.setUserName(credentialFactory.getUsername());
        connectOptions.setPassword(credentialFactory.getPassword().toCharArray());
    }
    MqttDefaultFilePersistence dataStore = new MqttDefaultFilePersistence(getPersistenceDirectory());
    try {
        client = new MqttClient(brokerUrl, clientId, dataStore);
    } catch (MqttException e) {
        throw new ConfigurationException("Could not create client", e);
    }
}
Also used : MqttClient(org.eclipse.paho.client.mqttv3.MqttClient) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) MqttConnectOptions(org.eclipse.paho.client.mqttv3.MqttConnectOptions) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) MqttException(org.eclipse.paho.client.mqttv3.MqttException) MqttDefaultFilePersistence(org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence)

Example 35 with ConfigurationException

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

the class WebServiceListener method configure.

/**
 * initialize listener and register <code>this</code> to the JNDI
 */
public void configure() throws ConfigurationException {
    super.configure();
    if (isSoap()) {
        // ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
        // String msg = ClassUtils.nameOf(this) +"["+getName()+"]: the use of attribute soap=true has been deprecated. Please change to SoapWrapperPipe";
        // configWarnings.add(log, msg);
        soapWrapper = SoapWrapper.getInstance();
    }
    try {
        if (StringUtils.isNotEmpty(getServiceNamespaceURI())) {
            log.debug("registering listener [" + getName() + "] with ServiceDispatcher by serviceNamespaceURI [" + getServiceNamespaceURI() + "]");
            ServiceDispatcher.getInstance().registerServiceClient(getServiceNamespaceURI(), this);
        } else {
            log.debug("registering listener [" + getName() + "] with ServiceDispatcher");
            ServiceDispatcher.getInstance().registerServiceClient(getName(), this);
            if (nag) {
                ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
                String msg = ClassUtils.nameOf(this) + "[" + getName() + "]: calling webservices via de ServiceDispatcher_ServiceProxy is deprecated. Please specify a serviceNamespaceURI and modify the call accordingly";
                configWarnings.add(log, msg);
            }
        }
    } catch (Exception e) {
        throw new ConfigurationException(e);
    }
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ListenerException(nl.nn.adapterframework.core.ListenerException)

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