Class GremlinLangScriptEngine

  • All Implemented Interfaces:
    ScriptEngine, GremlinScriptEngine

    public class GremlinLangScriptEngine
    extends AbstractScriptEngine
    implements GremlinScriptEngine
    A GremlinScriptEngine implementation that evaluates Gremlin scripts using gremlin-language. As it uses gremlin-language and thus the ANTLR parser, it is not capable of process arbitrary scripts as the GremlinGroovyScriptEngine can and is therefore a more secure Gremlin evaluator. It is obviously restricted to the capabilities of the ANTLR grammar so therefore syntax that includes things like lambdas are not supported. For bytecode evaluation it simply uses the JavaTranslator.

    As an internal note, technically, this is an incomplete implementation of the GremlinScriptEngine in the traditional sense as a drop-in replacement for something like the GremlinGroovyScriptEngine. As a result, this GremlinScriptEngine cannot pass the GremlinScriptEngineSuite tests in full. On the other hand, this limitation is precisely what makes this implementation better from a security perspective. Ultimately, this implementation represents the first step to changes in what it means to have a GremlinScriptEngine. In some sense, there is question why a GremlinScriptEngine approach is necessary at all except for easily plugging into the existing internals of Gremlin Server or more specifically the GremlinExecutor.