org.norther.tammi.core.scripter.groovy
Class GroovyEngine

java.lang.Object
  extended by org.norther.tammi.core.scripter.lang.AbstractEngine
      extended by org.norther.tammi.core.scripter.lang.AbstractInterpreter
          extended by org.norther.tammi.core.scripter.groovy.GroovyEngine
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, org.apache.bsf.BSFEngine, Interpreter, ScriptEngine

public class GroovyEngine
extends AbstractInterpreter
implements Serializable

A groovy interpreter engine to compile, evaluate and execute Java scripts and expressions.

Version:
$Id: GroovyEngine.java,v 1.15 2009/09/28 15:08:46 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.norther.tammi.core.scripter.lang.Interpreter
JAVA_LANGUAGE
 
Fields inherited from interface org.norther.tammi.core.scripter.lang.ScriptEngine
APPLY, ARGUMENTS, EVALUATE, EXECUTE, MAIN
 
Constructor Summary
GroovyEngine()
          Constructs a new engine.
 
Method Summary
 Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments)
           
 Object call(Object object, String method, Object[] args)
           
 void declareBean(org.apache.bsf.BSFDeclaredBean bean)
           
 Object eval(String source, int lineNo, int columnNo, Object script)
           
protected  Interpreter getInterpreter()
          Gets the adapted interpreter.
 void reinitialize(String lang, List<org.apache.bsf.BSFDeclaredBean> beans)
          Reinitializes the engine by clearing existing declarations.
 void reset()
          Resets this interpreter.
 void terminate()
           
 void undeclareBean(org.apache.bsf.BSFDeclaredBean bean)
           
 
Methods inherited from class org.norther.tammi.core.scripter.lang.AbstractInterpreter
addClassPath, addClassURL, defineClass, defineVariable, defineVariable, getClassLoader, getClassNames, getVariable, getVariableClass, getVariableNames, interpret, interpret, interpret, interpret, interpret, isDefined, loadClass, setVariable
 
Methods inherited from class org.norther.tammi.core.scripter.lang.AbstractEngine
compileApply, compileExpr, compileScript, exec, getClassPath, getDeclaredBeans, getInitializer, getLanguage, getTempDirectory, iexec, initialize, isInitialized, propertyChange, setClassLoader, setClassPath, setInitializer, setTempDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyEngine

public GroovyEngine()
Constructs a new engine.

Method Detail

reinitialize

public void reinitialize(String lang,
                         List<org.apache.bsf.BSFDeclaredBean> beans)
                  throws org.apache.bsf.BSFException
Description copied from interface: ScriptEngine
Reinitializes the engine by clearing existing declarations.

Specified by:
reinitialize in interface ScriptEngine
Overrides:
reinitialize in class AbstractEngine
Parameters:
lang - the language.
beans - declared beans.
Throws:
org.apache.bsf.BSFException - on errors.

declareBean

public void declareBean(org.apache.bsf.BSFDeclaredBean bean)
                 throws org.apache.bsf.BSFException
Specified by:
declareBean in interface org.apache.bsf.BSFEngine
Throws:
org.apache.bsf.BSFException

undeclareBean

public void undeclareBean(org.apache.bsf.BSFDeclaredBean bean)
                   throws org.apache.bsf.BSFException
Specified by:
undeclareBean in interface org.apache.bsf.BSFEngine
Throws:
org.apache.bsf.BSFException

call

public Object call(Object object,
                   String method,
                   Object[] args)
            throws org.apache.bsf.BSFException
Specified by:
call in interface org.apache.bsf.BSFEngine
Throws:
org.apache.bsf.BSFException

apply

public Object apply(String source,
                    int lineNo,
                    int columnNo,
                    Object funcBody,
                    Vector paramNames,
                    Vector arguments)
             throws org.apache.bsf.BSFException
Specified by:
apply in interface org.apache.bsf.BSFEngine
Throws:
org.apache.bsf.BSFException

eval

public Object eval(String source,
                   int lineNo,
                   int columnNo,
                   Object script)
            throws org.apache.bsf.BSFException
Specified by:
eval in interface org.apache.bsf.BSFEngine
Throws:
org.apache.bsf.BSFException

terminate

public void terminate()
Specified by:
terminate in interface org.apache.bsf.BSFEngine
Overrides:
terminate in class AbstractEngine

reset

public void reset()
Description copied from interface: Interpreter
Resets this interpreter.

Specified by:
reset in interface Interpreter
Overrides:
reset in class AbstractInterpreter

getInterpreter

protected Interpreter getInterpreter()
Description copied from class: AbstractInterpreter
Gets the adapted interpreter.

Specified by:
getInterpreter in class AbstractInterpreter
Returns:
the interpreter.


Copyright © 2004 The Norther Organization. All rights reserved.