<commit_before>/*******************************************************************************
 * Copyright (c) 2015 Development Gateway, Inc and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the MIT License (MIT)
 * which accompanies this distribution, and is available at
 * https://opensource.org/licenses/MIT
 *
 * Contributors:
 * Development Gateway - initial API and implementation
 *******************************************************************************/
/**
 * 
 */
package org.devgateway.toolkit.persistence.spring;

import javax.management.MBeanServer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;

import net.sf.ehcache.management.ManagementService;

/**
 * @author mpostelnicu
 *
 */
@Configuration
@EnableCaching
public class CacheConfiguration {

	@Autowired(required=false)
	private MBeanServer mbeanServer;

	@Bean
	public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
		EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
		ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
		ehCacheManagerFactoryBean.setShared(true);
		return ehCacheManagerFactoryBean;
	}
	
	@Bean
	public CacheManager cacheManager(EhCacheManagerFactoryBean factory) {
		return new EhCacheCacheManager(factory.getObject());
	}
	
	@Bean(destroyMethod = "dispose", initMethod = "init")
	@Profile("!integration")
	public ManagementService ehCacheManagementService(EhCacheManagerFactoryBean factory) {
		ManagementService managementService = new ManagementService(factory.getObject(), mbeanServer, true, true, true, true);<commit_msg>checkstyle fixes<commit_after>/*******************************************************************************
 * Copyright (c) 2015 Development Gateway, Inc and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the MIT License (MIT)
 * which accompanies this distribution, and is available at
 * https://opensource.org/licenses/MIT
 *
 * Contributors:
 * Development Gateway - initial API and implementation
 *******************************************************************************/
/**
 * 
 */
package org.devgateway.toolkit.persistence.spring;

import javax.management.MBeanServer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;

import net.sf.ehcache.management.ManagementService;

/**
 * @author mpostelnicu
 *
 */
@Configuration
@EnableCaching
public class CacheConfiguration {

	@Autowired(required = false)
	private MBeanServer mbeanServer;

	@Bean
	public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
		EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
		ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
		ehCacheManagerFactoryBean.setShared(true);
		return ehCacheManagerFactoryBean;
	}

	@Bean
	public CacheManager cacheManager(final EhCacheManagerFactoryBean factory) {
		return new EhCacheCacheManager(factory.getObject());
	}

	@Bean(destroyMethod = "dispose", initMethod = "init")
	@Profile("!integration")
	public ManagementService ehCacheManagementService(final EhCacheManagerFactoryBean factory) {
		ManagementService managementService = new ManagementService(factory.getObject(), mbeanServer, true, true, true,
				true);
{'fraction_non_alphanumeric': 0.15384615384615385, 'fraction_numerical': 0.001848001848001848, 'mean_word_length': 7.200757575757576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6039249', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1038, 'n_words': 241}