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
015package org.apache.tapestry;
016
017import java.util.Map;
018
019import org.apache.hivemind.Resource;
020
021/**
022 *  An object that can convert a set of symbols into a collection of JavaScript statements.
023 *
024 *  <p>IScript implementation must be threadsafe.
025 *
026 *  @author Howard Lewis Ship
027 *  @since 1.0.2
028 * 
029 **/
030
031public interface IScript
032{
033    /**
034     *  Returns the location from which the script was loaded.
035     *
036     **/
037
038    public Resource getScriptResource();
039
040    /**
041     * Executes the script, which will read and modify the symbols {@link Map}.  The
042     * script works with the {@link IScriptProcessor} to get the generated JavaScript
043     * included on the page.
044     * 
045     * @param cycle the current request cycle
046     * @param processor an object that processes the results of the script, typically
047     * an instance of {@link org.apache.tapestry.html.Body}
048     * @param symbols Map of input symbols; execution of the script may modify the map,
049     * creating new output symbols
050     * 
051     * @see TapestryUtils#getPageRenderSupport(IRequestCycle, Object)
052     *
053     */
054
055    public void execute(IRequestCycle cycle, IScriptProcessor processor, Map symbols);
056}