/** * Loads configuration from system defined arguments, i.e. -Dapi.x.y.z=abc. */ public Configuration fromSystem() { MapConfiguration mapConfig = setupConfiguration(new MapConfiguration((Properties) System.getProperties().clone())); // Disables trimming so system properties that include whitespace (such as line.separator) will // be preserved. mapConfig.setTrimmingDisabled(true); return mapConfig; }
/** * Loads configuration from system defined arguments, i.e. -Dapi.x.y.z=abc. */ public Configuration fromSystem() { MapConfiguration mapConfig = setupConfiguration(new MapConfiguration((Properties) System.getProperties().clone())); // Disables trimming so system properties that include whitespace (such as line.separator) will // be preserved. mapConfig.setTrimmingDisabled(true); return mapConfig; }
/** * Loads configuration from a specified path. If not absolute, will look in * the user home directory, the current classpath and the system classpath. * Absolute classpath references will not work. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(String path) throws ConfigurationLoadException { PropertiesConfiguration propertiesConfiguration = setupConfiguration(new PropertiesConfiguration()); propertiesConfiguration.setFileName(path); try { propertiesConfiguration.load(); } catch (ConfigurationException e) { if (Throwables.getRootCause(e) instanceof AccessControlException){ AdsServiceLoggers.ADS_API_LIB_LOG.debug("Properties could not be loaded.", e); } else { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } } return propertiesConfiguration; }
/** * Loads configuration from a specified path. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(File path) throws ConfigurationLoadException { PropertiesConfiguration configuration = setupConfiguration(new PropertiesConfiguration()); configuration.setFile(path); try { configuration.load(); return configuration; } catch (ConfigurationException e) { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } }
/** * Loads configuration from a specified path. If not absolute, will look in * the user home directory, the current classpath and the system classpath. * Absolute classpath references will not work. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(String path) throws ConfigurationLoadException { PropertiesConfiguration propertiesConfiguration = setupConfiguration(new PropertiesConfiguration()); propertiesConfiguration.setFileName(path); try { propertiesConfiguration.load(); } catch (ConfigurationException e) { if (Throwables.getRootCause(e) instanceof AccessControlException){ AdsServiceLoggers.ADS_API_LIB_LOG.debug("Properties could not be loaded.", e); } else { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } } return propertiesConfiguration; }
combinedConfiguration.addConfiguration((AbstractConfiguration) configuration); } else { combinedConfiguration.addConfiguration(setupConfiguration(new AbstractConfiguration() {
combinedConfiguration.addConfiguration((AbstractConfiguration) configuration); } else { combinedConfiguration.addConfiguration(setupConfiguration(new AbstractConfiguration() {
/** * Loads configuration from a specified path. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(URL path) throws ConfigurationLoadException { PropertiesConfiguration configuration = setupConfiguration(new PropertiesConfiguration()); configuration.setURL(path); try { configuration.load(); return configuration; } catch (ConfigurationException e) { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } }
/** * Loads configuration from a specified path. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(URL path) throws ConfigurationLoadException { PropertiesConfiguration configuration = setupConfiguration(new PropertiesConfiguration()); configuration.setURL(path); try { configuration.load(); return configuration; } catch (ConfigurationException e) { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } }
/** * Loads configuration from a specified path. * * @param path the path to try first as a resource, then as a file * @throws ConfigurationLoadException if the configuration could not be * loaded. * @returns properties loaded from the specified path or null. */ public Configuration fromFile(File path) throws ConfigurationLoadException { PropertiesConfiguration configuration = setupConfiguration(new PropertiesConfiguration()); configuration.setFile(path); try { configuration.load(); return configuration; } catch (ConfigurationException e) { throw new ConfigurationLoadException( "Encountered a problem reading the provided configuration file \"" + path + "\"!", e); } }
@Nullable List<ConfigurationInfo<URL>> urls) throws ConfigurationLoadException { CombinedConfiguration combinedConfiguration = setupConfiguration(new CombinedConfiguration(new OverrideCombiner()));
@Nullable List<ConfigurationInfo<URL>> urls) throws ConfigurationLoadException { CombinedConfiguration combinedConfiguration = setupConfiguration(new CombinedConfiguration(new OverrideCombiner()));