    001    // Copyright 2006, 2007, 2008, 2009, 2011 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.tapestry5.internal.services;
    016
    017    import org.apache.tapestry5.ComponentResourcesCommon;
    018    import org.apache.tapestry5.internal.structure.Page;
    019    import org.apache.tapestry5.services.pageload.ComponentResourceSelector;
    020
    021    /**
    022     * Instantiates a fully loaded, configured instance of a Tapestry page. This is a recursive process, since part of
    023     * loading a page is to load the page elements for the page, many of which are components. Further, in some cases, the
    024     * full component tree is not identified until after each component's template is loaded. Pages are instantiated once
    025     * for each {@link ComponentResourceSelector} (prior to 5.3, once for each locale; prior to 5.1, for locale and pooled).
    026     *
    027     * @see RequestPageCache
    028     */
    029    public interface PageLoader
    030    {
    031        /**
    032         * Loads the page for the indicated selector.
    033         *
    034         * @param pageName
    035         *            the <em>canonicalized</em> logical name of the page, which will be made available via
    036         *            {@link Page#getName()} and {@link ComponentResourcesCommon#getPageName()} (for any component within
    037         *            the page).
    038         * @param selector
    039         *            Encapsulates the locale and other information used to select the component's
    040         *            template and message catalog resources.
    041         */
    042        Page loadPage(String pageName, ComponentResourceSelector selector);
    043    }