Package org.forgerock.openig.script
Class GroovyScriptFactory
java.lang.Object
org.forgerock.openig.script.GroovyScriptFactory
- All Implemented Interfaces:
ScriptFactory
Provide support for scripts written in the Groovy language.
Groovy files must be UTF-8 encoded.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGroovyScriptFactory
(File basedir, File cacheDir) Constructs a new factory given two runtime directories:basedir
(the root directory where file scripts are stored) andcacheDir
(where inlined scripts would be stored prior to execution).GroovyScriptFactory
(Environment environment) Constructs a new factory based on the given runtimeEnvironment
. -
Method Summary
Modifier and TypeMethodDescriptioncreateInline
(String... lines) Build a newScript
instance from the givenlines
representing the script content.createResource
(String resource) Build a newScript
instance from a resource name.
-
Field Details
-
GROOVY_MIME_TYPE
The mime-type for Groovy scripts.- See Also:
-
-
Constructor Details
-
GroovyScriptFactory
Constructs a new factory based on the given runtimeEnvironment
.- Parameters:
environment
- where the IG instance lives- Throws:
ScriptException
- if directories cannot be created, or engine cannot be initialized
-
GroovyScriptFactory
Constructs a new factory given two runtime directories:basedir
(the root directory where file scripts are stored) andcacheDir
(where inlined scripts would be stored prior to execution).- Parameters:
basedir
- the root directory where file scripts are storedcacheDir
- where inlined scripts would be stored prior to execution- Throws:
ScriptException
- if engine cannot be initialized
-
-
Method Details
-
createResource
Description copied from interface:ScriptFactory
Build a newScript
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 interfaceScriptFactory
- Parameters:
resource
- Script resource name- Returns:
- a new Script instance
- Throws:
ScriptException
- if resource is not available or if any pre-validation failed
-
createInline
Description copied from interface:ScriptFactory
Build a newScript
instance from the givenlines
representing the script content.- Specified by:
createInline
in interfaceScriptFactory
- Parameters:
lines
- script content- Returns:
- a new Script instance
- Throws:
ScriptException
- if any pre-validation failed
-