Package org.codehaus.groovy.bsf
Class GroovyEngine
java.lang.Object
org.apache.bsf.util.BSFEngineImpl
org.codehaus.groovy.bsf.GroovyEngine
- All Implemented Interfaces:
PropertyChangeListener,EventListener,org.apache.bsf.BSFEngine
- Direct Known Subclasses:
CachingGroovyEngine
public class GroovyEngine
extends org.apache.bsf.util.BSFEngineImpl
A BSF Engine for the Groovy
scripting language.
It's derived from the Jython / JPython engine
- Author:
- James Strachan
-
Field Summary
FieldsFields 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) Allow an anonymous function to be declared and invokedCall the named method of the given object.voiddeclareBean(org.apache.bsf.BSFDeclaredBean bean) Declare a beanEvaluate an expression.voidExecute a script.protected GroovyShellvoidinitialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans) Initialize the engine.voidundeclareBean(org.apache.bsf.BSFDeclaredBean bean) Undeclare a previously declared bean.Methods inherited from class org.apache.bsf.util.BSFEngineImpl
compileApply, compileExpr, compileScript, iexec, propertyChange, terminate
-
Field Details
-
shell
-
-
Constructor Details
-
GroovyEngine
public GroovyEngine()
-
-
Method Details
-
apply
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws org.apache.bsf.BSFException Allow an anonymous function to be declared and invoked- Specified by:
applyin interfaceorg.apache.bsf.BSFEngine- Overrides:
applyin classorg.apache.bsf.util.BSFEngineImpl- Throws:
org.apache.bsf.BSFException
-
call
Call the named method of the given object.- Throws:
org.apache.bsf.BSFException
-
eval
public Object eval(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException Evaluate an expression.- Throws:
org.apache.bsf.BSFException
-
exec
public void exec(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFException Execute a script.- Specified by:
execin interfaceorg.apache.bsf.BSFEngine- Overrides:
execin classorg.apache.bsf.util.BSFEngineImpl- Throws:
org.apache.bsf.BSFException
-
initialize
public void initialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans) throws org.apache.bsf.BSFException Initialize the engine.- Specified by:
initializein interfaceorg.apache.bsf.BSFEngine- Overrides:
initializein classorg.apache.bsf.util.BSFEngineImpl- Throws:
org.apache.bsf.BSFException
-
declareBean
public void declareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFException Declare a bean- Specified by:
declareBeanin interfaceorg.apache.bsf.BSFEngine- Overrides:
declareBeanin classorg.apache.bsf.util.BSFEngineImpl- Throws:
org.apache.bsf.BSFException
-
undeclareBean
public void undeclareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFException Undeclare a previously declared bean.- Specified by:
undeclareBeanin interfaceorg.apache.bsf.BSFEngine- Overrides:
undeclareBeanin classorg.apache.bsf.util.BSFEngineImpl- Throws:
org.apache.bsf.BSFException
-
getEvalShell
- Returns:
- a newly created GroovyShell using the same variable scope but a new class loader
-