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 inspired from the Jython engine
- 
Field SummaryFields Modifier and Type Field Description protected GroovyShellshellFields inherited from class org.apache.bsf.util.BSFEngineImplclassLoader, classPath, declaredBeans, lang, mgr, tempDir
- 
Constructor SummaryConstructors Constructor Description GroovyEngine()
- 
Method SummaryModifier and Type Method Description Objectapply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)Allow an anonymous function to be declared and invokedObjectcall(Object object, String method, Object[] args)Call the named method of the given object.voiddeclareBean(org.apache.bsf.BSFDeclaredBean bean)Declare a beanObjecteval(String source, int lineNo, int columnNo, Object script)Evaluate an expression.voidexec(String source, int lineNo, int columnNo, Object script)Execute a script.protected GroovyShellgetEvalShell()voidinitialize(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.BSFEngineImplcompileApply, compileExpr, compileScript, iexec, propertyChange, terminate
- 
Field Details- 
shell
 
- 
- 
Constructor Details- 
GroovyEnginepublic GroovyEngine()
 
- 
- 
Method Details- 
applypublic Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws org.apache.bsf.BSFExceptionAllow an anonymous function to be declared and invoked- Specified by:
- applyin interface- org.apache.bsf.BSFEngine
- Overrides:
- applyin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
- 
callCall the named method of the given object.- Throws:
- org.apache.bsf.BSFException
 
- 
evalpublic Object eval(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFExceptionEvaluate an expression.- Throws:
- org.apache.bsf.BSFException
 
- 
execpublic void exec(String source, int lineNo, int columnNo, Object script) throws org.apache.bsf.BSFExceptionExecute a script.- Specified by:
- execin interface- org.apache.bsf.BSFEngine
- Overrides:
- execin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
- 
initializepublic void initialize(org.apache.bsf.BSFManager mgr, String lang, Vector declaredBeans) throws org.apache.bsf.BSFExceptionInitialize the engine.- Specified by:
- initializein interface- org.apache.bsf.BSFEngine
- Overrides:
- initializein class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
- 
declareBeanpublic void declareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFExceptionDeclare a bean- Specified by:
- declareBeanin interface- org.apache.bsf.BSFEngine
- Overrides:
- declareBeanin class- org.apache.bsf.util.BSFEngineImpl
- Throws:
- org.apache.bsf.BSFException
 
- 
undeclareBeanpublic void undeclareBean(org.apache.bsf.BSFDeclaredBean bean) throws org.apache.bsf.BSFExceptionUndeclare a previously declared bean.- Specified by:
- undeclareBeanin interface- org.apache.bsf.BSFEngine
- Overrides:
- undeclareBeanin class- org.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
 
 
-