public class CacheMapping extends Object
CacheMapping captures configuration information for a pattern-match-based mapping from a proposed
NamedCache name to a caching scheme.
In addition to the mapping between a cache name and a caching scheme, each CacheMapping retains a
ParameterResolver (representing user-provided parameters) to be during the realization of the said cache
and scheme. (This allows individual mappings to be parameterized)
Lastly CacheMappings also provide a mechanism to associate specific strongly typed resources
with each mapping at runtime. This provides a flexible and dynamic mechanism to associate further configuration
information with caches.
Pattern Matching Semantics: The only wildcard permitted for pattern matching with cache names is the "*" and it may only be used at the end of a cache name.
For example, the following cache name patterns are valid:
"*" and something-*, but *-something is invalid.
| Modifier and Type | Field and Description |
|---|---|
boolean |
m_fFederated
The flag to indicate if this
CacheMapping is federated. |
boolean |
m_fIsInternal
The flag to indicate if this
CacheMapping is for internal caches. |
| Constructor and Description |
|---|
CacheMapping(String sCacheNamePattern,
String sCachingSchemeName)
Construct a
CacheMapping for caches that will use rawtypes by default. |
| Modifier and Type | Method and Description |
|---|---|
String |
getCacheNamePattern()
Obtains the pattern used to match cache names to this
CacheMapping. |
String |
getCacheNameUsing(String sWildCardValue)
Determines the name of a cache given a value for the wildcard
(assuming the cache name pattern for the mapping is using a wildcard).
|
String |
getCachingSchemeName()
Obtains the name of the caching scheme to be used for
NamedCaches that match this CacheMapping. |
List<NamedEventInterceptorBuilder> |
getEventInterceptorBuilders()
|
String |
getKeyClassName()
Obtains the name of the key class for
NamedCaches using this CacheMapping. |
com.tangosol.config.expression.ParameterResolver |
getParameterResolver()
Obtains the
ParameterResolver that is to be used to resolve Parameters associated with
this CacheMapping. |
ResourceRegistry |
getResourceRegistry()
Obtains the
ResourceRegistry that holds resources associated with the CacheMapping. |
Object |
getValue(String sParamName)
Get value of
sParamName associated with this CacheMapping |
<T> T |
getValue(String sParamName,
Class<T> paramValueType)
Get value of
sParamName associated with this CacheMapping |
String |
getValueClassName()
Obtains the name of the value class for
NamedCaches using this CacheMapping. |
String |
getWildcardMatch(String sCacheName)
Determines the value the wildcard * declared in the cache name
pattern for the
CacheMapping matches. |
boolean |
isFederated()
Check if this CacheMapping is federated.
|
boolean |
isForCacheName(String sCacheName)
Determines if the
CacheMapping is for (matches) the specified cache name. |
boolean |
isInternal()
Check if this CacheMapping is for internal caches.
|
void |
setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)
|
CacheMapping |
setFederated(boolean fIsFederated)
Set true if this cache mapping is for federated caches.
|
CacheMapping |
setInternal(boolean fIsInternal)
Set the flag to indicate if this cache mapping is for internal caches
used by the service, especially for federation service.
|
void |
setKeyClassName(String sKeyClassName)
Sets the name of the key class for
NamedCaches using this CacheMapping. |
void |
setParameterResolver(com.tangosol.config.expression.ParameterResolver resolver)
|
void |
setValueClassName(String sValueClassName)
Sets the name of the value class for
NamedCaches using this CacheMapping. |
String |
toString() |
boolean |
usesRawTypes()
Determines if the
CacheMapping is configured to use raw-types
(ie: no type checking or constraints) |
boolean |
usesWildcard()
Determines if the
CacheMapping pattern contains a * wildcard. |
public boolean m_fFederated
CacheMapping is federated.public boolean m_fIsInternal
CacheMapping is for internal caches.public CacheMapping(String sCacheNamePattern, String sCachingSchemeName)
CacheMapping for caches that will use rawtypes by default.sCacheNamePattern - the pattern that maps cache names to caching schemessCachingSchemeName - the name of the caching scheme to which caches matching this
CacheMapping will be associated@Injectable(value="federated") public CacheMapping setFederated(boolean fIsFederated)
fIsFederated - true if this cache is to be federatedpublic boolean isFederated()
public CacheMapping setInternal(boolean fIsInternal)
fIsInternal - true if this is for internal cachespublic boolean isInternal()
public String getCacheNamePattern()
CacheMapping.public String getCachingSchemeName()
NamedCaches that match this CacheMapping.public String getKeyClassName()
NamedCaches using this CacheMapping.null if rawtypes are being usedpublic String getValueClassName()
NamedCaches using this CacheMapping.null if rawtypes are being usedpublic boolean usesRawTypes()
CacheMapping is configured to use raw-types
(ie: no type checking or constraints)true if using rawtypes, false otherwisepublic ResourceRegistry getResourceRegistry()
ResourceRegistry that holds resources associated with the CacheMapping.ResourceRegistrypublic com.tangosol.config.expression.ParameterResolver getParameterResolver()
ParameterResolver that is to be used to resolve Parameters associated with
this CacheMapping.ParameterResolver@Injectable(value="key-type") public void setKeyClassName(String sKeyClassName)
NamedCaches using this CacheMapping.sKeyClassName - the name of the key class or null if rawtypes are being used@Injectable(value="value-type") public void setValueClassName(String sValueClassName)
NamedCaches using this CacheMapping.sValueClassName - the name of the value class or null if rawtypes are being used@Injectable(value="init-params") public void setParameterResolver(com.tangosol.config.expression.ParameterResolver resolver)
resolver - the ParameterResolverpublic List<NamedEventInterceptorBuilder> getEventInterceptorBuilders()
List over NamedEventInterceptorBuilders or null if none are defined@Injectable(value="interceptors") public void setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)
listBuilders - the List of NamedEventInterceptorBuilderspublic boolean isForCacheName(String sCacheName)
CacheMapping is for (matches) the specified cache name.sCacheName - the cacheName to check for a matchtrue if the CacheMapping is for the specified cache name,
false otherwisepublic boolean usesWildcard()
CacheMapping pattern contains a * wildcard.true if the pattern contains a * wildcard,
false otherwisepublic String getWildcardMatch(String sCacheName)
CacheMapping matches. If the pattern does
not contain a wildcard * or the cache name does not match the
mapping, null is returned.
Examples:
1. Calling cacheMapping.getWildcardMatch("dist-test") on a CacheMapping with the cache name pattern "dist-*" will return "test".
2. Calling cacheMapping.getWildcardMatch("dist-*") on a CacheMapping with the cache name pattern "dist-*" will return "*".
3. Calling cacheMapping.getWildcardMatch("dist-fred") on a CacheMapping with
the cache name pattern "dist-fred" will return null.
4. Calling cacheMapping.getWildcardMatch("dist-fred") on a CacheMapping with
the cache name pattern "repl-*" will return null.
5. Calling cacheMapping.getWildcardMatch("dist-fred") on a CacheMapping with the cache name pattern "*" will return "dist-fred".
sCacheName - the cache name to matchpublic <T> T getValue(String sParamName, Class<T> paramValueType)
sParamName associated with this CacheMappingT - parameter value typesParamName - parameter name to look upparamValueType - parameter value typepublic Object getValue(String sParamName)
sParamName associated with this CacheMappingsParamName - parameter name to look uppublic String getCacheNameUsing(String sWildCardValue)
null will
be returned.
Examples:
1. Calling cacheMapping.getCacheNameUsing("test") on a CacheMapping with the cache name pattern "dist-*" will return "dist-test".
2. Calling cacheMapping.getCacheNameUsing("*") on a CacheMapping with the cache name pattern "dist-*" will return "dist-*".
3. Calling cacheMapping.getCacheNameUsing("fred") on a CacheMapping with
the cache name pattern "dist-fred" will return null.
4. Calling cacheMapping.getCacheNameUsing("dist-fred") on a CacheMapping with the cache name pattern "*" will return "dist-fred".
sWildCardValue - the value to replace the wildcard * with