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 aResourceMapping
for resources that will use raw types by default.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
getConfigElementName()
Obtain the xml element name of this mapping.List<NamedEventInterceptorBuilder>
getEventInterceptorBuilders()
String
getNamePattern()
Obtains the pattern used to match resource names to thisResourceMapping
.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).ParameterResolver
getParameterResolver()
Obtains theParameterResolver
that is to be used to resolveParameter
s associated with thisResourceMapping
.ResourceRegistry
getResourceRegistry()
Obtains theResourceRegistry
that holds resources associated with theResourceMapping
.String
getSchemeName()
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 containsObject
getValue(String sParamName)
Get value ofsParamName
associated with thisCacheMapping
<T> T
getValue(String sParamName, Class<T> paramValueType)
Get value ofsParamName
associated with thisCacheMapping
String
getWildcardMatch(String sName)
Determines the value the wildcard * declared in the resource name pattern for theResourceMapping
matches.boolean
isForName(String sName)
Determines if theResourceMapping
is for (matches) the specified resource name.boolean
isInternal()
Check if this ResourceMapping is for internal resources.void
setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)
ResourceMapping
setInternal(boolean fInternal)
Set the flag to indicate if this mapping is for internal resources used by the service.void
setParameterResolver(ParameterResolver resolver)
boolean
usesWildcard()
Determines if theResourceMapping
pattern contains a * wildcard.abstract void
validateScheme(Scheme scheme)
Determine whether the specified schem is valid for this mapping type.
-
-
-
Constructor Detail
-
ResourceMapping
public ResourceMapping(String sNamePattern, String sSchemeName)
Construct aResourceMapping
for 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 thisResourceMapping
will 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 theResourceRegistry
that holds resources associated with theResourceMapping
.- Returns:
- the
ResourceRegistry
-
getParameterResolver
public ParameterResolver getParameterResolver()
Obtains theParameterResolver
that is to be used to resolveParameter
s 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
List
overNamedEventInterceptorBuilder
s ornull
if none are defined
-
setEventInterceptorBuilders
@Injectable("interceptors") public void setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders)
- Parameters:
listBuilders
- theList
ofNamedEventInterceptorBuilder
s
-
isForName
public boolean isForName(String sName)
Determines if theResourceMapping
is for (matches) the specified resource name.- Parameters:
sName
- the resource name to check for a match- Returns:
true
if theResourceMapping
is for the specified resource name,false
otherwise
-
usesWildcard
public boolean usesWildcard()
Determines if theResourceMapping
pattern contains a * wildcard.- Returns:
true
if the pattern contains a * wildcard,false
otherwise
-
getWildcardMatch
public String getWildcardMatch(String sName)
Determines the value the wildcard * declared in the resource name pattern for theResourceMapping
matches. If the pattern does not contain a wildcard * or the resource name does not match the mapping,null
is 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 ofsParamName
associated 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 ofsParamName
associated 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 *,null
will 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.
-
-