001 // Copyright 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.asset; 016 017 import java.util.Locale; 018 019 import org.apache.hivemind.Location; 020 import org.apache.hivemind.Resource; 021 import org.apache.tapestry.IAsset; 022 023 /** 024 * Used to create an {@link org.apache.tapestry.IAsset} instance for a particular asset path. The 025 * path may have a prefix that indicates its type, or it may be relative to some existing resource. 026 * 027 * @author Howard M. Lewis Ship 028 * @since 4.0 029 */ 030 public interface AssetSource 031 { 032 /** 033 * Finds an asset relative to some existing resource (typically, a page, component or library 034 * specification). 035 * 036 * @param base 037 * the base resource used for resolving the asset 038 * @param path 039 * the path relative to the base resource; alternately, the path may include a prefix 040 * that defines a domain (such as "classpath:" or "context:") in which case the base 041 * resource is ignored and the resource resolved within that domain 042 * @param locale 043 * used to find a localized version of the asset, may be null to indicate no 044 * localization 045 * @param location 046 * used to report errors (such as missing resources) 047 * @return the asset, possibly localized 048 * @throws org.apache.hivemind.ApplicationRuntimeException 049 * if the asset does not exist 050 */ 051 public IAsset findAsset(Resource base, String path, Locale locale, Location location); 052 }