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.script; 016 017 import java.util.Map; 018 019 import org.apache.hivemind.Resource; 020 import org.apache.tapestry.IRequestCycle; 021 import org.apache.tapestry.IScriptProcessor; 022 023 /** 024 * Process object used when executing a 025 * {@link org.apache.tapestry.IScript script template}. This ScriptSession 026 * provides support 027 * 028 * @author Howard M. Lewis Ship 029 * @since 4.0 030 */ 031 public interface ScriptSession extends IScriptProcessor 032 { 033 034 /** 035 * Evaluates an OGNL expression, where the root object for the expression is 036 * the {@link #getSymbols() symbols map}. 037 */ 038 Object evaluate(String expression); 039 040 /** 041 * Returns the resource for the script template. 042 */ 043 044 Resource getScriptTemplateResource(); 045 046 /** 047 * Returns the symbols (which may be created or updated during the execution 048 * of the script template). 049 */ 050 051 Map getSymbols(); 052 053 /** 054 * Returns the current request cycle. 055 */ 056 IRequestCycle getRequestCycle(); 057 058 /** 059 * Evaluates an expression and coerces the result to a particlar type. 060 * 061 * @since 4.0 062 * @see org.apache.tapestry.coerce.ValueConverter 063 */ 064 065 Object evaluate(String expression, Class desiredType); 066 }