List of usage examples for java.util Properties loadFromXML
public synchronized void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException
From source file:com.websqrd.catbot.setting.CatbotSettings.java
private static Properties getXmlProperties(String xmlFilename) { String configFile = getKey(xmlFilename); logger.debug("Read properties = {}", configFile); Properties result = new Properties(); try {//from w ww . java 2 s . c o m result.loadFromXML(new FileInputStream(configFile)); putToCache(result, xmlFilename); return result; } catch (FileNotFoundException e) { logger.error(e.getMessage(), e); } catch (IOException e) { logger.error(e.getMessage(), e); } return null; }
From source file:Main.java
public Properties readProperties() throws Exception { Properties properties = new Properties(); FileInputStream fis = new FileInputStream("configuration.xml"); properties.loadFromXML(fis); return properties; }
From source file:ua.com.ecotep.unianalysis.security.ConfigParamsContext.java
@Override public ServerConfigParams getServerConfigParams() throws Exception { ServerConfigParams scp;/*from w ww . j a v a2s . c o m*/ ConfigEncoder ce = new ConfigEncoderImpl(); File f = new File("unianalysis.xml"); Properties properties = new Properties(); properties.loadFromXML(new FileInputStream(f)); String serverDBPath = null; String serverDBUser = null; String serverDBPass = null; for (String key : properties.stringPropertyNames()) { if (key.equals("serverpath")) { serverDBPath = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes())); } if (key.equals("user")) { serverDBUser = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes())); } if (key.equals("md5")) { serverDBPass = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes())); } } scp = new ServerConfigParamsImpl(serverDBPath, serverDBUser, serverDBPass); return scp; }
From source file:com.xiongyingqi.util.DefaultPropertiesPersister.java
@Override public void loadFromXml(Properties props, InputStream is) throws IOException { props.loadFromXML(is); }
From source file:test.es.alvsanand.webpage.services.UserServiceTest.java
@Before public void setUp() throws Exception { helper.setUp();/*from ww w . j av a2 s. co m*/ userService = new UserServiceImpl(); cryptographyService = new CryptographyServiceImpl(); Properties properties = new Properties(); properties.loadFromXML( ImageAdminServiceTest.class.getResourceAsStream("/" + AlvsanandProperties.CONFIG_FILE_NAME)); AlvsanandProperties.setProperties(properties); }
From source file:com.bigdata.rdf.properties.xml.PropertiesXMLParser.java
@Override public Properties parse(final InputStream in) throws IOException { final Properties p = new Properties(); p.loadFromXML(in); return p;/*from ww w .j a v a2 s .co m*/ }
From source file:com.wallabystreet.kinjo.common.transport.AbstractPeer.java
/** * @return//from w ww. ja v a 2s .c om * @throws IOException * @throws FileNotFoundException * @throws InvalidPropertiesFormatException */ protected Properties loadProperties(File f) throws InvalidPropertiesFormatException, FileNotFoundException, IOException { Properties p = null; p.loadFromXML(new FileInputStream(f)); log.debug("properties successfully loaded"); return new Properties(); }
From source file:com.bigdata.rdf.properties.xml.PropertiesXMLParser.java
@Override public Properties parse(final Reader reader) throws IOException { final InputStream in = new ReaderInputStream(reader, getFormat().getCharset()); try {//from w w w . j a va 2 s . co m final Properties p = new Properties(); p.loadFromXML(in); return p; } finally { in.close(); } }
From source file:org.alfresco.repo.bulkimport.metadataloaders.XmlPropertiesFileMetadataLoader.java
/** * @see AbstractMapBasedMetadataLoader#loadMetadataFromFile(java.io.File) *///from w ww .ja va 2s . c o m @Override protected Map<String, Serializable> loadMetadataFromFile(Path metadataFile) { Map<String, Serializable> result = null; try { Properties props = new Properties(); props.loadFromXML(new BufferedInputStream(Files.newInputStream(metadataFile))); result = new HashMap<String, Serializable>((Map) props); } catch (final IOException ioe) { if (log.isWarnEnabled()) log.warn("Metadata file '" + FileUtils.getFileName(metadataFile) + "' could not be read.", ioe); } return (result); }
From source file:com.enprowess.migration.bulkimport.metadataloaders.XmlPropertiesFileMetadataLoader.java
/** * @param metadataFile// w ww. j av a 2s . c o m * @return a map of key,value pair of the given metadata file */ @Override protected Map<String, Serializable> loadMetadataFromFile(File metadataFile) { Map<String, Serializable> result = null; try { Properties props = new Properties(); props.loadFromXML(new BufferedInputStream(new FileInputStream(metadataFile))); result = new HashMap<>((Map) props); } catch (final IOException ioe) { if (log.isWarnEnabled()) { log.warn("Metadata file '" + FileUtils.getFileName(metadataFile) + "' could not be read.", ioe); } } return result; }