org.apache.bsf.util
Class BSFEngineImpl
public abstract
class
BSFEngineImpl
extends Object
implements BSFEngine
This is a base implementation of the BSFEngine interface which
engine implementations may choose to extend to get the basic
methods of the interface implemented.
Author: Sanjiva Weerawarana Olivier Gruber (adding debugging support)
Method Summary |
Object | apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)
Default impl of apply - calls eval ignorning parameters and returns
the result. |
void | compileApply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb)
Default impl of compileApply - calls compileExpr ignorning parameters. |
void | compileExpr(String source, int lineNo, int columnNo, Object expr, CodeBuffer cb)
Default impl of compileExpr - generates code that'll create a new
manager, evaluate the expression, and return the value. |
void | compileScript(String source, int lineNo, int columnNo, Object script, CodeBuffer cb)
Default impl of compileScript - generates code that'll create a new
manager, and execute the script. |
void | declareBean(BSFDeclaredBean bean) |
void | disconnectedDebuggerNotify()
Basic engines are not supporting breakpoints for the meaning
and support is something that is language-specific. |
void | exec(String source, int lineNo, int columnNo, Object script)
Default impl of execute - calls eval and ignores the result. |
Object | getSpecificDebuggingInterface()
By default, an engine does not support debugging.
|
void | initialize(BSFManager mgr, String lang, Vector declaredBeans)
initialize the engine; called right after construction by
the manager. |
void | placeBreakpointAtLine(int brkptid, String docname, int lineno) |
void | placeBreakpointAtOffset(int brkptid, String docname, int offset) |
void | propertyChange(PropertyChangeEvent e)
Receive property change events from the manager and update my fields
as needed.
|
void | removeBreakpoint(String docname, int brkptid) |
void | setEntryExit(String docname, boolean on) |
void | terminate() |
void | undeclareBean(BSFDeclaredBean bean) |
protected ClassLoader classLoader
protected String classPath
protected Vector declaredBeans
protected String lang
protected String tempDir
public BSFEngineImpl()
Get the debug manager in the constructor, not in initialize.
First, this is ok since the debug manager is not BSFManager
dependent. Second, the debug manager needs to be known
sooner than "initialize" for the JavaScript engine.
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)
Default impl of apply - calls eval ignorning parameters and returns
the result.
public void compileApply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments,
CodeBuffer cb)
Default impl of compileApply - calls compileExpr ignorning parameters.
public void compileExpr(String source, int lineNo, int columnNo, Object expr,
CodeBuffer cb)
Default impl of compileExpr - generates code that'll create a new
manager, evaluate the expression, and return the value.
public void compileScript(String source, int lineNo, int columnNo, Object script,
CodeBuffer cb)
Default impl of compileScript - generates code that'll create a new
manager, and execute the script.
public void disconnectedDebuggerNotify()
Basic engines are not supporting breakpoints for the meaning
and support is something that is language-specific.
public void exec(String source, int lineNo, int columnNo, Object script)
Default impl of execute - calls eval and ignores the result.
public Object getSpecificDebuggingInterface()
By default, an engine does not support debugging.
Subclasses will need to redefine this method in order
to provide debuggers with their language-specific
interface for debugging.
public void initialize(
BSFManager mgr, String lang, Vector declaredBeans)
initialize the engine; called right after construction by
the manager. Declared beans are simply kept in a vector and
that's it. Subclasses must do whatever they want with it.
public void placeBreakpointAtLine(int brkptid, String docname, int lineno)
public void placeBreakpointAtOffset(int brkptid, String docname, int offset)
public void propertyChange(PropertyChangeEvent e)
Receive property change events from the manager and update my fields
as needed.
Parameters: e PropertyChange event with the change data
public void removeBreakpoint(String docname, int brkptid)
public void setEntryExit(String docname, boolean on)
public void terminate()