Class ScriptingEngines
- java.lang.Object
-
- org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines
-
- All Implemented Interfaces:
DmnScriptEngineResolver
public class ScriptingEngines extends java.lang.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 aScriptEngine
is 'cachable' if it declares to be threadsafe (see#isCachable(ScriptEngine)
)Custom Bindings: this class supports custom
Bindings
implementations through thescriptBindingsFactory
. SeeScriptBindingsFactory
.- Author:
- Tom Baeyens, Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_JS_SCRIPTING_LANGUAGE
static java.lang.String
DEFAULT_SCRIPTING_LANGUAGE
static java.lang.String
ECMASCRIPT_SCRIPTING_LANGUAGE
protected boolean
enableScriptEngineCaching
static java.lang.String
GRAAL_JS_SCRIPT_ENGINE_NAME
static java.lang.String
GROOVY_SCRIPTING_LANGUAGE
static java.lang.String
JAVASCRIPT_SCRIPTING_LANGUAGE
protected ScriptBindingsFactory
scriptBindingsFactory
protected ScriptEngineResolver
scriptEngineResolver
-
Constructor Summary
Constructors Constructor Description ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory, ScriptEngineResolver scriptEngineResolver)
ScriptingEngines(ScriptEngineResolver scriptEngineResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScriptingEngines
addScriptEngineFactory(javax.script.ScriptEngineFactory scriptEngineFactory)
javax.script.Bindings
createBindings(javax.script.ScriptEngine scriptEngine, VariableScope variableScope)
override to build a spring aware ScriptingEnginesprotected javax.script.ScriptEngine
getGlobalScriptEngine(java.lang.String language)
protected javax.script.ScriptEngine
getPaScriptEngine(java.lang.String language, ProcessApplicationReference pa)
ScriptBindingsFactory
getScriptBindingsFactory()
javax.script.ScriptEngine
getScriptEngineForLanguage(java.lang.String language)
Loads the given script engine by language name.javax.script.ScriptEngineManager
getScriptEngineManager()
boolean
isEnableScriptEngineCaching()
void
setEnableScriptEngineCaching(boolean enableScriptEngineCaching)
void
setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory)
void
setScriptEngineResolver(ScriptEngineResolver scriptEngineResolver)
-
-
-
Field Detail
-
DEFAULT_SCRIPTING_LANGUAGE
public static final java.lang.String DEFAULT_SCRIPTING_LANGUAGE
- See Also:
- Constant Field Values
-
GROOVY_SCRIPTING_LANGUAGE
public static final java.lang.String GROOVY_SCRIPTING_LANGUAGE
- See Also:
- Constant Field Values
-
JAVASCRIPT_SCRIPTING_LANGUAGE
public static final java.lang.String JAVASCRIPT_SCRIPTING_LANGUAGE
- See Also:
- Constant Field Values
-
ECMASCRIPT_SCRIPTING_LANGUAGE
public static final java.lang.String ECMASCRIPT_SCRIPTING_LANGUAGE
- See Also:
- Constant Field Values
-
GRAAL_JS_SCRIPT_ENGINE_NAME
public static final java.lang.String GRAAL_JS_SCRIPT_ENGINE_NAME
- See Also:
- Constant Field Values
-
DEFAULT_JS_SCRIPTING_LANGUAGE
public static final java.lang.String DEFAULT_JS_SCRIPTING_LANGUAGE
- See Also:
- Constant Field Values
-
scriptEngineResolver
protected ScriptEngineResolver scriptEngineResolver
-
scriptBindingsFactory
protected ScriptBindingsFactory scriptBindingsFactory
-
enableScriptEngineCaching
protected boolean enableScriptEngineCaching
-
-
Constructor Detail
-
ScriptingEngines
public ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory, ScriptEngineResolver scriptEngineResolver)
-
ScriptingEngines
public ScriptingEngines(ScriptEngineResolver scriptEngineResolver)
-
-
Method Detail
-
isEnableScriptEngineCaching
public boolean isEnableScriptEngineCaching()
-
setEnableScriptEngineCaching
public void setEnableScriptEngineCaching(boolean enableScriptEngineCaching)
-
getScriptEngineManager
public javax.script.ScriptEngineManager getScriptEngineManager()
-
addScriptEngineFactory
public ScriptingEngines addScriptEngineFactory(javax.script.ScriptEngineFactory scriptEngineFactory)
-
getScriptEngineForLanguage
public javax.script.ScriptEngine getScriptEngineForLanguage(java.lang.String language)
Loads the given script engine by language name. Will throw an exception if no script engine can be loaded for the given language name.- Specified by:
getScriptEngineForLanguage
in interfaceDmnScriptEngineResolver
- Parameters:
language
- the name of the script language to lookup an implementation for- Returns:
- the script engine
- Throws:
ProcessEngineException
- if no such engine can be found.
-
getPaScriptEngine
protected javax.script.ScriptEngine getPaScriptEngine(java.lang.String language, ProcessApplicationReference pa)
-
getGlobalScriptEngine
protected javax.script.ScriptEngine getGlobalScriptEngine(java.lang.String language)
-
createBindings
public javax.script.Bindings createBindings(javax.script.ScriptEngine scriptEngine, VariableScope variableScope)
override to build a spring aware ScriptingEngines- Parameters:
engineBindin
-scriptEngine
-
-
getScriptBindingsFactory
public ScriptBindingsFactory getScriptBindingsFactory()
-
setScriptBindingsFactory
public void setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory)
-
setScriptEngineResolver
public void setScriptEngineResolver(ScriptEngineResolver scriptEngineResolver)
-
-