List of usage examples for java.util Properties put
@Override public synchronized Object put(Object key, Object value)
From source file:de.hypoport.ep2.support.configuration.properties.PropertiesLoader.java
static void replacePropertyPlaceHolder(Properties properties) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { String key = (String) keyEnum.nextElement(); Object value = properties.get(key); if (value != null && value instanceof String) { String valueString = (String) value; valueString = replacePropertyPlaceHolder(valueString, properties); properties.put(key, valueString); }//from ww w .jav a 2 s. c o m } }
From source file:mx.itesm.imb.EcoreImbEditor.java
/** * /* ww w . j ava 2 s . co m*/ */ private static void initVelocity() { Properties velocityProperties; try { if (!velocityInit) { velocityProperties = new Properties(); velocityProperties.put("resource.loader", "class"); velocityProperties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(velocityProperties); velocityInit = true; } } catch (Exception e) { System.out.println("Error configuring velocity: " + e.getMessage()); } }
From source file:com.linkedin.databus.bootstrap.utils.BootstrapAddSource.java
private static void updatePropsFromCmdLine(Properties props, String cmdLinePropString) { String[] cmdLinePropSplit = cmdLinePropString.split(";"); for (String s : cmdLinePropSplit) { String[] onePropSplit = s.split("="); if (onePropSplit.length != 2) { LOG.error("CMD line property setting " + s + "is not valid!"); } else {/*from w w w. j a v a 2 s . c o m*/ LOG.info("CMD line Property overwride: " + s); props.put(onePropSplit[0], onePropSplit[1]); } } }
From source file:org.pentaho.support.cmd.CommandLineUtility.java
/** * read support.properties file//from w ww . j av a 2 s . c o m * * @return */ private static Properties loadSupportProperty() { supProp = new StringBuilder(); supProp.append(currentWorkingDirectory).append(File.separator).append(CMDConstant.CMD_RSC) .append(File.separator); Properties props = new Properties(); try { props.load(new FileInputStream(supProp.toString() + File.separator + CMDConstant.SUP_PROP_FILE)); props.put(CMDConstant.ENV_FILE_PATH, supProp.toString() + File.separator + CMDConstant.ENV_FILE_NAME); props.put(CMDConstant.MD5_PATH, supProp.toString()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return props; }
From source file:edu.ku.brc.af.core.UsageTracker.java
/** * Transfers and removes any old statistics from the user prefs to the new location. * @param newProps the new statistics/* w ww . j av a 2 s . c o m*/ */ private static void transferOldStats(final Properties newProps) { Properties lpProps = AppPreferences.getLocalPrefs().getProperties(); // not a copy for (Object keyObj : new Vector<Object>(lpProps.keySet())) { String pName = keyObj.toString(); if (pName.startsWith(USAGE_PREFIX)) { newProps.put(pName.substring(6), lpProps.get(keyObj)); lpProps.remove(keyObj); } } save(); }
From source file:org.cloudfoundry.identity.varz.VarzEndpoint.java
/** * @param properties/*ww w. j av a 2 s . co m*/ * @return new properties with no plaintext passwords */ public static Properties hidePasswords(Properties properties) { Properties result = new Properties(); result.putAll(properties); for (String key : properties.stringPropertyNames()) { if (isPassword(key)) { result.put(key, "#"); } } return result; }
From source file:zipkin.sparkstreaming.autoconfigure.consumer.storage.ZipkinStorageConsumerAutoConfiguration.java
static Properties extractZipkinProperties(ConfigurableEnvironment env) { Properties properties = new Properties(); Iterator<PropertySource<?>> it = env.getPropertySources().iterator(); while (it.hasNext()) { PropertySource<?> next = it.next(); if (!(next instanceof EnumerablePropertySource)) continue; EnumerablePropertySource source = (EnumerablePropertySource) next; for (String name : source.getPropertyNames()) { if (name.startsWith("zipkin")) properties.put(name, source.getProperty(name)); }// w w w . j a v a2 s . c o m } return properties; }
From source file:com.google.code.pentahoflashcharts.charts.PentahoOFC4JChartHelper.java
@SuppressWarnings("unchecked") private static Map createChartFactoryMap() { Properties chartFactories = new Properties(); // First, get known chart factories... try {/*from w w w. j ava 2 s. c om*/ ResourceBundle pluginBundle = ResourceBundle.getBundle(PLUGIN_BUNDLE_NAME); if (pluginBundle != null) { // Copy the bundle here... Enumeration keyEnum = pluginBundle.getKeys(); String bundleKey = null; while (keyEnum.hasMoreElements()) { bundleKey = (String) keyEnum.nextElement(); chartFactories.put(bundleKey, pluginBundle.getString(bundleKey)); } } } catch (Exception ex) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_NO_CHART_FACTORY_PROPERTIES_BUNDLE")); //$NON-NLS-1$ } // Get overrides... // // Note - If the override wants to remove an existing "known" plugin, // simply adding an empty value will cause the "known" plugin to be removed. // if (PentahoSystem.getObjectFactory() == null || !PentahoSystem.getObjectFactory().objectDefined(ISolutionRepository.class.getSimpleName())) { // this is ok return chartFactories; } ISolutionRepository solutionRepository = PentahoSystem.get(ISolutionRepository.class, new StandaloneSession("system")); //$NON-NLS-1$ try { if (solutionRepository.resourceExists(SOLUTION_PROPS)) { InputStream is = solutionRepository.getResourceInputStream(SOLUTION_PROPS, false); Properties overrideChartFactories = new Properties(); overrideChartFactories.load(is); chartFactories.putAll(overrideChartFactories); // load over the top of the known properties } } catch (FileNotFoundException ignored) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_NO_CHART_FACTORY_PROPERTIES")); //$NON-NLS-1$ } catch (IOException ignored) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_BAD_CHART_FACTORY_PROPERTIES"), ignored); //$NON-NLS-1$ } return chartFactories; }
From source file:com.jkoolcloud.tnt4j.streams.custom.kafka.interceptors.reporters.trace.MsgTraceReporter.java
protected static void pollConfigQueue(Map<String, ?> config, Properties kafkaProperties, Map<String, TraceCommandDeserializer.TopicTraceCommand> traceConfig) { Properties props = new Properties(); if (config != null) { props.putAll(config);// ww w.ja v a 2s .c o m } if (kafkaProperties != null) { props.putAll(extractKafkaProperties(kafkaProperties)); } if (!props.isEmpty()) { props.put(ConsumerConfig.CLIENT_ID_CONFIG, "kafka-x-ray-message-trace-reporter-config-listener"); // NON-NLS props.remove(ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG); KafkaConsumer<String, TraceCommandDeserializer.TopicTraceCommand> consumer = getKafkaConsumer(props); while (true) { ConsumerRecords<String, TraceCommandDeserializer.TopicTraceCommand> records = consumer.poll(100); if (records.count() > 0) { LOGGER.log(OpLevel.DEBUG, StreamsResources.getBundle(KafkaStreamConstants.RESOURCE_BUNDLE_NAME), "MsgTraceReporter.polled.commands", records.count(), records.iterator().next()); for (ConsumerRecord<String, TraceCommandDeserializer.TopicTraceCommand> record : records) { if (record.value() != null) { traceConfig.put(record.value().topic, record.value()); } } break; } } } }
From source file:annis.gui.docbrowser.DocBrowserController.java
private static Properties parseMappings(Visualizer config) { Properties mappings = new Properties(); if (config.getMappings() != null) { // split the entrys String[] entries = config.getMappings().split(";"); for (String e : entries) { // split key-value String[] keyvalue = e.split(":", 2); if (keyvalue.length == 2) { mappings.put(keyvalue[0].trim(), keyvalue[1].trim()); }/*from w ww . j a v a 2 s. c o m*/ } } return mappings; }