org.apache.tinkerpop.gremlin.process.remote

## Class EmbeddedRemoteConnection

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.remote.EmbeddedRemoteConnection

- All Implemented Interfaces:
    AutoCloseable, RemoteConnection

      public class EmbeddedRemoteConnection
      extends Object
      implements RemoteConnection

  Allows a `RemoteConnection` to be submitted to a "local" `Graph` instance thus simulating a connection to a remote source. Basic usage is as follows:

       // Using TinkerGraph here but any embedded Graph instance would suffice
       Graph graph = TinkerFactory.createModern();
       GraphTraversalSource g = graph.traversal();

       // setup the remote as normal but give it the embedded "g" so that it executes against that
       GraphTraversalSource simulatedRemoteG = TraversalSourceFactory.traversal(new EmbeddedRemoteConnection(g));
       assertEquals(6, simulatedRemoteG.V().count().next().intValue());

  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.remote.RemoteConnection

      `GREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EmbeddedRemoteConnection(GraphTraversalSource g)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `<E> RemoteTraversal<?,E>` | `submit(Bytecode bytecode)` Submits `Traversal` `Bytecode` to a server and returns a `RemoteTraversal`.
    `<E> Iterator<Traverser.Admin<E>>` | `submit(Traversal<?,E> traversal)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.remote.RemoteConnection

      `from, submitAsync`

- - ### Constructor Detail

    - #### EmbeddedRemoteConnection

          public EmbeddedRemoteConnection(GraphTraversalSource g)

  - ### Method Detail

    - #### submit

          public <E> Iterator<Traverser.Admin<E>> submit(Traversal<?,E> traversal)
                                                  throws RemoteConnectionException

      Specified by:
        `submit` in interface `RemoteConnection`
      Throws:
        `RemoteConnectionException`

    - #### submit

          public <E> RemoteTraversal<?,E> submit(Bytecode bytecode)
                                          throws RemoteConnectionException

      Description copied from interface: `RemoteConnection`
      Submits `Traversal` `Bytecode` to a server and returns a `RemoteTraversal`. The `RemoteTraversal` is an abstraction over two types of results that can be returned as part of the response from the server: the results of the `Traversal` itself and the side-effects that it produced.
      Specified by:
        `submit` in interface `RemoteConnection`
      Throws:
        `RemoteConnectionException`

    - #### close

          public void close()
                     throws Exception

      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `Exception`

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.