public class ScriptingEngines extends Object implements DmnScriptEngineResolver
Manager for JSR-223 ScriptEngine
handling.
Resolving a script engine:
This class supports resolving a script engine for a given 'language name' (eg. 'groovy').
If the configuration option enableScriptEngineCaching
is set to true,
the class will attempt to cache 'cachable' script engines. We assume a ScriptEngine
is
'cachable' if it declares to be threadsafe (see #isCachable(ScriptEngine)
)
Custom Bindings: this class supports custom Bindings
implementations through the scriptBindingsFactory
. See ScriptBindingsFactory
.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SCRIPTING_LANGUAGE |
protected boolean |
enableScriptEngineCaching |
static String |
GROOVY_SCRIPTING_LANGUAGE |
protected ScriptBindingsFactory |
scriptBindingsFactory |
protected ScriptEngineResolver |
scriptEngineResolver |
Constructor and Description |
---|
ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory) |
ScriptingEngines(ScriptEngineManager scriptEngineManager) |
Modifier and Type | Method and Description |
---|---|
ScriptingEngines |
addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory) |
Bindings |
createBindings(ScriptEngine scriptEngine,
VariableScope variableScope)
override to build a spring aware ScriptingEngines
|
protected ScriptEngine |
getGlobalScriptEngine(String language) |
protected ScriptEngine |
getPaScriptEngine(String language,
ProcessApplicationReference pa) |
ScriptBindingsFactory |
getScriptBindingsFactory() |
ScriptEngine |
getScriptEngineForLanguage(String language)
Loads the given script engine by language name.
|
ScriptEngineManager |
getScriptEngineManager() |
boolean |
isEnableScriptEngineCaching() |
void |
setEnableScriptEngineCaching(boolean enableScriptEngineCaching) |
void |
setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory) |
public static final String DEFAULT_SCRIPTING_LANGUAGE
public static final String GROOVY_SCRIPTING_LANGUAGE
protected ScriptEngineResolver scriptEngineResolver
protected ScriptBindingsFactory scriptBindingsFactory
protected boolean enableScriptEngineCaching
public ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory)
public ScriptingEngines(ScriptEngineManager scriptEngineManager)
public boolean isEnableScriptEngineCaching()
public void setEnableScriptEngineCaching(boolean enableScriptEngineCaching)
public ScriptEngineManager getScriptEngineManager()
public ScriptingEngines addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory)
public ScriptEngine getScriptEngineForLanguage(String language)
getScriptEngineForLanguage
in interface DmnScriptEngineResolver
language
- the name of the script language to lookup an implementation forProcessEngineException
- if no such engine can be found.protected ScriptEngine getPaScriptEngine(String language, ProcessApplicationReference pa)
protected ScriptEngine getGlobalScriptEngine(String language)
public Bindings createBindings(ScriptEngine scriptEngine, VariableScope variableScope)
engineBindin
- scriptEngine
- public ScriptBindingsFactory getScriptBindingsFactory()
public void setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory)
Copyright © 2019. All rights reserved.