Search in sources :

Example 1 with RemoteException

use of org.apache.tinkerpop.gremlin.jsr223.console.RemoteException in project cypher-for-gremlin by opencypher.

the class CypherRemoteAcceptor method submit.

@Override
public Object submit(List<String> args) throws RemoteException {
    String line = String.join(" ", args);
    line = DriverRemoteAcceptor.getScript(line, shellEnvironment);
    try {
        final List<Result> resultSet = send(line);
        shellEnvironment.setVariable(RESULT, resultSet);
        return resultSet.stream().map(Result::getObject).iterator();
    } catch (Exception ex) {
        throw new RemoteException(ex);
    }
}
Also used : RemoteException(org.apache.tinkerpop.gremlin.jsr223.console.RemoteException) IOException(java.io.IOException) RemoteException(org.apache.tinkerpop.gremlin.jsr223.console.RemoteException) Result(org.apache.tinkerpop.gremlin.driver.Result)

Example 2 with RemoteException

use of org.apache.tinkerpop.gremlin.jsr223.console.RemoteException in project cypher-for-gremlin by opencypher.

the class CypherRemoteAcceptor method getField.

@SuppressWarnings("unchecked")
private static <T> T getField(Object obj, String fieldName) throws RemoteException {
    try {
        Field field = obj.getClass().getDeclaredField(fieldName);
        field.setAccessible(true);
        return (T) field.get(obj);
    } catch (NoSuchFieldException | IllegalAccessException e) {
        throw new RemoteException(e);
    }
}
Also used : Field(java.lang.reflect.Field) NO_TIMEOUT(org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.NO_TIMEOUT) RemoteException(org.apache.tinkerpop.gremlin.jsr223.console.RemoteException)

Aggregations

RemoteException (org.apache.tinkerpop.gremlin.jsr223.console.RemoteException)2 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 NO_TIMEOUT (org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.NO_TIMEOUT)1 Result (org.apache.tinkerpop.gremlin.driver.Result)1