Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.coherence.config
Class CacheMapping

java.lang.Object
  extended by com.tangosol.coherence.config.CacheMapping


public class CacheMapping
extends java.lang.Object

A 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.

Since:
Coherence 12.1.2
Author:
bo 2011.06.25

Constructor Summary
CacheMapping(java.lang.String sCacheNamePattern, java.lang.String sCachingSchemeName)
          Construct a CacheMapping.

 

Method Summary
 java.lang.String getCacheNamePattern()
          Obtains the pattern used to match cache names to this CacheMapping.
 java.lang.String getCacheNameUsing(java.lang.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).
 java.lang.String getCachingSchemeName()
          Obtains the name of the caching scheme to be used for NamedCaches that match this CacheMapping.
 java.util.List getEventInterceptorBuilders()
          Obtains the List of NamedEventInterceptorBuilders for 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.
 java.lang.String getWildcardMatch(java.lang.String sCacheName)
          Determines the value the wildcard * declared in the cache name pattern for the CacheMapping matches.
 boolean isForCacheName(java.lang.String sCacheName)
          Determines if the CacheMapping is for (matches) the specified cache name.
 void setEventInterceptorBuilders(java.util.List listBuilders)
          Sets the List of NamedEventInterceptorBuilders for the CacheMapping.
 void setParameterResolver(com.tangosol.config.expression.ParameterResolver resolver)
          Sets the ParameterResolver that is used to resolve Parameters associated with the CacheMapping.
 boolean usesWildcard()
          Determines if the CacheMapping pattern contains a * wildcard.

 

Constructor Detail

CacheMapping

public CacheMapping(java.lang.String sCacheNamePattern,
                    java.lang.String sCachingSchemeName)
Construct a CacheMapping.
Parameters:
sCacheNamePattern - the pattern that maps cache names to caching schemes
sCachingSchemeName - the name of the caching scheme to which caches matching this CacheMapping will be associated

Method Detail

getCacheNamePattern

public java.lang.String getCacheNamePattern()
Obtains the pattern used to match cache names to this CacheMapping.
Returns:
the pattern

getCachingSchemeName

public java.lang.String getCachingSchemeName()
Obtains the name of the caching scheme to be used for NamedCaches that match this CacheMapping.
Returns:
the name of the associated caching scheme

getResourceRegistry

public ResourceRegistry getResourceRegistry()
Obtains the ResourceRegistry that holds resources associated with the CacheMapping.
Returns:
the ResourceRegistry

getParameterResolver

public com.tangosol.config.expression.ParameterResolver getParameterResolver()
Obtains the ParameterResolver that is to be used to resolve Parameters associated with this CacheMapping.
Returns:
the ParameterResolver

setParameterResolver

@Injectable(value="init-params")
public void setParameterResolver(com.tangosol.config.expression.ParameterResolver resolver)
Sets the ParameterResolver that is used to resolve Parameters associated with the CacheMapping.
Parameters:
resolver - the ParameterResolver

getEventInterceptorBuilders

public java.util.List getEventInterceptorBuilders()
Obtains the List of NamedEventInterceptorBuilders for this CacheMapping.
Returns:
an List over NamedEventInterceptorBuilders or null if none are defined

setEventInterceptorBuilders

@Injectable(value="interceptors")
public void setEventInterceptorBuilders(java.util.List listBuilders)
Sets the List of NamedEventInterceptorBuilders for the CacheMapping.
Parameters:
listBuilders - the List of NamedEventInterceptorBuilders

isForCacheName

public boolean isForCacheName(java.lang.String sCacheName)
Determines if the CacheMapping is for (matches) the specified cache name.
Parameters:
sCacheName - the cacheName to check for a match
Returns:
true if the CacheMapping is for the specified cache name, false otherwise

usesWildcard

public boolean usesWildcard()
Determines if the CacheMapping pattern contains a * wildcard.
Returns:
true if the pattern contains a * wildcard, false otherwise

getWildcardMatch

public java.lang.String getWildcardMatch(java.lang.String sCacheName)
Determines the value the wildcard * declared in the cache name pattern for the 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".

Parameters:
sCacheName - the cache name to match
Returns:
the cache name string that matches the wildcard.

getCacheNameUsing

public java.lang.String getCacheNameUsing(java.lang.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). If the pattern does not contain a wildcard *, 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".

Parameters:
sWildCardValue - the value to replace the wildcard * with
Returns:
the cache name with the wildcard replaced with the specified value

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.