org.ehcache.core.config
Class DefaultConfiguration

java.lang.Object
  extended by org.ehcache.core.config.DefaultConfiguration
All Implemented Interfaces:
Configuration, RuntimeConfiguration

public final class DefaultConfiguration
extends java.lang.Object
implements Configuration, RuntimeConfiguration

Base implementation of Configuration.


Constructor Summary
DefaultConfiguration(java.lang.ClassLoader classLoader)
          Creates a new configuration with the specified class loader.
DefaultConfiguration(Configuration cfg)
          Copy constructor
DefaultConfiguration(java.util.Map<java.lang.String,CacheConfiguration<?,?>> caches, java.lang.ClassLoader classLoader, ServiceCreationConfiguration<?>... services)
          Creates a new configuration with the specified cache configurations, class loader and service configurations.
 
Method Summary
 void addCacheConfiguration(java.lang.String alias, CacheConfiguration<?,?> config)
          Adds a CacheConfiguration tied to the provided alias.
 java.util.Map<java.lang.String,CacheConfiguration<?,?>> getCacheConfigurations()
          Mapping of names to CacheConfiguration, used to create the named Cache managed by a CacheManager
 java.lang.ClassLoader getClassLoader()
          The ClassLoader to be associated with the CacheManager
 java.util.Collection<ServiceCreationConfiguration<?>> getServiceCreationConfigurations()
          All services initially used to bootstrap the CacheManager and its Cache instances
 void removeCacheConfiguration(java.lang.String alias)
          Removes the CacheConfiguration tied to the provided alias.
<K,V> void
replaceCacheConfiguration(java.lang.String alias, CacheConfiguration<K,V> config, CacheRuntimeConfiguration<K,V> runtimeConfiguration)
          Replaces a CacheConfiguration with a CacheRuntimeConfiguration for the provided alias.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfiguration

public DefaultConfiguration(Configuration cfg)
Copy constructor

Parameters:
cfg - the configuration to copy

DefaultConfiguration

public DefaultConfiguration(java.lang.ClassLoader classLoader)
Creates a new configuration with the specified class loader.

This means no cache configurations nor service configurations.

Parameters:
classLoader - the class loader to use
See Also:
addCacheConfiguration(String, CacheConfiguration)

DefaultConfiguration

public DefaultConfiguration(java.util.Map<java.lang.String,CacheConfiguration<?,?>> caches,
                            java.lang.ClassLoader classLoader,
                            ServiceCreationConfiguration<?>... services)
Creates a new configuration with the specified cache configurations, class loader and service configurations.

Parameters:
caches - a map from alias to cache configuration
classLoader - the class loader to use for user types
services - an array of service configurations
Method Detail

getCacheConfigurations

public java.util.Map<java.lang.String,CacheConfiguration<?,?>> getCacheConfigurations()
Mapping of names to CacheConfiguration, used to create the named Cache managed by a CacheManager

Specified by:
getCacheConfigurations in interface Configuration
Returns:
the map of names to configs

getServiceCreationConfigurations

public java.util.Collection<ServiceCreationConfiguration<?>> getServiceCreationConfigurations()
All services initially used to bootstrap the CacheManager and its Cache instances

Specified by:
getServiceCreationConfigurations in interface Configuration
Returns:
the collection of said configs

getClassLoader

public java.lang.ClassLoader getClassLoader()
The ClassLoader to be associated with the CacheManager

Specified by:
getClassLoader in interface Configuration
Returns:
The classloader

addCacheConfiguration

public void addCacheConfiguration(java.lang.String alias,
                                  CacheConfiguration<?,?> config)
Adds a CacheConfiguration tied to the provided alias.

Parameters:
alias - the alias of the cache
config - the configuration of the cache

removeCacheConfiguration

public void removeCacheConfiguration(java.lang.String alias)
Removes the CacheConfiguration tied to the provided alias.

Parameters:
alias - the alias for which to remove configuration
Throws:
java.lang.IllegalStateException - if the alias was not in use

replaceCacheConfiguration

public <K,V> void replaceCacheConfiguration(java.lang.String alias,
                                            CacheConfiguration<K,V> config,
                                            CacheRuntimeConfiguration<K,V> runtimeConfiguration)
Replaces a CacheConfiguration with a CacheRuntimeConfiguration for the provided alias.

Type Parameters:
K - the key type
V - the value type
Parameters:
alias - the alias of the cache
config - the existing configuration
runtimeConfiguration - the new configuration
Throws:
java.lang.IllegalStateException - if the replace fails