|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines
public class ScriptingEngines
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.
| Field Summary | |
|---|---|
protected Map<String,ScriptEngine> |
cachedEngines
|
static String |
DEFAULT_SCRIPTING_LANGUAGE
|
protected boolean |
enableScriptEngineCaching
|
static String |
GROOVY_SCRIPTING_LANGUAGE
|
protected ScriptBindingsFactory |
scriptBindingsFactory
|
| Constructor Summary | |
|---|---|
ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory)
|
|
ScriptingEngines(ScriptEngineManager scriptEngineManager)
|
|
| Method Summary | |
|---|---|
ScriptingEngines |
addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory)
|
CompiledScript |
compile(String language,
String src)
Used to compile a script provided as String into an engine-specific CompiledScript. |
protected void |
configureGroovyScriptEngine(ScriptEngine scriptEngine)
Allows providing custom configuration for the groovy script engine. |
Bindings |
createBindings(ScriptEngine scriptEngine,
VariableScope variableScope)
override to build a spring aware ScriptingEngines |
Set<String> |
getAllSupportedLanguages()
|
protected ScriptEngine |
getCachedScriptEngine(String language)
Returns a cached script engine or creates a new script engine if no such engine is currently cached. |
ScriptBindingsFactory |
getScriptBindingsFactory()
|
ScriptEngine |
getScriptEngineForLanguage(String language)
Loads the given script engine by language name. |
protected boolean |
isCachable(ScriptEngine scriptEngine)
Allows checking whether the script engine can be cached. |
boolean |
isEnableScriptEngineCaching()
|
void |
setEnableScriptEngineCaching(boolean cacheScriptEngines)
|
void |
setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory)
|
void |
setScriptEngineFactories(List<ScriptEngineFactory> scriptEngineFactories)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_SCRIPTING_LANGUAGE
public static final String GROOVY_SCRIPTING_LANGUAGE
protected ScriptBindingsFactory scriptBindingsFactory
protected Map<String,ScriptEngine> cachedEngines
protected boolean enableScriptEngineCaching
| Constructor Detail |
|---|
public ScriptingEngines(ScriptBindingsFactory scriptBindingsFactory)
public ScriptingEngines(ScriptEngineManager scriptEngineManager)
| Method Detail |
|---|
public void setEnableScriptEngineCaching(boolean cacheScriptEngines)
public boolean isEnableScriptEngineCaching()
public ScriptingEngines addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory)
public void setScriptEngineFactories(List<ScriptEngineFactory> scriptEngineFactories)
public CompiledScript compile(String language,
String src)
Used to compile a script provided as String into an engine-specific CompiledScript.
Note on caching of compiled scripts: only cache the returned script if
enableScriptEngineCaching is set to 'true'. Depending on the implementation, the compiled
script will keep references to the script engine which created it.
language - the script language in which the script is writtensrc - a string of the source of the script
CompiledScript or null if script engine can be found but does not support compilation.
ProcessEngineException - if no ScriptEngine can be resolved for the provided language or
if the script cannot be compiled (syntax error ...).public ScriptEngine getScriptEngineForLanguage(String language)
language - the name of the script language to lookup an implementation for
ProcessEngineException - if no such engine can be found.public Set<String> getAllSupportedLanguages()
protected ScriptEngine getCachedScriptEngine(String language)
language - the language (such as 'groovy' for the script engine)
protected boolean isCachable(ScriptEngine scriptEngine)
scriptEngine - the script engine to check.
protected void configureGroovyScriptEngine(ScriptEngine scriptEngine)
scriptEngine - the groovy script engine to configure.
public Bindings createBindings(ScriptEngine scriptEngine,
VariableScope variableScope)
engineBindings - scriptEngine - public ScriptBindingsFactory getScriptBindingsFactory()
public void setScriptBindingsFactory(ScriptBindingsFactory scriptBindingsFactory)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||