Search in sources :

Example 1 with RandomLookup

use of com.evolveum.midpoint.init.interpol.RandomLookup in project midpoint by Evolveum.

the class StartupConfiguration method createXmlConfiguration.

private void createXmlConfiguration(String filename) throws ConfigurationException {
    Map<String, Lookup> lookups = new HashMap<>(ConfigurationInterpolator.getDefaultPrefixLookups());
    lookups.put(RandomLookup.PREFIX, new RandomLookup());
    lookups.put(HostnameLookup.PREFIX, new HostnameLookup());
    FileBasedConfigurationBuilder<XMLConfiguration> builder = new FileBasedConfigurationBuilder<>(XMLConfiguration.class).configure(new Parameters().xml().setFileName(filename).setPrefixLookups(lookups));
    /*
        On debug level this shows stacktrace for:
        DEBUG org.apache.commons.beanutils.FluentPropertyBeanIntrospector - Exception is:
        java.beans.IntrospectionException: bad write method arg count:
        public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty
        This is reportedly beanutils over-strictness issue but is nowhere close to be fixed.
        Jira for commons-configuration can be also found, but they rely on beanutils fix.
        */
    config = builder.getConfiguration();
    config.addProperty(MIDPOINT_HOME_PROPERTY, midPointHomePath);
    applyEnvironmentProperties();
    resolveFileReferences();
}
Also used : XMLConfiguration(org.apache.commons.configuration2.XMLConfiguration) Parameters(org.apache.commons.configuration2.builder.fluent.Parameters) HostnameLookup(com.evolveum.midpoint.init.interpol.HostnameLookup) RandomLookup(com.evolveum.midpoint.init.interpol.RandomLookup) Lookup(org.apache.commons.configuration2.interpol.Lookup) HostnameLookup(com.evolveum.midpoint.init.interpol.HostnameLookup) RandomLookup(com.evolveum.midpoint.init.interpol.RandomLookup)

Aggregations

HostnameLookup (com.evolveum.midpoint.init.interpol.HostnameLookup)1 RandomLookup (com.evolveum.midpoint.init.interpol.RandomLookup)1 XMLConfiguration (org.apache.commons.configuration2.XMLConfiguration)1 Parameters (org.apache.commons.configuration2.builder.fluent.Parameters)1 Lookup (org.apache.commons.configuration2.interpol.Lookup)1