Search in sources :

Example 6 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class Wsdl method getSoapAction.

protected String getSoapAction(IListener listener) {
    AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfiguration().getClassLoader());
    String sa = appConstants.getResolvedProperty("wsdl." + getName() + "." + listener.getName() + ".soapAction");
    if (sa != null) {
        return sa;
    }
    sa = appConstants.getResolvedProperty("wsdl." + getName() + ".soapAction");
    if (sa != null) {
        return sa;
    }
    sa = appConstants.getResolvedProperty("wsdl.soapAction");
    if (sa != null) {
        return sa;
    }
    if (esbSoapOperationName != null && esbSoapOperationVersion != null) {
        return esbSoapOperationName + "_" + esbSoapOperationVersion;
    }
    return "${wsdl." + getName() + "." + listener.getName() + ".soapAction}";
}
Also used : AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 7 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class Wsdl method getLocation.

protected String getLocation(String defaultLocation) {
    AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfiguration().getClassLoader());
    String sa = appConstants.getResolvedProperty("wsdl." + getName() + ".location");
    if (sa != null) {
        return sa;
    }
    sa = appConstants.getResolvedProperty("wsdl.location");
    if (sa != null) {
        return sa;
    }
    return defaultLocation;
}
Also used : AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 8 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class HostnamePropertySourcePostProcessor method convertProperties.

@Override
protected void convertProperties(Properties props) {
    AppConstants appConstants = AppConstants.getInstance();
    String hostname = appConstants.getResolvedProperty(HOSTNAME_PROPERTY);
    if (StringUtils.isEmpty(hostname)) {
        hostname = Misc.getHostname();
        appConstants.setProperty(HOSTNAME_PROPERTY, hostname);
        props.put(HOSTNAME_PROPERTY, hostname);
    }
}
Also used : AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 9 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class ConfigurationDigester method digestConfiguration.

private void digestConfiguration(Configuration configuration) throws ConfigurationException {
    String configurationFile = ConfigurationUtils.getConfigurationFile(configuration.getClassLoader(), configuration.getName());
    Digester digester = null;
    Resource configurationResource = Resource.getResource(configuration, configurationFile);
    if (configurationResource == null) {
        throw new ConfigurationException("Configuration file [" + configurationFile + "] not found in ClassLoader [" + configuration.getClassLoader() + "]");
    }
    try {
        digester = getDigester(configuration);
        if (log.isDebugEnabled())
            log.debug("digesting configuration [" + configuration.getName() + "] configurationFile [" + configurationFile + "]");
        AppConstants appConstants = AppConstants.getInstance(configuration.getClassLoader());
        parseAndResolveEntitiesAndProperties(digester, configuration, configurationResource, appConstants);
        configLogger.info(configuration.getLoadedConfiguration());
    } catch (Throwable t) {
        // wrap exception to be sure it gets rendered via the IbisException-renderer
        String currentElementName = null;
        if (digester != null) {
            currentElementName = digester.getCurrentElementName();
        }
        throw new ConfigurationException("error during unmarshalling configuration from file [" + configurationFile + "] with digester-rules-file [" + getDigesterRules() + "] in element [" + currentElementName + "]", t);
    }
}
Also used : TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) Digester(org.apache.commons.digester3.Digester) Resource(nl.nn.adapterframework.core.Resource) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 10 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class GalmMonitorAdapter method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    hostname = Misc.getHostname();
    AppConstants appConstants = AppConstants.getInstance();
    sourceId = appConstants.getResolvedProperty(SOURCE_ID_KEY);
    if (StringUtils.isEmpty(sourceId)) {
        throw new ConfigurationException("cannot read sourceId from [" + SOURCE_ID_KEY + "]");
    }
    if (sourceId.indexOf(' ') >= 0) {
        StringBuffer replacement = new StringBuffer();
        boolean replacementsMade = false;
        for (int i = 0; i < sourceId.length(); i++) {
            char c = sourceId.charAt(i);
            if (Character.isLetterOrDigit(c) || c == '_') {
                replacement.append(c);
            } else {
                replacement.append('_');
                replacementsMade = true;
            }
        }
        if (replacementsMade) {
            if (log.isDebugEnabled())
                log.debug("sourceId [" + sourceId + "] read from [" + SOURCE_ID_KEY + "] contains spaces, replacing them with underscores, resulting in [" + replacement.toString() + "]");
            sourceId = replacement.toString();
        }
    }
    dtapStage = appConstants.getString(DTAP_STAGE_KEY, null);
    if (StringUtils.isEmpty(dtapStage)) {
        throw new ConfigurationException("cannot read dtapStage from [" + DTAP_STAGE_KEY + "]");
    }
    if (!("DEV".equals(dtapStage)) && !("TEST".equals(dtapStage)) && !("ACCEPT".equals(dtapStage)) && !("PROD".equals(dtapStage))) {
        throw new ConfigurationException("dtapStage [" + dtapStage + "] read from [" + DTAP_STAGE_KEY + "] not equal to one of DEV, TEST, ACCEPT, PROD");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Aggregations

AppConstants (nl.nn.adapterframework.util.AppConstants)42 IbisContext (nl.nn.adapterframework.configuration.IbisContext)7 File (java.io.File)6 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)6 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)3 FileWriter (java.io.FileWriter)2 URL (java.net.URL)2 Enumeration (java.util.Enumeration)2 ServletContext (javax.servlet.ServletContext)2 ServletException (javax.servlet.ServletException)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1