Class CacheMapping
- java.lang.Object
-
- com.tangosol.coherence.config.ResourceMapping
-
- com.tangosol.coherence.config.CacheMapping
-
- Direct Known Subclasses:
RegExCacheMapping
public class CacheMapping extends ResourceMapping
ACacheMapping
captures configuration information for a pattern-match-based mapping from a proposedNamedCache
name to a caching scheme.In addition to the mapping between a cache name and a caching scheme, each
CacheMapping
retains aParameterResolver
(representing user-provided parameters) to be during the realization of the said cache and scheme. (This allows individual mappings to be parameterized)Lastly
CacheMapping
s 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:
"*"
andsomething-*
, but*-something
is invalid.- Since:
- Coherence 12.1.2
- Author:
- bo 2011.06.25
-
-
Field Summary
Fields Modifier and Type Field Description boolean
m_fFederated
The flag to indicate if thisCacheMapping
is federated.
-
Constructor Summary
Constructors Constructor Description CacheMapping(String sCacheNamePattern, String sCachingSchemeName)
Construct aCacheMapping
for caches that will use rawtypes by default.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getCacheNamePattern()
Deprecated.As of Coherence 14.1.1, useResourceMapping.getNamePattern()
.String
getCachingSchemeName()
Deprecated.As of Coherence 14.1.1, useResourceMapping.getSchemeName()
.String
getConfigElementName()
Obtain the xml element name of this mapping.String
getKeyClassName()
Obtains the name of the key class forNamedCache
s using thisCacheMapping
.String
getValueClassName()
Obtains the name of the value class forNamedCache
s using thisCacheMapping
.boolean
isFederated()
Check if this CacheMapping is federated.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 mapping is for internal resources used by the service.void
setKeyClassName(String sKeyClassName)
Sets the name of the key class forNamedCache
s using thisCacheMapping
.void
setValueClassName(String sValueClassName)
Sets the name of the value class forNamedCache
s using thisCacheMapping
.boolean
usesRawTypes()
Determines if theCacheMapping
is configured to use raw-types (ie: no type checking or constraints)void
validateScheme(Scheme scheme)
Determine whether the specified schem is valid for this mapping type.-
Methods inherited from class com.tangosol.coherence.config.ResourceMapping
getEventInterceptorBuilders, getNamePattern, getNameUsing, getParameterResolver, getResourceRegistry, getSchemeName, getSubMappings, getValue, getValue, getWildcardMatch, isForName, isInternal, setEventInterceptorBuilders, setParameterResolver, usesWildcard
-
-
-
-
Field Detail
-
m_fFederated
public boolean m_fFederated
The flag to indicate if thisCacheMapping
is federated.
-
-
Constructor Detail
-
CacheMapping
public CacheMapping(String sCacheNamePattern, String sCachingSchemeName)
Construct aCacheMapping
for caches that will use rawtypes by default.- Parameters:
sCacheNamePattern
- the pattern that maps cache names to caching schemessCachingSchemeName
- the name of the caching scheme to which caches matching thisCacheMapping
will be associated
-
-
Method Detail
-
getConfigElementName
public String getConfigElementName()
Description copied from class:ResourceMapping
Obtain the xml element name of this mapping.- Specified by:
getConfigElementName
in classResourceMapping
- Returns:
- the xml element name of this mapping
-
validateScheme
public void validateScheme(Scheme scheme)
Description copied from class:ResourceMapping
Determine whether the specified schem is valid for this mapping type.- Specified by:
validateScheme
in classResourceMapping
- Parameters:
scheme
- the scheme to validate
-
setFederated
@Injectable("federated") public CacheMapping setFederated(boolean fIsFederated)
Set true if this cache mapping is for federated caches. This has no effect for non-federated caches.- Parameters:
fIsFederated
- true if this cache is to be federated- Returns:
- this CacheMapping object
-
isFederated
public boolean isFederated()
Check if this CacheMapping is federated.- Returns:
- true if this CacheMapping is federated
-
setInternal
public CacheMapping setInternal(boolean fIsInternal)
Description copied from class:ResourceMapping
Set the flag to indicate if this mapping is for internal resources used by the service.- Overrides:
setInternal
in classResourceMapping
- Parameters:
fIsInternal
- true if this is for internal resource- Returns:
- this ResourceMapping object
-
getCacheNamePattern
public String getCacheNamePattern()
Deprecated.As of Coherence 14.1.1, useResourceMapping.getNamePattern()
.Obtains the pattern used to match cache names to thisCacheMapping
.- Returns:
- the pattern
-
getCachingSchemeName
public String getCachingSchemeName()
Deprecated.As of Coherence 14.1.1, useResourceMapping.getSchemeName()
.Obtains the name of the caching scheme to be used forNamedCache
s that match thisCacheMapping
.- Returns:
- the name of the associated caching scheme
-
getKeyClassName
public String getKeyClassName()
Obtains the name of the key class forNamedCache
s using thisCacheMapping
.- Returns:
- the name of the key class or
null
if rawtypes are being used
-
getValueClassName
public String getValueClassName()
Obtains the name of the value class forNamedCache
s using thisCacheMapping
.- Returns:
- the name of the value class or
null
if rawtypes are being used
-
usesRawTypes
public boolean usesRawTypes()
Determines if theCacheMapping
is configured to use raw-types (ie: no type checking or constraints)- Returns:
true
if using rawtypes,false
otherwise
-
setKeyClassName
@Injectable("key-type") public void setKeyClassName(String sKeyClassName)
Sets the name of the key class forNamedCache
s using thisCacheMapping
.- Parameters:
sKeyClassName
- the name of the key class ornull
if rawtypes are being used
-
setValueClassName
@Injectable("value-type") public void setValueClassName(String sValueClassName)
Sets the name of the value class forNamedCache
s using thisCacheMapping
.- Parameters:
sValueClassName
- the name of the value class ornull
if rawtypes are being used
-
-