Package org.infinispan.scripting
Interface ScriptingManager
-
public interface ScriptingManagerScriptingManager. Defines the operations that can be performed on scripts. Scripts are stored in a dedicated cache.- Since:
- 7.2
- Author:
- Tristan Tarrant
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCRIPT_CACHEstatic StringSCRIPT_MANAGER_ROLE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddScript(String name, String script)Adds a new named script.StringgetScript(String scriptName)Retrieves the source code of an existing script.Set<String>getScriptNames()Retrieves names of all available scripts.voidremoveScript(String name)Removes a script.<T> CompletableFuture<T>runScript(String scriptName)Runs a named script<T> CompletableFuture<T>runScript(String scriptName, TaskContext context)Runs a named script using the specifiedTaskContext
-
-
-
Field Detail
-
SCRIPT_CACHE
static final String SCRIPT_CACHE
- See Also:
- Constant Field Values
-
SCRIPT_MANAGER_ROLE
static final String SCRIPT_MANAGER_ROLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
addScript
void addScript(String name, String script)
Adds a new named script.- Parameters:
name- the name of the script. The name should contain an extension identifying its languagescript- the source of the script
-
removeScript
void removeScript(String name)
Removes a script.- Parameters:
name- the name of the script ro remove
-
runScript
<T> CompletableFuture<T> runScript(String scriptName)
Runs a named script- Parameters:
scriptName- The name of the script to run. UseaddScript(String, String)to add a script- Returns:
- a
CompletableFuturewhich will return the result of the script execution
-
runScript
<T> CompletableFuture<T> runScript(String scriptName, TaskContext context)
Runs a named script using the specifiedTaskContext- Parameters:
scriptName- The name of the script to run. UseaddScript(String, String)to add a scriptcontext- ATaskContextwithin which the script will be executed- Returns:
- a
CompletableFuturewhich will return the result of the script execution
-
getScript
String getScript(String scriptName)
Retrieves the source code of an existing script.- Parameters:
scriptName- The name of the script- Returns:
- the source code of the script
-
-