List of usage examples for java.util Dictionary get
public abstract V get(Object key);
From source file:org.jahia.services.usermanager.ldap.JahiaLDAPConfig.java
@SuppressWarnings("unchecked") private String computeProviderKey(Dictionary<String, ?> dictionary) { String provideKey = (String) dictionary.get(LDAP_PROVIDER_KEY_PROP); if (provideKey != null) { return provideKey; }/* w w w. jav a2s . c om*/ String filename = (String) dictionary.get("felix.fileinstall.filename"); String factoryPid = (String) dictionary.get(ConfigurationAdmin.SERVICE_FACTORYPID); String confId; if (StringUtils.isBlank(filename)) { confId = (String) dictionary.get(Constants.SERVICE_PID); if (StringUtils.startsWith(confId, factoryPid + ".")) { confId = StringUtils.substringAfter(confId, factoryPid + "."); } } else { confId = StringUtils.removeEnd(StringUtils.substringAfter(filename, factoryPid + "-"), ".cfg"); } return (StringUtils.isBlank(confId) || "config".equals(confId)) ? "ldap" : ("ldap." + confId); }
From source file:com.activecq.tools.auth.impl.PluggableAuthenticationHandlerImpl.java
/** OSGi Activate/Deactivate **/ protected void activate(ComponentContext componentContext) { Dictionary properties = componentContext.getProperties(); enabled = PropertiesUtil.toBoolean(properties.get(PROP_ENABLED), DEFAULT_ENABLED); trustCredentials = PropertiesUtil.toString(properties.get(PROP_TRUST_CREDENTIALS), DEFAULT_TRUST_CREDENTIALS);/*from w w w .j a v a 2s.com*/ requestCredentialsRedirect = StringUtils.stripToEmpty(PropertiesUtil .toString(properties.get(PROP_REQUEST_CREDENTIALS_REDIRECT), DEFAULT_REQUEST_CREDENTIALS_REDIRECT)); try { adminResourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null); } catch (LoginException ex) { } }
From source file:org.openhab.binding.ekey.internal.EKeyBinding.java
/** * @{inheritDoc// www .j ava 2 s.c o m */ @Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { // get ip from config file ip = (String) config.get("ip"); if (!Pattern.compile(IP_PATTERN).matcher(ip).matches()) { // check valid ip logger.warn("eKey:ip No ip specified. It is recommended to specify a static ip"); ip = null; } // get port from config file String portstring = (String) config.get("port"); if (StringUtils.isNotBlank(portstring)) { port = Integer.parseInt(portstring); } else throw new ConfigurationException("eKey:port", "No port specified." + " Please specify a port as you did during the UDP-Converter configuration"); // get mode from config file String modestring = (String) config.get("mode"); if (StringUtils.isNotBlank(modestring)) { modestring = modestring.toUpperCase().trim(); if (modestring.equals(MODES[0])) mode = UniformPacket.tRARE; else if (modestring.equals(MODES[1])) mode = UniformPacket.tHOME; else if (modestring.equals(MODES[2])) mode = UniformPacket.tMULTI; else throw new ConfigurationException("eKey:mode", "Unknown mode '" + modestring + "'. Valid values are RARE, MULTI or HOME."); } else { // no mode specified -> use default logger.warn("eKey:mode was not declared in the config file. So mode RARE is used as default!"); mode = UniformPacket.tRARE; } // get deliminator from the config file String delstring = (String) config.get("delimiter"); if (StringUtils.isBlank(delstring)) { // a blank (" ") will be definded as default deliminator deliminator = " "; } else { deliminator = delstring; } // make sure that there is no listener running packetlistener.stopListener(); // send the parsed information to the listener packetlistener.initializeReceiver(mode, ip, port, deliminator); // start the listener new Thread(packetlistener).start(); } }
From source file:org.openhab.binding.hue.internal.HueBinding.java
@SuppressWarnings("rawtypes") @Override//w w w .j av a2 s . c om public void updated(Dictionary config) throws ConfigurationException { if (config != null) { String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { this.bridgeIP = ip; } else { try { this.bridgeIP = new SsdpDiscovery().findIpForResponseKeywords("description.xml", "FreeRTOS"); } catch (IOException e) { logger.warn( "Could not find hue bridge automatically. Please make sure it is switched on and connected to the same network as openHAB. If it permanently fails you may configure the IP address of your hue bridge manually in the openHAB configuration."); } } String secret = (String) config.get("secret"); if (StringUtils.isNotBlank(secret)) { this.bridgeSecret = secret; } // connect the Hue bridge with the new configs if (this.bridgeIP != null) { activeBridge = new HueBridge(bridgeIP, bridgeSecret); activeBridge.pairBridgeIfNecessary(); } 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); } } }
From source file:org.openhab.binding.sallegra.internal.SallegraBinding.java
/** * {@inheritDoc}//from w w w. j a va2 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 = keys.nextElement(); // Escape of dot absolutely necessary String[] keyElements = key.split("\\."); String deviceId = keyElements[0]; if (keyElements.length >= 2) { SallegraNode node = sallegraNodes.get(deviceId); if (node == null) { node = new SallegraNode(); sallegraNodes.put(deviceId, node); } String option = keyElements[1]; if (option.equals("password")) { node.setPassword((String) config.get(key)); } else if (option.equals("hostname")) { node.setHostName((String) config.get(key)); } } } setProperlyConfigured(checkProperlyConfigured()); } }
From source file:uk.ac.gda.util.dictionary.MapBasedDictionary.java
@SuppressWarnings("unchecked") 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)); }//from ww w. java 2 s .c om }
From source file:org.opencastproject.workflow.impl.OsgiWorkflowCleanupScheduler.java
@Override public void updated(@SuppressWarnings("rawtypes") Dictionary properties) throws ConfigurationException { unschedule();//from ww w . j a v a 2 s .c o m if (properties != null) { logger.debug("Updating configuration..."); enabled = BooleanUtils.toBoolean((String) properties.get(PARAM_KEY_ENABLED)); logger.debug("enabled = {}", enabled); cronExpression = (String) properties.get(PARAM_KEY_CRON_EXPR); if (StringUtils.isBlank(cronExpression)) throw new ConfigurationException(PARAM_KEY_CRON_EXPR, "Cron expression must be valid"); logger.debug("cronExpression = {}", cronExpression); try { lifetimeSuccessfulJobs = Integer.valueOf((String) properties.get(PARAM_KEY_LIFETIME_SUCCEEDED)); } catch (NumberFormatException e) { throw new ConfigurationException(PARAM_KEY_LIFETIME_SUCCEEDED, "Lifetime must be a valid integer", e); } logger.debug("lifetimeFinishedJobs = {}", lifetimeSuccessfulJobs); try { lifetimeFailedJobs = Integer.valueOf((String) properties.get(PARAM_KEY_LIFETIME_FAILED)); } catch (NumberFormatException e) { throw new ConfigurationException(PARAM_KEY_LIFETIME_FAILED, "Lifetime must be a valid integer", e); } logger.debug("lifetimeFailedJobs = {}", lifetimeFailedJobs); try { lifetimeStoppedJobs = Integer.valueOf((String) properties.get(PARAM_KEY_LIFETIME_STOPPED)); } catch (NumberFormatException e) { throw new ConfigurationException(PARAM_KEY_LIFETIME_STOPPED, "Lifetime must be a valid integer", e); } logger.debug("lifetimeStoppedJobs = {}", lifetimeStoppedJobs); try { lifetimeParentlessJobs = Integer.valueOf((String) properties.get(PARAM_KEY_LIFETIME_PARENTLESS)); } catch (NumberFormatException e) { throw new ConfigurationException(PARAM_KEY_LIFETIME_PARENTLESS, "Lifetime must be a valid integer", e); } logger.debug("lifetimeParentlessJobs = {}", lifetimeParentlessJobs); } schedule(); }
From source file:com.whizzosoftware.hobson.bootstrap.api.hub.OSGIHubManager.java
@Override public boolean isSetupWizardComplete(String userId, String hubId) { Configuration config = getConfiguration(); Dictionary props = config.getProperties(); return (props != null && props.get(SETUP_COMPLETE) != null && (Boolean) props.get(SETUP_COMPLETE)); }
From source file:org.openhab.binding.dmx.internal.core.DmxController.java
/** * {@inheritDoc}// ww w .jav a 2s . c o m */ @Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String configuredConnection = (String) config.get("connection"); if (StringUtils.isNotBlank(configuredConnection)) { connectionString = configuredConnection; logger.debug("Setting connection from config: {}", connectionString); } } }
From source file:org.openhab.io.myopenhab.internal.MyOpenHABServiceImpl.java
@Override public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String baseUrlString = (String) config.get("baseUrl"); if (StringUtils.isNotBlank(baseUrlString)) { mMyOHBaseUrl = baseUrlString; }//from ww w . j a v a 2 s.c o m String localPortString = (String) config.get("localPort"); if (StringUtils.isNotBlank(localPortString)) { mLocalPort = Integer.valueOf(localPortString); } } else { logger.debug("config is null"); } logger.debug("UUID = " + getUUID() + ", secret = " + getSecret()); myOHClient = new MyOHClient(getUUID(), getSecret()); if (mMyOHBaseUrl != null) { myOHClient.setMyOHBaseUrl(mMyOHBaseUrl); } if (mLocalPort != 8080) { myOHClient.setOHBaseUrl("http://localhost:" + String.valueOf(mLocalPort)); } myOHClient.setOpenHABVersion(getVersion()); myOHClient.connect(); myOHClient.setListener(this); MyOpenHAB.mMyOpenHABService = this; }