List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:org.spring.data.gemfire.config.DistributedSystemValidationBeanPostProcessor.java
protected void logDiff(String sourceLabel, Properties source, String targetLabel, Properties target) { for (String propertyName : target.stringPropertyNames()) { if (source.containsKey(propertyName)) { String sourcePropertyValue = StringUtils.trimWhitespace(source.getProperty(propertyName)); String targetPropertyValue = StringUtils.trimWhitespace(target.getProperty(propertyName)); if (!targetPropertyValue.equals(sourcePropertyValue)) { System.out.printf( "**CONFIGURATION ERROR** Expected the %1$s value (%2$s) of property (%3$s); but %4$s value was (%5$s)%n", sourceLabel, sourcePropertyValue, propertyName, targetLabel, targetPropertyValue); }//from ww w. jav a 2 s .co m } } }
From source file:org.icgc.dcc.portal.PortalMain.java
private void logInfo(PortalProperties config) { log.info("{}", repeat("-", 100)); log.info("Version: {}", getVersion()); log.info("Built: {}", getBuildTimestamp()); log.info("SCM:"); Properties scmInfo = VersionUtils.getScmInfo(); for (String property : scmInfo.stringPropertyNames()) { String value = scmInfo.getProperty(property, "").replaceAll("\n", " "); log.info(" {}: {}", padEnd(property, 24, ' '), value); }/*from w ww. j a v a2 s . c o m*/ log.info("Config: {}", config); log.info("Working Directory: {}", System.getProperty("user.dir")); log.info("{}", repeat("-", 100)); }
From source file:com.eryansky.modules.sys.service.ConfigService.java
/** * ??/*w w w .ja va 2 s .c o m*/ * @param overrideFromProperties */ @Transactional(readOnly = false) public void syncFromProperties(Boolean overrideFromProperties) { PropertiesLoader propertiesLoader = AppConstants.getConfig(); Properties properties = propertiesLoader.getProperties(); for (String key : properties.stringPropertyNames()) { Config config = getConfigByCode(key); if (config == null) { config = new Config(key, properties.getProperty(key), null); this.save(config); } else { if (overrideFromProperties != null && overrideFromProperties) { config.setValue(properties.getProperty(key)); this.save(config); } } } }
From source file:org.apache.hive.service.server.ServerOptionsProcessor.java
public boolean process(String[] argv) { try {//from www .ja v a 2 s .c om commandLine = new GnuParser().parse(options, argv); if (commandLine.hasOption('H')) { printUsage(); return false; } //get hiveconf param values and set the System property values Properties confProps = commandLine.getOptionProperties("hiveconf"); for (String propKey : confProps.stringPropertyNames()) { LOG.debug("Setting " + propKey + "=" + confProps.getProperty(propKey) + ";"); System.setProperty(propKey, confProps.getProperty(propKey)); } } catch (ParseException e) { System.err.println(e.getMessage()); printUsage(); return false; } return true; }
From source file:org.wso2.carbon.webapp.mgt.WebappMetadataDeployer.java
private void loadPersistData(String path, WebApplication webapp) throws ArtifactMetadataException, AxisFault { ArtifactMetadataManager manager = DeploymentArtifactMetadataFactory.getInstance(axisConfig) .getMetadataManager();/*from w ww . ja v a 2 s. co m*/ Properties prop = manager.loadParameters(path); for (String propName : prop.stringPropertyNames()) { String propValue = prop.getProperty(propName); webapp.addParameter(propName, propValue); } }
From source file:org.elasticsearch.hadoop.hive.EsStorageHandler.java
private void copyToJobProperties(Map<String, String> jobProperties, Properties properties) { // #359, HIVE-8307 for (String key : properties.stringPropertyNames()) { // copy only some properties since apparently job properties can contain junk which messes up the XML serialization if (key.startsWith("es.") || key.equals(TABLE_LOCATION) || key.equals(COLUMNS) || key.equals(COLUMNS_TYPES)) { jobProperties.put(key, properties.getProperty(key)); }/* w w w . ja va2 s .co m*/ } }
From source file:org.spring.data.gemfire.config.DistributedSystemValidationBeanPostProcessor.java
protected void log(String label, Properties properties) { Set<String> propertyNames = new TreeSet<>(properties.stringPropertyNames()); StringBuilder builder = new StringBuilder("[\n"); int count = 0; for (String propertyName : propertyNames) { builder.append(++count > 1 ? ",\n" : ""); builder.append(String.format(" %1$s = %2$s", propertyName, properties.getProperty(propertyName))); }/*from w w w .java2s . c om*/ builder.append("\n]"); System.out.printf("%1$s (%2$s)%n", label, builder.toString()); }
From source file:org.apache.hive.service.server.HiveServerServerOptionsProcessor.java
public HiveServer2.ServerOptionsProcessorResponse parse(String[] argv) { try {/*from ww w. j ava 2s . c o m*/ commandLine = new GnuParser().parse(options, argv); // Process --hiveconf // Get hiveconf param values and set the System property values Properties confProps = commandLine.getOptionProperties("hiveconf"); for (String propKey : confProps.stringPropertyNames()) { // save logging message for log4j output latter after log4j initialize properly debugMessage.append("Setting " + propKey + "=" + confProps.getProperty(propKey) + ";\n"); // System.setProperty("hivecli." + propKey, confProps.getProperty(propKey)); System.setProperty(propKey, confProps.getProperty(propKey)); } // Process --help if (commandLine.hasOption('H')) { return new HiveServer2.ServerOptionsProcessorResponse( new HiveServer2.HelpOptionExecutor(serverName, options)); } // Process --deregister if (commandLine.hasOption("deregister")) { return new HiveServer2.ServerOptionsProcessorResponse( new HiveServer2.DeregisterOptionExecutor(commandLine.getOptionValue("deregister"))); } } catch (ParseException e) { // Error out & exit - we were not able to parse the args successfully System.err.println("Error starting HiveServer2 with given arguments: "); System.err.println(e.getMessage()); System.exit(-1); } // Default executor, when no option is specified return new HiveServer2.ServerOptionsProcessorResponse(new HiveServer2.StartOptionExecutor()); }
From source file:com.velonuboso.made.gui.Configurator.java
private void copyProperties(Properties source, Properties target) { for (String key : source.stringPropertyNames()) { target.put(key, source.getProperty(key)); }/*from w ww . j a va 2 s .c o m*/ }
From source file:org.apache.samza.tools.benchmark.AbstractSamzaBench.java
Config convertToSamzaConfig(Properties props) { Map<String, String> propsValue = props.stringPropertyNames().stream() .collect(Collectors.toMap(Function.identity(), props::getProperty)); return new MapConfig(propsValue); }