com.ibm.bsf.engines.jpython
Class JPythonEngine

java.lang.Object
  |
  +--com.ibm.bsf.util.BSFEngineImpl
        |
        +--com.ibm.bsf.engines.jpython.JPythonEngine

public class JPythonEngine
extends BSFEngineImpl

This is the interface to JPython (http://www.jpython.org/) from BSF.

Author:
Sanjiva Weerawarana, Finn Bock

Fields inherited from class com.ibm.bsf.util.BSFEngineImpl
classLoader, classPath, debug, debugStream, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
JPythonEngine()
           
 
Method Summary
 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 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 com.ibm.bsf.util.BSFEngineImpl
apply, compileApply, compileExpr, compileScript, propertyChange, setDebug, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPythonEngine

public JPythonEngine()
Method Detail

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine.
Overrides:
initialize in class BSFEngineImpl
Tags copied from interface: BSFEngine
Parameters:
mgr - The BSFManager that's hosting this engine.
lang - 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.
Throws:
BSFException - if anything goes wrong while init'ing a BSFException is thrown. The reason indicates the problem.

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object script)
                      throws BSFException
Evaluate an expression.
Tags copied from interface: BSFEngine
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
expr - 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.
Overrides:
exec in class BSFEngineImpl
Tags copied from interface: BSFEngine
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 script to execute
Throws:
BSFException - if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.

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.
Tags copied from interface: BSFEngine
Parameters:
object - object on which to make the call
name - 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.

unwrap

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

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean
Overrides:
declareBean in class BSFEngineImpl
Tags copied from interface: BSFEngine
Parameters:
bean - the bean to declare
Throws:
BSFException - if the engine cannot do this operation

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a previously declared bean.
Overrides:
undeclareBean in class BSFEngineImpl
Tags copied from interface: BSFEngine
Parameters:
bean - the bean to undeclare
Throws:
BSFException - if the engine cannot do this operation