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

public final Class Configuration

extends Object
Class Inheritance
Imports
net.sf.ehcache.Cache, .CacheException, .CacheManager, .EhcacheDefaultClassLoader, .FeaturesManager, .ObjectExistsException, .Status, net.sf.ehcache.config.generator.ConfigurationSource, net.sf.ehcache.store.Store, net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup, .TransactionManagerLookup, net.sf.ehcache.util.PropertyUtil, org.slf4j.Logger, .LoggerFactory, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.lang.reflect.InvocationTargetException, java.util.ArrayList, .Collection, .HashMap, .HashSet, .List, .Map, .Properties, .Set, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList

A bean, used by BeanUtils, to set configuration from an XML configuration file.
Author
Greg Luck
Version
$Id: Configuration.java 10789 2018-04-26 02:08:13Z adahanne $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
Configuration.DynamicProperty

Enum of all properties that can change once the Configuration is being used by a CacheManager

public static enum
Configuration.Monitoring

Represents whether monitoring should be enabled or not.

public class
Configuration.RuntimeCfg

Runtime configuration as being used by the CacheManager

Field Summary

Modifier and TypeField and Description
private final Map<String, CacheConfiguration>
private FactoryConfiguration<T extends FactoryConfiguration>
private String
private final List<FactoryConfiguration<T extends FactoryConfiguration>>
private final List<FactoryConfiguration<T extends FactoryConfiguration>>
private volatile Configuration.RuntimeCfg
private volatile ClassLoader
private ConfigurationSource
public static final boolean
DEFAULT_DYNAMIC_CONFIG

Default value for dynamicConfig

public static final long
DEFAULT_MAX_BYTES_OFF_HEAP

Default value for maxBytesLocalOffHeap when not explicitly set

public static final long
DEFAULT_MAX_BYTES_ON_DISK

Default value for maxBytesLocalDisk when not explicitly set

public static final long
DEFAULT_MAX_BYTES_ON_HEAP

Default value for maxBytesLocalHeap when not explicitly set

public static final Configuration.Monitoring
DEFAULT_MONITORING

Default value for monitoring

public static final SizeOfPolicyConfiguration
DEFAULT_SIZEOF_POLICY_CONFIGURATION

Default sizeOfPolicy configuration

public static final FactoryConfiguration<T extends FactoryConfiguration>
DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG

Default transactionManagerLookupConfiguration

public static final int
DEFAULT_TRANSACTION_TIMEOUT

Default value for defaultTransactionTimeoutInSeconds

private CacheConfiguration
private int
private DiskStoreConfiguration
private boolean
private static final int
private static final Logger
private ManagementRESTServiceConfiguration
private Long
private String
private Long
private String
private Long
private String
private Configuration.Monitoring
private final List<PropertyChangeListener>
private SizeOfPolicyConfiguration
private TerracottaClientConfiguration
private FactoryConfiguration<T extends FactoryConfiguration>

Constructor Summary

AccessConstructor and Description
public
Configuration()

Empty constructor, which is used by ConfigurationFactory, and can be also used programmatically.

Method Summary

Modifier and TypeMethod and Description
public final void
addCache(CacheConfiguration cacheConfiguration)

Allows BeanHandler to add Cache Configurations to the configuration.

pack-priv void
addCache(CacheConfiguration
the CacheConfiguration
cacheConfiguration
,
final boolean
true if added regularly, validation dyn config constraints, false if added through the cache being added
strict
)

Maintains the known Cache's configuration map in this Configuration

public final void
addCacheManagerEventListenerFactory(FactoryConfiguration<T extends FactoryConfiguration> cacheManagerEventListenerFactoryConfiguration)

Allows BeanHandler to add the CacheManagerEventListener to the configuration.

public final void
addCacheManagerPeerListenerFactory(FactoryConfiguration<T extends FactoryConfiguration> factory)

Adds a CacheManagerPeerListener through FactoryConfiguration.

public final void
addCacheManagerPeerProviderFactory(FactoryConfiguration<T extends FactoryConfiguration> factory)

Adds a CacheManagerPeerProvider through FactoryConfiguration.

public final void
addDefaultCache(CacheConfiguration defaultCacheConfiguration)

Allows BeanHandler to add a default configuration to the configuration.

public final void
addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter)

Allows BeanHandler to add disk store location to the configuration.

public final void
addManagementRESTService(ManagementRESTServiceConfiguration managementRESTServiceConfiguration)

Allows BeanHandler to add a ManagementRESTService configuration to the configuration

public boolean

Returns:

true if added, false otherwise
addPropertyChangeListener
(final PropertyChangeListener
the listener instance
listener
)

Adds a PropertyChangeListener for this configuration

public final void
addSizeOfPolicy(SizeOfPolicyConfiguration
the SizeOfPolicy Configuration
sizeOfPolicy
)

Sets the default SizeOfPolicyConfiguration for this cache manager.

public final void
addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration)

Allows BeanHandler to add a Terracotta configuration to the configuration

public final void
addTransactionManagerLookup(FactoryConfiguration<T extends FactoryConfiguration> transactionManagerLookupParameter)

Allows BeanHandler to add transaction manager lookup to the configuration.

private void
public final Configuration

Returns:

this configuration instance
cache
(CacheConfiguration cacheConfiguration)

Builder to add a new cache through its config

public final Configuration

Returns:

this configuration instance
cacheManagerEventListenerFactory
(FactoryConfiguration<T extends FactoryConfiguration> cacheManagerEventListenerFactoryConfiguration)

Builder to set the event lister through a factory, only one of these can be added and subsequent calls are ignored.

public final Configuration

Returns:

this configuration instance
cacheManagerPeerListenerFactory
(FactoryConfiguration<T extends FactoryConfiguration> factory)

Builder method to add a peer listener through a factory.

public final Configuration

Returns:

this configuration instance
cacheManagerPeerProviderFactory
(FactoryConfiguration<T extends FactoryConfiguration> factory)

Builder method to add a peer provider through a factory.

private boolean
checkDynChange(final String prop)

public void
public final Configuration

Returns:

this configuration instance
defaultCache
(CacheConfiguration defaultCacheConfiguration)

Builder method to set the default cache configuration, this can only be used once.

public final Configuration

Returns:

this configuration instance
defaultTransactionTimeoutInSeconds
(int
the default transaction timeout in seconds
defaultTransactionTimeoutInSeconds
)

Builder to set the default transaction timeout.

public final Configuration

Returns:

this configuration instance
diskStore
(DiskStoreConfiguration
the disk store configuration to use
diskStoreConfigurationParameter
)

Builder to add a disk store to the cache manager, only one disk store can be added.

public final Configuration

Returns:

this configuration instance
dynamicConfig
(boolean
true if dynamic config should be enabled; or false otherwise.
dynamicConfig
)

Builder to set the dynamic config capability

private <T> void
firePropertyChange(final String prop, final T oldValue, final T newValue)

pack-priv static Set<Cache>

Returns:

the Set of all active caches
getAllActiveCaches
(CacheManager
The cacheManager
cacheManager
)

Returns all active caches managed by the Manager

public final Map<String, CacheConfiguration>
getCacheConfigurations()

Gets a Map of cache configurations, keyed by name.

public final Set<String>
getCacheConfigurationsKeySet()

Gets a Map of cacheConfigurations.

public final FactoryConfiguration<T extends FactoryConfiguration>
getCacheManagerEventListenerFactoryConfiguration()

Gets the CacheManagerEventListener factory configuration.

public final List<FactoryConfiguration<T extends FactoryConfiguration>>
getCacheManagerPeerListenerFactoryConfigurations()

Gets the CacheManagerPeerListener factory configuration.

public final List<FactoryConfiguration<T extends FactoryConfiguration>>
getCacheManagerPeerProviderFactoryConfiguration()

Gets the CacheManagerPeerProvider factory configuration.

public ClassLoader
public final ConfigurationSource
getConfigurationSource()

Gets a description of the source from which this configuration was created.

public final CacheConfiguration

Returns:

the configuration's default cache configuration
getDefaultCacheConfiguration
()

private static FactoryConfiguration<T extends FactoryConfiguration>
public final int

Returns:

default transaction timeout in seconds
getDefaultTransactionTimeoutInSeconds
()

Get default transaction timeout

public final DiskStoreConfiguration
getDiskStoreConfiguration()

Gets the disk store configuration.

public final boolean
getDynamicConfig()

Get flag for dynamicConfig

public final ManagementRESTServiceConfiguration
getManagementRESTService()

Gets the ManagementRESTServiceConfiguration

public long

Returns:

amount in bytes
getMaxBytesLocalDisk
()

Maximum amount of bytes the CacheManager will use on the Disk Tier.

public String

Returns:

Original input for maxBytesLocalDisk
getMaxBytesLocalDiskAsString
()

public long

Returns:

amount of bytes, 0 is unbound
getMaxBytesLocalHeap
()

Maximum amount of bytes the CacheManager will use on the heap

public String

Returns:

Original input for maxBytesLocalHeap
getMaxBytesLocalHeapAsString
()

public long

Returns:

amount in bytes
getMaxBytesLocalOffHeap
()

Maximum amount of bytes the CacheManager will use on the OffHeap Tier.

public String

Returns:

Original input for maxBytesLocalOffHeap
getMaxBytesLocalOffHeapAsString
()

public final Configuration.Monitoring
getMonitoring()

Get monitoring type, should not be null

public final String
getName()

CacheManager name

private long
public final SizeOfPolicyConfiguration
getSizeOfPolicyConfiguration()

Gets the SizeOf policy configuration.

public final TerracottaClientConfiguration
getTerracottaConfiguration()

Gets the TerracottaClientConfiguration

public long

Returns:

Total amount offheap configured by current caches
getTotalConfiguredOffheap
()

public final FactoryConfiguration<T extends FactoryConfiguration>
getTransactionManagerLookupConfiguration()

Gets the transaction manager lookup configuration.

public final boolean
getUpdateCheck()

Deprecated
Get flag for updateCheck
public boolean

Returns:

true if set by user, false otherwise
isMaxBytesLocalDiskSet
()

Checks whether the user explicitly set the maxBytesOnDisk

public boolean

Returns:

true if set by user, false otherwise
isMaxBytesLocalHeapSet
()

Checks whether the user explicitly set the maxBytesOnHeap

public boolean

Returns:

true if set by user, false otherwise
isMaxBytesLocalOffHeapSet
()

Checks whether the user explicitly set the maxBytesOffHeat

private boolean
isPercentage(final String stringValue)

public final Configuration

Returns:

this configuration instance
managementRESTService
(ManagementRESTServiceConfiguration cfg)

Builder method to REST management capabilities to the cache manager through a dedicated configuration, this can only be used once.

public Configuration

Returns:

this
maxBytesLocalDisk
(final long
the amount of unit
amount
,
final MemoryUnit
the actual unit
memoryUnit
)

Sets the maxOnDisk size

public Configuration

Returns:

this
maxBytesLocalHeap
(final long
the amount of unit
amount
,
final MemoryUnit
the actual unit
memoryUnit
)

Sets the maxOnHeap size for the cache being configured

public Configuration

Returns:

this
maxBytesLocalOffHeap
(final long
the amount of unit
amount
,
final MemoryUnit
the actual unit
memoryUnit
)

Sets the maximum size for the OffHeap tier for all the caches this CacheManagers holds.

public final Configuration

Returns:

this configuration instance
monitoring
(Configuration.Monitoring
an non-null instance of Monitoring
monitoring
)

Builder to set the monitoring approach

public final Configuration

Returns:

this configuration instance
name
(String
the name to set
name
)

Builder to set the cache manager name.

private int
parsePercentage(final String stringValue)

public boolean

Returns:

true if removed, false otherwise
removePropertyChangeListener
(final PropertyChangeListener
the listener to be removed
listener
)

Removes a PropertyChangeListener for this configuration

public void
setClassLoader(ClassLoader
the classloader to use
loader
)

Set the classloader for the cache manager (and it's associated caches) to use when creating application objects (eg.

public final void
public final void
setDefaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds)

Allows BeanHandler to set the default transaction timeout.

public final void
setDynamicConfig(boolean dynamicConfig)

Allows BeanHandler to set the dynamic configuration flag

public void
setMaxBytesLocalDisk(final String
String representation of the size.
maxBytesOnDisk
)

Sets maximum amount of bytes the CacheManager will use on the Disk Tier.

public void
setMaxBytesLocalDisk(final Long
max bytes on disk in bytes. Needs be be greater than 0
maxBytesOnDisk
)

Sets maximum amount of bytes the CacheManager will use on the Disk Tier.

public void
setMaxBytesLocalHeap(final String
String representation of the size.
maxBytesOnHeap
)

Sets maximum amount of bytes the CacheManager will use on the Disk Tier.

public void
setMaxBytesLocalHeap(final Long
amount of bytes
maxBytesOnHeap
)

Sets the maximum amount of bytes the cache manager being configured will use on the OnHeap tier

public void
setMaxBytesLocalOffHeap(final String
String representation of the size.
maxBytesOffHeap
)

Sets maximum amount of bytes the CacheManager will use on the OffHeap Tier.

public void
setMaxBytesLocalOffHeap(final Long
max bytes on disk in bytes. Needs be be greater than 0
maxBytesOffHeap
)

Sets maximum amount of bytes the CacheManager will use on the OffHeap Tier.

public final void
setMonitoring(String monitoring)

Allows BeanHandler to set the monitoring flag

public final void
setName(String name)

Allows BeanHandler to set the CacheManager name.

public final void
setSource(ConfigurationSource
an informative description of the source, preferably including the resource name and location.
configurationSource
)

Sets the configuration source.

public final void
setUpdateCheck(boolean updateCheck)

Deprecated
Allows BeanHandler to set the updateCheck flag.
public Configuration.RuntimeCfg
setupFor(final CacheManager
the CacheManager instance being configured
cacheManager
,
final String fallbackName)

Freezes part of the configuration that need to be, and runs validation checks on the Configuration.

public final Configuration

Returns:

this configuration instance
sizeOfPolicy
(SizeOfPolicyConfiguration
the SizeOfPolicy Configuration
sizeOfPolicyConfiguration
)

Builder to set the default SizeOfPolicyConfiguration for this cache manager.

public final Configuration

Returns:

this configuration instance
source
(ConfigurationSource configurationSource)

Builder to set the configuration source.

public final Configuration

Returns:

this configuration instance
terracotta
(TerracottaClientConfiguration terracottaConfiguration)

Builder method to Terracotta capabilities to the cache manager through a dedicated configuration, this can only be used once.

public final Configuration

Returns:

this configuration instance
transactionManagerLookup
(FactoryConfiguration<T extends FactoryConfiguration>
the transaction manager lookup class to use
transactionManagerLookupParameter
)

Builder to add a transaction manager lookup class to the cache manager, only one of these can be added.

public final Configuration

Returns:

this configuration instance
updateCheck
(boolean
true if the update check should be turned on; or false otherwise
updateCheck
)

Deprecated
Builder to set the state of the automated update check.
public Collection<ConfigError>

Returns:

the list of errors withing that configuration
validate
()

Validates the current configuration

private void
verifyGreaterThanZero(final Long maxBytesOnHeap, final String field)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait