private static List<Properties> loadAllProperties(String propertyFileName) throws IOException { ClassLoader cl = ClassUtils.getClassLoader(null); List<Properties> properties = new ArrayList<Properties>(); // read the normal property file names Enumeration<URL> propertyUrls = cl.getResources(propertyFileName + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } // and also read the ones post-fixed with the projectStage ProjectStage ps = ProjectStageProducer.getInstance().getProjectStage(); propertyUrls = cl.getResources(propertyFileName + "-" + ps + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } if (properties.isEmpty()) { if (LOG.isLoggable(Level.INFO)) { LOG.info("could not find any property files with name " + propertyFileName); } return null; } return properties; }
private static List<Properties> loadAllProperties(String propertyFileName) throws IOException { ClassLoader cl = ClassUtils.getClassLoader(null); List<Properties> properties = new ArrayList<Properties>(); // read the normal property file names Enumeration<URL> propertyUrls = cl.getResources(propertyFileName + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } // and also read the ones post-fixed with the projectStage ProjectStage ps = ProjectStageProducer.getInstance().getProjectStage(); propertyUrls = cl.getResources(propertyFileName + "-" + ps + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } if (properties.isEmpty()) { if (LOG.isLoggable(Level.INFO)) { LOG.info("could not find any property files with name " + propertyFileName); } return null; } return properties; }
private static List<Properties> loadAllProperties(String propertyFileName) throws IOException { ClassLoader cl = ClassUtils.getClassLoader(null); List<Properties> properties = new ArrayList<Properties>(); // read the normal property file names Enumeration<URL> propertyUrls = cl.getResources(propertyFileName + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } // and also read the ones post-fixed with the projectStage ProjectStage ps = ProjectStageProducer.getInstance().getProjectStage(); propertyUrls = cl.getResources(propertyFileName + "-" + ps + FILE_EXTENSION); while (propertyUrls != null && propertyUrls.hasMoreElements()) { URL propertyUrl = propertyUrls.nextElement(); fillProperties(properties, propertyUrl); } if (properties.isEmpty()) { if (LOG.isLoggable(Level.INFO)) { LOG.info("could not find any property files with name " + propertyFileName); } return null; } return properties; }