/** * Searches the given properties file from a list of paths. * * @param propertiesFile the file to load properties * @param confPathList a list of paths to search the propertiesFile * @return the site properties file on success search, or null if failed */ @Nullable public static String searchPropertiesFile(String propertiesFile, String[] confPathList) { if (propertiesFile == null || confPathList == null) { return null; } for (String path : confPathList) { String file = PathUtils.concatPath(path, propertiesFile); Properties properties = loadPropertiesFromFile(file); if (properties != null) { // If a site conf is successfully loaded, stop trying different paths. return file; } } return null; }
Properties siteProps = null; if (sitePropertyFile != null) { siteProps = loadPropertiesFromFile(sitePropertyFile); sSourcePropertyFile = sitePropertyFile; } else {
/** * Searches the given properties file from a list of paths. * * @param propertiesFile the file to load properties * @param confPathList a list of paths to search the propertiesFile * @return the site properties file on success search, or null if failed */ @Nullable public static String searchPropertiesFile(String propertiesFile, String[] confPathList) { if (propertiesFile == null || confPathList == null) { return null; } for (String path : confPathList) { String file = PathUtils.concatPath(path, propertiesFile); Properties properties = loadPropertiesFromFile(file); if (properties != null) { // If a site conf is successfully loaded, stop trying different paths. return file; } } return null; }
ConfigurationUtils.searchPropertiesFile(Constants.SITE_PROPERTIES, confPathList); if (sitePropertyFile != null) { siteProps = ConfigurationUtils.loadPropertiesFromFile(sitePropertyFile); } else { URL resource = Configuration.class.getClassLoader().getResource(Constants.SITE_PROPERTIES);