001    // Copyright 2004, 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.engine;
016    
017    import java.util.Locale;
018    
019    import org.apache.tapestry.IComponent;
020    import org.apache.tapestry.IRequestCycle;
021    import org.apache.tapestry.parse.ComponentTemplate;
022    
023    /**
024     *  Acts as a delegate to the {@link org.apache.tapestry.services.TemplateSource}, 
025     *  providing access to page and component templates after the normal search mechanisms have failed.
026     * 
027     *  <p>
028     *  The delegate must be threadsafe.
029     *
030     *  @author Howard Lewis Ship
031     *  @since 3.0
032     *  @see org.apache.tapestry.services.impl.TemplateSourceImpl
033     * 
034     **/
035    
036    public interface ITemplateSourceDelegate
037    {
038        /**
039         *  Invoked by the {@link ITemplateSourceDelegate} when a template can't be found
040         *  by normal means (i.e., in the normal locations).  This method
041         *  should find the template.  The result may be null.  The delegate
042         *  is responsible for caching the result.
043         * 
044         *  @param cycle for access to Tapestry and Servlet API objects
045         *  @param component component (or page) for which a template is needed
046         *  @param locale the desired locale for the template
047         * 
048         **/
049    
050        ComponentTemplate findTemplate(IRequestCycle cycle, IComponent component, Locale locale);
051    }