List of usage examples for java.util Properties load
public synchronized void load(InputStream inStream) throws IOException
From source file:net.tirasa.olingooauth2.Main.java
public static void main(final String[] args) throws Exception { final Properties oauth2Properties = new Properties(); oauth2Properties.load(Main.class.getResourceAsStream("/oauth2.properties")); final AzureADOAuth2HttpClientFactory oauth2HCF = new AzureADOAuth2HttpClientFactory( oauth2Properties.getProperty("oauth2.authority"), oauth2Properties.getProperty("oauth2.clientId"), oauth2Properties.getProperty("oauth2.redirectURI"), oauth2Properties.getProperty("oauth2.resourceURI"), new UsernamePasswordCredentials(oauth2Properties.getProperty("oauth2.username"), oauth2Properties.getProperty("oauth2.password"))); final ODataClient client = ODataClientFactory.getEdmEnabledV4("https://outlook.office365.com/ews/odata"); client.getConfiguration().setHttpClientFactory(oauth2HCF); final ODataEntitySetRequest<ODataEntitySet> messages = client.getRetrieveRequestFactory() .getEntitySetRequest(/*from w w w.ja v a2 s.com*/ URI.create("https://outlook.office365.com/ews/odata/Me/Folders('Inbox')/Messages")); for (ODataEntity message : messages.execute().getBody().getEntities()) { System.out.println("Message: " + message.getId()); } }
From source file:Main.java
public static void main(String args[]) throws Exception { Properties props = new Properties(); URL url = ClassLoader.getSystemResource("props.properties"); props.load(url.openStream()); System.out.println("prop1 :\n " + props.get("prop1")); System.out.println("prop2 :\n " + props.get("prop2")); }
From source file:Main.java
public static void main(String args[]) throws Exception { Properties props = new Properties(); URL url = ClassLoader.getSystemResource("myprops.props"); props.load(url.openStream()); System.out.println(props);/*from w ww .j a va 2s . c om*/ }
From source file:com.imolinfo.offline.InModelValidation.java
public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { SparkConf conf = new SparkConf().setAppName("Train"); final JavaSparkContext jsc = new JavaSparkContext(conf); Properties p = new Properties(); p.load(new FileInputStream("runtime.properties")); GlobalVariable.getInstance().setProperties(p); invokePipeline(jsc);//from w w w . j a v a2 s . co m }
From source file:hd3gtv.embddb.MainClass.java
public static void main(String[] args) throws Exception { Security.addProvider(new BouncyCastleProvider()); PoolManager poolmanager = new PoolManager("test"); poolmanager.startLocalServers();/*w ww . j a va2s . c o m*/ // TODO manage white/black range addr list for autodiscover Thread.sleep(50); Properties conf = new Properties(); conf.load(FileUtils.openInputStream(new File("conf.properties"))); poolmanager.setBootstrapPotentialNodes( importConf(poolmanager, conf, poolmanager.getProtocol().getDefaultTCPPort())); poolmanager.connectToBootstrapPotentialNodes("Startup"); Thread.sleep(50); poolmanager.startConsole(); }
From source file:net.dfs.user.test.Retrieve.java
/** * Retrieve application will be started with the main() of the {@link Retrieve}. * /*from ww w. ja v a 2 s . com*/ * @param args the parameter which is passed to the main() * @throws IOException * @throws FileNotFoundException * @throws IOException */ public static void main(String args[]) throws IOException { Properties prop = new Properties(); prop.load(new FileInputStream("server.properties")); Retrieve ret = new Retrieve(); ret.fileNameAnalyzer(prop.getProperty("retrieve.fileName")); ApplicationContext context = new ClassPathXmlApplicationContext("net\\dfs\\user\\test\\spring-user.xml"); RetrievalConnectionHandler retrieve = (RetrievalConnectionHandler) context.getBean("retrieve"); retrieve.retrieveFile(fileName, extention, InetAddress.getLocalHost().getHostAddress()); log.debug("The File " + fileName + extention + " Request from the Server"); }
From source file:net.sf.jodreports.cli.CreateDocument.java
public static void main(String[] args) throws Exception { if (args.length < 3) { System.err.println("USAGE: " + CreateDocument.class.getName() + " <template-document> <data-file> <output-document>"); System.exit(0);// ww w . ja v a 2s . c om } File templateFile = new File(args[0]); File dataFile = new File(args[1]); File outputFile = new File(args[2]); DocumentTemplateFactory documentTemplateFactory = new DocumentTemplateFactory(); DocumentTemplate template = documentTemplateFactory.getTemplate(templateFile); Object model = null; String dataFileExtension = FilenameUtils.getExtension(dataFile.getName()); if (dataFileExtension.equals("xml")) { model = NodeModel.parse(dataFile); } else if (dataFileExtension.equals("properties")) { Properties properties = new Properties(); properties.load(new FileInputStream(dataFile)); model = properties; } else { throw new IllegalArgumentException( "data file must be 'xml' or 'properties'; unsupported type: " + dataFileExtension); } template.createDocument(model, new FileOutputStream(outputFile)); }
From source file:com.magnet.mmx.util.DatabaseExport.java
public static void main(String[] args) throws Exception { InputStream inputStream = DeviceDAOImplTest.class.getResourceAsStream("/test.properties"); Properties testProperties = new Properties(); testProperties.load(inputStream); String host = testProperties.getProperty("db.host"); String port = testProperties.getProperty("db.port"); String user = testProperties.getProperty("db.user"); String password = testProperties.getProperty("db.password"); String driver = testProperties.getProperty("db.driver"); String schema = testProperties.getProperty("db.schema"); String url = "jdbc:mysql://" + host + ":" + port + "/" + schema; BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driver);//from w w w.j a va2s. c o m ds.setUsername(user); ds.setPassword(password); ds.setUrl(url); TreeMap<String, String> map = new TreeMap<String, String>(); map.put("mmxTag", "SELECT * FROM mmxTag "); doWork(ds.getConnection(), map); }
From source file:example.ConfigurationsExample.java
public static void main(String[] args) { String jdbcPropToLoad = "prod.properties"; CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("d", "dev", false, "Dev tag to launch app in dev mode. Means that app will launch embedded mckoi db."); try {// ww w .jav a 2 s . com CommandLine line = parser.parse(options, args); if (line.hasOption("d")) { System.err.println("App is in DEV mode"); jdbcPropToLoad = "dev.properties"; } } catch (ParseException exp) { System.err.println("Parsing failed. Reason: " + exp.getMessage()); } Properties p = new Properties(); try { p.load(ConfigurationsExample.class.getResourceAsStream("/" + jdbcPropToLoad)); } catch (IOException e) { System.err.println("Properties loading failed. Reason: " + e.getMessage()); } try { String clazz = p.getProperty("driver.class"); Class.forName(clazz); System.out.println(" Jdbc driver loaded :" + clazz); } catch (ClassNotFoundException e) { System.err.println("Jdbc Driver class loading failed. Reason: " + e.getMessage()); e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) throws IOException { Properties properties = new Properties(); try (InputStream input = new FileInputStream("test.properties")) { properties.load(input); }//from w ww . j av a 2 s . co m for (String key : properties.stringPropertyNames()) { System.out.println(key + " = '" + properties.get(key) + "'"); } }