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