ehcache

net.sf.ehcache.config
Class Configuration

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

public final class Configuration
extends Object

A bean, used by BeanUtils, to set configuration from an XML configuration file.

Version:
$Id: Configuration.java 3664 2011-02-18 18:59:29Z lorban $
Author:
Greg Luck

Nested Class Summary
static class Configuration.Monitoring
          Represents whether monitoring should be enabled or not.
 
Field Summary
static boolean DEFAULT_DYNAMIC_CONFIG
          Default value for dynamicConfig
static Configuration.Monitoring DEFAULT_MONITORING
          Default value for monitoring
static FactoryConfiguration DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG
          Default transactionManagerLookupConfiguration
static int DEFAULT_TRANSACTION_TIMEOUT
          Default value for defaultTransactionTimeoutInSeconds
static boolean DEFAULT_UPDATE_CHECK
          Default value for updateCheck
 
Constructor Summary
Configuration()
          Empty constructor, which is used by ConfigurationFactory, and can be also used programmatically.
 
Method Summary
 void addCache(CacheConfiguration cacheConfiguration)
          Allows BeanHandler to add Cache Configurations to the configuration.
 void addCacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration)
          Allows BeanHandler to add the CacheManagerEventListener to the configuration.
 void addCacheManagerPeerListenerFactory(FactoryConfiguration factory)
          Adds a CacheManagerPeerListener through FactoryConfiguration.
 void addCacheManagerPeerProviderFactory(FactoryConfiguration factory)
          Adds a CacheManagerPeerProvider through FactoryConfiguration.
 void addDefaultCache(CacheConfiguration defaultCacheConfiguration)
          Allows BeanHandler to add a default configuration to the configuration.
 void addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter)
          Allows BeanHandler to add disk store location to the configuration.
 void addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration)
          Allows BeanHandler to add a Terracotta configuration to the configuration
 void addTransactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter)
          Allows BeanHandler to add transaction manager lookup to the configuration.
 Configuration cache(CacheConfiguration cacheConfiguration)
          Builder to add a new cache through its config
 Configuration cacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration)
          Builder to set the event lister through a factory, only one of these can be added and subsequent calls are ignored.
 Configuration cacheManagerPeerListenerFactory(FactoryConfiguration factory)
          Builder method to add a peer listener through a factory.
 Configuration cacheManagerPeerProviderFactory(FactoryConfiguration factory)
          Builder method to add a peer provider through a factory.
 Configuration defaultCache(CacheConfiguration defaultCacheConfiguration)
          Builder method to set the default cache configuration, this can only be used once.
 Configuration defaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds)
          Builder to set the default transaction timeout.
 Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter)
          Builder to add a disk store to the cache manager, only one disk store can be added.
 Configuration dynamicConfig(boolean dynamicConfig)
          Builder to set the dynamic config capability
 Map<String,CacheConfiguration> getCacheConfigurations()
          Gets a Map of cache configurations, keyed by name.
 Set<String> getCacheConfigurationsKeySet()
          Gets a Map of cacheConfigurations.
 FactoryConfiguration getCacheManagerEventListenerFactoryConfiguration()
          Gets the CacheManagerEventListener factory configuration.
 List<FactoryConfiguration> getCacheManagerPeerListenerFactoryConfigurations()
          Gets the CacheManagerPeerListener factory configuration.
 List<FactoryConfiguration> getCacheManagerPeerProviderFactoryConfiguration()
          Gets the CacheManagerPeerProvider factory configuration.
 ConfigurationSource getConfigurationSource()
          Gets a description of the source from which this configuration was created.
 CacheConfiguration getDefaultCacheConfiguration()
           
 int getDefaultTransactionTimeoutInSeconds()
          Get default transaction timeout
 DiskStoreConfiguration getDiskStoreConfiguration()
          Gets the disk store configuration.
 boolean getDynamicConfig()
          Get flag for dynamicConfig
 Configuration.Monitoring getMonitoring()
          Get monitoring type, should not be null
 String getName()
          CacheManager name
 TerracottaClientConfiguration getTerracottaConfiguration()
          Gets the TerracottaClientConfiguration
 FactoryConfiguration getTransactionManagerLookupConfiguration()
          Gets the transaction manager lookup configuration.
 boolean getUpdateCheck()
          Get flag for updateCheck
 Configuration monitoring(Configuration.Monitoring monitoring)
          Builder to set the monitoring approach
 Configuration name(String name)
          Builder to set the cache manager name.
 void setDefaultCacheConfiguration(CacheConfiguration defaultCacheConfiguration)
           
 void setDefaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds)
          Allows BeanHandler to set the default transaction timeout.
 void setDynamicConfig(boolean dynamicConfig)
          Allows BeanHandler to set the dynamic configuration flag
 void setMonitoring(String monitoring)
          Allows BeanHandler to set the monitoring flag
 void setName(String name)
          Allows BeanHandler to set the CacheManager name.
 void setSource(ConfigurationSource configurationSource)
          Sets the configuration source.
 void setUpdateCheck(boolean updateCheck)
          Allows BeanHandler to set the updateCheck flag.
 Configuration source(ConfigurationSource configurationSource)
          Builder to set the configuration source.
 Configuration terracotta(TerracottaClientConfiguration terracottaConfiguration)
          Builder method to Terracotta capabilities to the cache manager through a dedicated configuration, this can only be used once.
 Configuration transactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter)
          Builder to add a transaction manager lookup class to the cache manager, only one of these can be added.
 Configuration updateCheck(boolean updateCheck)
          Builder to set the state of the automated update check.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DYNAMIC_CONFIG

public static final boolean DEFAULT_DYNAMIC_CONFIG
Default value for dynamicConfig

See Also:
Constant Field Values

DEFAULT_UPDATE_CHECK

public static final boolean DEFAULT_UPDATE_CHECK
Default value for updateCheck

See Also:
Constant Field Values

DEFAULT_TRANSACTION_TIMEOUT

public static final int DEFAULT_TRANSACTION_TIMEOUT
Default value for defaultTransactionTimeoutInSeconds

See Also:
Constant Field Values

DEFAULT_MONITORING

public static final Configuration.Monitoring DEFAULT_MONITORING
Default value for monitoring


DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG

public static final FactoryConfiguration DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG
Default transactionManagerLookupConfiguration

Constructor Detail

Configuration

public Configuration()
Empty constructor, which is used by ConfigurationFactory, and can be also used programmatically.

If you are using it programmtically you need to call the relevant add and setter methods in this class to populate everything.

Method Detail

name

public final Configuration name(String name)
Builder to set the cache manager name.

Parameters:
name - the name to set
Returns:
this configuration instance
See Also:
setName(String)

setName

public final void setName(String name)
Allows BeanHandler to set the CacheManager name.


getName

public final String getName()
CacheManager name


updateCheck

public final Configuration updateCheck(boolean updateCheck)
Builder to set the state of the automated update check.

Parameters:
updateCheck - true if the update check should be turned on; or false otherwise
Returns:
this configuration instance

setUpdateCheck

public final void setUpdateCheck(boolean updateCheck)
Allows BeanHandler to set the updateCheck flag.


getUpdateCheck

public final boolean getUpdateCheck()
Get flag for updateCheck


defaultTransactionTimeoutInSeconds

public final Configuration defaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds)
Builder to set the default transaction timeout.

Parameters:
defaultTransactionTimeoutInSeconds - the default transaction timeout in seconds
Returns:
this configuration instance

setDefaultTransactionTimeoutInSeconds

public final void setDefaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds)
Allows BeanHandler to set the default transaction timeout.


getDefaultTransactionTimeoutInSeconds

public final int getDefaultTransactionTimeoutInSeconds()
Get default transaction timeout

Returns:
default transaction timeout in seconds

monitoring

public final Configuration monitoring(Configuration.Monitoring monitoring)
Builder to set the monitoring approach

Parameters:
monitoring - an non-null instance of Configuration.Monitoring
Returns:
this configuration instance

setMonitoring

public final void setMonitoring(String monitoring)
Allows BeanHandler to set the monitoring flag


getMonitoring

public final Configuration.Monitoring getMonitoring()
Get monitoring type, should not be null


dynamicConfig

public final Configuration dynamicConfig(boolean dynamicConfig)
Builder to set the dynamic config capability

Parameters:
dynamicConfig - true if dynamic config should be enabled; or false otherwise.
Returns:
this configuration instance

setDynamicConfig

public final void setDynamicConfig(boolean dynamicConfig)
Allows BeanHandler to set the dynamic configuration flag


getDynamicConfig

public final boolean getDynamicConfig()
Get flag for dynamicConfig


diskStore

public final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter)
                              throws ObjectExistsException
Builder to add a disk store to the cache manager, only one disk store can be added.

Parameters:
diskStoreConfigurationParameter - the disk store configuration to use
Returns:
this configuration instance
Throws:
ObjectExistsException - if the disk store has already been configured

addDiskStore

public final void addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter)
                        throws ObjectExistsException
Allows BeanHandler to add disk store location to the configuration.

Throws:
ObjectExistsException

transactionManagerLookup

public final Configuration transactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter)
                                             throws ObjectExistsException
Builder to add a transaction manager lookup class to the cache manager, only one of these can be added.

Parameters:
transactionManagerLookupParameter - the transaction manager lookup class to use
Returns:
this configuration instance
Throws:
ObjectExistsException - if the transaction manager lookup has already been configured

addTransactionManagerLookup

public final void addTransactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter)
                                       throws ObjectExistsException
Allows BeanHandler to add transaction manager lookup to the configuration.

Throws:
ObjectExistsException

cacheManagerEventListenerFactory

public final Configuration cacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration)
Builder to set the event lister through a factory, only one of these can be added and subsequent calls are ignored.

Returns:
this configuration instance

addCacheManagerEventListenerFactory

public final void addCacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration)
Allows BeanHandler to add the CacheManagerEventListener to the configuration.


cacheManagerPeerProviderFactory

public final Configuration cacheManagerPeerProviderFactory(FactoryConfiguration factory)
Builder method to add a peer provider through a factory.

Returns:
this configuration instance

addCacheManagerPeerProviderFactory

public final void addCacheManagerPeerProviderFactory(FactoryConfiguration factory)
Adds a CacheManagerPeerProvider through FactoryConfiguration.


cacheManagerPeerListenerFactory

public final Configuration cacheManagerPeerListenerFactory(FactoryConfiguration factory)
Builder method to add a peer listener through a factory.

Returns:
this configuration instance

addCacheManagerPeerListenerFactory

public final void addCacheManagerPeerListenerFactory(FactoryConfiguration factory)
Adds a CacheManagerPeerListener through FactoryConfiguration.


terracotta

public final Configuration terracotta(TerracottaClientConfiguration terracottaConfiguration)
                               throws ObjectExistsException
Builder method to Terracotta capabilities to the cache manager through a dedicated configuration, this can only be used once.

Returns:
this configuration instance
Throws:
ObjectExistsException - if the Terracotta config has already been configured

addTerracottaConfig

public final void addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration)
                               throws ObjectExistsException
Allows BeanHandler to add a Terracotta configuration to the configuration

Throws:
ObjectExistsException

defaultCache

public final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration)
                                 throws ObjectExistsException
Builder method to set the default cache configuration, this can only be used once.

Returns:
this configuration instance
Throws:
ObjectExistsException - if the default cache config has already been configured

addDefaultCache

public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration)
                           throws ObjectExistsException
Allows BeanHandler to add a default configuration to the configuration.

Throws:
ObjectExistsException

cache

public final Configuration cache(CacheConfiguration cacheConfiguration)
                          throws ObjectExistsException
Builder to add a new cache through its config

Returns:
this configuration instance
Throws:
ObjectExistsException - if a cache with the same name already exists, or if the name conflicts with the name of the default cache

addCache

public final void addCache(CacheConfiguration cacheConfiguration)
                    throws ObjectExistsException
Allows BeanHandler to add Cache Configurations to the configuration.

Throws:
ObjectExistsException

getCacheConfigurationsKeySet

public final Set<String> getCacheConfigurationsKeySet()
Gets a Map of cacheConfigurations.


getDefaultCacheConfiguration

public final CacheConfiguration getDefaultCacheConfiguration()
Returns:
the configuration's default cache configuration

setDefaultCacheConfiguration

public final void setDefaultCacheConfiguration(CacheConfiguration defaultCacheConfiguration)
Parameters:
defaultCacheConfiguration -

getDiskStoreConfiguration

public final DiskStoreConfiguration getDiskStoreConfiguration()
Gets the disk store configuration.


getTransactionManagerLookupConfiguration

public final FactoryConfiguration getTransactionManagerLookupConfiguration()
Gets the transaction manager lookup configuration.


getCacheManagerPeerProviderFactoryConfiguration

public final List<FactoryConfiguration> getCacheManagerPeerProviderFactoryConfiguration()
Gets the CacheManagerPeerProvider factory configuration.


getCacheManagerPeerListenerFactoryConfigurations

public final List<FactoryConfiguration> getCacheManagerPeerListenerFactoryConfigurations()
Gets the CacheManagerPeerListener factory configuration.


getCacheManagerEventListenerFactoryConfiguration

public final FactoryConfiguration getCacheManagerEventListenerFactoryConfiguration()
Gets the CacheManagerEventListener factory configuration.


getTerracottaConfiguration

public final TerracottaClientConfiguration getTerracottaConfiguration()
Gets the TerracottaClientConfiguration


getCacheConfigurations

public final Map<String,CacheConfiguration> getCacheConfigurations()
Gets a Map of cache configurations, keyed by name.


source

public final Configuration source(ConfigurationSource configurationSource)
Builder to set the configuration source.

Returns:
this configuration instance

setSource

public final void setSource(ConfigurationSource configurationSource)
Sets the configuration source.

Parameters:
configurationSource - an informative description of the source, preferably including the resource name and location.

getConfigurationSource

public final ConfigurationSource getConfigurationSource()
Gets a description of the source from which this configuration was created.


ehcache

true