Search in sources :

Example 51 with ConfigurationException

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

the class FileSystemSender method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    getFileSystem().configure();
    try {
        actor.configure(fileSystem, getParameterList(), this);
    } catch (ConfigurationException e) {
        throw new ConfigurationException(getLogPrefix(), e);
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 52 with ConfigurationException

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

the class XmlUtils method getXPathTransformerPool.

public static TransformerPool getXPathTransformerPool(String namespaceDefs, String xPathExpression, OutputType outputType, boolean includeXmlDeclaration, ParameterList params, int xsltVersion) throws ConfigurationException {
    List<String> paramNames = null;
    if (params != null) {
        paramNames = new ArrayList<String>();
        Iterator<Parameter> iterator = params.iterator();
        while (iterator.hasNext()) {
            paramNames.add(iterator.next().getName());
        }
    }
    try {
        String xslt;
        xslt = createXPathEvaluatorSource(namespaceDefs, xPathExpression, outputType, includeXmlDeclaration, paramNames, true, StringUtils.isEmpty(namespaceDefs), null, xsltVersion);
        if (log.isDebugEnabled())
            log.debug("xpath [" + xPathExpression + "] resulted in xslt [" + xslt + "]");
        return getUtilityTransformerPool(xslt, "XPath:" + xPathExpression + "|" + outputType + "|" + namespaceDefs + "|" + xsltVersion, !includeXmlDeclaration, false, xsltVersion);
    } 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) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 53 with ConfigurationException

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

the class JavaxValidationContext method getSchemaObject.

/**
 * Returns the {@link Schema} associated with this validator. This is an XSD schema containing knowledge about the
 * schema source as returned by {@link #getSchemaSources(List)}
 */
protected synchronized Schema getSchemaObject(String schemasId, List<nl.nn.adapterframework.validation.Schema> schemas) throws ConfigurationException {
    Schema schema = javaxSchemas.get(schemasId);
    if (schema == null) {
        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        factory.setResourceResolver(new LSResourceResolver() {

            @Override
            public LSInput resolveResource(String s, String s1, String s2, String s3, String s4) {
                return null;
            }
        });
        try {
            Collection<Source> sources = getSchemaSources(schemas);
            schema = factory.newSchema(sources.toArray(new Source[sources.size()]));
            javaxSchemas.put(schemasId, schema);
        } catch (Exception e) {
            throw new ConfigurationException("cannot read schema's [" + schemasId + "]", e);
        }
    }
    return schema;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) LSResourceResolver(org.w3c.dom.ls.LSResourceResolver) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Schema(javax.xml.validation.Schema) LSInput(org.w3c.dom.ls.LSInput) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) NotImplementedException(org.apache.commons.lang3.NotImplementedException) PipeRunException(nl.nn.adapterframework.core.PipeRunException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 54 with ConfigurationException

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

the class XmlUtils method getUtilityTransformerPool.

private static TransformerPool getUtilityTransformerPool(String xslt, String key, boolean omitXmlDeclaration, boolean indent, int xsltVersion) throws ConfigurationException {
    String fullKey = key + "-" + omitXmlDeclaration + "-" + indent;
    TransformerPool result = utilityTPs.get(fullKey);
    if (result == null) {
        try {
            TransformerPool newtp = TransformerPool.getUtilityInstance(xslt, xsltVersion);
            result = utilityTPs.put(fullKey, newtp);
            if (result == null) {
                result = newtp;
            }
        } catch (TransformerConfigurationException te) {
            throw new ConfigurationException("Could not create TransformerPool for [" + key + "]", te);
        }
    }
    return result;
}
Also used : TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Example 55 with ConfigurationException

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

the class XmlValidatorTest method testSoapNamespaceFeature.

/*
	 * <tr> <td>{@link #setSoapNamespace(String) soapNamespace}</td> <td>the
	 * namespace of the SOAP Envelope, when this property has a value and the
	 * input message is a SOAP Message the content of the SOAP Body is used for
	 * validation, hence the SOAP Envelope and SOAP Body elements are not
	 * considered part of the message to validate. Please note that this
	 * functionality is deprecated, using {@link
	 * nl.nn.adapterframework.soap.SoapValidator} is now the preferred solution
	 * in case a SOAP Message needs to be validated, in other cases give this
	 * property an empty value</td>
	 * <td>http://schemas.xmlsoap.org/soap/envelope/</td></tr>
	 * 
	 */
public void testSoapNamespaceFeature(String schema, String root, String inputFile) throws ConfigurationException, IOException, PipeRunException, XmlValidatorException, PipeStartException {
    XmlValidator validator = new XmlValidator();
    try {
        validator.setImplementation(implementation);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    validator.registerForward(createSuccessForward());
    validator.setThrowException(true);
    validator.setFullSchemaChecking(true);
    validator.setRoot(root);
    validator.setSoapNamespace("http://www.w3.org/2003/05/soap-envelope");
    validator.setSchema(schema);
    validator.configure();
    validator.start();
    assertNull(runAndEvaluate(validator, inputFile, null));
}
Also used : AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) PipeRunException(nl.nn.adapterframework.core.PipeRunException) PipeStartException(nl.nn.adapterframework.core.PipeStartException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) XmlValidatorException(nl.nn.adapterframework.validation.XmlValidatorException)

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