Class ResourceMapping
- java.lang.Object
-
- com.tangosol.coherence.config.ResourceMapping
-
- Direct Known Subclasses:
CacheMapping,TopicMapping
public abstract class ResourceMapping extends Object
A base class for mapping elements.- Since:
- Coherence 14.1.1
- Author:
- jk 2015.05.21
-
-
Constructor Summary
Constructors Constructor Description ResourceMapping(String sNamePattern, String sSchemeName)Construct aResourceMappingfor resources that will use raw types by default.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract StringgetConfigElementName()Obtain the xml element name of this mapping.List<NamedEventInterceptorBuilder>getEventInterceptorBuilders()StringgetNamePattern()Obtains the pattern used to match resource names to thisResourceMapping.StringgetNameUsing(String sWildCardValue)Determines the name of a resource given a value for the wildcard (assuming the resource name pattern for the mapping is using a wildcard).ParameterResolvergetParameterResolver()Obtains theParameterResolverthat is to be used to resolveParameters associated with thisResourceMapping.ResourceRegistrygetResourceRegistry()Obtains theResourceRegistrythat holds resources associated with theResourceMapping.StringgetSchemeName()Obtains the name of the caching scheme to be used that match thisResourceMapping.List<ResourceMapping>getSubMappings()Obtain the list of sub-mappings that this mapping containsObjectgetValue(String sParamName)Get value ofsParamNameassociated with thisCacheMapping<T> TgetValue(String sParamName, Class<T> paramValueType)Get value ofsParamNameassociated with thisCacheMappingStringgetWildcardMatch(String sName)Determines the value the wildcard * declared in the resource name pattern for theResourceMappingmatches.booleanisForName(String sName)Determines if theResourceMappingis for (matches) the specified resource name.booleanisInternal()Check if this ResourceMapping is for internal resources.voidsetEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)ResourceMappingsetInternal(boolean fInternal)Set the flag to indicate if this mapping is for internal resources used by the service.voidsetParameterResolver(ParameterResolver resolver)booleanusesWildcard()Determines if theResourceMappingpattern contains a * wildcard.abstract voidvalidateScheme(Scheme scheme)Determine whether the specified schem is valid for this mapping type.
-
-
-
Constructor Detail
-
ResourceMapping
public ResourceMapping(String sNamePattern, String sSchemeName)
Construct aResourceMappingfor resources that will use raw types by default.- Parameters:
sNamePattern- the pattern that maps resource names to caching schemessSchemeName- the name of the caching scheme to which a resource matching thisResourceMappingwill be associated
-
-
Method Detail
-
getConfigElementName
public abstract String getConfigElementName()
Obtain the xml element name of this mapping.- Returns:
- the xml element name of this mapping
-
validateScheme
public abstract void validateScheme(Scheme scheme)
Determine whether the specified schem is valid for this mapping type.- Parameters:
scheme- the scheme to validate- Throws:
IllegalStateException- if the scheme is not valid
-
setInternal
public ResourceMapping setInternal(boolean fInternal)
Set the flag to indicate if this mapping is for internal resources used by the service.- Parameters:
fInternal- true if this is for internal resource- Returns:
- this ResourceMapping object
-
isInternal
public boolean isInternal()
Check if this ResourceMapping is for internal resources.- Returns:
- true if this is for internal resources
-
getNamePattern
public String getNamePattern()
Obtains the pattern used to match resource names to thisResourceMapping.- Returns:
- the pattern
-
getSchemeName
public String getSchemeName()
Obtains the name of the caching scheme to be used that match thisResourceMapping.- Returns:
- the name of the associated caching scheme
-
getResourceRegistry
public ResourceRegistry getResourceRegistry()
Obtains theResourceRegistrythat holds resources associated with theResourceMapping.- Returns:
- the
ResourceRegistry
-
getParameterResolver
public ParameterResolver getParameterResolver()
Obtains theParameterResolverthat is to be used to resolveParameters associated with thisResourceMapping.- Returns:
- the
ParameterResolver
-
setParameterResolver
@Injectable("init-params") public void setParameterResolver(ParameterResolver resolver)
- Parameters:
resolver- theParameterResolver
-
getEventInterceptorBuilders
public List<NamedEventInterceptorBuilder> getEventInterceptorBuilders()
- Returns:
- an
ListoverNamedEventInterceptorBuilders ornullif none are defined
-
setEventInterceptorBuilders
@Injectable("interceptors") public void setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)
- Parameters:
listBuilders- theListofNamedEventInterceptorBuilders
-
isForName
public boolean isForName(String sName)
Determines if theResourceMappingis for (matches) the specified resource name.- Parameters:
sName- the resource name to check for a match- Returns:
trueif theResourceMappingis for the specified resource name,falseotherwise
-
usesWildcard
public boolean usesWildcard()
Determines if theResourceMappingpattern contains a * wildcard.- Returns:
trueif the pattern contains a * wildcard,falseotherwise
-
getWildcardMatch
public String getWildcardMatch(String sName)
Determines the value the wildcard * declared in the resource name pattern for theResourceMappingmatches. If the pattern does not contain a wildcard * or the resource name does not match the mapping,nullis returned.Examples:
1. Calling mapping.getWildcardMatch("dist-test") on a ResourceMapping with the resource name pattern "dist-*" will return "test".
2. Calling mapping.getWildcardMatch("dist-*") on a ResourceMapping with the resource name pattern "dist-*" will return "*".
3. Calling mapping.getWildcardMatch("dist-fred") on a ResourceMapping with the resource name pattern "dist-fred" will return
null.4. Calling mapping.getWildcardMatch("dist-fred") on a ResourceMapping with the resource name pattern "repl-*" will return
null.5. Calling mapping.getWildcardMatch("dist-fred") on a ResourceMapping with the resource name pattern "*" will return "dist-fred".
- Parameters:
sName- the resource name to match- Returns:
- the resource name string that matches the wildcard.
-
getValue
public <T> T getValue(String sParamName, Class<T> paramValueType)
Get value ofsParamNameassociated with thisCacheMapping- Type Parameters:
T- parameter value type- Parameters:
sParamName- parameter name to look upparamValueType- parameter value type- Returns:
- parameter value as an instance of paramValueType or null if parameter is not defined
-
getValue
public Object getValue(String sParamName)
Get value ofsParamNameassociated with thisCacheMapping- Parameters:
sParamName- parameter name to look up- Returns:
- parameter value or null if parameter is not found
-
getNameUsing
public String getNameUsing(String sWildCardValue)
Determines the name of a resource given a value for the wildcard (assuming the resource name pattern for the mapping is using a wildcard). If the pattern does not contain a wildcard *,nullwill be returned.Examples:
1. Calling mapping.getNameUsing("test") on a ResourceMapping with the resource name pattern "dist-*" will return "dist-test".
2. Calling mapping.getNameUsing("*") on a ResourceMapping with the resource name pattern "dist-*" will return "dist-*".
3. Calling mapping.getNameUsing("fred") on a ResourceMapping with the resource name pattern "dist-fred" will return
null.4. Calling mapping.getNameUsing("dist-fred") on a ResourceMapping with the resource name pattern "*" will return "dist-fred".
- Parameters:
sWildCardValue- the value to replace the wildcard * with- Returns:
- the resource name with the wildcard replaced with the specified value
-
getSubMappings
public List<ResourceMapping> getSubMappings()
Obtain the list of sub-mappings that this mapping contains- Returns:
- the list of sub-mappings that this mapping contains.
-
-