ehcache

net.sf.ehcache.config
Class ConfigurationHelper

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

public final class ConfigurationHelper
extends java.lang.Object

The configuration for ehcache.

This class can be populated through:

Version:
$Id: ConfigurationHelper.java 608 2008-05-04 03:32:51Z gregluck $
Author:
Greg Luck

Constructor Summary
ConfigurationHelper(CacheManager cacheManager, Configuration configuration)
          Only Constructor
 
Method Summary
 BootstrapCacheLoader createBootstrapCacheLoader(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factoryConfiguration)
          Tries to load a BootstrapCacheLoader from the class specified.
(package private)  Ehcache createCache(CacheConfiguration cacheConfiguration)
          Create a cache given a cache configuration
 CacheExceptionHandler createCacheExceptionHandler(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration)
          Tries to create a CacheLoader from the configuration using the factory specified.
(package private)  Ehcache createCacheFromName(java.lang.String name)
          Creates a cache from configuration where the configuration cache name matches the given name
 CacheLoader createCacheLoader(CacheConfiguration.CacheLoaderFactoryConfiguration factoryConfiguration)
          Tries to create a CacheLoader from the configuration using the factory specified.
 CacheManagerEventListener createCacheManagerEventListener()
          Tries to load the class specified.
 CacheManagerPeerListener createCachePeerListener()
          Tries to load the class specified otherwise defaults to null
 CacheManagerPeerProvider createCachePeerProvider()
          Tries to load the class specified otherwise defaults to null
 java.util.Set createCaches()
          Creates unitialised caches for each cache configuration found
 Ehcache createDefaultCache()
           
 Configuration getConfigurationBean()
           
 java.lang.String getDiskStorePath()
           
 java.lang.Integer numberOfCachesThatAreDiskPersistent()
          Calculates the number of caches in the configuration that are diskPersistent
 java.lang.Integer numberOfCachesThatOverflowToDisk()
          Calculates the number of caches in the configuration that overflow to disk
protected static void registerCacheExtensions(CacheConfiguration cacheConfiguration, Ehcache cache)
          A factory method to register cache extensions
protected static void registerCacheListeners(CacheConfiguration cacheConfiguration, RegisteredEventListeners registeredEventListeners)
          A factory method to create a RegisteredEventListeners
 
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

registerCacheListeners

protected static void registerCacheListeners(CacheConfiguration cacheConfiguration,
                                             RegisteredEventListeners registeredEventListeners)
A factory method to create a RegisteredEventListeners


registerCacheExtensions

protected static void registerCacheExtensions(CacheConfiguration cacheConfiguration,
                                              Ehcache cache)
A factory method to register cache extensions


createBootstrapCacheLoader

public final BootstrapCacheLoader createBootstrapCacheLoader(CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration factoryConfiguration)
                                                      throws CacheException
Tries to load a BootstrapCacheLoader from the class specified.

Returns:
If there is none returns null.
Throws:
CacheException

createCacheLoader

public final CacheLoader createCacheLoader(CacheConfiguration.CacheLoaderFactoryConfiguration factoryConfiguration)
                                    throws CacheException
Tries to create a CacheLoader from the configuration using the factory specified.

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

createCacheExceptionHandler

public final CacheExceptionHandler createCacheExceptionHandler(CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration)
                                                        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

createCachePeerProvider

public final CacheManagerPeerProvider createCachePeerProvider()
Tries to load the class specified otherwise defaults to null


createCachePeerListener

public final CacheManagerPeerListener createCachePeerListener()
Tries to load the class specified otherwise defaults to null


createCacheManagerEventListener

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

Returns:
If there is none returns null.
Throws:
CacheException

getDiskStorePath

public final java.lang.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 java.util.Set createCaches()
Creates unitialised caches for each cache configuration found

Returns:
an empty set if there are none,

numberOfCachesThatOverflowToDisk

public final java.lang.Integer numberOfCachesThatOverflowToDisk()
Calculates the number of caches in the configuration that overflow to disk


numberOfCachesThatAreDiskPersistent

public final java.lang.Integer numberOfCachesThatAreDiskPersistent()
Calculates the number of caches in the configuration that are diskPersistent


createCacheFromName

final Ehcache createCacheFromName(java.lang.String name)
Creates a cache from configuration where the configuration cache name matches the given name

Returns:
the cache, or null if there is no match

createCache

final Ehcache createCache(CacheConfiguration cacheConfiguration)
Create a cache given a cache configuration

Parameters:
cacheConfiguration -

getConfigurationBean

public final Configuration getConfigurationBean()
Returns:
the Configuration used

ehcache