Search in sources :

Example 21 with AppConstants

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

the class LiquibaseMigrator method getChangeLog.

private Resource getChangeLog() {
    AppConstants appConstants = AppConstants.getInstance(getApplicationContext().getClassLoader());
    String changeLogFile = appConstants.getString("liquibase.changeLogFile", "DatabaseChangelog.xml");
    URL resource = getResource(changeLogFile);
    if (resource == null) {
        String msg = "unable to find database changelog file [" + changeLogFile + "]";
        msg += " classLoader [" + getConfigurationClassLoader() + "]";
        log.debug(msg);
        return null;
    }
    try {
        return new BytesResource(resource.openStream(), changeLogFile);
    } catch (IOException e) {
        log.debug("unable to open or read changelog [" + changeLogFile + "]", e);
    }
    return null;
}
Also used : BytesResource(nl.nn.adapterframework.core.BytesResource) IOException(java.io.IOException) URL(java.net.URL) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 22 with AppConstants

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

the class WsdlGenerator 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 23 with AppConstants

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

the class StatisticsKeeperLogger method configure.

@Override
public void configure() throws ConfigurationException {
    super.configure();
    AppConstants ac = AppConstants.getInstance();
    if (directory == null) {
        setDirectory(ac.getResolvedProperty("log.dir"));
    }
    if (retentionDays < 0) {
        setRetentionDays(ac.getInt("statistics.retention", 7));
    }
}
Also used : AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 24 with AppConstants

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

the class Migrator method configure.

public synchronized void configure(String configurationName, ClassLoader classLoader, String changeLogFile) throws ConfigurationException {
    if (configurationName == null)
        throw new ConfigurationException("configurationName cannot be null");
    AppConstants appConstants = AppConstants.getInstance(classLoader);
    if (changeLogFile == null)
        changeLogFile = appConstants.getString("liquibase.changeLogFile", "DatabaseChangelog.xml");
    LiquibaseClassLoader cl = new LiquibaseClassLoader(classLoader);
    if (cl.getResource(changeLogFile) == null) {
        log.debug("unable to find database changelog file [" + changeLogFile + "] configuration [" + configurationName + "]");
    } else {
        String dataSource = appConstants.getString("jdbc.migrator.dataSource", "jdbc/" + appConstants.getResolvedProperty("instance.name.lc"));
        setDatasourceName(dataSource);
        try {
            JdbcConnection connection = new JdbcConnection(getConnection());
            instance = new LiquibaseImpl(ibisContext, cl, connection, configurationName, changeLogFile);
        } catch (JdbcException e) {
            throw new ConfigurationException("migrator error connecting to database [" + dataSource + "]", e);
        } catch (ValidationFailedException e) {
            throw new ConfigurationException("liquibase validation failed", e);
        } catch (LiquibaseException e) {
            throw new ConfigurationException("liquibase failed to initialize", e);
        }
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ValidationFailedException(liquibase.exception.ValidationFailedException) JdbcConnection(liquibase.database.jvm.JdbcConnection) LiquibaseException(liquibase.exception.LiquibaseException) JdbcException(nl.nn.adapterframework.jdbc.JdbcException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 25 with AppConstants

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

the class HostnamePropertyPlaceholderConfigurer 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.putPropertyPlaceholderConfigurerProperty(HOSTNAME_PROPERTY, hostname);
        props.put(HOSTNAME_PROPERTY, hostname);
    }
}
Also used : 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