Interface IResourceStreamLocator

All Known Implementing Classes:
CachingResourceStreamLocator, OsgiResourceStreamLocator, ResourceStreamLocator

public interface IResourceStreamLocator
Interface for code that locates resources, taking into account variations for locale and style.
Author:
Jonathan Locke
  • Method Details

    • locate

      IResourceStream locate(Class<?> clazz, String path)
      Locate a resource, given a path and class. Typically this method is either called by external clients if they are not interested in a lookup that takes the style and locale into account, or it is called by the implementation of locate(Class, String, String, String, java.util.Locale, String, boolean) where the latter just takes care of trying out the different combinations for the provided style and locale and uses this method to actually load the resource stream.
      Parameters:
      clazz - The class loader for delegating the loading of the resource
      path - The path of the resource
      Returns:
      The resource or null
    • locate

      IResourceStream locate(Class<?> clazz, String path, String style, String variation, Locale locale, String extension, boolean strict)
      Locate a resource by combining the given path, style, variation, locale and extension parameters. The exact search order depends on the implementation.
      Parameters:
      clazz - The class loader for delegating the loading of the resource
      path - The path of the resource
      style - Any resource style, such as a skin style (see Session)
      variation - The component's variation (of the style)
      locale - The locale of the resource to load
      extension - A comma separate list of extensions
      strict - whether the specified attributes must match exactly
      Returns:
      The resource or null
    • newResourceNameIterator

      IResourceNameIterator newResourceNameIterator(String path, Locale locale, String style, String variation, String extension, boolean strict)
      Markup resources and Properties files both need to iterate over different combinations of locale, style, etc.. And though no single locate(..) method exists which is used by both, they both use ResourceNameIterators.
      Parameters:
      path - The path of the resource
      style - Any resource style, such as a skin style (see Session)
      variation - The component's variation (of the style)
      locale - The locale of the resource to load
      extension - A comma separate list of extensions
      strict - whether the specified attributes must match exactly
      Returns:
      resource name iterator