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.
bindMember
public final int bindMember(Object target,
String name,
short bindType)
throws Exception
Binds a method to an integer so it can be later referenced to invoke the method via callMethod.
call
public Object call(Object object,
String method,
Object[] args)
throws BSFException
Return an object from an extension.
- 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.
callMethod
public final Object callMethod(Object bean,
int methodID,
Object[] args)
throws Exception
Invokes the method assocaited with methodID on the bean with parameters in the array args.
createBSFException
public static final Throwable createBSFException(int reason,
String msg,
Throwable t)
createBean
public final Object createBean(Object[] args)
throws BSFException
createBean
declareBean
public final void declareBean(BSFDeclaredBean bean)
throws BSFException
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.
- declareBean in interface BSFEngine
- declareBean in interface BSFEngineImpl
bean
- the bean to declare
eval
public Object eval(String source,
int lineNo,
int columnNo,
Object oscript)
throws BSFException
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.
- eval in interface BSFEngine
exec
public void exec(String source,
int lineNo,
int columnNo,
Object script)
throws BSFException
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.
- exec in interface BSFEngine
- exec in interface BSFEngineImpl
finalize
protected void finalize()
throws Throwable
initialize
public void initialize(BSFManager mgr,
String language,
Vector declaredBeans)
throws BSFException
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.
- initialize in interface BSFEngine
- initialize in interface BSFEngineImpl
isCaseSensitive
protected final boolean isCaseSensitive()
isJScript
protected final boolean isJScript()
isPerlScript
protected final boolean isPerlScript()
isVBScript
protected final boolean isVBScript()
lookupBean
public final Object lookupBean(String name)
lookupBean
setEvalRet
public final void setEvalRet(Object ret)