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<?>,String>
com.evolveum.midpoint.model.common.expression.script.groovy.GroovyScriptEvaluator
- All Implemented Interfaces:
ScriptEvaluator
public class GroovyScriptEvaluator
extends AbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>,String>
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 -
Constructor Summary
ConstructorsConstructorDescriptionGroovyScriptEvaluator(PrismContext prismContext, Protector protector, LocalizationService localizationService) Called by Spring but also by lower-level tests -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?>compileScript(String codeString, ScriptExpressionEvaluationContext context) protected groovy.lang.GroovyClassLoaderprotected booleanprotected ObjectevaluateScript(Class<?> compiledScriptClass, ScriptExpressionEvaluationContext context) Returns human readable name of the language that this evaluator supports@NotNull StringReturns (canonical) URL of the language that this evaluator can handleprotected StringgetScriptCachingKey(String codeString, ScriptExpressionEvaluationContext context) Methods inherited from class com.evolveum.midpoint.model.common.expression.script.AbstractCachingScriptEvaluator
evaluateInternal, getInterpreter, getScriptCacheMethods inherited from class com.evolveum.midpoint.model.common.expression.script.AbstractScriptEvaluator
evaluate, getLocalizationService, getPrismContext, getProtector, needsServiceVariables, prepareFunctionLibraryMap, prepareScriptVariablesMap, prepareScriptVariablesTypedValueMap, prepareUnifiedScriptVariablesValueMap, supportsDeprecatedVariablesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.model.common.expression.script.ScriptEvaluator
isInitialized
-
Field Details
-
LANGUAGE_NAME
- See Also:
-
-
Constructor Details
-
GroovyScriptEvaluator
public GroovyScriptEvaluator(PrismContext prismContext, Protector protector, LocalizationService localizationService) Called by Spring but also by lower-level tests
-
-
Method Details
-
getScriptCachingKey
- Specified by:
getScriptCachingKeyin classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>, String>
-
getLanguageName
Description copied from interface:ScriptEvaluatorReturns human readable name of the language that this evaluator supports -
getLanguageUrl
Description copied from interface:ScriptEvaluatorReturns (canonical) URL of the language that this evaluator can handle -
doesSupportRestrictions
protected boolean doesSupportRestrictions()- Overrides:
doesSupportRestrictionsin classAbstractScriptEvaluator
-
compileScript
protected Class<?> compileScript(String codeString, ScriptExpressionEvaluationContext context) throws ExpressionEvaluationException, SecurityViolationException - Specified by:
compileScriptin classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>, String> - Throws:
ExpressionEvaluationExceptionSecurityViolationException
-
createInterpreter
protected groovy.lang.GroovyClassLoader createInterpreter(ScriptExpressionEvaluationContext context) throws SecurityViolationException - Specified by:
createInterpreterin classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>, String> - Throws:
SecurityViolationException
-
evaluateScript
protected Object evaluateScript(Class<?> compiledScriptClass, ScriptExpressionEvaluationContext context) throws Exception - Specified by:
evaluateScriptin classAbstractCachingScriptEvaluator<groovy.lang.GroovyClassLoader,Class<?>, String> - Throws:
Exception
-