public interface Scripting
Scripting includes the ability to load dynamically compiled Java and Groovy classes from classpath and conf directory, as well as running Groovy scripts and expressions.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears compiled classes cache
|
<T> T |
evaluateGroovy(java.lang.String text,
groovy.lang.Binding binding)
Evaluates Groovy expression.
|
<T> T |
evaluateGroovy(java.lang.String text,
groovy.lang.Binding binding,
ScriptExecutionPolicy... policies)
Evaluates Groovy expression.
|
<T> T |
evaluateGroovy(java.lang.String text,
java.util.Map<java.lang.String,java.lang.Object> context)
Evaluates Groovy expression.
|
java.lang.ClassLoader |
getClassLoader()
Returns the dynamic classloader.
|
java.lang.Class<?> |
loadClass(java.lang.String name)
Loads class by name using the following sequence:
Search for a Groovy source in the conf directory.
|
java.lang.Class<?> |
loadClassNN(java.lang.String name)
Loads a class by name using the sequence described in
loadClass(String) . |
boolean |
removeClass(java.lang.String name)
Remove compiled class from cache
|
<T> T |
runGroovyScript(java.lang.String name,
groovy.lang.Binding binding)
Runs Groovy script.
|
<T> T |
runGroovyScript(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> context)
Runs Groovy script.
|
static final java.lang.String NAME
<T> T evaluateGroovy(java.lang.String text, groovy.lang.Binding binding, ScriptExecutionPolicy... policies)
T
- result typetext
- expression textbinding
- Groovy bindingpolicies
- policies for script execution ScriptExecutionPolicy
<T> T evaluateGroovy(java.lang.String text, groovy.lang.Binding binding)
T
- result typetext
- expression textbinding
- Groovy binding<T> T evaluateGroovy(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> context)
T
- result typetext
- expression textcontext
- map of parameters to pass to the expression, same as Binding<T> T runGroovyScript(java.lang.String name, groovy.lang.Binding binding)
T
- result typename
- path to the script relative to conf dir or to the classpath rootbinding
- Groovy binding<T> T runGroovyScript(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> context)
T
- result typename
- path to the script relative to conf dir or to the classpath rootcontext
- map of parameters to pass to the script, same as Bindingjava.lang.ClassLoader getClassLoader()
Actually it is the GroovyClassLoader which parent is JavaClassLoader
.
For explanation on class loading sequence see loadClass(String)
@Nullable java.lang.Class<?> loadClass(java.lang.String name)
clearCache()
method, e.g. through JMX interface
CachingFacadeMBean.name
- fully qualified class namejava.lang.Class<?> loadClassNN(java.lang.String name)
loadClass(String)
.name
- fully qualified class namejava.lang.IllegalStateException
- if the class is not foundboolean removeClass(java.lang.String name)
void clearCache()