Java Code Examples for org.apache.atlas.AtlasErrorCode#GREMLIN_SCRIPT_EXECUTION_FAILED

The following examples show how to use org.apache.atlas.AtlasErrorCode#GREMLIN_SCRIPT_EXECUTION_FAILED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasJanusGraph.java    From atlas with Apache License 2.0 6 votes vote down vote up
private Object executeGremlinScript(String gremlinQuery) throws AtlasBaseException {
    GremlinGroovyScriptEngine scriptEngine = getGremlinScriptEngine();

    try {
        Bindings bindings = scriptEngine.createBindings();

        bindings.put("graph", getGraph());
        bindings.put("g", getGraph().traversal());

        Object result = scriptEngine.eval(gremlinQuery, bindings);

        return result;
    } catch (ScriptException e) {
        throw new AtlasBaseException(AtlasErrorCode.GREMLIN_SCRIPT_EXECUTION_FAILED, e, gremlinQuery);
    } finally {
        releaseGremlinScriptEngine(scriptEngine);
    }
}
 
Example 2
Source File: Titan1Graph.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private Object executeGremlinScript(String gremlinQuery) throws AtlasBaseException {
    GremlinGroovyScriptEngine scriptEngine = getGremlinScriptEngine();

    try {
        Bindings bindings = scriptEngine.createBindings();

        bindings.put("graph", getGraph());
        bindings.put("g", getGraph().traversal());

        Object result = scriptEngine.eval(gremlinQuery, bindings);

        return result;
    } catch (ScriptException e) {
        throw new AtlasBaseException(AtlasErrorCode.GREMLIN_SCRIPT_EXECUTION_FAILED, gremlinQuery);
    } finally {
        releaseGremlinScriptEngine(scriptEngine);
    }
}
 
Example 3
Source File: Titan0Graph.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private Object executeGremlinScript(String gremlinQuery) throws AtlasBaseException {
    Object       result = null;
    ScriptEngine engine = getGremlinScriptEngine();

    try {
        Bindings bindings = engine.createBindings();

        bindings.put("g", getGraph());

        result = engine.eval(gremlinQuery, bindings);
    } catch (ScriptException e) {
        throw new AtlasBaseException(AtlasErrorCode.GREMLIN_SCRIPT_EXECUTION_FAILED, gremlinQuery);
    } finally {
        releaseGremlinScriptEngine(engine);
    }

    return result;
}