001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.core.util.resource.locator; 018 019import java.util.Locale; 020 021import org.apache.wicket.util.resource.IResourceStream; 022 023 024/** 025 * Interface for code that locates resources, taking into account variations for locale and style. 026 * 027 * @author Jonathan Locke 028 */ 029public interface IResourceStreamLocator 030{ 031 /** 032 * Locate a resource, given a path and class. Typically this method is either called by external 033 * clients if they are not interested in a lookup that takes the style and locale into account, 034 * or it is called by the implementation of 035 * {@link #locate(Class, String, String, String, java.util.Locale, String, boolean)} where the 036 * latter just takes care of trying out the different combinations for the provided style and 037 * locale and uses this method to actually load the resource stream. 038 * 039 * @param clazz 040 * The class loader for delegating the loading of the resource 041 * @param path 042 * The path of the resource 043 * 044 * @return The resource or null 045 */ 046 IResourceStream locate(Class<?> clazz, String path); 047 048 /** 049 * Locate a resource by combining the given path, style, variation, locale and extension 050 * parameters. The exact search order depends on the implementation. 051 * 052 * @param clazz 053 * The class loader for delegating the loading of the resource 054 * @param path 055 * The path of the resource 056 * @param style 057 * Any resource style, such as a skin style (see {@link org.apache.wicket.Session}) 058 * @param variation 059 * The component's variation (of the style) 060 * @param locale 061 * The locale of the resource to load 062 * @param extension 063 * A comma separate list of extensions 064 * @param strict 065 * whether the specified attributes must match exactly 066 * @return The resource or null 067 */ 068 IResourceStream locate(Class<?> clazz, String path, String style, String variation, 069 Locale locale, String extension, boolean strict); 070 071 /** 072 * Markup resources and Properties files both need to iterate over different combinations of 073 * locale, style, etc.. And though no single locate(..) method exists which is used by both, 074 * they both use ResourceNameIterators. 075 * 076 * @param path 077 * The path of the resource 078 * @param style 079 * Any resource style, such as a skin style (see {@link org.apache.wicket.Session}) 080 * @param variation 081 * The component's variation (of the style) 082 * @param locale 083 * The locale of the resource to load 084 * @param extension 085 * A comma separate list of extensions 086 * @param strict 087 * whether the specified attributes must match exactly 088 * @return resource name iterator 089 */ 090 IResourceNameIterator newResourceNameIterator(String path, Locale locale, String style, 091 String variation, String extension, boolean strict); 092}