Interface ScopeResolver


  • public interface ScopeResolver
    This interface is used to derive a scope name used to create an instance of ConfigurableCacheFactory. This scope name is used as a prefix to service names created by the ConfigurableCacheFactory which enables consumers of the factory to isolate their services and caches from other applications running in the same cluster.
    Since:
    Coherence 3.7
    Author:
    pp 2010.01.20
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ScopeResolver INSTANCE
      A default implementation of a ScopeResolver that always returns passed in scope name.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      String resolveScopeName​(String sConfigURI, ClassLoader loader, String sScopeName)
      Implementations of this method must decide whether to return the scope name provided by the cache configuration return a modified scope name or return a different scope name based on external configuration throw an exception indicating rejection of the requested scope
      default String resolveURI​(String sConfigURI)
      Resolve the URI that identifies the cache configuration.
      default boolean useScopeInConfig()
      Returns true if any scope set in the defaults section of the XML configuration file should take precedence over any scope decoded from the URI.
    • Field Detail

      • INSTANCE

        static final ScopeResolver INSTANCE
        A default implementation of a ScopeResolver that always returns passed in scope name.
    • Method Detail

      • resolveScopeName

        String resolveScopeName​(String sConfigURI,
                                ClassLoader loader,
                                String sScopeName)
        Implementations of this method must decide whether to
        • return the scope name provided by the cache configuration
        • return a modified scope name or return a different scope name based on external configuration
        • throw an exception indicating rejection of the requested scope
        Parameters:
        sConfigURI - the configuration URI
        loader - class loader for which the configuration should be used
        sScopeName - the scope name provided in the cache configuration; may be null
        Returns:
        scope name for the ConfigurableCacheFactory instance that will be created with the configuration specified by sConfigURI
        Throws:
        IllegalArgumentException - if the requested scope name is rejected (for example if a duplicate scope name is detected)
      • resolveURI

        default String resolveURI​(String sConfigURI)
        Resolve the URI that identifies the cache configuration. The URI provided may be a normal URL or Resource, or it may be a "special" default URI that is used when a specific cache configuration file is not indicated (for example, if the user requests a factory via CacheFactory.getConfigurableCacheFactory(). If the "default" URI is requested, the URI is resolved to the default cache configuration name indicated in the operational configuration file; otherwise the provided URI is returned.
        Parameters:
        sConfigURI - the passed in URI
        Returns:
        the resolved URI
        See Also:
        CacheFactoryBuilder.URI_DEFAULT
      • useScopeInConfig

        default boolean useScopeInConfig()
        Returns true if any scope set in the defaults section of the XML configuration file should take precedence over any scope decoded from the URI.
        Returns:
        true to use any scope defined in the XML configuration file