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 org.apache.hivemind.Location;
018    import org.apache.tapestry.IComponent;
019    import org.apache.tapestry.INamespace;
020    import org.apache.tapestry.IPage;
021    import org.apache.tapestry.IRequestCycle;
022    import org.apache.tapestry.ITemplateComponent;
023    import org.apache.tapestry.spec.IComponentSpecification;
024    
025    /**
026     * Interface exposed to components as they are loaded by the page loader.
027     * 
028     * @see IComponent#finishLoad(IRequestCycle, IPageLoader,
029     *      org.apache.tapestry.spec.IComponentSpecification)
030     * @author Howard Lewis Ship
031     */
032    
033    public interface IPageLoader
034    {
035    
036        /**
037         * Invoked to create an implicit component (one which is defined in the
038         * containing component's template, rather that in the containing
039         * component's specification).
040         * 
041         * @see org.apache.tapestry.services.impl.ComponentTemplateLoaderImpl
042         * @since 3.0
043         */
044    
045        IComponent createImplicitComponent(IRequestCycle cycle,
046                IComponent container, String componentId, String componentType,
047                Location location);
048    
049        /**
050         * Invoked by the {@link IPageSource}to load a specific page. This method
051         * is not reentrant. The page is immediately attached to the
052         * {@link IEngine engine}.
053         * 
054         * @param name
055         *            the simple (unqualified) name of the page to load
056         * @param namespace
057         *            from which the page is to be loaded (used when resolving
058         *            components embedded by the page)
059         * @param cycle
060         *            the request cycle the page is initially loaded for (this is
061         *            used to define the locale of the new page, and provide access
062         *            to the corect specification source, etc.).
063         * @param specification
064         *            the specification for the page
065         */
066    
067        IPage loadPage(String name, INamespace namespace,
068                IRequestCycle cycle, IComponentSpecification specification);
069    
070        /**
071         * Invoked by a component (from within its
072         * {@link IComponent#finishLoad(IRequestCycle, IPageLoader, IComponentSpecification)}method)
073         * to load the template for the component. This will result in new
074         * components being created, and the "outers" of the component being
075         * updated.
076         * 
077         * @see ITemplateComponent
078         * @since 4.0
079         */
080        void loadTemplateForComponent(IRequestCycle cycle,
081                ITemplateComponent component);
082    }