Class ResourceMapping
- Direct Known Subclasses:
CacheMapping,TopicMapping
- Since:
- Coherence 14.1.1
- Author:
- jk 2015.05.21
-
Constructor Summary
ConstructorsConstructorDescriptionResourceMapping(String sNamePattern, String sSchemeName) Construct aResourceMappingfor resources that will use raw types by default. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringObtain the xml element name of this mapping.Obtains the pattern used to match resource names to thisResourceMapping.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).Obtains theParameterResolverthat is to be used to resolveParameters associated with thisResourceMapping.Obtains theResourceRegistrythat holds resources associated with theResourceMapping.Obtains the name of the caching scheme to be used that match thisResourceMapping.Obtain the list of sub-mappings that this mapping containsGet value ofsParamNameassociated with thisCacheMapping<T> TGet value ofsParamNameassociated with thisCacheMappinggetWildcardMatch(String sName) Determines the value the wildcard * declared in the resource name pattern for theResourceMappingmatches.booleanDetermines if theResourceMappingis for (matches) the specified resource name.booleanCheck if this ResourceMapping is for internal resources.voidsetEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders) setInternal(boolean fInternal) Set the flag to indicate if this mapping is for internal resources used by the service.voidsetParameterResolver(ParameterResolver resolver) booleanDetermines if theResourceMappingpattern contains a * wildcard.abstract voidvalidateScheme(Scheme scheme) Determine whether the specified schem is valid for this mapping type.
-
Constructor Details
-
ResourceMapping
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 Details
-
getConfigElementName
Obtain the xml element name of this mapping.- Returns:
- the xml element name of this mapping
-
validateScheme
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
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
Obtains the pattern used to match resource names to thisResourceMapping.- Returns:
- the pattern
-
getSchemeName
Obtains the name of the caching scheme to be used that match thisResourceMapping.- Returns:
- the name of the associated caching scheme
-
getResourceRegistry
Obtains theResourceRegistrythat holds resources associated with theResourceMapping.- Returns:
- the
ResourceRegistry
-
getParameterResolver
Obtains theParameterResolverthat is to be used to resolveParameters associated with thisResourceMapping.- Returns:
- the
ParameterResolver
-
setParameterResolver
- Parameters:
resolver- theParameterResolver
-
getEventInterceptorBuilders
- Returns:
- an
ListoverNamedEventInterceptorBuilders ornullif none are defined
-
setEventInterceptorBuilders
@Injectable("interceptors") public void setEventInterceptorBuilders(List<NamedEventInterceptorBuilder> listBuilders) - Parameters:
listBuilders- theListofNamedEventInterceptorBuilders
-
isForName
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
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
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
Get value ofsParamNameassociated with thisCacheMapping- Parameters:
sParamName- parameter name to look up- Returns:
- parameter value or null if parameter is not found
-
getNameUsing
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
Obtain the list of sub-mappings that this mapping contains- Returns:
- the list of sub-mappings that this mapping contains.
-