Class DefaultScriptEngineResolver
- java.lang.Object
-
- org.camunda.bpm.engine.impl.scripting.engine.DefaultScriptEngineResolver
-
- All Implemented Interfaces:
ScriptEngineResolver
public class DefaultScriptEngineResolver extends java.lang.Object implements ScriptEngineResolver
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,javax.script.ScriptEngine>
cachedEngines
protected javax.script.ScriptEngineManager
scriptEngineManager
-
Constructor Summary
Constructors Constructor Description DefaultScriptEngineResolver(javax.script.ScriptEngineManager scriptEngineManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScriptEngineFactory(javax.script.ScriptEngineFactory scriptEngineFactory)
protected void
configureGraalJsScriptEngine(javax.script.ScriptEngine scriptEngine)
Allows providing custom configuration for the Graal JS script engine.protected void
configureGroovyScriptEngine(javax.script.ScriptEngine scriptEngine)
Allows providing custom configuration for the groovy script engine.protected void
configureScriptEngines(java.lang.String language, javax.script.ScriptEngine scriptEngine)
protected javax.script.ScriptEngine
getJavaScriptScriptEngine(java.lang.String language)
protected javax.script.ScriptEngine
getScriptEngine(java.lang.String language)
javax.script.ScriptEngine
getScriptEngine(java.lang.String language, boolean resolveFromCache)
Returns a cached script engine or creates a new script engine if no such engine is currently cached.javax.script.ScriptEngineManager
getScriptEngineManager()
protected boolean
isCachable(javax.script.ScriptEngine scriptEngine)
Allows checking whether the script engine can be cached.
-
-
-
Method Detail
-
addScriptEngineFactory
public void addScriptEngineFactory(javax.script.ScriptEngineFactory scriptEngineFactory)
- Specified by:
addScriptEngineFactory
in interfaceScriptEngineResolver
-
getScriptEngineManager
public javax.script.ScriptEngineManager getScriptEngineManager()
- Specified by:
getScriptEngineManager
in interfaceScriptEngineResolver
-
getScriptEngine
public javax.script.ScriptEngine getScriptEngine(java.lang.String language, boolean resolveFromCache)
Returns a cached script engine or creates a new script engine if no such engine is currently cached.- Specified by:
getScriptEngine
in interfaceScriptEngineResolver
- Parameters:
language
- the language (such as 'groovy' for the script engine)- Returns:
- the cached engine or null if no script engine can be created for the given language
-
getScriptEngine
protected javax.script.ScriptEngine getScriptEngine(java.lang.String language)
-
getJavaScriptScriptEngine
protected javax.script.ScriptEngine getJavaScriptScriptEngine(java.lang.String language)
-
isCachable
protected boolean isCachable(javax.script.ScriptEngine scriptEngine)
Allows checking whether the script engine can be cached.- Parameters:
scriptEngine
- the script engine to check.- Returns:
- true if the script engine may be cached.
-
configureScriptEngines
protected void configureScriptEngines(java.lang.String language, javax.script.ScriptEngine scriptEngine)
-
configureGroovyScriptEngine
protected void configureGroovyScriptEngine(javax.script.ScriptEngine scriptEngine)
Allows providing custom configuration for the groovy script engine.- Parameters:
scriptEngine
- the groovy script engine to configure.
-
configureGraalJsScriptEngine
protected void configureGraalJsScriptEngine(javax.script.ScriptEngine scriptEngine)
Allows providing custom configuration for the Graal JS script engine.- Parameters:
scriptEngine
- the Graal JS script engine to configure.
-
-