|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.scripting.UnifiedScriptEngine
public abstract class UnifiedScriptEngine
A script engine interface that provides a common set of methods that can map both the Apache Jakarta Bean Scripting Framework (BSF) and the Java 6 JSR 223 (javax.script) framework, allowing callers to use either underlying framework without changing code. This class is modeled on the JSR 223 interface, though it is much simpler.
| Constructor Summary | |
|---|---|
UnifiedScriptEngine()
|
|
| Method Summary | |
|---|---|
UnifiedCompiledScript |
compile(java.io.File scriptFile)
Compile a script, if possible, returning an object that implements the UnifiedCompiledScript interface. |
abstract UnifiedCompiledScript |
compile(java.io.Reader scriptReader)
Compile a script, if possible, returning an object that implements the UnifiedCompiledScript interface. |
UnifiedCompiledScript |
compile(java.lang.String scriptString)
Compile a script, if possible, returning an object that implements the UnifiedCompiledScript interface. |
abstract java.lang.Object |
eval(java.lang.String scriptString)
Evaluate a script or a script snippet and return the value of the evaluation. |
void |
exec(java.io.File scriptFile)
Execute a script. |
abstract void |
exec(java.io.Reader scriptReader)
Execute a script. |
void |
exec(java.lang.String scriptString)
Execute a script. |
abstract void |
exec(UnifiedCompiledScript compiledScript)
Execute a previously compiled script. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UnifiedScriptEngine()
| Method Detail |
|---|
public abstract UnifiedCompiledScript compile(java.io.Reader scriptReader)
throws UnifiedScriptException
UnifiedCompiledScript interface. (The interface's
name was deliberately chosen to avoid conflicts with the JSR 223
CompiledScript interface. If the underlying script engine
does not support compilation, then this routine simply returns null
(rather than throwing an exception).
scriptReader - a Reader that will produce the script
UnifiedScriptException - compilation errorcompile(String),
compile(File)
public final UnifiedCompiledScript compile(java.lang.String scriptString)
throws UnifiedScriptException
UnifiedCompiledScript interface. (The interface's
name was deliberately chosen to avoid conflicts with the JSR 223
CompiledScript interface. If the underlying script engine
does not support compilation, then this routine simply returns null
(rather than throwing an exception).
scriptString - a String containing the script
UnifiedScriptException - compilation errorcompile(File),
compile(Reader)
public final UnifiedCompiledScript compile(java.io.File scriptFile)
throws UnifiedScriptException
UnifiedCompiledScript interface. (The interface's
name was deliberately chosen to avoid conflicts with the JSR 223
CompiledScript interface. If the underlying script engine
does not support compilation, then this routine simply returns null
(rather than throwing an exception).
scriptFile - file containing the script; the file's extension
is used to determine the language
java.io.IOException - error reading script
UnifiedScriptException - compilation errorcompile(String),
compile(Reader)
public abstract void exec(java.io.Reader scriptReader)
throws UnifiedScriptException
scriptReader - a Reader that will produce the script
UnifiedScriptException - compilation errorexec(String),
exec(File)
public final void exec(java.io.File scriptFile)
throws UnifiedScriptException
scriptFile - file containing the script; the file's extension
is used to determine the language
UnifiedScriptException - compilation errorexec(String),
exec(Reader)
public final void exec(java.lang.String scriptString)
throws UnifiedScriptException
scriptString - string containing the script
UnifiedScriptException - compilation errorexec(File),
exec(Reader)
public abstract void exec(UnifiedCompiledScript compiledScript)
throws UnifiedScriptException
compiledScript - the compiled script
UnifiedScriptException - compilation errorexec(File),
exec(Reader)
public abstract java.lang.Object eval(java.lang.String scriptString)
throws UnifiedScriptException
scriptString - the script string
UnifiedScriptException - on error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||