List of usage examples for java.util Dictionary get
public abstract V get(Object key);
From source file:org.apache.cxf.dosgi.dsw.OsgiUtils.java
public static Filter createFilterFromProperties(BundleContext bc, Dictionary properties) { if (properties == null || properties.isEmpty()) { return null; }/*from ww w. ja v a 2 s. co m*/ StringBuilder sb = new StringBuilder(); sb.append("(&"); for (Enumeration keys = properties.keys(); keys.hasMoreElements();) { String key = keys.nextElement().toString(); String value = properties.get(key).toString(); sb.append('(').append(key).append('=').append(value).append(')'); } sb.append(')'); return createFilter(bc, sb.toString()); }
From source file:com.basistech.yca.FlattenerTest.java
@Test public void flattenSomething() throws Exception { URL testDocUrl = Resources.getResource(FlattenerTest.class, "flatten-test.yaml"); JsonNode node = new ObjectMapper(new YAMLFactory()).readTree(testDocUrl); Dictionary<String, ?> dict = JsonNodeFlattener.flatten(node); assertEquals("blue", dict.get("color")); assertEquals("arms", dict.get("limbs[0]")); assertEquals("legs", dict.get("limbs[1]")); assertEquals(1.0, (Double) dict.get("ingredients.stuffing.thickness"), 0.001); assertEquals("a", dict.get("ingredients.topping[0]")); assertEquals("dog", dict.get("ingredients.topping[2].cat")); }
From source file:ch.entwine.weblounge.bridge.mail.Account.java
/** * Creates a new account from what's found within the properties. * //from w ww .j av a 2 s .com * @param properties * the account properties if either one of the properties * <code>host</code>, <code>account</code> or <code>password</code> * is <code>null</code> */ Account(Dictionary<?, ?> properties) { this((String) properties.get(OPT_HOST), (String) properties.get(OPT_LOGIN), (String) properties.get(OPT_PASSWORD)); }
From source file:com.github.lburgazzoli.quickfixj.osgi.ConfigAdminSessionSettingsBuilder.java
/** * * @param prop/* www . j av a 2 s .c o m*/ * @return */ private boolean validate(Dictionary<String, Object> prop) { return StringUtils.isNoneBlank((String) prop.get(SessionSettings.BEGINSTRING)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.SENDERCOMPID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.SENDERSUBID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.SENDERLOCID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.TARGETCOMPID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.TARGETSUBID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.TARGETLOCID)) && StringUtils.isNoneBlank((String) prop.get(SessionSettings.SESSION_QUALIFIER)) && StringUtils.isNoneBlank((String) prop.get(SessionFactory.INITIATOR_CONNECTION_TYPE)); }
From source file:org.opencastproject.index.service.catalog.adapter.DublinCoreMetadataUtil.java
@SuppressWarnings("unchecked") public static Map<String, MetadataField<?>> getDublinCoreProperties(Dictionary configProperties) { Map<String, MetadataField<?>> dublinCorePropertyMapByConfigurationName = new HashMap<String, MetadataField<?>>(); for (Object configObject : Collections.list(configProperties.keys())) { String property = configObject.toString(); if (getDublinCorePropertyName(property).isSome()) { MetadataField<?> dublinCoreProperty = dublinCorePropertyMapByConfigurationName .get(getDublinCorePropertyName(property).get()); if (dublinCoreProperty == null) { dublinCoreProperty = new MetadataField(); }/*from w w w . j av a 2 s .c om*/ dublinCoreProperty.setValue(getDublinCorePropertyKey(property).get(), configProperties.get(property).toString()); dublinCorePropertyMapByConfigurationName.put(getDublinCorePropertyName(property).get(), dublinCoreProperty); } } Map<String, MetadataField<?>> dublinCorePropertyMap = new TreeMap<String, MetadataField<?>>(); for (MetadataField dublinCoreProperty : dublinCorePropertyMapByConfigurationName.values()) { dublinCorePropertyMap.put(dublinCoreProperty.getOutputID(), dublinCoreProperty); } return dublinCorePropertyMap; }
From source file:org.codice.ddf.configuration.admin.ConfigurationFileFactory.java
private boolean isManagedServiceFactoryConfiguration(Dictionary<String, Object> properties) { return properties.get(ConfigurationAdmin.SERVICE_FACTORYPID) != null; }
From source file:org.codice.ddf.configuration.admin.ConfigurationFileFactory.java
private boolean isManagedServiceConfiguration(Dictionary<String, Object> properties) { return properties.get(Constants.SERVICE_PID) != null; }
From source file:org.opencastproject.dictionary.regexp.DictionaryServiceImpl.java
/** * Load configuration//from www . j ava2 s. c o m */ public synchronized void updated(Dictionary properties) { if (properties != null && properties.get(PATTERN_CONFIG_KEY) != null) { String pattern = properties.get(PATTERN_CONFIG_KEY).toString(); /* Fix special characters */ try { pattern = new String(pattern.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { logger.warn("Error decoding pattern string"); } logger.info("Setting pattern for regexp based DictionaryService to '{}'", pattern); setPattern(pattern); } }
From source file:io.wcm.config.core.override.impl.RequestHeaderOverrideProvider.java
@Activate void activate(final ComponentContext ctx) { Dictionary config = ctx.getProperties(); this.enabled = PropertiesUtil.toBoolean(config.get(PROPERTY_ENABLED), DEFAULT_ENABLED); }
From source file:org.openhab.action.prowl.internal.ProwlActionService.java
@SuppressWarnings("rawtypes") public void updated(Dictionary config) throws ConfigurationException { if (config != null) { Prowl.url = (String) config.get("url"); Prowl.apiKey = (String) config.get("apikey"); if (StringUtils.isBlank(Prowl.apiKey)) { throw new ConfigurationException("prowl.apikey", "The parameter 'apikey' must be configured. Please refer to your 'openhab.cfg'"); }/*w w w . ja va2 s.c o m*/ String priorityString = (String) config.get("defaultpriority"); if (StringUtils.isNotBlank(priorityString)) { Prowl.priority = Integer.valueOf(priorityString); } isProperlyConfigured = true; } }