VnanoScriptEngine Class Specification
(org.vcssl.nano.VnanoScriptEngine)


Abstract

The wrapper class for using VnanoEngine class through javax.script.ScriptEngine interface.

If the Scripting API (javax.script package) is available on your environment, you can get an instance of this class as follows:

import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
...
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine vnanoScriptEngine = scriptEngineManager.getEngineByName("vnano");

Note that, the above code can be compiled without "Vnano.jar", but it requires to specify the path of "Vnano.jar" for running.

In the point of view of "loose coupling" between the scripting engine and apps, the above may (using this class) have has some advantage.

On the other hand, if your apps requires to control the scripting engine detailedly, we recommend to use VnanoEngine directly, instead.

List of Public Constructors/Fields/Methods

Object eval(String scriptCode)
Executes an expression or a script code passed as an argument.
Object eval(Reader reader)
Executes an expression or a script code read from Reader (for example: FileReader).
void put(String name, Object value)
Connects an external function/variable, or sets options/permission, or takes some special operations, and so on.
Object get(String name)
Gets information values of the engine/language (e.g.: version), performance monitoring values, or the value which is put by put(String, Object) method.

Public Constructors

- None -
(You can get an instance through ScriptEngineManager. See the description of this class.)

Public Fields

- None -

Public Methods (Excluding Unsupported Methods defined in ScriptEngine)

Name eval
Signature Object eval(String scriptCode) throws ScriptException
Description Executes an expression or a script code passed as an argument.
Parameters scriptCode: The expression or the script code to execute.
Return The evaluated value of the expression, or last expression statement in the script code.
Exception ScriptException: Thrown when an error will be detected for the content or the processing of the script.
Name eval
Signature Object eval(Reader reader) throws ScriptException
Description Executes an expression or a script code read from Reader (for example: FileReader).
Parameters reader: The Reader instance to read script code.
Return The evaluated value of the expression, or last expression statement in the script code (or, null if it does not exist).
Exception ScriptException: Thrown when an error will be detected for the content or the processing of the script.
Name put
Signature void put(String name, Object value)
Description

Connects an external function/variable, or sets options/permission, or takes some special operations, and so on.

If the value of the argument "name" is "___VNANO_OPTION_MAP", this method behaves as a wrapper of VnanoEngine.setOptionMap(Map) method, which is to set options.

If the value of the argument "name" is "___VNANO_PERMISSION_MAP", this method behaves as a wrapper of VnanoEngine.setPermissionMap(Map) method, which is to set permissions.

If the value of the argument "name" is "___VNANO_LIBRARY_LIST_FILE", this method loads library scripts of which paths are described in the specified list file, and register them to be "include"-ed in the execution script by the engine.

If the value of the argument "name" is "___VNANO_PLUGIN_LIST_FILE", this method loads plug-ins of which paths are described in the specified list file, and connect them to the engine.

If the value of the argument "name" is "___VNANO_COMMAND", this method invokes special commands of the engine. Available commands are defined in org.vcssl.nano.spec.SpecialBindingValue class.

Other than the above, this method behaves as a wrapper of VnanoEngine.connectPlugin(String, Object) method, which is to connect instances of plug-ins.

Parameters name: See the above description. value: See the above description.
Return None
Exception None
Name get
Signature Object get(String name)
Description Gets information values of the engine/language (e.g.: version), performance monitoring values, or the value which is put by put(String, Object) method.
Parameters name: The name/key of the value to be gotten.
Return The gotten value.
Exception None