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