Refactor script context generic types (elastic/x-pack-elasticsearch#1547)
This is the xpack side of https://github.com/elastic/elasticsearch/pull/24877 Original commit: elastic/x-pack-elasticsearch@4f3a1a27e6
This commit is contained in:
parent
463c337d62
commit
3b58334efb
|
@ -182,11 +182,11 @@ public class Watcher implements ActionPlugin {
|
||||||
public static final Setting<TimeValue> MAX_STOP_TIMEOUT_SETTING =
|
public static final Setting<TimeValue> MAX_STOP_TIMEOUT_SETTING =
|
||||||
Setting.timeSetting("xpack.watcher.stop.timeout", TimeValue.timeValueSeconds(30), Setting.Property.NodeScope);
|
Setting.timeSetting("xpack.watcher.stop.timeout", TimeValue.timeValueSeconds(30), Setting.Property.NodeScope);
|
||||||
|
|
||||||
public static final ScriptContext<SearchScript, SearchScript.Compiled> SCRIPT_SEARCH_CONTEXT =
|
public static final ScriptContext<SearchScript.Compiled> SCRIPT_SEARCH_CONTEXT =
|
||||||
new ScriptContext<>("xpack", SearchScript.class, SearchScript.Compiled.class);
|
new ScriptContext<>("xpack", SearchScript.Compiled.class);
|
||||||
// TODO: remove this context when each xpack script use case has their own contexts
|
// TODO: remove this context when each xpack script use case has their own contexts
|
||||||
public static final ScriptContext<ExecutableScript, ExecutableScript.Compiled> SCRIPT_EXECUTABLE_CONTEXT
|
public static final ScriptContext<ExecutableScript.Compiled> SCRIPT_EXECUTABLE_CONTEXT
|
||||||
= new ScriptContext<>("xpack_executable", ExecutableScript.class, ExecutableScript.Compiled.class);
|
= new ScriptContext<>("xpack_executable", ExecutableScript.Compiled.class);
|
||||||
|
|
||||||
private static final Logger logger = Loggers.getLogger(Watcher.class);
|
private static final Logger logger = Loggers.getLogger(Watcher.class);
|
||||||
private WatcherIndexingListener listener;
|
private WatcherIndexingListener listener;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class WatcherTemplateIT extends ESTestCase {
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
MustacheScriptEngine engine = new MustacheScriptEngine();
|
MustacheScriptEngine engine = new MustacheScriptEngine();
|
||||||
Map<String, ScriptEngine> engines = Collections.singletonMap(engine.getType(), engine);
|
Map<String, ScriptEngine> engines = Collections.singletonMap(engine.getType(), engine);
|
||||||
Map<String, ScriptContext<?, ?>> contexts =
|
Map<String, ScriptContext<?>> contexts =
|
||||||
Collections.singletonMap(Watcher.SCRIPT_EXECUTABLE_CONTEXT.name, Watcher.SCRIPT_EXECUTABLE_CONTEXT);
|
Collections.singletonMap(Watcher.SCRIPT_EXECUTABLE_CONTEXT.name, Watcher.SCRIPT_EXECUTABLE_CONTEXT);
|
||||||
ScriptService scriptService = new ScriptService(Settings.EMPTY, engines, contexts);
|
ScriptService scriptService = new ScriptService(Settings.EMPTY, engines, contexts);
|
||||||
textTemplateEngine = new TextTemplateEngine(Settings.EMPTY, scriptService);
|
textTemplateEngine = new TextTemplateEngine(Settings.EMPTY, scriptService);
|
||||||
|
|
Loading…
Reference in New Issue