Top Description Fields Constructors Methods
net.sf.ehcache.config

public final Class ConfigurationHelper

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Properties, .Set, net.sf.ehcache.Cache, .CacheException, .CacheManager, .Ehcache, net.sf.ehcache.config.CacheConfiguration.CacheDecoratorFactoryConfiguration, net.sf.ehcache.constructs.CacheDecoratorFactory, net.sf.ehcache.distribution.CacheManagerPeerListener, .CacheManagerPeerListenerFactory, .CacheManagerPeerProvider, .CacheManagerPeerProviderFactory, net.sf.ehcache.event.CacheManagerEventListener, .CacheManagerEventListenerFactory, net.sf.ehcache.exceptionhandler.CacheExceptionHandler, .CacheExceptionHandlerFactory, .ExceptionHandlingDynamicCacheProxy, net.sf.ehcache.util.ClassLoaderUtil, .PropertyUtil, org.slf4j.Logger, .LoggerFactory

The configuration for ehcache.

This class can be populated through:

Author
Greg Luck
Version
$Id: ConfigurationHelper.java 10789 2018-04-26 02:08:13Z adahanne $

Field Summary

Modifier and TypeField and Description
private final CacheManager
private final Configuration
private final ClassLoader
private static final Logger

Constructor Summary

AccessConstructor and Description
public
ConfigurationHelper(CacheManager cacheManager, Configuration configuration)

Only Constructor

Method Summary

Modifier and TypeMethod and Description
private Ehcache
pack-priv final Ehcache
createCache(CacheConfiguration cacheConfiguration)

Create a cache given a cache configuration

public List<Ehcache>

Returns:

List of the decorated ehcaches, if any configured in ehcache.xml otherwise returns empty list
createCacheDecorators
(Ehcache
the cache
cache
)

Creates decorated ehcaches for the cache, if any configured in ehcache.xml

public static CacheExceptionHandler

Returns:

The CacheExceptionHandler, or null if it could not be found.
createCacheExceptionHandler
(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader)

Tries to create a CacheLoader from the configuration using the factory specified.

pack-priv final Ehcache

Returns:

the cache, or null if there is no match
createCacheFromName
(String name)

Creates a cache from configuration where the configuration cache name matches the given name

public final CacheManagerEventListener

Returns:

If there is none returns null.
createCacheManagerEventListener
(CacheManager cacheManager)

Tries to load the class specified.

public Map<String, CacheManagerPeerListener>
createCachePeerListeners()

Tries to load the class specified otherwise defaults to null

public Map<String, CacheManagerPeerProvider>

Returns:

a map of CacheManagerPeerProviders
createCachePeerProviders
()

Tries to load the class specified otherwise defaults to null

public final Set<E>

Returns:

an empty set if there are none,
createCaches
()

Creates unitialised caches for each cache configuration found

private static Ehcache
createDecoratedCache(Ehcache cache, CacheConfiguration.CacheDecoratorFactoryConfiguration factoryConfiguration, boolean forDefaultCache, ClassLoader loader)

Creates the decorated cache from the decorator config specified.

public final Ehcache

Returns:

the Default Cache
createDefaultCache
()

public static List<Ehcache>

Returns:

list of decorated caches
createDefaultCacheDecorators
(Ehcache
the underlying cache that will be decorated
cache
,
CacheConfiguration
default cache configuration
defaultCacheConfiguration
,
ClassLoader loader)

Creates default cache decorators specified in the default cache configuration if any

public final Configuration

Returns:

the Configuration used
getConfigurationBean
()

public final String

Returns:

the disk store path, or null if not set.
getDiskStorePath
()

public static Class<?>

Returns:

attribute type as class
getSearchAttributeType
(SearchAttribute
search attribute
sa
,
ClassLoader loader)

Deprecated internal use only
public final int
numberOfCachesThatUseDiskStorage()

Calculates the number of caches in the configuration that are diskPersistent

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheManagerback to summary
private final CacheManager cacheManager
configurationback to summary
private final Configuration configuration
loaderback to summary
private final ClassLoader loader
LOGback to summary
private static final Logger LOG

Constructor Detail

ConfigurationHelperback to summary
public ConfigurationHelper(CacheManager cacheManager, Configuration configuration)

Only Constructor

Method Detail

applyCacheExceptionHandlerback to summary
private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache)
createCacheback to summary
pack-priv final Ehcache createCache(CacheConfiguration cacheConfiguration)

Create a cache given a cache configuration

createCacheDecoratorsback to summary
public List<Ehcache> createCacheDecorators(Ehcache cache)

Creates decorated ehcaches for the cache, if any configured in ehcache.xml

Parameters
cache:Ehcache

the cache

Returns:List<Ehcache>

List of the decorated ehcaches, if any configured in ehcache.xml otherwise returns empty list

createCacheExceptionHandlerback to summary
public static CacheExceptionHandler createCacheExceptionHandler(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader) throws CacheException

Tries to create a CacheLoader from the configuration using the factory specified.

Returns:CacheExceptionHandler

The CacheExceptionHandler, or null if it could not be found.

createCacheFromNameback to summary
pack-priv final Ehcache createCacheFromName(String name)

Creates a cache from configuration where the configuration cache name matches the given name

Returns:Ehcache

the cache, or null if there is no match

createCacheManagerEventListenerback to summary
public final CacheManagerEventListener createCacheManagerEventListener(CacheManager cacheManager) throws CacheException

Tries to load the class specified.

Returns:CacheManagerEventListener

If there is none returns null.

createCachePeerListenersback to summary
public Map<String, CacheManagerPeerListener> createCachePeerListeners()

Tries to load the class specified otherwise defaults to null

createCachePeerProvidersback to summary
public Map<String, CacheManagerPeerProvider> createCachePeerProviders()

Tries to load the class specified otherwise defaults to null

Returns:Map<String, CacheManagerPeerProvider>

a map of CacheManagerPeerProviders

createCachesback to summary
public final Set<E> createCaches()

Creates unitialised caches for each cache configuration found

Returns:Set<E>

an empty set if there are none,

createDecoratedCacheback to summary
private static Ehcache createDecoratedCache(Ehcache cache, CacheConfiguration.CacheDecoratorFactoryConfiguration factoryConfiguration, boolean forDefaultCache, ClassLoader loader)

Creates the decorated cache from the decorator config specified. Returns null if the name of the factory class is not specified

createDefaultCacheback to summary
public final Ehcache createDefaultCache() throws CacheException
Returns:Ehcache

the Default Cache

Exceptions
CacheException:
if there is no default cache
createDefaultCacheDecoratorsback to summary
public static List<Ehcache> createDefaultCacheDecorators(Ehcache cache, CacheConfiguration defaultCacheConfiguration, ClassLoader loader)

Creates default cache decorators specified in the default cache configuration if any

Parameters
cache:Ehcache

the underlying cache that will be decorated

defaultCacheConfiguration:CacheConfiguration

default cache configuration

Returns:List<Ehcache>

list of decorated caches

getConfigurationBeanback to summary
public final Configuration getConfigurationBean()
Returns:Configuration

the Configuration used

getDiskStorePathback to summary
public final String getDiskStorePath()
Returns:String

the disk store path, or null if not set.

getSearchAttributeTypeback to summary
public static Class<?> getSearchAttributeType(SearchAttribute sa, ClassLoader loader)

Deprecated

internal use only

Parameters
sa:SearchAttribute

search attribute

Returns:Class<?>

attribute type as class

numberOfCachesThatUseDiskStorageback to summary
public final int numberOfCachesThatUseDiskStorage()

Calculates the number of caches in the configuration that are diskPersistent