Package org.apache.bsf.engines.jython

# Class JythonEngine

java.lang.Object
org.apache.bsf.util.BSFEngineImpl
org.apache.bsf.engines.jython.JythonEngine

All Implemented Interfaces:
  `PropertyChangeListener`, `EventListener`, `BSFEngine`

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 <bckfnn@worldonline.dk>, Chuck Murcko, Sonny To" <son.c.to@gmail.com>, 2006-10-30

- ## Field Summary

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

  `classLoader, classPath, declaredBeans, lang, mgr, tempDir`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JythonEngine()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)`
  Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).
  `Object`
  `call(Object object, String method, Object[] args)`
  call the named method of the given object.
  `void`
  `declareBean(BSFDeclaredBean bean)`
  Declare a bean
  `Object`
  `eval(String source, int lineNo, int columnNo, Object script)`
  Evaluate an expression.
  `void`
  `exec(String source, int lineNo, int columnNo, Object script)`
  Execute a script.
  `void`
  `iexec(String source, int lineNo, int columnNo, Object script)`
  Execute script code, emulating console interaction.
  `void`
  `initialize(BSFManager mgr, String lang, Vector declaredBeans)`
  Initialize the engine.
  `void`
  `propertyChange(PropertyChangeEvent e)`
  Receive property change events from the manager and update my fields as needed.
  `void`
  `undeclareBean(BSFDeclaredBean bean)`
  Undeclare a previously declared bean.
  `Object`
  `unwrap(org.python.core.PyObject result)`

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

  `compileApply, compileExpr, compileScript, terminate`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JythonEngine

    public JythonEngine()

- ## Method Details

  - ### call

    public Object call(Object object, String method, 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`
    Parameters:
      `bean` - the bean to declare
    Throws:
      `BSFException` - if the engine cannot do this operation

  - ### apply

    public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, 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`
    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
      `funcBody` - the multi-line, value returning script to evaluate
      `paramNames` - the names of the parameters above assumes
      `arguments` - values of the above parameters
    Throws:
      `BSFException` - if anything goes wrong while doin' it.

  - ### eval

    public Object eval(String source, int lineNo, int columnNo, 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(String source, int lineNo, int columnNo, Object script) throws BSFException
    Execute a script.
    Specified by:
      `exec` in interface `BSFEngine`
    Overrides:
      `exec` in class `BSFEngineImpl`
    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.

  - ### iexec

    public void iexec(String source, int lineNo, int columnNo, Object script) throws BSFException
    Execute script code, emulating console interaction.
    Specified by:
      `iexec` in interface `BSFEngine`
    Overrides:
      `iexec` in class `BSFEngineImpl`
    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.

  - ### initialize

    public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException
    Initialize the engine.
    Specified by:
      `initialize` in interface `BSFEngine`
    Overrides:
      `initialize` in class `BSFEngineImpl`
    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.

  - ### undeclareBean

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

  - ### unwrap

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

  - ### propertyChange

    public void propertyChange(PropertyChangeEvent e)
    Description copied from class: `BSFEngineImpl`
    Receive property change events from the manager and update my fields as needed.
    Specified by:
      `propertyChange` in interface `PropertyChangeListener`
    Overrides:
      `propertyChange` in class `BSFEngineImpl`
    Parameters:
      `e` - PropertyChange event with the change data