/** * 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. 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(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); } }
/** * 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); } }