|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bsf.util.BSFEngineImpl
org.apache.bsf.engines.activescript.ActiveScriptEngine
public class ActiveScriptEngine
This is the interface to active scripting engines from the Bean Scripting Framework. This code uses John Ponzo's IBM Active Scripting Toolkit to tie in active scripting engines to BSF. This class implements Runnable to create a thread. This thread is to exclusively access the scripting engine. All methods from this class to the engines is proxied over to the engine thread for execution. Why? Because, MS engines are implemented to only be accessed from ONE thread.
Field Summary | |
---|---|
protected java.lang.String |
lang
|
Fields inherited from class org.apache.bsf.util.BSFEngineImpl |
---|
classLoader, classPath, dbgmgr, declaredBeans, mgr, tempDir |
Constructor Summary | |
---|---|
ActiveScriptEngine()
|
Method Summary | |
---|---|
void |
addEventListener(java.lang.Object bean,
java.lang.String event,
java.lang.String filter,
java.lang.String script)
add an event listener |
int |
bindMember(java.lang.Object target,
java.lang.String name,
short bindType)
Binds a method to an integer so it can be later referenced to invoke the method via callMethod. |
java.lang.Object |
call(java.lang.Object object,
java.lang.String method,
java.lang.Object[] args)
Return an object from an extension. |
java.lang.Object |
callMethod(java.lang.Object bean,
int methodID,
java.lang.Object[] args)
Invokes the method assocaited with methodID on the bean with parameters in the array args. |
java.lang.Object |
createBean(java.lang.Object[] args)
createBean |
static java.lang.Throwable |
createBSFException(int reason,
java.lang.String msg,
java.lang.Throwable t)
|
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 oscript)
This is used by an application to evaluate a string containing some expression. |
void |
exec(java.lang.String source,
int lineNo,
int columnNo,
java.lang.Object script)
This is used by an application to execute a string containing a script to execute. |
protected void |
finalize()
|
void |
initialize(BSFManager mgr,
java.lang.String language,
java.util.Vector declaredBeans)
initialize the engine; called right after construction by the manager. |
protected boolean |
isCaseSensitive()
|
protected boolean |
isJScript()
|
protected boolean |
isPerlScript()
|
protected boolean |
isVBScript()
|
java.lang.Object |
lookupBean(java.lang.String name)
lookupBean |
void |
setEvalRet(java.lang.Object ret)
|
void |
terminate()
Graceful termination |
void |
undeclareBean(BSFDeclaredBean bean)
Undeclare a previously declared bean. |
Methods inherited from class org.apache.bsf.util.BSFEngineImpl |
---|
apply, compileApply, compileExpr, compileScript, disconnectedDebuggerNotify, getSpecificDebuggingInterface, placeBreakpointAtLine, placeBreakpointAtOffset, propertyChange, removeBreakpoint, setEntryExit |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String lang
Constructor Detail |
---|
public ActiveScriptEngine()
Method Detail |
---|
public void addEventListener(java.lang.Object bean, java.lang.String event, java.lang.String filter, java.lang.String script) throws BSFException
addEventListener
in interface JavaBeanAddEventListener
BSFException
public final int bindMember(java.lang.Object target, java.lang.String name, short bindType) throws java.lang.Exception
java.lang.Exception
public java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args) throws BSFException
call
in interface BSFEngine
method
- The name of the method to call.args
- an array of arguments to be
passed to the extension, which may be either
Vectors of Nodes, or Strings.object
- object on which to make the call
BSFException
- if anything goes wrong while eval'ing a
BSFException is thrown. The reason indicates the problem.public final java.lang.Object callMethod(java.lang.Object bean, int methodID, java.lang.Object[] args) throws java.lang.Exception
java.lang.Exception
public final java.lang.Object createBean(java.lang.Object[] args) throws BSFException
BSFException
public static final java.lang.Throwable createBSFException(int reason, java.lang.String msg, java.lang.Throwable t)
public final void declareBean(BSFDeclaredBean bean) throws BSFException
declareBean
in interface BSFEngine
declareBean
in class BSFEngineImpl
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 oscript) throws BSFException
eval
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 exproscript
- 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
exec
in interface BSFEngine
exec
in class BSFEngineImpl
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.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void initialize(BSFManager mgr, java.lang.String language, java.util.Vector declaredBeans) throws BSFException
BSFEngineImpl
initialize
in interface BSFEngine
initialize
in class BSFEngineImpl
mgr
- The BSFManager that's hosting this engine.language
- 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.protected final boolean isCaseSensitive()
protected final boolean isJScript()
protected final boolean isPerlScript()
protected final boolean isVBScript()
public final java.lang.Object lookupBean(java.lang.String name)
public final void setEvalRet(java.lang.Object ret)
public void terminate()
BSFEngine
terminate
in interface BSFEngine
terminate
in class BSFEngineImpl
public void undeclareBean(BSFDeclaredBean bean) throws BSFException
undeclareBean
in interface BSFEngine
undeclareBean
in class BSFEngineImpl
bean
- the bean to undeclare
BSFException
- if the engine cannot do this operation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |