Top Description Fields Constructors Methods
net.sf.ehcache.constructs

public abstract Class CacheDecoratorFactory

extends Object
Class Inheritance
Known Direct Subclasses
net.sf.ehcache.constructs.readthrough.ReadThroughCacheFactory, net.sf.ehcache.constructs.refreshahead.RefreshAheadCacheFactory
Imports
java.util.Properties, net.sf.ehcache.Ehcache

An abstract factory for creating decorated Ehcache instances. Implementing classes should provide their own concrete factory extending this factory.
Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
public static final String
DASH

Dash string : "-"

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract Ehcache

Returns:

a decorated Ehcache
createDecoratedEhcache
(Ehcache
a reference to the owning cache
cache
,
Properties
implementation specific properties configured as delimiter separated name value pairs in ehcache.xml
properties
)

Creates a decorated Ehcache using the properties specified for configuring the decorator.

public abstract Ehcache

Returns:

a decorated Ehcache
createDefaultDecoratedEhcache
(Ehcache
a reference to the owning cache
cache
,
Properties
implementation specific properties configured as delimiter separated name value pairs in ehcache.xml
properties
)

This method is called when the factory is specified for the defaultCache in the config.

public static String

Returns:

Name to be used for the new decorated cache in the form of cache.getName() + "-" + cacheNameSuffix or cache.getName() if cacheNameSuffix is null
generateDefaultDecoratedCacheName
(Ehcache
the underlying cache
cache
,
String
Name to be used as suffix. This is normally provided as a property in the decorator config properties. If this parameter is null or empty string, cache.getName() is returned
cacheNameSuffix
)

Utility method to generate name of decorated cache to be created using factory specified in defaultCache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DASHback to summary
public static final String DASH

Dash string : "-"

Constructor Detail

CacheDecoratorFactoryback to summary
public CacheDecoratorFactory()

Method Detail

createDecoratedEhcacheback to summary
public abstract Ehcache createDecoratedEhcache(Ehcache cache, Properties properties)

Creates a decorated Ehcache using the properties specified for configuring the decorator.

If the returned decorated cache has the same name as the underlying cache, then the original cache will be replaced by this new decorated cache in the CacheManager.

Parameters
cache:Ehcache

a reference to the owning cache

properties:Properties

implementation specific properties configured as delimiter separated name value pairs in ehcache.xml

Returns:Ehcache

a decorated Ehcache

createDefaultDecoratedEhcacheback to summary
public abstract Ehcache createDefaultDecoratedEhcache(Ehcache cache, Properties properties)

This method is called when the factory is specified for the defaultCache in the config. Create the decorated Ehcache using the properties specified.

If the returned decorated cache has the same name as the underlying cache, then the original cache will be replaced by this new decorated cache in the CacheManager.

Parameters
cache:Ehcache

a reference to the owning cache

properties:Properties

implementation specific properties configured as delimiter separated name value pairs in ehcache.xml

Returns:Ehcache

a decorated Ehcache

generateDefaultDecoratedCacheNameback to summary
public static String generateDefaultDecoratedCacheName(Ehcache cache, String cacheNameSuffix)

Utility method to generate name of decorated cache to be created using factory specified in defaultCache.

Parameters
cache:Ehcache

the underlying cache

cacheNameSuffix:String

Name to be used as suffix. This is normally provided as a property in the decorator config properties. If this parameter is null or empty string, cache.getName() is returned

Returns:String

Name to be used for the new decorated cache in the form of cache.getName() + "-" + cacheNameSuffix or cache.getName() if cacheNameSuffix is null