Package com.lucidworks.apollo.util
Class ScriptEngineFactory
java.lang.Object
com.lucidworks.apollo.util.ScriptEngineFactory
Simple static "factory" for Javascript ScriptEngine instances
ScriptEngine#eval is not thread safe, so we need a thread local to avoid synchronization
See: CAMEL-6559
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompiledScriptcompileScript(ScriptEngine scriptEngine, Function<ScriptEngine, Bindings> bindingsSupplier, String script) static ScriptEngineget()static ScriptEnginestatic CompiledScriptgetCompiledScript(ScriptEngine scriptEngine, String script) static ScriptEnginestatic ScriptEnginegetNewByExtension(String extension) static ScriptEnginegetNewByMimeType(String mimeType) static ScriptEnginegetNewByName(String name) static StringgetWrappedScript(String template, String script, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Takes in the wrapper template and the script and returns the converted scriptstatic booleanDo instances returned by this factory implement Compilable?
-
Field Details
-
OPENJDK_NASHORN_ENGINE
- See Also:
-
DEFAULT_NASHORN_ENGINE
- See Also:
-
-
Constructor Details
-
ScriptEngineFactory
public ScriptEngineFactory()
-
-
Method Details
-
getNewByExtension
-
getNewByMimeType
-
getNew
-
getNewByName
-
get
-
get
-
isCompilable
public static boolean isCompilable()Do instances returned by this factory implement Compilable? -
getWrappedScript
public static String getWrappedScript(String template, String script, com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws Exception Takes in the wrapper template and the script and returns the converted script- Throws:
Exception
-
compileScript
public static CompiledScript compileScript(ScriptEngine scriptEngine, Function<ScriptEngine, Bindings> bindingsSupplier, String script) throws ScriptException- Throws:
ScriptException
-
getCompiledScript
-