org.apache.wicket.util.resource.locator
Interface IResourceStreamLocator

All Known Implementing Classes:
CachingResourceStreamLocator, OsgiResourceStreamLocator, ResourceStreamLocator

public interface IResourceStreamLocator

Interface for code that locates resources.

Author:
Jonathan Locke

Method Summary
 IResourceStream locate(java.lang.Class<?> clazz, java.lang.String path)
          Locate a resource, given a path and class.
 IResourceStream locate(java.lang.Class<?> clazz, java.lang.String path, java.lang.String style, java.lang.String variation, java.util.Locale locale, java.lang.String extension, boolean strict)
          Locate a resource by combining the given path, style, variation, locale and extension parameters.
 ResourceNameIterator newResourceNameIterator(java.lang.String path, java.util.Locale locale, java.lang.String style, java.lang.String variation, java.lang.String extension, boolean strict)
          Markup resources and Properties files both need to iterate over different combinations of locale, style, etc..
 

Method Detail

locate

IResourceStream locate(java.lang.Class<?> clazz,
                       java.lang.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, Locale, String) 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(java.lang.Class<?> clazz,
                       java.lang.String path,
                       java.lang.String style,
                       java.lang.String variation,
                       java.util.Locale locale,
                       java.lang.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

ResourceNameIterator newResourceNameIterator(java.lang.String path,
                                             java.util.Locale locale,
                                             java.lang.String style,
                                             java.lang.String variation,
                                             java.lang.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


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.