List of usage examples for java.util Dictionary get
public abstract V get(Object key);
From source file:org.eclipse.swordfish.core.util.MapBasedDictionary.java
public void putAll(Dictionary dictionary) { if (dictionary != null) // copy the dictionary for (Enumeration enm = dictionary.keys(); enm.hasMoreElements();) { Object key = enm.nextElement(); map.put(key, dictionary.get(key)); }/* w w w .j a va 2 s . c o m*/ }
From source file:com.github.lburgazzoli.quickfixj.osgi.ConfigAdminSessionSettingsBuilder.java
@Override public SessionSettings build() { SessionSettings settings = new SessionSettings(); try {/*from w ww.j a v a 2 s . c om*/ Configuration cfg = m_cfgAdm.getConfiguration(m_pid); Dictionary<String, Object> prop = cfg.getProperties(); if (validate(prop)) { Enumeration<String> keys = prop.keys(); String key = null; while (keys.hasMoreElements()) { key = keys.nextElement(); settings.setString(key, (String) prop.get(key)); } } } catch (IOException e) { LOGGER.warn("IOException", e); } return settings; }
From source file:org.opencastproject.inspection.impl.MediaInspectionServiceImpl.java
/** * {@inheritDoc}/*from www . j a v a 2s . c o m*/ * * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary) */ @Override @SuppressWarnings("unchecked") public void updated(Dictionary properties) throws ConfigurationException { if (properties == null) return; final String path = StringUtils .trimToNull((String) properties.get(MediaInfoAnalyzer.MEDIAINFO_BINARY_CONFIG)); if (path != null) { logger.info("Setting the path to mediainfo to " + path); inspector = new MediaInspector(workspace, tikaParser, path); } }
From source file:org.openhab.binding.enigma2.internal.Enigma2Binding.java
/** * @{inheritDoc//from w w w . j ava 2 s . c om */ @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); } Enumeration<String> keys = config.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); String[] keyElements = key.split(":"); String deviceId = keyElements[0]; if (keyElements.length >= 2) { Enigma2Node node = enigmaNodes.get(deviceId); if (node == null) { node = new Enigma2Node(); enigmaNodes.put(deviceId, node); } String option = keyElements[1]; if (option.equals("hostname")) { node.setHostName((String) config.get(key)); } else if (option.equals("username")) { node.setUserName((String) config.get(key)); } else if (option.equals("password")) { node.setPassword((String) config.get(key)); } } } setProperlyConfigured(checkProperlyConfigured()); } }
From source file:org.openhab.binding.mojio.internal.MojioBinding.java
/** * * {@inheritDoc}/*from www. j a va 2 s . co m*/ * */ @SuppressWarnings("rawtypes") public void updated(final Dictionary configuration) throws ConfigurationException { logger.debug("Updating bundle"); String refreshIntervalString = (String) configuration.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } // read further config parameters here ... String appId = (String) configuration.get("appId"); if (StringUtils.isBlank(appId)) { return; // Not properly configured } String appKey = (String) configuration.get("appKey"); if (StringUtils.isBlank(appKey)) { return; // Not properly configured } String username = (String) configuration.get("username"); if (StringUtils.isBlank(username)) { return; // Not properly configured } String password = (String) configuration.get("password"); if (StringUtils.isBlank(password)) { return; // Not properly configured } authTag = new MojioAuthTag(appId, appKey, username, password); logger.debug("Got auth tag: " + authTag.getAuthToken()); setProperlyConfigured(true); }
From source file:org.openhab.binding.radiothermostat.internal.RadioThermostatBinding.java
@Override public void updated(@SuppressWarnings("rawtypes") Dictionary config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); // RefreshInterval is specified in openhap.cfg, therefore enable polling setProperlyConfigured(true); }// w ww. j av a2s . com } }
From source file:org.openhab.action.xmpp.internal.XMPPConnect.java
@SuppressWarnings("rawtypes") public void updated(Dictionary config) throws ConfigurationException { if (config == null) { return;//from www .j a va2s.c o m } XMPPConnect.servername = (String) config.get("servername"); XMPPConnect.proxy = (String) config.get("proxy"); String portString = (String) config.get("port"); if (portString != null) { XMPPConnect.port = Integer.valueOf(portString); } XMPPConnect.username = (String) config.get("username"); XMPPConnect.password = (String) config.get("password"); XMPPConnect.chatroom = (String) config.get("chatroom"); XMPPConnect.chatnickname = (String) config.get("chatnickname"); XMPPConnect.chatpassword = (String) config.get("chatpassword"); String securityModeString = (String) config.get("securitymode"); if (securityModeString != null) { securityMode = SecurityMode.valueOf(securityModeString); } XMPPConnect.tlsPin = (String) config.get("tlspin"); String users = (String) config.get("consoleusers"); if (!StringUtils.isEmpty(users)) { XMPPConnect.consoleUsers = users.split(","); } else { XMPPConnect.consoleUsers = new String[0]; } // check mandatory settings if (StringUtils.isEmpty(servername)) return; if (StringUtils.isEmpty(username)) return; if (StringUtils.isEmpty(password)) return; // set defaults for optional settings if (port == null) { port = 5222; } if (StringUtils.isEmpty(chatnickname)) { chatnickname = "openhab-bot"; } establishConnection(); }
From source file:org.openhab.persistence.emoncms.internal.EmoncmsService.java
/** * @{inheritDoc/*from w ww . ja v a 2 s . co m*/ */ @SuppressWarnings("rawtypes") public void updated(Dictionary config) throws ConfigurationException { this.initialized = false; this.emoncmsLogger = null; logger.debug("Parsing new configuration for emoncms persistence service"); if (config != null) { this.url = (String) config.get("url"); if (StringUtils.isBlank(url)) { this.url = DEFAULT_EVENT_URL; } try { this.node = Integer.parseInt((String) config.get("node")); } catch (Exception e) { logger.info("emoncms using default node : " + DEFAULT_NODE + " error : " + e.getLocalizedMessage()); this.node = DEFAULT_NODE; } try { this.sendInterval = Integer.parseInt((String) config.get("sendinterval")); } catch (Exception e) { logger.info("emoncms using default sendinterval : " + DEFAULT_SEND_INTERVAL + " error : " + e.getLocalizedMessage()); this.sendInterval = DEFAULT_SEND_INTERVAL; } try { this.round = (boolean) Boolean.parseBoolean((String) config.get("round")); } catch (Exception e) { logger.info( "emoncms using default round : " + DEFAULT_ROUND + " error : " + e.getLocalizedMessage()); this.round = DEFAULT_ROUND; } this.apiKey = (String) config.get("apikey"); if (StringUtils.isBlank(apiKey)) { throw new ConfigurationException("emoncms:apikey", "The emoncms API-Key is missing - please configure it in openhab.cfg"); } this.initialized = true; this.emoncmsLogger = (this.sendInterval == 0 ? new EmoncmsLogger(url, apiKey, node, round) : new DelayedEmoncmsLogger(url, apiKey, node, round, sendInterval)); } }
From source file:com.honnix.jaxo.core.internal.services.PoolableCoreServiceImpl.java
private GenericObjectPool.Config buildConfig(Dictionary properties, String prefix) { GenericObjectPool.Config config = new GenericObjectPool.Config(); String maxIdle = (String) properties.get(prefix + MAX_IDLE); if (maxIdle != null) { config.maxIdle = Integer.valueOf(maxIdle); }/*from ww w . j a va 2 s . co m*/ String minIdle = (String) properties.get(prefix + MIN_IDLE); if (minIdle != null) { config.minIdle = Integer.valueOf(minIdle); } String maxActive = (String) properties.get(prefix + MAX_ACTIVE); if (maxActive != null) { config.maxActive = Integer.valueOf(maxActive); } String maxWait = (String) properties.get(prefix + MAX_WAIT); if (maxWait != null) { config.maxWait = Long.valueOf(maxWait); } String timeBetweenEvictionRunsMillis = (String) properties.get(prefix + TIME_BETWEEN_EVICTION_RUNS_MILLIS); if (timeBetweenEvictionRunsMillis != null) { config.timeBetweenEvictionRunsMillis = Long.parseLong(timeBetweenEvictionRunsMillis); } String minEvictableIdleTimeMillis = (String) properties.get(prefix + MIN_EVICTABLE_IDLE_TIME_MILLIS); if (minEvictableIdleTimeMillis != null) { config.minEvictableIdleTimeMillis = Long.parseLong(minEvictableIdleTimeMillis); } return config; }
From source file:org.openhab.binding.IEEE1888.internal.IEEE1888Binding.java
@Override public void updated(Dictionary<String, ?> configuration) throws ConfigurationException { if (removeTimeoutTrapTimer != null) { removeTimeoutTrapTimer.cancel(); }/*from ww w . jav a 2 s. c o m*/ // Trap timeout String trapTimeOutString = (String) configuration.get("trapTimeOut"); if (StringUtils.isNotBlank(trapTimeOutString)) { long trapTimeOut = Long.parseLong(trapTimeOutString); removeTimeoutTrapTimer = new Timer(); removeTimeoutTrapTimer.schedule(new TimerTask() { @Override public void run() { TrapManager.removeTimeoutTrap(trapTimeOut); } }, new Date(), 10 * 1000); } }