/** * Implement a quick and dirty sorting mechanism for the given Properties. * @param allProperties * @return the Properties list sorted by it's 'configuration.ordinal' in ascending order. */ private static List<Properties> sortProperties(List<Properties> allProperties) { List<Properties> sortedProperties = new ArrayList<>(); for (Properties p : allProperties) { int configOrder = getConfigurationOrdinal(p); int i; for (i = 0; i < sortedProperties.size(); i++) { int listConfigOrder = getConfigurationOrdinal(sortedProperties.get(i)); if (listConfigOrder > configOrder) { // only go as far as we found a higher priority Properties file break; } } sortedProperties.add(i, p); } return sortedProperties; }
/** * (re)read the configuration from the resources in the classpath. * @see #DEFAULT_CONFIG_PROPERTIES_NAME * @see #DEFAULT_CONFIG_PROPERTIES_NAME */ public synchronized void parseConfiguration() throws WebBeansConfigurationException { Properties newConfigProperties = PropertyLoader.getProperties(DEFAULT_CONFIG_PROPERTIES_NAME); configProperties.clear(); // set the new one as perfect fit. if(newConfigProperties != null) { overrideWithGlobalSettings(newConfigProperties); configProperties.putAll(newConfigProperties); } }
List<Properties> allProperties = loadAllProperties(propertyFileName); if (allProperties == null) List<Properties> sortedProperties = sortProperties(allProperties); Properties properties = mergeProperties(sortedProperties); return properties;
try List<Properties> properties = PropertyLoader.loadAllProperties(DEFAULT_CONFIG_PROPERTIES_NAME); if (properties != null)
int ordinal = getConfigurationOrdinal(prop); if(logger.isLoggable(Level.FINE))