ehcache

net.sf.ehcache.config
Class ConfigurationHelper

java.lang.Object
  extended by net.sf.ehcache.config.ConfigurationHelper

public final class ConfigurationHelper
extends Object

The configuration for ehcache.

This class can be populated through:

Version:
$Id: ConfigurationHelper.java 8927 2014-04-15 22:06:53Z teck $
Author:
Greg Luck

Constructor Summary
ConfigurationHelper(CacheManager cacheManager, Configuration configuration)
          Only Constructor
 
Method Summary
 List<Ehcache> createCacheDecorators(Ehcache cache)
          Creates decorated ehcaches for the cache, if any configured in ehcache.xml
static CacheExceptionHandler createCacheExceptionHandler(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader)
          Tries to create a CacheLoader from the configuration using the factory specified.
 CacheManagerEventListener createCacheManagerEventListener(CacheManager cacheManager)
          Tries to load the class specified.
 Map<String,CacheManagerPeerListener> createCachePeerListeners()
          Tries to load the class specified otherwise defaults to null
 Map<String,CacheManagerPeerProvider> createCachePeerProviders()
          Tries to load the class specified otherwise defaults to null
 Set createCaches()
          Creates unitialised caches for each cache configuration found
 Ehcache createDefaultCache()
           
static List<Ehcache> createDefaultCacheDecorators(Ehcache cache, CacheConfiguration defaultCacheConfiguration, ClassLoader loader)
          Creates default cache decorators specified in the default cache configuration if any
 Configuration getConfigurationBean()
           
 String getDiskStorePath()
           
static Class<?> getSearchAttributeType(SearchAttribute sa, ClassLoader loader)
          Deprecated. internal use only
 int numberOfCachesThatUseDiskStorage()
          Calculates the number of caches in the configuration that are diskPersistent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationHelper

public ConfigurationHelper(CacheManager cacheManager,
                           Configuration configuration)
Only Constructor

Parameters:
cacheManager -
configuration -
Method Detail

createCacheExceptionHandler

public static CacheExceptionHandler createCacheExceptionHandler(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration,
                                                                ClassLoader loader)
                                                         throws CacheException
Tries to create a CacheLoader from the configuration using the factory specified.

Returns:
The CacheExceptionHandler, or null if it could not be found.
Throws:
CacheException

createCachePeerProviders

public Map<String,CacheManagerPeerProvider> createCachePeerProviders()
Tries to load the class specified otherwise defaults to null

Returns:
a map of CacheManagerPeerProviders

createCachePeerListeners

public Map<String,CacheManagerPeerListener> createCachePeerListeners()
Tries to load the class specified otherwise defaults to null


createCacheManagerEventListener

public final CacheManagerEventListener createCacheManagerEventListener(CacheManager cacheManager)
                                                                throws CacheException
Tries to load the class specified.

Parameters:
cacheManager -
Returns:
If there is none returns null.
Throws:
CacheException

getDiskStorePath

public final String getDiskStorePath()
Returns:
the disk store path, or null if not set.

createDefaultCache

public final Ehcache createDefaultCache()
                                 throws CacheException
Returns:
the Default Cache
Throws:
CacheException - if there is no default cache

createCaches

public final Set createCaches()
Creates unitialised caches for each cache configuration found

Returns:
an empty set if there are none,

numberOfCachesThatUseDiskStorage

public final int numberOfCachesThatUseDiskStorage()
Calculates the number of caches in the configuration that are diskPersistent


createCacheDecorators

public List<Ehcache> createCacheDecorators(Ehcache cache)
Creates decorated ehcaches for the cache, if any configured in ehcache.xml

Parameters:
cache - the cache
Returns:
List of the decorated ehcaches, if any configured in ehcache.xml otherwise returns empty list

createDefaultCacheDecorators

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 - the underlying cache that will be decorated
defaultCacheConfiguration - default cache configuration
loader -
Returns:
list of decorated caches

getSearchAttributeType

public static Class<?> getSearchAttributeType(SearchAttribute sa,
                                              ClassLoader loader)
Deprecated. internal use only

Parameters:
sa - search attribute
Returns:
attribute type as class

getConfigurationBean

public final Configuration getConfigurationBean()
Returns:
the Configuration used

ehcache

Copyright 2001-2014, Terracotta, Inc.