public class ScriptEngines extends Object implements AutoCloseable
ScriptEngine
objects for the server.Constructor and Description |
---|
ScriptEngines(Consumer<ScriptEngines> initializer) |
Modifier and Type | Method and Description |
---|---|
void |
addImports(Set<String> imports)
Perform append to the existing import list for all
ScriptEngine instances that implement the
DependencyManager interface. |
void |
close() |
CompiledScript |
compile(Reader script,
String language)
Compiles a script without executing it.
|
CompiledScript |
compile(String script,
String language)
Compiles a script without executing it.
|
Map<String,List<Map>> |
dependencies()
List dependencies for those
ScriptEngine objects that implement the DependencyManager interface. |
Object |
eval(Reader reader,
Bindings bindings,
String language)
Evaluate a script with
Bindings for a particular language. |
Object |
eval(String script,
Bindings bindings,
String language)
Evaluate a script with
Bindings for a particular language. |
Map<String,List<Map>> |
imports() |
void |
loadPlugins(List<GremlinPlugin> plugins) |
void |
reload(String language,
Set<String> imports,
Set<String> staticImports,
Map<String,Object> config)
Reload a
ScriptEngine with fresh imports. |
void |
reset()
Resets the ScriptEngines and re-initializes them.
|
List<GremlinPlugin> |
use(String group,
String artifact,
String version)
Pull in dependencies given some Maven coordinates.
|
public ScriptEngines(Consumer<ScriptEngines> initializer)
public Object eval(String script, Bindings bindings, String language) throws ScriptException
Bindings
for a particular language.ScriptException
public Object eval(Reader reader, Bindings bindings, String language) throws ScriptException
Bindings
for a particular language.ScriptException
public CompiledScript compile(String script, String language) throws ScriptException
UnsupportedOperationException
- if the ScriptEngine
implementation does not implement
the Compilable
interface.ScriptException
public CompiledScript compile(Reader script, String language) throws ScriptException
UnsupportedOperationException
- if the ScriptEngine
implementation does not implement
the Compilable
interface.ScriptException
public void reload(String language, Set<String> imports, Set<String> staticImports, Map<String,Object> config)
ScriptEngine
with fresh imports. Waits for any existing script evaluations to complete but
then blocks other operations until complete.public void addImports(Set<String> imports)
ScriptEngine
instances that implement the
DependencyManager
interface. Waits for any existing script evaluations to complete but
then blocks other operations until complete.public List<GremlinPlugin> use(String group, String artifact, String version)
ScriptEngine
and determine if it
implements DependencyManager
. For those that do call the @{link DependencyManager#use} method to fire
it up. Waits for any existing script evaluations to complete but then blocks other operations until complete.public void loadPlugins(List<GremlinPlugin> plugins)
public void close() throws Exception
close
in interface AutoCloseable
Exception
public void reset()
public Map<String,List<Map>> dependencies()
ScriptEngine
objects that implement the DependencyManager
interface.Copyright © 2013–2015 Apache Software Foundation. All rights reserved.