public class GroovyScriptFactory extends Object implements ScriptFactory
Modifier and Type | Field and Description |
---|---|
static String |
GROOVY_MIME_TYPE
The mime-type for Groovy scripts.
|
Constructor and Description |
---|
GroovyScriptFactory(Environment environment)
Constructs a new factory based on the given runtime
Environment . |
GroovyScriptFactory(File basedir,
File cacheDir)
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). |
Modifier and Type | Method and Description |
---|---|
Script |
createInline(String... lines)
Build a new
Script instance from the given lines representing the script content. |
Script |
createResource(String resource)
Build a new
Script instance from a resource name. |
public static final String GROOVY_MIME_TYPE
public GroovyScriptFactory(Environment environment) throws ScriptException
Environment
.environment
- where the IG instance livesScriptException
- if directories cannot be created, or engine cannot be initializedpublic GroovyScriptFactory(File basedir, File cacheDir) throws ScriptException
basedir
(the root directory where file scripts
are stored) and cacheDir
(where inlined scripts would be stored prior to execution).basedir
- the root directory where file scripts are storedcacheDir
- where inlined scripts would be stored prior to executionScriptException
- if engine cannot be initializedpublic Script createResource(String resource) throws ScriptException
ScriptFactory
Script
instance from a resource name.
The resource
name can either:
createResource
in interface ScriptFactory
resource
- Script resource nameScriptException
- if resource is not available or if any pre-validation failedpublic Script createInline(String... lines) throws ScriptException
ScriptFactory
Script
instance from the given lines
representing the script content.createInline
in interface ScriptFactory
lines
- script contentScriptException
- if any pre-validation failedCopyright 2011-2017 ForgeRock AS.