List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:net.ontopia.topicmaps.viz.ResourceBundlesTest.java
/** * Checks all properties files in a given directory for consistency * against the master file. Note that the properties are loaded from * the classpath.//from www . j ava 2 s . c o m */ public void testTranslationsAreConsistent() throws IOException { String languages[] = { "de", "no", "ja" }; Properties master = loadProperties("messages.properties"); for (int ix = 0; ix < languages.length; ix++) { String file = "messages_" + languages[ix] + ".properties"; Properties trans = loadProperties(file); List missing = new ArrayList(); List extra = new ArrayList(); for (Object prop : trans.keySet()) { if (!master.containsKey(prop)) extra.add(prop); } for (Object prop : master.keySet()) { if (!trans.containsKey(prop)) missing.add(prop); } assertTrue(buildReport(file, missing, extra), missing.isEmpty() && extra.isEmpty()); } }
From source file:nl.clockwork.common.PropertyPlaceholderConfigurer.java
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties properties) throws BeansException { super.processProperties(beanFactoryToProcess, properties); this.properties = new HashMap<String, String>(); for (Object key : properties.keySet()) this.properties.put(key.toString(), parseStringValue(properties.getProperty(key.toString()), properties, new HashSet<Object>())); }
From source file:com.sun.socialsite.business.impl.JPASocialSiteModule.java
/** * Configures bindings which are appropriate for a JPA-based SocialSite backend. *//*from w w w. jav a2s .c om*/ public void configure(Binder binder) { // We don't need many explicit bindings here, since they'd just mirror // the @ImplementedBy defaults which are set on each interface. // Read Shindig properties from standard SocialSite configuration file // Backend needs them too Properties shindigProperties = Config.getPropertiesStartingWith("shindig."); Properties properties = PropertyExpander.expandProperties(shindigProperties, Config.toMap(), null); if (log.isDebugEnabled()) { for (Object key : properties.keySet()) { log.debug(String.format("%s[%s]=%s", "socialsite.properties", key, properties.get(key))); } } Names.bindProperties(binder, properties); binder.bind(UserManager.class).to(DelegatingUserManagerImpl.class); binder.bind(OAuthStore.class).to(JPAOAuthStore.class); }
From source file:org.apache.stratos.cloud.controller.validate.DockerPartitionValidator.java
private void updateOtherProperties(IaasProvider updatedIaasProvider, Properties properties) { Iaas updatedIaas;/* w ww . j a va2s .c om*/ try { updatedIaas = CloudControllerUtil.getIaas(updatedIaasProvider); for (Object property : properties.keySet()) { if (property instanceof String) { String key = (String) property; updatedIaasProvider.setProperty(key, properties.getProperty(key)); if (log.isDebugEnabled()) { log.debug("Added property " + key + " to the IaasProvider."); } } } updatedIaas = CloudControllerUtil.getIaas(updatedIaasProvider); updatedIaas.setIaasProvider(updatedIaasProvider); } catch (InvalidIaasProviderException ignore) { } }
From source file:org.agatom.springatom.core.locale.SAMessageSource.java
@Override public Map<String, String> getAllMessages(final Locale locale) { final Properties properties = this.getMergedProperties(locale).getProperties(); final Map<String, String> map = Maps.newHashMapWithExpectedSize(properties.size()); for (final Object propKey : properties.keySet()) { map.put(propKey.toString(), properties.get(propKey).toString()); }//from w ww . j ava2s . co m return map; }
From source file:com.adaptris.http.test.SimpleHttpServer.java
private void initProcessors() throws Exception { processorList = new ArrayList(); Properties urlList = Config.getPropertySubset(Config.HTTP_SERVER_LISTENER, config); Iterator i = urlList.keySet().iterator(); while (i.hasNext()) { String key = i.next().toString(); ProcessorConfig rc = new ProcessorConfig(key); if (processorList.contains(rc)) { rc = (ProcessorConfig) processorList.get(processorList.indexOf(rc)); } else {/*from w ww .j a va 2 s. co m*/ processorList.add(rc); } rc.set(key, config.getProperty(key)); } }
From source file:org.apache.atlas.sqoop.hook.SqoopHook.java
private Referenceable createSqoopProcessInstance(Referenceable dbStoreRef, Referenceable hiveTableRef, SqoopJobDataPublisher.Data data, String clusterName) { Referenceable procRef = new Referenceable(SqoopDataTypes.SQOOP_PROCESS.getName()); final String sqoopProcessName = getSqoopProcessName(data, clusterName); procRef.set(AtlasClient.NAME, sqoopProcessName); procRef.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, sqoopProcessName); procRef.set(SqoopHook.OPERATION, data.getOperation()); if (isImportOperation(data)) { procRef.set(SqoopHook.INPUTS, dbStoreRef); procRef.set(SqoopHook.OUTPUTS, hiveTableRef); } else {/*from w w w . ja va2 s. c om*/ procRef.set(SqoopHook.INPUTS, hiveTableRef); procRef.set(SqoopHook.OUTPUTS, dbStoreRef); } procRef.set(SqoopHook.USER, data.getUser()); procRef.set(SqoopHook.START_TIME, new Date(data.getStartTime())); procRef.set(SqoopHook.END_TIME, new Date(data.getEndTime())); Map<String, String> sqoopOptionsMap = new HashMap<>(); Properties options = data.getOptions(); for (Object k : options.keySet()) { sqoopOptionsMap.put((String) k, (String) options.get(k)); } procRef.set(SqoopHook.CMD_LINE_OPTS, sqoopOptionsMap); return procRef; }
From source file:com.threewks.thundr.jrebel.ThundrJRebelPlugin.java
private Set<String> loadWatchedClassList() { Set<String> watchedClasses = new HashSet<String>(); watchedClasses.add(ApplicationRoutesClassName); InputStream inputStream = getClass().getClassLoader().getResourceAsStream(PropertiesFileName); if (inputStream == null) { Logger.info("No %s found using defaults.", PropertiesFileName); } else {// w ww .jav a 2s . c om Logger.info("Found %s, loading...", PropertiesFileName); try { Properties properties = new Properties(); properties.load(inputStream); watchedClasses.addAll((Set) properties.keySet()); } catch (IOException e) { Logger.error("There was a problem loading %s: %s; ignoring", PropertiesFileName, e.getMessage()); } } return watchedClasses; }
From source file:net.ymate.platform.base.impl.DefaultModuleLoader.java
/** * @param moduleName ???//from ww w .j a v a 2 s . c o m * @param configs ??? * @return ?????? */ private Map<String, String> __parseModuleCfg(String moduleName, Properties configs) { Map<String, String> _returnValue = new HashMap<String, String>(); // ????? for (Object _key : configs.keySet()) { String _prefix = "ymp.configs." + moduleName + "."; if (StringUtils.startsWith((String) _key, _prefix)) { String _cfgKey = StringUtils.substring((String) _key, _prefix.length()); String _cfgValue = configs.getProperty((String) _key); _returnValue.put(_cfgKey, _cfgValue); } } return _returnValue; }
From source file:com.enonic.cms.business.core.security.userstore.connector.remote.plugin.RemoteUserStoreFactory.java
public RemoteUserStorePlugin create(String type, Properties props) { RemoteUserStorePlugin userStorePlugin = createInstance(type); if (props != null) { BeanMap bean = new BeanMap(userStorePlugin); for (Object key : props.keySet()) { String strKey = key.toString(); String strValue = props.getProperty(strKey); // Preventing this property to be set as false if it blank (since it will be confusing for the user) if ("readUserSyncAttributeAsBinary".equals(strKey) && StringUtils.isBlank(strValue)) { continue; }// ww w. j a v a 2 s . c o m try { bean.put(strKey, strValue); } catch (Exception e) { LOG.warn("Failed to set property [" + strKey + "] with value [" + strValue + "]."); } } } return userStorePlugin; }