List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:it.cnr.icar.eric.client.xml.registry.util.ProviderProperties.java
/** * Merge properties with existing properties. * * @param p New properties/*from ww w.ja v a 2s. c o m*/ */ public void mergeProperties(Properties p) { //todo: consider refactoring to AbstractProperties Set<Object> keys = p.keySet(); Iterator<Object> i = keys.iterator(); Object key; while (i.hasNext()) { key = i.next(); String value = (String) p.get(key); if (key != null && value != null) { this.props.put(key, value); } } }
From source file:com.mmnaseri.dragonfly.runtime.session.ApplicationSessionPreparator.java
public ApplicationSessionPreparator(Properties basePackages, DatabaseDialect databaseDialect, boolean initializeSession) { this(with(basePackages.keySet()).transform(new CastingTransformer<Object, String>(String.class)).list(), databaseDialect, initializeSession); }
From source file:com.alibaba.rocketmq.tools.command.broker.GetBrokerConfigCommand.java
protected void getAndPrint(final MQAdminExt defaultMQAdminExt, final String printPrefix, final String addr) throws InterruptedException, RemotingConnectException, UnsupportedEncodingException, RemotingTimeoutException, MQBrokerException, RemotingSendRequestException { System.out.print(printPrefix); Properties properties = defaultMQAdminExt.getBrokerConfig(addr); if (properties == null) { System.out.printf("Broker[%s] has no config property!\n", addr); return;// w ww.j a va 2 s .co m } for (Object key : properties.keySet()) { System.out.printf("%-50s= %s\n", key, properties.get(key)); } System.out.printf("%n"); }
From source file:com.cloud.utils.PropertiesUtil.java
public static Map<String, String> processConfigFile(String[] configFiles) { Map<String, String> configMap = new HashMap<String, String>(); Properties preProcessedCommands = new Properties(); for (String configFile : configFiles) { File commandsFile = findConfigFile(configFile); if (commandsFile != null) { try { loadFromFile(preProcessedCommands, commandsFile); } catch (FileNotFoundException fnfex) { // in case of a file within a jar in classpath, try to open stream using url InputStream stream = PropertiesUtil.openStreamFromURL(configFile); if (stream != null) { try { preProcessedCommands.load(stream); } catch (IOException e) { s_logger.error("IO Exception, unable to find properties file:", fnfex); }/*from w w w.j a v a2 s .com*/ } else { s_logger.error("Unable to find properites file", fnfex); } } catch (IOException ioe) { s_logger.error("IO Exception loading properties file", ioe); } } } for (Object key : preProcessedCommands.keySet()) { String preProcessedCommand = preProcessedCommands.getProperty((String) key); int splitIndex = preProcessedCommand.lastIndexOf(";"); String value = preProcessedCommand.substring(splitIndex + 1); configMap.put((String) key, value); } return configMap; }
From source file:com.mindquarry.jcr.change.ChangeClient.java
private ByteArrayOutputStream applyHandlerTransformations(ByteArrayOutputStream result) throws Exception { // load handler definitions InputStream is = getClass().getClassLoader().getResourceAsStream("transform-handler.properties"); //$NON-NLS-1$ Properties handlerProps = new Properties(); handlerProps.load(is);/*from w w w.j a v a 2 s . com*/ // process handler Iterator<Object> keys = handlerProps.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); if (key.startsWith("com.mindquarry.jcr.change.handler.")) { //$NON-NLS-1$ String handlerName = handlerProps.getProperty(key); Class handlerClass = Class.forName(handlerName); JcrChangeHandler handler = (JcrChangeHandler) handlerClass.newInstance(); result = handler.process(new ByteArrayInputStream(result.toByteArray())); } } return result; }
From source file:org.apache.archiva.metadata.repository.file.FileMetadataRepository.java
private static void clearMetadataFacetProperties(Collection<MetadataFacet> facetList, Properties properties, String prefix) {//w ww. j a v a 2 s. c o m List<Object> propsToRemove = new ArrayList<>(); for (MetadataFacet facet : facetList) { for (Object key : new ArrayList(properties.keySet())) { String keyString = (String) key; if (keyString.startsWith(prefix + facet.getFacetId() + ":")) { propsToRemove.add(key); } } } for (Object key : propsToRemove) { properties.remove(key); } }
From source file:org.apache.hadoop.hive.ql.processors.SetProcessor.java
private void dumpOptions(Properties p) { SessionState ss = SessionState.get(); ss.out.println("silent=" + (ss.getIsSilent() ? "on" : "off")); for (Object one : p.keySet()) { String oneProp = (String) one; String oneValue = p.getProperty(oneProp); ss.out.println(oneProp + "=" + oneValue); }/*from w ww . j a v a 2s . c o m*/ }
From source file:hydrograph.ui.expression.editor.buttons.OperatorToolCombo.java
private void loadDropDownItems() { Properties properties = new Properties(); InputStream inStream;//from w ww. j a va 2 s . c om try { inStream = ExpressionEditorUtil.INSTANCE.getPropertyFilePath(PathConstant.OPERATOR_CONFIG_FILE); properties.load(inStream); for (Object key : properties.keySet()) { if (key != null && properties.get(key) != null) { String operatorName = StringUtils.replaceChars((String) key, '_', SWT.SPACE); this.add(operatorName); this.setData(operatorName, (String) properties.get(key)); } } } catch (IOException | RuntimeException exception) { LOGGER.error("Exception occurred while loading property file.", exception); StringBuffer buffer = new StringBuffer(); buffer.append(Messages.OPERATOR_FILE_NOT_FOUND); new CustomMessageBox(SWT.ICON_WARNING, buffer.toString(), Messages.WARNING).open(); } }
From source file:org.apache.any23.extractor.microdata.MicrodataParserTest.java
private int countKeysWithPrefix(Properties properties, String prefix) { int count = 0; for (Object key : properties.keySet()) { if (key.toString().indexOf(prefix) == 0) count++;/* www .j a v a 2 s. c om*/ } return count; }
From source file:com.evolveum.midpoint.tools.gui.PropertiesGenerator.java
private PropertiesStatistics mergeProperties(Properties baseProperties, Properties targetProperties) { PropertiesStatistics stats = new PropertiesStatistics(); Set<Object> keySet = baseProperties.keySet(); for (Object key : keySet) { if (targetProperties.containsKey(key)) { continue; }/*from w w w.j a v a 2s .c o m*/ targetProperties.setProperty((String) key, (String) baseProperties.get(key)); stats.incrementAdded(); } keySet = new HashSet<Object>(); keySet.addAll(targetProperties.keySet()); for (Object key : keySet) { if (baseProperties.containsKey(key)) { continue; } targetProperties.remove(key); stats.incrementDeleted(); } return stats; }