private static Properties loadFromFile(String uri) throws IOException { InputStream inputStream = null; Properties inputProperties = new Properties(); Properties outputProperties = new Properties(); if( new File(uri).exists() ) { inputStream = new FileInputStream(uri); } else { // it's probably a file embedded in a .jar inputStream = new URL(uri).openStream(); } try { loadFromXML(inputProperties,inputStream); } finally { inputStream.close(); } Enumeration namesEnumeration = inputProperties.propertyNames(); while(namesEnumeration.hasMoreElements()) { String propertyName = (String)namesEnumeration.nextElement(); String propertyValue = inputProperties.getProperty(propertyName); propertyValue = propertyValue.trim(); // perform JBossAS style property substitutions. JBTM-369 propertyValue = StringPropertyReplacer.replaceProperties(propertyValue); outputProperties.setProperty(propertyName, propertyValue); } return outputProperties; }
private static Properties loadFromFile(String uri) throws IOException { InputStream inputStream = null; Properties inputProperties = new Properties(); Properties outputProperties = new Properties(); if( new File(uri).exists() ) { inputStream = new FileInputStream(uri); } else { // it's probably a file embedded in a .jar inputStream = new URL(uri).openStream(); } try { loadFromXML(inputProperties,inputStream); } finally { inputStream.close(); } Enumeration namesEnumeration = inputProperties.propertyNames(); while(namesEnumeration.hasMoreElements()) { String propertyName = (String)namesEnumeration.nextElement(); String propertyValue = inputProperties.getProperty(propertyName); propertyValue = propertyValue.trim(); // perform JBossAS style property substitutions. JBTM-369 propertyValue = StringPropertyReplacer.replaceProperties(propertyValue); outputProperties.setProperty(propertyName, propertyValue); } return outputProperties; }
private static Properties loadFromFile(String uri) throws IOException { InputStream inputStream = null; Properties inputProperties = new Properties(); Properties outputProperties = new Properties(); if( new File(uri).exists() ) { inputStream = new FileInputStream(uri); } else { // it's probably a file embedded in a .jar inputStream = new URL(uri).openStream(); } try { loadFromXML(inputProperties,inputStream); } finally { inputStream.close(); } Enumeration namesEnumeration = inputProperties.propertyNames(); while(namesEnumeration.hasMoreElements()) { String propertyName = (String)namesEnumeration.nextElement(); String propertyValue = inputProperties.getProperty(propertyName); propertyValue = propertyValue.trim(); // perform JBossAS style property substitutions. JBTM-369 propertyValue = StringPropertyReplacer.replaceProperties(propertyValue); outputProperties.setProperty(propertyName, propertyValue); } return outputProperties; }
private static Properties loadFromFile(String uri) throws IOException { InputStream inputStream = null; Properties inputProperties = new Properties(); Properties outputProperties = new Properties(); if( new File(uri).exists() ) { inputStream = new FileInputStream(uri); } else { // it's probably a file embedded in a .jar inputStream = new URL(uri).openStream(); } try { loadFromXML(inputProperties,inputStream); } finally { inputStream.close(); } Enumeration namesEnumeration = inputProperties.propertyNames(); while(namesEnumeration.hasMoreElements()) { String propertyName = (String)namesEnumeration.nextElement(); String propertyValue = inputProperties.getProperty(propertyName); propertyValue = propertyValue.trim(); // perform JBossAS style property substitutions. JBTM-369 propertyValue = StringPropertyReplacer.replaceProperties(propertyValue); outputProperties.setProperty(propertyName, propertyValue); } return outputProperties; }