List of usage examples for java.util Properties getProperty
public String getProperty(String key)
From source file:com.cognifide.qa.bb.provider.selenium.webdriver.WebDriverType.java
private static WebDriver getWebDriverWithProxyCookieSupport(Properties properties, WebDriver driver) { if (Boolean.valueOf(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE))) { driver.get(properties.getProperty(ConfigKeys.BASE_URL)); Cookie cookie = new Cookie(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_NAME), properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_VALUE), "." + properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_DOMAIN), "/", DateUtils.addMonths(new Date(), 1)); driver.manage().addCookie(cookie); }/*from w ww . j a v a 2s . c om*/ return driver; }
From source file:io.unravelling.ferguson.configuration.FergusonConfiguration.java
/** * Validates the server username that was supplied. * @param configuration Configuration of the server. * @return Boolean indicating if the server configuration is correct or not. *//*from w w w. j ava2 s .co m*/ static boolean validateServerUsername(final Properties configuration) { return (configuration.containsKey(FergusonConfiguration.SERVER_USERNAME) && !configuration.getProperty(FergusonConfiguration.SERVER_USERNAME).isEmpty()); }
From source file:com.amazonaws.devicefarm.DeviceFarmClientFactory.java
private static String readPluginVersion() { try {//from w w w. j a v a2 s . c o m final Properties props = new Properties(); props.load(DeviceFarmServer.class.getResourceAsStream("/META-INF/gradle-plugins/version.properties")); return props.getProperty("version"); } catch (IOException e) { throw new DeviceFarmException("Unable to read version", e); } }
From source file:de.uzk.hki.da.at.AcceptanceTest.java
/** * @param gridImplBeanName bean name /* www . ja v a 2 s. c om*/ * @param dcaImplBeanName distributed conversion adapter beanName * @return */ private static void instantiateGrid(Properties properties) { String gridImplBeanName = properties.getProperty("cb.implementation.grid"); String dcaImplBeanName = properties.getProperty("cb.implementation.distributedConversion"); if (gridImplBeanName == null) gridImplBeanName = "fakeGridFacade"; if (dcaImplBeanName == null) dcaImplBeanName = "fakeDistributedConversionAdapter"; AbstractApplicationContext context = new FileSystemXmlApplicationContext("conf/beans.xml"); gridFacade = (GridFacade) context.getBean(gridImplBeanName); distributedConversionAdapter = (DistributedConversionAdapter) context.getBean(dcaImplBeanName); context.close(); }
From source file:hd3gtv.embddb.MainClass.java
private static List<InetSocketAddress> importConf(PoolManager poolmanager, Properties conf, int default_port) throws Exception { if (conf.containsKey("hosts") == false) { throw new NullPointerException("No hosts in configuration"); }/*ww w. j av a 2 s . com*/ String hosts = conf.getProperty("hosts"); return Arrays.asList(hosts.split(" ")).stream().map(addr -> { if (addr.isEmpty() == false) { log.debug("Found host in configuration: " + addr); return new InetSocketAddress(addr, default_port); } else { return null; } }).filter(addr -> { return addr != null; }).collect(Collectors.toList()); }
From source file:com.roche.iceboar.settings.GlobalSettingsFactory.java
private static boolean getCloseOnEnd(Properties properties) { String closeOnEnd = properties.getProperty(JNLP_CLOSE_ON_END); return !(isNotBlank(closeOnEnd) && closeOnEnd.equals("false")); }
From source file:de.drippinger.serviceExtractor.CLIEntry.java
static RunParameter extractParameterFromConfigFile(CommandLine cmd) throws ExtractorException { RunParameter parameter = new RunParameter(); StandardPBEStringEncryptor encryptors = new StandardPBEStringEncryptor(); encryptors.setPassword(cmd.getOptionValue("s")); Properties properties = new EncryptableProperties(encryptors); try {/*from www . j a v a 2 s.co m*/ properties.load(new FileInputStream(cmd.getOptionValue("c"))); parameter.database(properties.getProperty("datasource.url")) .databaseUser(properties.getProperty("datasource.username")) .databasePassword(properties.getProperty("datasource.password")) .pathToFlows(properties.getProperty("wm.pathToFlows")); } catch (IOException e) { throw new ExtractorException("Could not load property file", e); } return parameter; }
From source file:gridool.Settings.java
private static void importExternalFiles(final Properties props, final String userDir) { final String externals = props.getProperty("prop.external"); if (externals == null) { return;// www . j a v a 2s . co m } String[] filePaths = externals.split(";"); for (String fp : filePaths) { fp = fp.trim(); if (fp.length() == 0) { continue; } final InputStream is = ClassLoader.getSystemResourceAsStream(fp); if (is != null) { try { props.load(is); LOG.info("Loaded an external property file in the classpath: " + fp); } catch (IOException e) { LOG.warn("An error caused while loading a property file: " + fp); } String fileName = FileUtils.basename(fp, '/'); File propFile = new File(userDir, fileName); if (propFile.exists()) { try { props.load(new FileInputStream(propFile)); LOG.info("Loaded an external property file in the user dir: " + fp); } catch (IOException e) { LOG.warn("An error caused while loading a property file: " + propFile.getAbsolutePath()); } } } } }
From source file:com.feilong.commons.core.configure.PropertiesUtil.java
/** * ?Properties?./*from ww w . j ava2 s . c o m*/ * * @param clz * ? * @param propertiesPath * Properties "/WEB-INF/classes/feilong.user.properties" * @param key * * @return ?Properties? * @see #getProperties(Class, String) */ public static String getPropertiesValue(Class<?> clz, String propertiesPath, String key) { Properties properties = getProperties(clz, propertiesPath); return properties.getProperty(key); }
From source file:com.cloudera.recordbreaker.hive.borrowed.AvroSerdeUtils.java
/** * Determine the schema to that's been provided for Avro serde work. * @param properties containing a key pointing to the schema, one way or another * @return schema to use while serdeing the avro file * @throws IOException if error while trying to read the schema from another location * @throws AvroSerdeException if unable to find a schema or pointer to it in the properties */// ww w .j a v a2 s. com public static Schema determineSchemaOrThrowException(Properties properties) throws IOException, AvroSerdeException { String schemaString = properties.getProperty(SCHEMA_LITERAL); if (schemaString != null && !schemaString.equals(SCHEMA_NONE)) return Schema.parse(schemaString); // Try pulling directly from URL schemaString = properties.getProperty(SCHEMA_URL); if (schemaString == null || schemaString.equals(SCHEMA_NONE)) throw new AvroSerdeException(EXCEPTION_MESSAGE); try { if (schemaString.toLowerCase().startsWith("hdfs://")) return getSchemaFromHDFS(schemaString, new Configuration()); } catch (IOException ioe) { throw new AvroSerdeException("Unable to read schema from HDFS: " + schemaString, ioe); } return Schema.parse(new URL(schemaString).openStream()); }