|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.scripter.lang.EngineInterpreter
public class EngineInterpreter
An interpreter adapter for BSF engines.
Field Summary |
---|
Fields inherited from interface org.norther.tammi.core.scripter.lang.Interpreter |
---|
JAVA_LANGUAGE |
Constructor Summary | |
---|---|
EngineInterpreter(String lang,
org.apache.bsf.BSFEngine adaptee)
Construcs a new adapter. |
Method Summary | |
---|---|
void |
addClassPath(String path)
Adds a class search path. |
void |
addClassURL(URL url)
Adds a class search URL. |
Object |
apply(String source,
int lineNo,
int columnNo,
Object funcBody,
Vector paramNames,
Vector arguments)
|
Object |
call(Object object,
String name,
Object[] args)
|
void |
compileApply(String source,
int lineNo,
int columnNo,
Object funcBody,
Vector paramNames,
Vector arguments,
org.apache.bsf.util.CodeBuffer cb)
|
void |
compileExpr(String source,
int lineNo,
int columnNo,
Object expr,
org.apache.bsf.util.CodeBuffer cb)
|
void |
compileScript(String source,
int lineNo,
int columnNo,
Object script,
org.apache.bsf.util.CodeBuffer cb)
|
void |
declareBean(org.apache.bsf.BSFDeclaredBean bean)
|
Class<?> |
defineClass(String name,
byte[] code)
Converts an array of bytes into a class. |
void |
defineVariable(String name,
Object value)
Defines a variable in the interpreter environment. |
void |
defineVariable(String name,
Object value,
Class<?> c)
Defines a variable of the specified class. |
Object |
eval(String source,
int lineNo,
int columnNo,
Object expr)
|
void |
exec(String source,
int lineNo,
int columnNo,
Object script)
|
ClassLoader |
getClassLoader()
Gets the class loader. |
Set<String> |
getClassNames()
Gets the defined class names. |
Object |
getVariable(String name)
Gets the value of a variable. |
Class<?> |
getVariableClass(String name)
Gets the class of a variable. |
Set<String> |
getVariableNames()
Gets the defined variable names. |
void |
iexec(String source,
int lineNo,
int columnNo,
Object script)
|
void |
initialize(org.apache.bsf.BSFManager mgr,
String lang,
Vector declaredBeans)
|
Object |
interpret(File file)
Interprets a file. |
Object |
interpret(InputStream in,
String fname)
Interprets an input stream. |
Object |
interpret(Reader r,
String fname)
Interprets a reader. |
Object |
interpret(String s,
String fname)
Interprets a string. |
Object |
interpret(URL url)
Interprets a URL. |
boolean |
isDefined(String name)
Checks whether a variable is defined. |
Class<?> |
loadClass(String name)
Loads an interpreted class. |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
reset()
Resets this interpreter. |
void |
setVariable(String name,
Object value)
Sets the value of a variable. |
void |
terminate()
|
void |
undeclareBean(org.apache.bsf.BSFDeclaredBean bean)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EngineInterpreter(String lang, org.apache.bsf.BSFEngine adaptee)
lang
- the language.adaptee
- the engine adaptee.Method Detail |
---|
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws org.apache.bsf.BSFException
apply
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public Object call(Object object, String name, Object[] args) throws org.apache.bsf.BSFException
call
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void compileApply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, org.apache.bsf.util.CodeBuffer cb) throws org.apache.bsf.BSFException
compileApply
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void compileExpr(String source, int lineNo, int columnNo, Object expr, org.apache.bsf.util.CodeBuffer cb) throws org.apache.bsf.BSFException
compileExpr
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void compileScript(String source, int lineNo, int columnNo, Object script, org.apache.bsf.util.CodeBuffer cb) throws org.apache.bsf.BSFException
compileScript
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void declareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFException
declareBean
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public Object eval(String source, int lineNo, int columnNo, Object expr) throws org.apache.bsf.BSFException
eval
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void exec(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException
exec
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void iexec(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException
iexec
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void initialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans) throws org.apache.bsf.BSFException
initialize
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public void terminate()
terminate
in interface org.apache.bsf.BSFEngine
public void undeclareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFException
undeclareBean
in interface org.apache.bsf.BSFEngine
org.apache.bsf.BSFException
public Object interpret(String s, String fname)
Interpreter
interpret
in interface Interpreter
s
- the string from which the statements are read.fname
- the name of the parsed string.
public Object interpret(InputStream in, String fname)
Interpreter
interpret
in interface Interpreter
in
- the input stream from which the statements are read.fname
- the name of the parsed stream.
public Object interpret(Reader r, String fname)
Interpreter
interpret
in interface Interpreter
r
- the reader.fname
- the name of the parsed stream.
public Object interpret(File file) throws IOException
Interpreter
interpret
in interface Interpreter
file
- the file to interpret.
IOException
- on I/O errors.public Object interpret(URL url) throws IOException
Interpreter
interpret
in interface Interpreter
url
- the url to interpret.
IOException
- on I/O errors.public void defineVariable(String name, Object value)
Interpreter
defineVariable
in interface Interpreter
name
- the variable's name.value
- the initial value of the variable.public void defineVariable(String name, Object value, Class<?> c)
Interpreter
defineVariable
in interface Interpreter
name
- the name.value
- the value.c
- the class.public boolean isDefined(String name)
Interpreter
isDefined
in interface Interpreter
name
- the name.
public Object getVariable(String name)
Interpreter
getVariable
in interface Interpreter
name
- the variable name.
public void setVariable(String name, Object value)
Interpreter
setVariable
in interface Interpreter
name
- the variable name.value
- the value of the variable.public Class<?> getVariableClass(String name)
Interpreter
getVariableClass
in interface Interpreter
name
- the variable name.
public Set<String> getVariableNames()
Interpreter
getVariableNames
in interface Interpreter
public void addClassPath(String path)
Interpreter
addClassPath
in interface Interpreter
path
- the path to add.public void addClassURL(URL url)
Interpreter
addClassURL
in interface Interpreter
url
- the url to add.public Class<?> loadClass(String name) throws ClassNotFoundException
Interpreter
loadClass
in interface Interpreter
name
- the fully qualified name of the class to load.
ClassNotFoundException
- if the class cannot be find.public Class<?> defineClass(String name, byte[] code)
Interpreter
defineClass
in interface Interpreter
name
- the fully qualified name of the class to load.code
- the byte code of the class.
public Set<String> getClassNames()
Interpreter
getClassNames
in interface Interpreter
public ClassLoader getClassLoader()
Interpreter
getClassLoader
in interface Interpreter
public void reset()
Interpreter
reset
in interface Interpreter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |