List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:org.apache.solr.kelvin.URLQueryPerformer.java
@Override protected Object performTestQueries(ITestCase testCase, Properties queryParams) throws Exception { URIBuilder uriBuilder = new URIBuilder(this.baseUrl); for (String paramName : queryParams.stringPropertyNames()) { uriBuilder.setParameter(paramName, queryParams.getProperty(paramName)); }/* w w w . j a va 2s . com*/ URI uri = uriBuilder.build(); HttpGet httpget = new HttpGet(uri); System.out.println("executing request " + httpget.getURI()); // Create a custom response handler ResponseHandler<String> responseHandler = new ResponseHandler<String>() { public String handleResponse(final HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; } else { throw new ClientProtocolException("Unexpected response status: " + status); } } }; String responseBody = httpclient.execute(httpget, responseHandler); return responseBody; }
From source file:com.robin.utilities.config.RobinConfiguration.java
private void loadPropertiesFromPath(final File file) throws IOException { Properties propertiesFromFile = new Properties(); propertiesFromFile.load(getStream(file)); for (String key : propertiesFromFile.stringPropertyNames()) { String value = replaceBaseDirInString(propertiesFromFile.getProperty(key)); properties.setProperty(key, value); }/*w ww . j av a 2 s . co m*/ }
From source file:org.jitsi.meet.test.base.ParticipantOptions.java
/** * Copies all of the mapping from given {@link ParticipantOptions} to this * instance. It will result in an overwrite of any matching properties. * * @param toAdd the options to be merged into this instance. *//*w w w .j a va 2 s.c o m*/ public void putAll(ParticipantOptions toAdd) { // It was a conscious decision Properties srcBackend = toAdd.backend; for (String key : srcBackend.stringPropertyNames()) { setProperty(key, srcBackend.getProperty(key)); } }
From source file:com.github.mrstampy.gameboot.messages.context.GameBootContextLoader.java
private List<String> getCodes(Properties p) { return p.stringPropertyNames().stream().filter(s -> s.endsWith(CODE)).collect(Collectors.toList()); }
From source file:org.apache.hadoop.hive.jdbc.storagehandler.JdbcSerDeHelper.java
public void setProperties(Properties tblProps, Configuration sysConf) { for (String key : tblProps.stringPropertyNames()) { // LOG.info(">> " + key + ">> " + tblProps.getProperty(key)); if (key.contains("jdbc.input.table.name")) { String value = tblProps.getProperty(key); tableName = value;/*from w w w .j av a 2 s . c o m*/ } if (key.startsWith("mapred.jdbc.")) { String value = tblProps.getProperty(key); sysConf.set(key, value); key = key.replaceAll("mapred", "mapreduce"); sysConf.set(key, value); } } for (String key : tblProps.stringPropertyNames()) { if (key.startsWith("mapreduce.jdbc.")) { String value = tblProps.getProperty(key); sysConf.set(key, value); key = key.replaceAll("mapreduce", "mapred"); sysConf.set(key, value); } } }
From source file:org.jitsi.meet.test.base.ParticipantOptions.java
/** * Loads values from the configuration into the participant options backend. * @param config - A <tt>Properties</tt> instance holding configuration * properties.//from w w w . ja v a 2 s . c o m * @param configPrefix the configuration prefix which is used to identify * the config properties which describe the new {@link ParticipantOptions} * set. */ public void load(Properties config, String configPrefix) { for (String key : config.stringPropertyNames()) { if (key.startsWith(configPrefix + ".")) { // Only strings are allowed in the backend, so if config // contains object it will throw class cast exception. String value = config.getProperty(key); backend.setProperty(key.substring(configPrefix.length() + 1), value); } } }
From source file:org.apache.hadoop.hive.common.cli.CommonCliOptions.java
/** * Add the hiveconf properties to the Java system properties, override * anything therein.//from w w w.java2 s. c o m * * @return a copy of the properties specified in hiveconf */ public Properties addHiveconfToSystemProperties() { Properties confProps = commandLine.getOptionProperties("hiveconf"); for (String propKey : confProps.stringPropertyNames()) { if (verbose) { System.err.println("hiveconf: " + propKey + "=" + confProps.getProperty(propKey)); } if (propKey.equalsIgnoreCase("hive.root.logger")) { splitAndSetLogger(propKey, confProps); } else { System.setProperty(propKey, confProps.getProperty(propKey)); } } return confProps; }
From source file:edu.cornell.mannlib.oce.startup.StartupListener.java
/** * The System Property must point to a settings file, and we must be able to * read it, and it must be a valid properties file. *//*from w w w. j a v a 2 s .c o m*/ private void readSettings() throws IOException { String path = System.getProperty(PROPERTY_NAME); if (path == null) { throw new IllegalStateException("No System property for '" + PROPERTY_NAME + "'"); } File file = new File(path); if (!file.exists()) { throw new IllegalStateException("Settings file '" + path + "' does not exist."); } if (!file.isFile()) { throw new IllegalStateException("Settings file '" + path + "' is not a proper file."); } if (!file.canRead()) { throw new IllegalStateException("Cannot read settings file '" + path + "'."); } Properties props = new Properties(); props.load(new FileReader(file)); Map<String, String> map = new HashMap<>(); for (String name : props.stringPropertyNames()) { map.put(name, props.getProperty(name)); } settings = Collections.unmodifiableMap(map); }
From source file:gobblin.kafka.writer.Kafka08DataWriterIntegrationTest.java
private void replaceProperties(Properties props, String searchString, String replacementString) { for (String key : props.stringPropertyNames()) { String value = props.getProperty(key); if (value.contains(searchString)) { String replacedValue = value.replace(searchString, replacementString); props.setProperty(key, replacedValue); }/*from w w w . j a v a2 s .com*/ } }
From source file:com.netflix.iep.dynprop.RemoteConfigurationSource.java
@Override public PollResult poll(boolean initial, Object checkPoint) throws IOException { Properties props = getProperties(); HashMap<String, Object> mProps = new HashMap<>(); for (String key : props.stringPropertyNames()) mProps.put(key, props.getProperty(key)); PollResult pollResult = PollResult.createFull(mProps); if (initial) { logger.info("initialized dynamic properties"); }/*from w w w . ja va 2 s . co m*/ return pollResult; }