org.apache.bsf.engines.activescript
Class ActiveScriptEngine
public
class
ActiveScriptEngine
extends BSFEngineImpl
implements JavaBeanAddEventListener
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.
Author: Sanjiva Weerawarana
Method Summary |
void | addEventListener(Object bean, String event, String filter, String script)
add an event listener |
int | bindMember(Object target, String name, short bindType)
Binds a method to an integer so it can be later referenced to invoke the method via callMethod.
|
Object | call(Object object, String method, Object[] args)
Return an object from an extension. |
Object | callMethod(Object bean, int methodID, Object[] args)
Invokes the method assocaited with methodID on the bean with parameters in the array args.
|
Object | createBean(Object[] args)
createBean
|
static Throwable | createBSFException(int reason, String msg, Throwable t) |
void | declareBean(BSFDeclaredBean bean)
Declare a bean after the engine has been started. |
Object | eval(String source, int lineNo, int columnNo, Object oscript)
This is used by an application to evaluate a string containing
some expression. |
void | exec(String source, int lineNo, int columnNo, Object script)
This is used by an application to execute a string containing
a script to execute. |
protected void | finalize() |
void | initialize(BSFManager mgr, String language, Vector declaredBeans) |
protected boolean | isCaseSensitive() |
protected boolean | isJScript() |
protected boolean | isPerlScript() |
protected boolean | isVBScript() |
Object | lookupBean(String name)
lookupBean |
void | setEvalRet(Object ret) |
void | terminate() |
void | undeclareBean(BSFDeclaredBean bean)
Undeclare a previously declared bean.
|
protected String lang
public void addEventListener(Object bean, String event, String filter, String script)
add an event listener
public final int bindMember(Object target, String name, short bindType)
Binds a method to an integer so it can be later referenced to invoke the method via callMethod.
public Object call(Object object, String method, Object[] args)
Return an object from an extension.
Parameters: 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.
public final Object callMethod(Object bean, int methodID, Object[] args)
Invokes the method assocaited with methodID on the bean with parameters in the array args.
public final Object createBean(Object[] args)
createBean
public static final Throwable createBSFException(int reason, String msg, Throwable t)
Declare a bean after the engine has been started. Declared beans
are beans that are named and which the engine must make available
to the scripts it runs in the most first class way possible.
Parameters: bean the bean to declare
Throws: BSFException if the engine cannot do this operation
public Object eval(String source, int lineNo, int columnNo, Object oscript)
This is used by an application to evaluate a string containing
some expression. ActiveScript engines don't return anything .. so
the return value is awlays null.
public void exec(String source, int lineNo, int columnNo, Object script)
This is used by an application to execute a string containing
a script to execute. ActiveScript engines don't return anything .. so
the return value is awlays null.
protected void finalize()
public void initialize(
BSFManager mgr, String language, Vector declaredBeans)
protected final boolean isCaseSensitive()
protected final boolean isJScript()
protected final boolean isPerlScript()
protected final boolean isVBScript()
public final Object lookupBean(String name)
lookupBean
public final void setEvalRet(Object ret)
public void terminate()
Undeclare a previously declared bean.
Parameters: bean the bean to undeclare
Throws: BSFException if the engine cannot do this operation