Package org.forgerock.openig.script
Class GroovyScriptFactory
- java.lang.Object
- 
- org.forgerock.openig.script.GroovyScriptFactory
 
- 
- All Implemented Interfaces:
- ScriptFactory
 
 public class GroovyScriptFactory extends Object implements ScriptFactory Provide support for scripts written in the Groovy language.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringGROOVY_MIME_TYPEThe mime-type for Groovy scripts.
 - 
Constructor SummaryConstructors Constructor Description GroovyScriptFactory(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 SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ScriptcreateInline(String... lines)Build a newScriptinstance from the givenlinesrepresenting the script content.ScriptcreateResource(String resource)Build a newScriptinstance from a resource name.
 
- 
- 
- 
Field Detail- 
GROOVY_MIME_TYPEpublic static final String GROOVY_MIME_TYPE The mime-type for Groovy scripts.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
GroovyScriptFactorypublic GroovyScriptFactory(Environment environment) throws ScriptException 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
 
 - 
GroovyScriptFactorypublic GroovyScriptFactory(File basedir, File cacheDir) throws ScriptException 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 stored
- cacheDir- where inlined scripts would be stored prior to execution
- Throws:
- ScriptException- if engine cannot be initialized
 
 
- 
 - 
Method Detail- 
createResourcepublic Script createResource(String resource) throws ScriptException Description copied from interface:ScriptFactoryBuild a newScriptinstance from a resource name.The resourcename can either:- a relative path to the script base directory
- an absolute URL
 - Specified by:
- createResourcein 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
 
 - 
createInlinepublic Script createInline(String... lines) throws ScriptException Description copied from interface:ScriptFactoryBuild a newScriptinstance from the givenlinesrepresenting the script content.- Specified by:
- createInlinein interface- ScriptFactory
- Parameters:
- lines- script content
- Returns:
- a new Script instance
- Throws:
- ScriptException- if any pre-validation failed
 
 
- 
 
-