Package com.tinkerpop.gremlin.groovy.jsr223

Examples of com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine


    protected volatile static boolean initiated = false;

    public static ScriptEngine createGremlinScriptEngine(Map<String, Object> context) {
        try {
            ScriptEngine engine = new GremlinGroovyScriptEngine();

            Bindings bindings = new SimpleBindings();
            bindings.putAll(context);

            engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);

            return engine;
        } catch (Throwable e) {
            // Pokemon catch b/c fails here get hidden until the server exits.
            e.printStackTrace();
View Full Code Here


/**
* @author Joshua Shinavier (http://fortytwo.net)
*/
public class GremlinWrapper extends ScriptEngineWrapper {
    public GremlinWrapper() {
        super(new GremlinGroovyScriptEngine());
    }
View Full Code Here

            evaluate(new FileReader(arguments[0]), Arrays.asList(arguments).subList(1, arguments.length));
        }
    }

    protected static void evaluate(final Reader reader, final List<String> arguments) {
        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();

        final Bindings bindings = engine.createBindings();
        bindings.put("args", arguments.toArray());
        // TODO: Deprecate this
        if (arguments.size() > 0) {
            for (int i = 0; i < arguments.size(); i++) {
                bindings.put("a" + (i + 1), arguments.get(i));
            }
        }
        try {
            engine.eval(reader, bindings);
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }

    }
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.