Class GroovyScriptFactory

  • All Implemented Interfaces:
    ScriptFactory

    public class GroovyScriptFactory
    extends Object
    implements ScriptFactory
    Provide support for scripts written in the Groovy language.
    • Constructor Detail

      • GroovyScriptFactory

        public GroovyScriptFactory​(Environment environment)
                            throws ScriptException
        Constructs a new factory based on the given runtime Environment.
        Parameters:
        environment - where the IG instance lives
        Throws:
        ScriptException - if directories cannot be created, or engine cannot be initialized
      • GroovyScriptFactory

        public GroovyScriptFactory​(File basedir,
                                   File cacheDir)
                            throws ScriptException
        Constructs a new factory given two runtime directories: basedir (the root directory where file scripts are stored) and cacheDir (where inlined scripts would be stored prior to execution).
        Parameters:
        basedir - the root directory where file scripts are stored
        cacheDir - where inlined scripts would be stored prior to execution
        Throws:
        ScriptException - if engine cannot be initialized
    • Method Detail

      • createResource

        public Script createResource​(String resource)
                              throws ScriptException
        Description copied from interface: ScriptFactory
        Build a new Script instance from a resource name.

        The resource name can either:

        • a relative path to the script base directory
        • an absolute URL
        Specified by:
        createResource in interface ScriptFactory
        Parameters:
        resource - Script resource name
        Returns:
        a new Script instance
        Throws:
        ScriptException - if resource is not available or if any pre-validation failed