Save This Page
Home » groovy-src-1.6.5 » groovy » util » [javadoc | source]
groovy.util
public class: GroovyScriptEngine [javadoc | source]
java.lang.Object
   groovy.util.GroovyScriptEngine

All Implemented Interfaces:
    ResourceConnector

Specific script engine able to reload modified scripts as well as dealing properly with dependent scripts.
Constructor:
 public GroovyScriptEngine(URL[] roots) 
    The groovy script engine will run groovy scripts and reload them and their dependencies when they are modified. This is useful for embedding groovy in other containers like games and application servers.
    Parameters:
    roots - This an array of URLs where Groovy scripts will be stored. They should be layed out using their package structure like Java classes
 public GroovyScriptEngine(String[] urls) throws IOException 
 public GroovyScriptEngine(String url) throws IOException 
 public GroovyScriptEngine(ResourceConnector rc) 
 public GroovyScriptEngine(URL[] roots,
    ClassLoader parentClassLoader) 
 public GroovyScriptEngine(String[] urls,
    ClassLoader parentClassLoader) throws IOException 
 public GroovyScriptEngine(String url,
    ClassLoader parentClassLoader) throws IOException 
 public GroovyScriptEngine(ResourceConnector rc,
    ClassLoader parentClassLoader) 
Method from groovy.util.GroovyScriptEngine Summary:
createScript,   getGroovyClassLoader,   getParentClassLoader,   getResourceConnection,   loadScriptByName,   loadScriptByName,   main,   run,   run,   setParentClassLoader
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from groovy.util.GroovyScriptEngine Detail:
 public Script createScript(String scriptName,
    Binding binding) throws ResourceException, ScriptException 
    Creates a Script with a given scriptName and binding.
 public GroovyClassLoader getGroovyClassLoader() 
    Returns the GroovyClassLoader associated with this script engine instance. Useful if you need to pass the class loader to another library.
 public ClassLoader getParentClassLoader() 
    Get the ClassLoader that will serve as the parent ClassLoader of the GroovyClassLoader in which scripts will be executed. By default, this is the ClassLoader that loaded the GroovyScriptEngine class.
 public URLConnection getResourceConnection(String resourceName) throws ResourceException 
    Get a resource connection as a URLConnection to retrieve a script from the ResourceConnector.
 public Class loadScriptByName(String scriptName) throws ResourceException, ScriptException 
    Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading.
 public Class loadScriptByName(String scriptName,
    ClassLoader parentClassLoader) throws ResourceException, ScriptException 
Deprecated!
    Get the class of the scriptName in question, so that you can instantiate Groovy objects with caching and reloading.
 public static  void main(String[] urls) throws Exception 
    Simple testing harness for the GSE. Enter script roots as arguments and then input script names to run them.
 public String run(String scriptName,
    String argument) throws ResourceException, ScriptException 
    Run a script identified by name with a single argument.
 public Object run(String scriptName,
    Binding binding) throws ResourceException, ScriptException 
    Run a script identified by name with a given binding.
 public  void setParentClassLoader(ClassLoader parentClassLoader) 
Deprecated!