Class CacheMapping

  • Direct Known Subclasses:
    RegExCacheMapping

    public class CacheMapping
    extends ResourceMapping
    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
    • Field Detail

      • m_fFederated

        public boolean m_fFederated
        The flag to indicate if this CacheMapping is federated.
    • Constructor Detail

      • CacheMapping

        public CacheMapping​(String sCacheNamePattern,
                            String sCachingSchemeName)
        Construct a CacheMapping for caches that will use rawtypes by default.
        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

      • 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 class ResourceMapping
        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 class ResourceMapping
        Parameters:
        fIsInternal - true if this is for internal resource
        Returns:
        this ResourceMapping object
      • getKeyClassName

        public String getKeyClassName()
        Obtains the name of the key class for NamedCaches using this CacheMapping.
        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 for NamedCaches using this CacheMapping.
        Returns:
        the name of the value class or null if rawtypes are being used
      • usesRawTypes

        public boolean usesRawTypes()
        Determines if the CacheMapping 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 for NamedCaches using this CacheMapping.
        Parameters:
        sKeyClassName - the name of the key class or null if rawtypes are being used
      • setValueClassName

        @Injectable("value-type")
        public void setValueClassName​(String sValueClassName)
        Sets the name of the value class for NamedCaches using this CacheMapping.
        Parameters:
        sValueClassName - the name of the value class or null if rawtypes are being used