/*
* @(#)ScriptEngine.java 1.5 06/06/19 20:53:06
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTAIL. Use is subject to license terms.
*/
package javax.script;
import java.io.Reader;
import java.util.Map;
import java.util.Set;
/**
* <code>ScriptEngine</code> is the fundamental interface whose methods must be
* fully functional in every implementation of this specification.
* <br><br>
* These methods provide basic scripting functionality. Applications written to this
* simple interface are expected to work with minimal modifications in every implementation.
* It includes methods that execute scripts, and ones that set and get values.
* <br><br>
* The values are key/value pairs of two types. The first type of pairs consists of
* those whose keys are reserved and defined in this specification or by individual
* implementations. The values in the pairs with reserved keys have specified meanings.
* <br><br>
* The other type of pairs consists of those that create Java language Bindings, the values are
* usually represented in scripts by the corresponding keys or by decorated forms of them.
*
* @author Mike Grogan
* @version 1.0
* @since 1.6
*/
public interface ScriptEngine {
/**
* Reserved key for a named value that passes
* an array of positional arguments to a script.
*/
public static final String ARGV="javax.script.argv";
/**
* Reserved key for a named value that is
* the name of the file being executed.
*/
public static final String FILENAME = "javax.script.filename";
/**
* Reserved key for a named value that is
* the name of the <code>ScriptEngine</code> implementation.
*/
public static final String ENGINE = "javax.script.engine";
/**
* Reserved key for a named value that identifies
* the version of the <code>ScriptEngine</code> implementation.
*/
public static final String ENGINE_VERSION = "javax.script.engine_version";
/**
* Reserved key for a named value that identifies
* the short name of the scripting language. The name is used by the
* <code>ScriptEngineManager</code> to locate a <code>ScriptEngine</code>
* with a given name in the <code>getEngineByName</code> method.
*/
public static final String NAME = "javax.script.name";
/**
* Reserved key for a named value that is
* the full name of Scripting Language supported by the implementation.
*/
public static final String LANGUAGE = "javax.script.language";
/**
* Reserved key for the named value that identifies
* the version of the scripting language supported by the implementation.
*/
public static final String LANGUAGE_VERSION ="javax.script.language_version";
/**
* Causes the immediate execution of the script whose source is the String
* passed as the first argument. The script may be reparsed or recompiled before
* execution. State left in the engine from previous executions, including
* variable values and compiled procedures may be visible during this execution.
*
* @param script The script to be executed by the script engine.
*
* @param context A <code>ScriptContext</code> exposing sets of attributes in
* different scopes. The meanings of the scopes <code>ScriptContext.GLOBAL_SCOPE</code>,
* and <code>ScriptContext.ENGINE_SCOPE</code> are defined in the specification.
* <br><br>
* The <code>ENGINE_SCOPE</code> <code>Bindings</code> of the <code>ScriptContext</code> contains the
* bindings of scripting variables to application objects to be used during this
* script execution.
*
*
* @return The value returned from the execution of the script.
*
* @throws ScriptException if an error occurrs in script. ScriptEngines should create and throw
=1= |