Class GroovyScriptFactory

java.lang.Object
org.forgerock.openig.script.GroovyScriptFactory
All Implemented Interfaces:
ScriptFactory

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

Groovy files must be UTF-8 encoded.

  • Constructor Details

    • GroovyScriptFactory

      public GroovyScriptFactory()
  • Method Details

    • init

      public GroovyScriptFactory init(Environment environment) throws ScriptException
      Description copied from interface: ScriptFactory
      Initialize the factory with the given environment.
      Specified by:
      init in interface ScriptFactory
      Parameters:
      environment - the current environment information
      Returns:
      this factory to allow method chaining
      Throws:
      ScriptException - if the initialization failed
    • 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
    • createInline

      public Script createInline(String... lines) throws ScriptException
      Description copied from interface: ScriptFactory
      Build a new Script instance from the given lines representing the script content.
      Specified by:
      createInline in interface ScriptFactory
      Parameters:
      lines - script content
      Returns:
      a new Script instance
      Throws:
      ScriptException - if any pre-validation failed
    • mimeType

      public String mimeType()
      Description copied from interface: ScriptFactory
      Returns the mime-type of the script supported by this factory.
      Specified by:
      mimeType in interface ScriptFactory
      Returns:
      the mime-type of the script supported by this factory.