|
20080913, rgf | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bsf.util.BSFEngineImpl
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.
Field Summary | |
protected java.lang.ClassLoader |
classLoader
|
protected java.lang.String |
classPath
|
protected java.util.Vector |
declaredBeans
|
protected java.lang.String |
lang
|
protected BSFManager |
mgr
|
protected java.lang.String |
tempDir
|
Constructor Summary | |
BSFEngineImpl()
|
Method Summary | |
java.lang.Object |
apply(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object funcBody,
java.util.Vector paramNames,
java.util.Vector arguments)
Default impl of apply - calls eval ignoring parameters and returns the result. |
void |
compileApply(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object funcBody,
java.util.Vector paramNames,
java.util.Vector arguments,
CodeBuffer cb)
Default impl of compileApply - calls compileExpr ignoring parameters. |
void |
compileExpr(java.lang.String source,
int lineNo,
int columnNo,
java.lang.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(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script,
CodeBuffer cb)
Default impl of compileScript - generates code that'll create a new manager, and execute the script. |
void |
declareBean(BSFDeclaredBean bean)
Declare a bean after the engine has been started. |
void |
exec(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script)
Default impl of execute - calls eval and ignores the result. |
void |
iexec(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script)
Default impl of interactive execution - calls eval and ignores the result. |
void |
initialize(BSFManager mgr,
java.lang.String lang,
java.util.Vector declaredBeans)
initialize the engine; called right after construction by the manager. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Receive property change events from the manager and update my fields as needed. |
void |
terminate()
Graceful termination |
void |
undeclareBean(BSFDeclaredBean bean)
Undeclare a previously declared bean. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.bsf.BSFEngine |
call, eval |
Field Detail |
protected BSFManager mgr
protected java.lang.String lang
protected java.util.Vector declaredBeans
protected java.lang.String classPath
protected java.lang.String tempDir
protected java.lang.ClassLoader classLoader
Constructor Detail |
public BSFEngineImpl()
Method Detail |
public java.lang.Object apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments) throws BSFException
apply
in interface BSFEngine
source
- (context info) the source of this expression
(e.g., filename)lineNo
- (context info) the line number in source for exprcolumnNo
- (context info) the column number in source for exprfuncBody
- the multi-line, value returning script to evaluateparamNames
- the names of the parameters above assumesarguments
- values of the above parameters
BSFException
- if anything goes wrong while doin' it.public void compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb) throws BSFException
compileApply
in interface BSFEngine
source
- (context info) the source of this expression
(e.g., filename)lineNo
- (context info) the line number in source for exprcolumnNo
- (context info) the column number in source for exprfuncBody
- the multi-line, value returning script to evaluateparamNames
- the names of the parameters above assumesarguments
- values of the above parameterscb
- the CodeBuffer to compile into
BSFException
- if anything goes wrong while doin' it.public void compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb) throws BSFException
compileExpr
in interface BSFEngine
source
- (context info) the source of this expression
(e.g., filename)lineNo
- (context info) the line number in source for exprcolumnNo
- (context info) the column number in source for exprexpr
- the expression to compilecb
- the CodeBuffer to compile into
BSFException
- if anything goes wrong while compiling a
BSFException is thrown. The reason indicates the problem.public void compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb) throws BSFException
compileScript
in interface BSFEngine
source
- (context info) the source of this script
(e.g., filename)lineNo
- (context info) the line number in source for scriptcolumnNo
- (context info) the column number in source for scriptscript
- the script to compilecb
- the CodeBuffer to compile into
BSFException
- if anything goes wrong while compiling a
BSFException is thrown. The reason indicates the problem.public void declareBean(BSFDeclaredBean bean) throws BSFException
BSFEngine
declareBean
in interface BSFEngine
bean
- the bean to declare
BSFException
- if the engine cannot do this operationpublic void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script) throws BSFException
exec
in interface BSFEngine
source
- (context info) the source of this expression
(e.g., filename)lineNo
- (context info) the line number in source for exprcolumnNo
- (context info) the column number in source for exprscript
- the script to execute
BSFException
- if anything goes wrong while exec'ing a
BSFException is thrown. The reason indicates the problem.public void iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script) throws BSFException
iexec
in interface BSFEngine
source
- (context info) the source of this expression
(e.g., filename)lineNo
- (context info) the line number in source for exprcolumnNo
- (context info) the column number in source for exprscript
- the script to execute
BSFException
- if anything goes wrong while exec'ing a
BSFException is thrown. The reason indicates the problem.public void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans) throws BSFException
initialize
in interface BSFEngine
mgr
- The BSFManager that's hosting this engine.lang
- Language string which this engine is handling.declaredBeans
- Vector of BSFDeclaredObject containing beans
that should be declared into the language runtime at init
time as best as possible.
BSFException
- if anything goes wrong while init'ing a
BSFException is thrown. The reason indicates the problem.public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- PropertyChange event with the change datapublic void terminate()
BSFEngine
terminate
in interface BSFEngine
public void undeclareBean(BSFDeclaredBean bean) throws BSFException
BSFEngine
undeclareBean
in interface BSFEngine
bean
- the bean to undeclare
BSFException
- if the engine cannot do this operation
|
20080913, rgf | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |