20080913, rgf

org.apache.bsf.engines.jython
Class JythonEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.jython.JythonEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class JythonEngine
extends BSFEngineImpl

This is the interface to Jython (http://www.jython.org/) from BSF. It's derived from the JPython 1.x engine

Author:
Sanjiva Weerawarana, Finn Bock , Chuck Murcko

Field Summary
(package private)  org.apache.bsf.engines.jython.JythonEngine.BSFPythonInterpreter interp
           
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
JythonEngine()
           
 
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)
          Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).
 java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          call the named method of the given object.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Evaluate an expression.
 void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute a script.
 void iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute script code, emulating console interaction.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 java.lang.Object unwrap(org.python.core.PyObject result)
           
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
compileApply, compileExpr, compileScript, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interp

org.apache.bsf.engines.jython.JythonEngine.BSFPythonInterpreter interp
Constructor Detail

JythonEngine

public JythonEngine()
Method Detail

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
call the named method of the given object.

Parameters:
object - object on which to make the call
method - name of the method / procedure to call
args - the arguments to be given to the procedure
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

apply

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
Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).

Specified by:
apply in interface BSFEngine
Overrides:
apply in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object script)
                      throws BSFException
Evaluate an expression.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

exec

public void exec(java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
Execute a script.

Specified by:
exec in interface BSFEngine
Overrides:
exec in class BSFEngineImpl
Throws:
BSFException

iexec

public void iexec(java.lang.String source,
                  int lineNo,
                  int columnNo,
                  java.lang.Object script)
           throws BSFException
Execute script code, emulating console interaction.

Specified by:
iexec in interface BSFEngine
Overrides:
iexec in class BSFEngineImpl
Throws:
BSFException

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException

unwrap

public java.lang.Object unwrap(org.python.core.PyObject result)

20080913, rgf