Class GroovyScriptEvaluator
- java.lang.Object
-
- com.evolveum.midpoint.model.common.expression.script.AbstractScriptEvaluator
-
- com.evolveum.midpoint.model.common.expression.script.AbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>>
-
- com.evolveum.midpoint.model.common.expression.script.groovy.GroovyScriptEvaluator
-
- All Implemented Interfaces:
ScriptEvaluator
public class GroovyScriptEvaluator extends AbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>>
Expression evaluator that is using Groovy scripting engine. "Sandboxing" based on type checking inspired by work of Cédric Champeau (http://melix.github.io/blog/2015/03/sandboxing.html)
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUILTIN_EXPRESSION_PROFILE_NAME
The name is not really used for anything serious.static String
LANGUAGE_NAME
static String
LANGUAGE_URL
-
Constructor Summary
Constructors Constructor Description GroovyScriptEvaluator(PrismContext prismContext, Protector protector, LocalizationService localizationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkRestrictions(ScriptExpressionEvaluationContext context)
protected Class<?>
compileScript(String codeString, ScriptExpressionEvaluationContext context)
protected Object
evaluateScript(Class<?> compiledScriptClass, ScriptExpressionEvaluationContext context)
String
getLanguageName()
Returns human readable name of the language that this evaluator supportsString
getLanguageUrl()
Returns URL of the language that this evaluator can handle-
Methods inherited from class com.evolveum.midpoint.model.common.expression.script.AbstractCachingScriptEvaluator
evaluate, getScriptCache
-
Methods inherited from class com.evolveum.midpoint.model.common.expression.script.AbstractScriptEvaluator
getLocalizationService, getPrismContext, getProtector, prepareScriptVariablesValueMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.model.common.expression.script.ScriptEvaluator
isInitialized
-
-
-
-
Field Detail
-
LANGUAGE_NAME
public static final String LANGUAGE_NAME
- See Also:
- Constant Field Values
-
LANGUAGE_URL
public static final String LANGUAGE_URL
- See Also:
- Constant Field Values
-
BUILTIN_EXPRESSION_PROFILE_NAME
public static final String BUILTIN_EXPRESSION_PROFILE_NAME
The name is not really used for anything serious. Maybe just for diagnostics. But setting it to non-null to avoid confusing with the "null" profile.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GroovyScriptEvaluator
public GroovyScriptEvaluator(PrismContext prismContext, Protector protector, LocalizationService localizationService)
-
-
Method Detail
-
getLanguageName
public String getLanguageName()
Description copied from interface:ScriptEvaluator
Returns human readable name of the language that this evaluator supports
-
getLanguageUrl
public String getLanguageUrl()
Description copied from interface:ScriptEvaluator
Returns URL of the language that this evaluator can handle
-
checkRestrictions
protected void checkRestrictions(ScriptExpressionEvaluationContext context) throws SecurityViolationException
- Overrides:
checkRestrictions
in classAbstractScriptEvaluator
- Throws:
SecurityViolationException
-
compileScript
protected Class<?> compileScript(String codeString, ScriptExpressionEvaluationContext context) throws ExpressionEvaluationException, SecurityViolationException
- Specified by:
compileScript
in classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>>
- Throws:
ExpressionEvaluationException
SecurityViolationException
-
evaluateScript
protected Object evaluateScript(Class<?> compiledScriptClass, ScriptExpressionEvaluationContext context) throws Exception
- Specified by:
evaluateScript
in classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>>
- Throws:
Exception
-
-