Package org.apereo.cas.util.scripting
Class ScriptingUtils
- java.lang.Object
-
- org.apereo.cas.util.scripting.ScriptingUtils
-
public class ScriptingUtils extends java.lang.ObjectThis isScriptingUtils.- Since:
- 5.1.0
-
-
Constructor Summary
Constructors Constructor Description ScriptingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TexecuteGroovyScript(groovy.lang.GroovyObject groovyObject, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script.static <T> TexecuteGroovyScript(groovy.lang.GroovyObject groovyObject, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script t.static <T> TexecuteGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script via run object.static <T> TexecuteGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Class<T> clazz)Execute groovy script.static <T> TexecuteGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Class<T> clazz, java.lang.Object... args)Execute groovy script t.static <T> TexecuteGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script.static <T> TexecuteGroovyScriptEngine(java.lang.String script, java.util.Map<java.lang.String,java.lang.Object> variables, java.lang.Class<T> clazz)Execute inline groovy script engine.static <T> TexecuteGroovyShellScript(groovy.lang.Script script, java.lang.Class<T> clazz)Execute groovy shell script t.static <T> TexecuteGroovyShellScript(groovy.lang.Script script, java.util.Map<java.lang.String,java.lang.Object> variables, java.lang.Class<T> clazz)Execute groovy shell script t.static <T> TexecuteScriptEngine(java.lang.String scriptFile, java.lang.Object[] args, java.lang.Class<T> clazz)Execute groovy script engine t.static java.util.regex.MatchergetMatcherForExternalGroovyScript(java.lang.String script)Gets groovy file script matcher.static java.util.regex.MatchergetMatcherForInlineGroovyScript(java.lang.String script)Gets inline groovy script matcher.static <T> TgetObjectInstanceFromGroovyResource(org.springframework.core.io.Resource resource, java.lang.Class[] constructorArgs, java.lang.Object[] args, java.lang.Class<T> expectedType)Gets object instance from groovy resource.static <T> TgetObjectInstanceFromGroovyResource(org.springframework.core.io.Resource resource, java.lang.Class<T> expectedType)Gets object instance from groovy resource.static java.lang.StringgetScriptEngineName(java.lang.String scriptFile)Gets script engine name.static booleanisExternalGroovyScript(java.lang.String script)Is external groovy script ?.static booleanisInlineGroovyScript(java.lang.String script)Is inline groovy script ?.static groovy.lang.GroovyObjectparseGroovyScript(org.springframework.core.io.Resource groovyScript, boolean failOnError)Parse groovy script groovy object.static groovy.lang.ScriptparseGroovyShellScript(java.lang.String script)Parse groovy shell script script.
-
-
-
Method Detail
-
isInlineGroovyScript
public static boolean isInlineGroovyScript(java.lang.String script)
Is inline groovy script ?.- Parameters:
script- the script- Returns:
- true/false
-
isExternalGroovyScript
public static boolean isExternalGroovyScript(java.lang.String script)
Is external groovy script ?.- Parameters:
script- the script- Returns:
- true/false
-
getMatcherForInlineGroovyScript
public static java.util.regex.Matcher getMatcherForInlineGroovyScript(java.lang.String script)
Gets inline groovy script matcher.- Parameters:
script- the script- Returns:
- the inline groovy script matcher
-
getMatcherForExternalGroovyScript
public static java.util.regex.Matcher getMatcherForExternalGroovyScript(java.lang.String script)
Gets groovy file script matcher.- Parameters:
script- the script- Returns:
- the groovy file script matcher
-
executeGroovyShellScript
public static <T> T executeGroovyShellScript(groovy.lang.Script script, java.lang.Class<T> clazz)Execute groovy shell script t.- Type Parameters:
T- the type parameter- Parameters:
script- the scriptclazz- the clazz- Returns:
- the t
-
executeGroovyShellScript
public static <T> T executeGroovyShellScript(groovy.lang.Script script, java.util.Map<java.lang.String,java.lang.Object> variables, java.lang.Class<T> clazz)Execute groovy shell script t.- Type Parameters:
T- the type parameter- Parameters:
script- the scriptvariables- the variablesclazz- the clazz- Returns:
- the t
-
executeGroovyScript
public static <T> T executeGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script via run object.- Type Parameters:
T- the type parameter- Parameters:
groovyScript- the groovy scriptargs- the argsclazz- the clazzfailOnError- the fail on error- Returns:
- the object
-
executeGroovyScript
public static <T> T executeGroovyScript(groovy.lang.GroovyObject groovyObject, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script.- Type Parameters:
T- the type parameter- Parameters:
groovyObject- the groovy objectargs- the argsclazz- the clazzfailOnError- the fail on error- Returns:
- the result
-
executeGroovyScript
public static <T> T executeGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Class<T> clazz, java.lang.Object... args)Execute groovy script t.- Type Parameters:
T- the type parameter- Parameters:
groovyScript- the groovy scriptmethodName- the method nameclazz- the clazzargs- the args- Returns:
- the type to return
-
executeGroovyScript
public static <T> T executeGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Class<T> clazz)Execute groovy script.- Type Parameters:
T- the type parameter- Parameters:
groovyScript- the groovy scriptmethodName- the method nameclazz- the clazz- Returns:
- the t
-
executeGroovyScript
public static <T> T executeGroovyScript(org.springframework.core.io.Resource groovyScript, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script.- Type Parameters:
T- the type parameter- Parameters:
groovyScript- the groovy scriptmethodName- the method nameargs- the argsclazz- the clazzfailOnError- the fail on error- Returns:
- the t
-
executeGroovyScript
public static <T> T executeGroovyScript(groovy.lang.GroovyObject groovyObject, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> clazz, boolean failOnError)Execute groovy script t.- Type Parameters:
T- the type parameter- Parameters:
groovyObject- the groovy objectmethodName- the method nameargs- the argsclazz- the clazzfailOnError- the fail on error- Returns:
- the t
-
parseGroovyShellScript
public static groovy.lang.Script parseGroovyShellScript(java.lang.String script)
Parse groovy shell script script.- Parameters:
script- the script- Returns:
- the script
-
parseGroovyScript
public static groovy.lang.GroovyObject parseGroovyScript(org.springframework.core.io.Resource groovyScript, boolean failOnError)Parse groovy script groovy object.- Parameters:
groovyScript- the groovy scriptfailOnError- the fail on error- Returns:
- the groovy object
-
executeScriptEngine
public static <T> T executeScriptEngine(java.lang.String scriptFile, java.lang.Object[] args, java.lang.Class<T> clazz)Execute groovy script engine t.- Type Parameters:
T- the type parameter- Parameters:
scriptFile- the script fileargs- the argsclazz- the clazz- Returns:
- the t
-
executeGroovyScriptEngine
public static <T> T executeGroovyScriptEngine(java.lang.String script, java.util.Map<java.lang.String,java.lang.Object> variables, java.lang.Class<T> clazz)Execute inline groovy script engine.- Type Parameters:
T- the type parameter- Parameters:
script- the scriptvariables- the variablesclazz- the clazz- Returns:
- the t
-
getObjectInstanceFromGroovyResource
public static <T> T getObjectInstanceFromGroovyResource(org.springframework.core.io.Resource resource, java.lang.Class<T> expectedType)Gets object instance from groovy resource.- Type Parameters:
T- the type parameter- Parameters:
resource- the resourceexpectedType- the expected type- Returns:
- the object instance from groovy resource
-
getObjectInstanceFromGroovyResource
public static <T> T getObjectInstanceFromGroovyResource(org.springframework.core.io.Resource resource, java.lang.Class[] constructorArgs, java.lang.Object[] args, java.lang.Class<T> expectedType)Gets object instance from groovy resource.- Type Parameters:
T- the type parameter- Parameters:
resource- the resourceconstructorArgs- the constructor argsargs- the argsexpectedType- the expected type- Returns:
- the object instance from groovy resource
-
getScriptEngineName
public static java.lang.String getScriptEngineName(java.lang.String scriptFile)
Gets script engine name.- Parameters:
scriptFile- the script file- Returns:
- the script engine name
-
-