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
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 -
Method Summary
Modifier and TypeMethodDescriptionapply(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).call the named method of the given object.voiddeclareBean(BSFDeclaredBean bean) Declare a beanEvaluate an expression.voidExecute a script.voidExecute script code, emulating console interaction.voidinitialize(BSFManager mgr, String lang, Vector declaredBeans) Initialize the engine.voidReceive property change events from the manager and update my fields as needed.voidundeclareBean(BSFDeclaredBean bean) Undeclare a previously declared bean.unwrap(org.python.core.PyObject result) Methods inherited from class org.apache.bsf.util.BSFEngineImpl
compileApply, compileExpr, compileScript, terminate
-
Constructor Details
-
JythonEngine
public JythonEngine()
-
-
Method Details
-
call
call the named method of the given object.- Parameters:
object- object on which to make the callmethod- name of the method / procedure to callargs- 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
Declare a bean- Specified by:
declareBeanin interfaceBSFEngine- Overrides:
declareBeanin classBSFEngineImpl- 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:
applyin interfaceBSFEngine- Overrides:
applyin classBSFEngineImpl- Parameters:
source- (context info) the source of this expression (e.g., filename)lineNo- (context info) the line number in source for exprcolumnNo- (context info) the column number in source for exprfuncBody- the multi-line, value returning script to evaluateparamNames- the names of the parameters above assumesarguments- values of the above parameters- Throws:
BSFException- if anything goes wrong while doin' it.
-
eval
Evaluate an expression.- Parameters:
source- (context info) the source of this expression (e.g., filename)lineNo- (context info) the line number in source for exprcolumnNo- (context info) the column number in source for exprscript- the expression to evaluate- Throws:
BSFException- if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.
-
exec
Execute a script.- Specified by:
execin interfaceBSFEngine- Overrides:
execin classBSFEngineImpl- Parameters:
source- (context info) the source of this expression (e.g., filename)lineNo- (context info) the line number in source for exprcolumnNo- (context info) the column number in source for exprscript- the script to execute- Throws:
BSFException- if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.
-
iexec
Execute script code, emulating console interaction.- Specified by:
iexecin interfaceBSFEngine- Overrides:
iexecin classBSFEngineImpl- Parameters:
source- (context info) the source of this expression (e.g., filename)lineNo- (context info) the line number in source for exprcolumnNo- (context info) the column number in source for exprscript- the script to execute- Throws:
BSFException- if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.
-
initialize
Initialize the engine.- Specified by:
initializein interfaceBSFEngine- Overrides:
initializein classBSFEngineImpl- 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
Undeclare a previously declared bean.- Specified by:
undeclareBeanin interfaceBSFEngine- Overrides:
undeclareBeanin classBSFEngineImpl- Parameters:
bean- the bean to undeclare- Throws:
BSFException- if the engine cannot do this operation
-
unwrap
-
propertyChange
Description copied from class:BSFEngineImplReceive property change events from the manager and update my fields as needed.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classBSFEngineImpl- Parameters:
e- PropertyChange event with the change data
-