|
20080913, rgf | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the view of a scripting engine assumed by the Bean Scripting Framework. This interface is used when an application decides to run some script under application control. (This is the reverse of the more common situation, which is that of the scripting language calling into the application.)
When a scripting engine is first fired up, the initialize() method is called right after construction.
A scripting engine must provide two access points for applications to call into them: via function calls and via expression evaluation. It must also support loading scripts.
A scripting engine is a property change listener and will be notified when any of the relevant properties of the manager change. (See BSFManager to see which of its properties are bound.)
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)
This is used by an application to invoke an anonymous function. |
java.lang.Object |
call(java.lang.Object object,
java.lang.String name,
java.lang.Object[] args)
This is used by an application to call into the scripting engine to make a function/method call. |
void |
compileApply(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object funcBody,
java.util.Vector paramNames,
java.util.Vector arguments,
CodeBuffer cb)
This is used by an application to compile an anonymous function. |
void |
compileExpr(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object expr,
CodeBuffer cb)
This is used by an application to compile a value-returning expression. |
void |
compileScript(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script,
CodeBuffer cb)
This is used by an application to compile some script. |
void |
declareBean(BSFDeclaredBean bean)
Declare a bean after the engine has been started. |
java.lang.Object |
eval(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object expr)
This is used by an application to evaluate an expression. |
void |
exec(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script)
This is used by an application to execute some script. |
void |
iexec(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script)
This is used by an application to execute some script, as though one were interacting with the language in an interactive session. |
void |
initialize(BSFManager mgr,
java.lang.String lang,
java.util.Vector declaredBeans)
This method is used to initialize the engine right after construction. |
void |
terminate()
Graceful termination |
void |
undeclareBean(BSFDeclaredBean bean)
Undeclare a previously declared bean. |
Methods inherited from interface java.beans.PropertyChangeListener |
propertyChange |
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
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 java.lang.Object call(java.lang.Object object, java.lang.String name, java.lang.Object[] args) throws BSFException
object
- object on which to make the callname
- name of the method / procedure to callargs
- the arguments to be given to the procedure
BSFException
- if anything goes wrong while eval'ing a
BSFException is thrown. The reason indicates the problem.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
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
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
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
bean
- the bean to declare
BSFException
- if the engine cannot do this operationpublic java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr) throws BSFException
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 evaluate
BSFException
- if anything goes wrong while eval'ing a
BSFException is thrown. The reason indicates the problem.public void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script) throws BSFException
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
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
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 terminate()
public void undeclareBean(BSFDeclaredBean bean) throws BSFException
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 |