org.apache.bsf.engines.javascript

Class JavaScriptEngine

Implemented Interfaces:
BSFEngine, PropertyChangeListener

public class JavaScriptEngine
extends BSFEngineImpl

This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.

The original version of this code was first written by Adam Peller for use in LotusXSL. Sanjiva took his code and adapted it for BSF.

Authors:
Adam Peller
Sanjiva Weerawarana
Matthew J. Duftler
Norris Boyd

Field Summary

Fields inherited from class org.apache.bsf.util.BSFEngineImpl

classLoader, classPath, declaredBeans, lang, mgr, tempDir

Method Summary

Object
call(Object object, String method, Object[] args)
Return an object from an extension.
void
declareBean(BSFDeclaredBean bean)
Object
eval(String source, int lineNo, int columnNo, Object oscript)
This is used by an application to evaluate a string containing some expression.
void
initialize(BSFManager mgr, String lang, Vector declaredBeans)
Initialize the engine.
void
undeclareBean(BSFDeclaredBean bean)

Methods inherited from class org.apache.bsf.util.BSFEngineImpl

apply, compileApply, compileExpr, compileScript, declareBean, exec, iexec, initialize, propertyChange, terminate, undeclareBean

Method Details

call

public Object call(Object object,
                   String method,
                   Object[] args)
            throws BSFException
Return an object from an extension.
Specified by:
call in interface BSFEngine
Parameters:
object - Object on which to make the call (ignored).
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.

declareBean

public void declareBean(BSFDeclaredBean bean)
            throws BSFException
Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in interface BSFEngineImpl

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.
Specified by:
eval in interface BSFEngine

initialize

public void initialize(BSFManager mgr,
                       String lang,
                       Vector declaredBeans)
            throws BSFException
Initialize the engine. Put the manager into the context-manager map hashtable too.
Specified by:
initialize in interface BSFEngine
Overrides:
initialize in interface BSFEngineImpl

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
            throws BSFException
Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in interface BSFEngineImpl