|
TeaEngine 0.7.0 Java Script API | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectjavax.script.AbstractScriptEngine
com.pdmfc.tea.engine.TeaScriptEngine
public class TeaScriptEngine
Most of the functionality is implemented, except for 2 Invocable methods.
| Field Summary | |
|---|---|
protected com.pdmfc.tea.compiler.SCompiler |
_compiler
A single com.pdmfc.tea.compiler.SCompiler is used to compile Tea code into an internal representation com.pdmfc.tea.runtime.SCode. |
protected TeaScriptEngineFactory |
_factory
Reference the factory that instantiated this object. |
| Fields inherited from class javax.script.AbstractScriptEngine |
|---|
context |
| Fields inherited from interface javax.script.ScriptEngine |
|---|
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME |
| Constructor Summary | |
|---|---|
TeaScriptEngine()
Initialize _fatcory to null. |
|
TeaScriptEngine(TeaScriptEngineFactory aFactory)
Initialize _factory and super-class with AbstractScriptEngine(new TeaBindings())
so that the context now has an uninitialized TeaBindings. |
|
| Method Summary | ||
|---|---|---|
javax.script.CompiledScript |
compile(java.io.Reader reader)
|
|
javax.script.CompiledScript |
compile(java.lang.String script)
|
|
javax.script.CompiledScript |
compileBytes(byte[] script)
|
|
javax.script.Bindings |
createBindings()
|
|
void |
end()
com.pdmfc.tea.runtime.STeaRuntime should have the end() method called before unloading, so that any Tea code callbacks may be called to free allocated resources. |
|
java.lang.Object |
eval(java.io.Reader reader,
javax.script.ScriptContext scriptContext)
Reads the file to memory, and converts it to byte[] for evaluation. |
|
java.lang.Object |
eval(java.lang.String script,
javax.script.ScriptContext scriptContext)
Converts the String to byte[] for evaluation. |
|
java.lang.Object |
evalBytes(byte[] script,
javax.script.ScriptContext scriptContext)
Compiles byte[] as a Tea script and executes it. |
|
com.pdmfc.tea.compiler.SCompiler |
getCompiler()
|
|
javax.script.ScriptEngineFactory |
getFactory()
|
|
|
getInterface(java.lang.Class<T> clasz)
Unsupported yet. |
|
|
getInterface(java.lang.Object thisz,
java.lang.Class<T> clasz)
Unsupported yet. |
|
com.pdmfc.tea.runtime.STeaRuntime |
getMyRuntime()
Get (and initialize if necessary) a com.pdmfc.tea.runtime.STeaRuntime from the current engine context. |
|
static com.pdmfc.tea.runtime.STeaRuntime |
getRuntime(javax.script.ScriptContext sc)
Get (and initialize if necessary) a com.pdmfc.tea.runtime.STeaRuntime from the given engine context. |
|
java.lang.Object |
invokeFunction(java.lang.String name,
java.lang.Object... args)
|
|
java.lang.Object |
invokeMethod(java.lang.Object thisz,
java.lang.String name,
java.lang.Object... args)
|
|
| Methods inherited from class javax.script.AbstractScriptEngine |
|---|
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected com.pdmfc.tea.compiler.SCompiler _compiler
protected TeaScriptEngineFactory _factory
| Constructor Detail |
|---|
public TeaScriptEngine()
TeaCompiledScript.eval(ScriptContext scriptContext)public TeaScriptEngine(TeaScriptEngineFactory aFactory)
AbstractScriptEngine(new TeaBindings())
so that the context now has an uninitialized TeaBindings.
As we are not allowed to throw a ScriptException, real
initialization is delayed until you try to evaluate some Tea
code.
TeaCompiledScript.eval(ScriptContext scriptContext)| Method Detail |
|---|
public javax.script.Bindings createBindings()
createBindings in interface javax.script.ScriptEnginepublic com.pdmfc.tea.compiler.SCompiler getCompiler()
public java.lang.Object eval(java.lang.String script,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
byte[] for evaluation.
eval in interface javax.script.ScriptEnginejavax.script.ScriptExceptionevalBytes(byte[] script, ScriptContext scriptContext).
public java.lang.Object eval(java.io.Reader reader,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
byte[] for evaluation.
eval in interface javax.script.ScriptEnginejavax.script.ScriptExceptionevalBytes(byte[] script, ScriptContext scriptContext).
public java.lang.Object evalBytes(byte[] script,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
byte[] as a Tea script and executes it.
javax.script.ScriptExceptionpublic javax.script.ScriptEngineFactory getFactory()
getFactory in interface javax.script.ScriptEngine
public javax.script.CompiledScript compile(java.io.Reader reader)
throws javax.script.ScriptException
compile in interface javax.script.Compilablejavax.script.ScriptException
public javax.script.CompiledScript compile(java.lang.String script)
throws javax.script.ScriptException
compile in interface javax.script.Compilablejavax.script.ScriptException
public javax.script.CompiledScript compileBytes(byte[] script)
throws javax.script.ScriptException
javax.script.ScriptException
public java.lang.Object invokeFunction(java.lang.String name,
java.lang.Object... args)
throws javax.script.ScriptException
invokeFunction in interface javax.script.Invocablejavax.script.ScriptException
public java.lang.Object invokeMethod(java.lang.Object thisz,
java.lang.String name,
java.lang.Object... args)
throws javax.script.ScriptException
invokeMethod in interface javax.script.Invocablejavax.script.ScriptExceptionpublic <T> T getInterface(java.lang.Class<T> clasz)
getInterface in interface javax.script.Invocablejava.lang.UnsupportedOperationException
public <T> T getInterface(java.lang.Object thisz,
java.lang.Class<T> clasz)
getInterface in interface javax.script.Invocablejava.lang.UnsupportedOperationException
public void end()
throws javax.script.ScriptException
javax.script.ScriptException
public com.pdmfc.tea.runtime.STeaRuntime getMyRuntime()
throws javax.script.ScriptException
javax.script.ScriptExceptiongetRuntime(ScriptContext sc)
public static com.pdmfc.tea.runtime.STeaRuntime getRuntime(javax.script.ScriptContext sc)
throws javax.script.ScriptException
javax.script.ScriptException - as Tea initialization code might be
called to initialize the runtime.TeaBindings.getMyRuntime()
|
TeaEngine 0.7.0 Java Script API | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||