List of usage examples for java.util Dictionary get
public abstract V get(Object key);
From source file:org.openhab.binding.octoller.internal.OctollerBinding.java
/** * {@inheritDoc}/* ww w .ja v a2 s . c o m*/ */ @Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } setProperlyConfigured(true); } }
From source file:com.adobe.acs.commons.logging.impl.SyslogAppender.java
@Activate @SuppressWarnings("squid:S1149") protected void activate(ComponentContext ctx) { final Dictionary<?, ?> properties = ctx.getProperties(); final String[] loggers = PropertiesUtil.toStringArray(properties.get(PROP_LOGGERS), new String[] { ROOT }); final String suffixPattern = PropertiesUtil.toString(properties.get(PROP_SUFFIX_PATTERN), DEFAULT_SUFFIX_PATTERN);//from w w w. j a v a 2s. c o m final int port = PropertiesUtil.toInteger(properties.get(PROP_PORT), DEFAULT_PORT); final String host = PropertiesUtil.toString(properties.get(PROP_HOST), null); final String facility = PropertiesUtil.toString(properties.get(PROP_FACILITY), DEFAULT_FACILITY); final String stackTracePattern = PropertiesUtil.toString(properties.get(PROP_STACK_TRACE_PATTERN), null); final boolean throwableExcluded = PropertiesUtil.toBoolean(properties.get(PROP_THROWABLE_EXCLUDED), DEFAULT_THROWABLE_EXCLUDED); if (host == null || port == -1) { throw new IllegalArgumentException( "Syslog Appender not configured correctly. Both host and port need to be provided."); } // throws a descriptive IllegalArgumentException if facility is not valid. SyslogAppenderBase.facilityStringToint(facility); final BundleContext bundleContext = ctx.getBundleContext(); appender = new ch.qos.logback.classic.net.SyslogAppender(); appender.setSyslogHost(host); appender.setPort(port); appender.setFacility(facility); appender.setSuffixPattern(suffixPattern); if (StringUtils.isNotEmpty(stackTracePattern)) { appender.setStackTracePattern(stackTracePattern); } appender.setThrowableExcluded(throwableExcluded); Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("loggers", loggers); appenderRegistration = bundleContext.registerService(Appender.class.getName(), appender, props); }
From source file:edu.northwestern.bioinformatics.studycalendar.osgi.felixcm.internal.PscFelixPersistenceManagerTest.java
public void testStoreAsUpdate() throws Exception { {/*w w w . ja v a 2 s . c o m*/ Dictionary d = manager.load(GOOD_PID); d.put("favorite", "mezzanine"); d.put("first", 'W'); d.remove("letters"); manager.store(GOOD_PID, d); } Dictionary reloaded = manager.load(GOOD_PID); assertEquals("Updated value not updated", "mezzanine", reloaded.get("favorite")); assertNull("Removed property still present", reloaded.get("letters")); assertEquals("New property not present", 'W', reloaded.get("first")); }
From source file:org.openhab.action.ciscospark.internal.CiscoSparkActionService.java
/** * @{inheritDoc}/*from w w w . j a v a2 s. c om*/ */ @Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String accessTokenString = Objects.toString(config.get("accessToken")); if (isNotBlank(accessTokenString)) { accessToken = accessTokenString; } if (isBlank(accessToken)) { throw new ConfigurationException("ciscospark", "The parameter 'accessToken' is missing! Please refer to your config file."); } String defaultRoomIdString = Objects.toString(config.get("defaultRoomId")); if (isNotBlank(defaultRoomIdString)) { defaultRoomId = defaultRoomIdString; } isProperlyConfigured = true; start(); } }
From source file:edu.mayo.cts2.framework.core.config.RefreshableServerContext.java
@Override @SuppressWarnings("rawtypes") public void updated(Dictionary properties) throws ConfigurationException { if (properties != null) { String newServerRoot = (String) properties.get(ConfigConstants.SERVER_ROOT_PROPERTY); if (StringUtils.isNotBlank(newServerRoot)) { this.serverRoot = newServerRoot; }/* w w w . jav a 2 s . c o m*/ String newAppName = (String) properties.get(ConfigConstants.APP_NAME_PROPERTY); synchronized (this.mutex) { if (newAppName != null) { this.appName = newAppName; appNameUpdated = true; } } } }
From source file:edu.northwestern.bioinformatics.studycalendar.osgi.felixcm.internal.PscFelixPersistenceManagerTest.java
public void testLoadForExisting() throws Exception { Dictionary actual = manager.load(GOOD_PID); assertNotNull(actual);// ww w .j av a2 s . c o m assertTrue("Missing letters array: " + actual.get("letters"), actual.get("letters") instanceof char[]); assertEquals("Missing favorite value", "godspeed", actual.get("favorite")); assertEquals("Wrong number of items", 2, actual.size()); }
From source file:org.openhab.persistence.grafana.internal.GrafanaChartProvider.java
/** * {@inheritDoc}// w w w . j a v a2 s. c o m */ @Override public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties == null) return; if (properties.get("url") != null) { grafanaUrl = (String) properties.get("url"); } if (properties.get("theme") != null) { theme = (String) properties.get("theme"); } if (properties.get("apiKey") != null) { apiKey = (String) properties.get("apikey"); } }
From source file:org.openhab.binding.ntp.internal.NtpBinding.java
/** * {@inheritDoc}//from www.j av a 2 s . c o m */ @SuppressWarnings("rawtypes") public void updated(Dictionary config) throws ConfigurationException { if (config != null) { String hostnameString = (String) config.get("hostname"); if (StringUtils.isNotBlank(hostnameString)) { hostname = hostnameString; } String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } setProperlyConfigured(true); } }
From source file:org.openhab.io.multimedia.internal.tts.TTSServiceGoogleTTS.java
/** * {@inheritDoc}//from w ww . j a v a2s . c om */ public void updated(Dictionary<String, ?> properties) throws ConfigurationException { if (properties != null) { String language = (String) properties.get(LANGUAGE_PROPERTY); if (!StringUtils.isBlank(language)) { logger.debug("Using TTS language from config: " + ttsLanguage); ttsLanguage = language; } String delimiters = (String) properties.get(SENTENCE_DELIMITERS_PROPERTY); if (!StringUtils.isBlank(delimiters)) { logger.debug("Using custom sentence delimiters from config: " + delimiters); textProcessor.setCustomSentenceDelimiters(delimiters); } String configTranslateUrl = (String) properties.get(TRANSLATE_URL_PROPERTY); if (!StringUtils.isBlank(configTranslateUrl)) { logger.debug("Using custom translate URL from config: " + configTranslateUrl); translateUrl = configTranslateUrl; } } }
From source file:com.whizzosoftware.hobson.wemo.WeMoPlugin.java
/** * Callback method when the plugin's configuration changes. * * @param config the new configuration//from w ww . j a v a 2 s . co m */ @Override public void onPluginConfigurationUpdate(Dictionary config) { String json = (String) config.get(PROP_WEMO_URIS); if (json != null) { deviceURIsProperty = new JSONArray(new JSONTokener(json)); for (int i = 0; i < deviceURIsProperty.length(); i++) { onFoundDevice(deviceURIsProperty.getString(i)); } } }