当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtils.mergePropertiesIntoMap方法代码示例

本文整理汇总了Java中org.springframework.util.CollectionUtils.mergePropertiesIntoMap方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.mergePropertiesIntoMap方法的具体用法?Java CollectionUtils.mergePropertiesIntoMap怎么用?Java CollectionUtils.mergePropertiesIntoMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.CollectionUtils的用法示例。


在下文中一共展示了CollectionUtils.mergePropertiesIntoMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Merges the given map into the target properties object. Additionally it checks if there are any given local
 * properties and whether these can override the source.
 * 
 * @return a new (Properties) object mergeing the local properties and the source
 */
public static Properties initProperties(Properties localMap, boolean localOverride, Map<?, ?> source,
		Properties target) {

	synchronized (target) {
		target.clear();

		// merge the local properties (upfront)
		if (localMap != null && !localOverride) {
			CollectionUtils.mergePropertiesIntoMap(localMap, target);
		}

		if (source != null) {
			target.putAll(source);
		}

		// merge local properties (if needed)
		if (localMap != null && localOverride) {
			CollectionUtils.mergePropertiesIntoMap(localMap, target);
		}

		return target;
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:PropertiesUtil.java

示例2: afterPropertiesSet

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Merges the {@code Properties} configured in the {@code mappings} and
 * {@code mappingLocations} into the final {@code Properties} instance
 * used for {@code ObjectName} resolution.
 * @throws IOException
 */
@Override
public void afterPropertiesSet() throws IOException {
	this.mergedMappings = new Properties();

	CollectionUtils.mergePropertiesIntoMap(this.mappings, this.mergedMappings);

	if (this.mappingLocations != null) {
		for (int i = 0; i < this.mappingLocations.length; i++) {
			Resource location = this.mappingLocations[i];
			if (logger.isInfoEnabled()) {
				logger.info("Loading JMX object name mappings file from " + location);
			}
			PropertiesLoaderUtils.fillProperties(this.mergedMappings, location);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:KeyNamingStrategy.java

示例3: copyTo

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
public void copyTo(String environment, Properties prop) {
    List<CustomPropertyPlaceholderConfigurer> list = new ArrayList<CustomPropertyPlaceholderConfigurer>();
    findEnvironments(environment, list);
    for (CustomPropertyPlaceholderConfigurer configurer : list) {
        if (configurer.properties != null) {
            CollectionUtils.mergePropertiesIntoMap(configurer.properties, prop);
        }
    }
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:10,代码来源:CustomPropertyPlaceholderConfigurer.java

示例4: start

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
public void start() throws Exception {
	if (framework == null) {
		// copy configuration properties to sys properties
		System.getProperties().putAll(getConfigurationProperties());
           Map<String, String> props = new HashMap<String, String>();
           CollectionUtils.mergePropertiesIntoMap(getPlatformProperties(), props);
		framework = (KF_2X ? new KF2Platform(this) : new KF3Platform(props, log));
		context = framework.start();
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:11,代码来源:KnopflerfishPlatform.java

示例5: createInitialContext

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Create a new JNDI initial context. Invoked by {@link #getContext}.
 * <p>The default implementation use this template's environment settings.
 * Can be subclassed for custom contexts, e.g. for testing.
 * @return the initial Context instance
 * @throws NamingException in case of initialization errors
 */
protected Context createInitialContext() throws NamingException {
	Hashtable<?, ?> icEnv = null;
	Properties env = getEnvironment();
	if (env != null) {
		icEnv = new Hashtable<Object, Object>(env.size());
		CollectionUtils.mergePropertiesIntoMap(env, icEnv);
	}
	return new InitialContext(icEnv);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JndiTemplate.java

示例6: createVelocityEngine

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Prepare the VelocityEngine instance and return it.
 * @return the VelocityEngine instance
 * @throws IOException if the config file wasn't found
 * @throws VelocityException on Velocity initialization failure
 */
public VelocityEngine createVelocityEngine() throws IOException, VelocityException {
	VelocityEngine velocityEngine = newVelocityEngine();
	Map<String, Object> props = new HashMap<String, Object>();

	// Load config file if set.
	if (this.configLocation != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Loading Velocity config from [" + this.configLocation + "]");
		}
		CollectionUtils.mergePropertiesIntoMap(PropertiesLoaderUtils.loadProperties(this.configLocation), props);
	}

	// Merge local properties if set.
	if (!this.velocityProperties.isEmpty()) {
		props.putAll(this.velocityProperties);
	}

	// Set a resource loader path, if required.
	if (this.resourceLoaderPath != null) {
		initVelocityResourceLoader(velocityEngine, this.resourceLoaderPath);
	}

	// Log via Commons Logging?
	if (this.overrideLogging) {
		velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
	}

	// Apply properties to VelocityEngine.
	for (Map.Entry<String, Object> entry : props.entrySet()) {
		velocityEngine.setProperty(entry.getKey(), entry.getValue());
	}

	postProcessVelocityEngine(velocityEngine);

	// Perform actual initialization.
	velocityEngine.init();

	return velocityEngine;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:VelocityEngineFactory.java

示例7: afterPropertiesSet

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Initialize the PersistenceManagerFactory for the given location.
 * @throws IllegalArgumentException in case of illegal property values
 * @throws IOException if the properties could not be loaded from the given location
 * @throws JDOException in case of JDO initialization errors
 */
@Override
public void afterPropertiesSet() throws IllegalArgumentException, IOException, JDOException {
	if (this.persistenceManagerFactoryName != null) {
		if (this.configLocation != null || !this.jdoPropertyMap.isEmpty()) {
			throw new IllegalStateException("'configLocation'/'jdoProperties' not supported in " +
					"combination with 'persistenceManagerFactoryName' - specify one or the other, not both");
		}
		if (logger.isInfoEnabled()) {
			logger.info("Building new JDO PersistenceManagerFactory for name '" +
					this.persistenceManagerFactoryName + "'");
		}
		this.persistenceManagerFactory = newPersistenceManagerFactory(this.persistenceManagerFactoryName);
	}

	else {
		Map<String, Object> mergedProps = new HashMap<String, Object>();
		if (this.configLocation != null) {
			if (logger.isInfoEnabled()) {
				logger.info("Loading JDO config from [" + this.configLocation + "]");
			}
			CollectionUtils.mergePropertiesIntoMap(
					PropertiesLoaderUtils.loadProperties(this.configLocation), mergedProps);
		}
		mergedProps.putAll(this.jdoPropertyMap);
		logger.info("Building new JDO PersistenceManagerFactory");
		this.persistenceManagerFactory = newPersistenceManagerFactory(mergedProps);
	}

	// Build default JdoDialect if none explicitly specified.
	if (this.jdoDialect == null) {
		this.jdoDialect = new DefaultJdoDialect(this.persistenceManagerFactory.getConnectionFactory());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:LocalPersistenceManagerFactoryBean.java

示例8: initSchedulerFactory

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Load and/or apply Quartz properties to the given SchedulerFactory.
 * @param schedulerFactory the SchedulerFactory to initialize
 */
private void initSchedulerFactory(SchedulerFactory schedulerFactory) throws SchedulerException, IOException {
	if (!(schedulerFactory instanceof StdSchedulerFactory)) {
		if (this.configLocation != null || this.quartzProperties != null ||
				this.taskExecutor != null || this.dataSource != null) {
			throw new IllegalArgumentException(
					"StdSchedulerFactory required for applying Quartz properties: " + schedulerFactory);
		}
		// Otherwise assume that no initialization is necessary...
		return;
	}

	Properties mergedProps = new Properties();

	if (this.resourceLoader != null) {
		mergedProps.setProperty(StdSchedulerFactory.PROP_SCHED_CLASS_LOAD_HELPER_CLASS,
				ResourceLoaderClassLoadHelper.class.getName());
	}

	if (this.taskExecutor != null) {
		mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS,
				LocalTaskExecutorThreadPool.class.getName());
	}
	else {
		// Set necessary default properties here, as Quartz will not apply
		// its default configuration when explicitly given properties.
		mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
		mergedProps.setProperty(PROP_THREAD_COUNT, Integer.toString(DEFAULT_THREAD_COUNT));
	}

	if (this.configLocation != null) {
		if (logger.isInfoEnabled()) {
			logger.info("Loading Quartz config from [" + this.configLocation + "]");
		}
		PropertiesLoaderUtils.fillProperties(mergedProps, this.configLocation);
	}

	CollectionUtils.mergePropertiesIntoMap(this.quartzProperties, mergedProps);

	if (this.dataSource != null) {
		mergedProps.put(StdSchedulerFactory.PROP_JOB_STORE_CLASS, LocalDataSourceJobStore.class.getName());
	}

	// Make sure to set the scheduler name as configured in the Spring configuration.
	if (this.schedulerName != null) {
		mergedProps.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, this.schedulerName);
	}

	((StdSchedulerFactory) schedulerFactory).initialize(mergedProps);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:54,代码来源:SchedulerFactoryBean.java

示例9: setValidationProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Specify bean validation properties to be passed to the validation provider.
 * <p>Can be populated with a String "value" (parsed via PropertiesEditor)
 * or a "props" element in XML bean definitions.
 * @see javax.validation.Configuration#addProperty(String, String)
 */
public void setValidationProperties(Properties jpaProperties) {
	CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.validationPropertyMap);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:LocalValidatorFactoryBean.java

示例10: setEnvironment

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Set the environment properties used to construct the {@code JMXConnectorServer}
 * as {@code java.util.Properties} (String key/value pairs).
 */
public void setEnvironment(Properties environment) {
	CollectionUtils.mergePropertiesIntoMap(environment, this.environment);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ConnectorServerFactoryBean.java

示例11: setEnvironment

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Set the environment properties used to construct the {@code JMXConnector}
 * as {@code java.util.Properties} (String key/value pairs).
 */
public void setEnvironment(Properties environment) {
	CollectionUtils.mergePropertiesIntoMap(environment, this.environment);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:MBeanServerConnectionFactoryBean.java

示例12: setVelocityProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Set Velocity properties, like "file.resource.loader.path".
 * Can be used to override values in a Velocity config file,
 * or to specify all necessary properties locally.
 * <p>Note that the Velocity resource loader path also be set to any
 * Spring resource location via the "resourceLoaderPath" property.
 * Setting it here is just necessary when using a non-file-based
 * resource loader.
 * @see #setVelocityPropertiesMap
 * @see #setConfigLocation
 * @see #setResourceLoaderPath
 */
public void setVelocityProperties(Properties velocityProperties) {
	CollectionUtils.mergePropertiesIntoMap(velocityProperties, this.velocityProperties);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:VelocityEngineFactory.java

示例13: setJpaProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Specify JPA properties, to be passed into
 * {@code Persistence.createEntityManagerFactory} (if any).
 * <p>Can be populated with a String "value" (parsed via PropertiesEditor) or a
 * "props" element in XML bean definitions.
 * @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
 * @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
 */
public void setJpaProperties(Properties jpaProperties) {
	CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AbstractEntityManagerFactoryBean.java

示例14: setJpaProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Specify JPA properties, to be passed into
 * {@code EntityManagerFactory.createEntityManager(Map)} (if any).
 * <p>Can be populated with a String "value" (parsed via PropertiesEditor)
 * or a "props" element in XML bean definitions.
 * @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
 */
public void setJpaProperties(Properties jpaProperties) {
	CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:JpaTransactionManager.java

示例15: setJdoProperties

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Set JDO properties, such as"javax.jdo.PersistenceManagerFactoryClass".
 * <p>Can be used to override values in a JDO properties config file,
 * or to specify all necessary properties locally.
 * <p>Can be populated with a String "value" (parsed via PropertiesEditor)
 * or a "props" element in XML bean definitions.
 */
public void setJdoProperties(Properties jdoProperties) {
	CollectionUtils.mergePropertiesIntoMap(jdoProperties, this.jdoPropertyMap);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:LocalPersistenceManagerFactoryBean.java


注:本文中的org.springframework.util.CollectionUtils.mergePropertiesIntoMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。