org.apache.tinkerpop.gremlin.driver.remote

## Class DriverRemoteConnection

- java.lang.Object
- - org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection

- All Implemented Interfaces:
    AutoCloseable, RemoteConnection

      public class DriverRemoteConnection
      extends Object
      implements RemoteConnection

  A `RemoteConnection` implementation for Gremlin Server. Each `DriverServerConnection` is bound to one graph instance hosted in Gremlin Server.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `GREMLIN_REMOTE_DRIVER_CLUSTERFILE`
    `static String` | `GREMLIN_REMOTE_DRIVER_SOURCENAME`

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

      `GREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DriverRemoteConnection(Configuration conf)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected static RequestOptions` | `getRequestOptions(Bytecode bytecode)`
    `<E> CompletableFuture<RemoteTraversal<?,E>>` | `submitAsync(Bytecode bytecode)` Submits `Traversal` `Bytecode` to a server and returns a promise of a `RemoteTraversal`.
    `String` | `toString()`
    `Transaction` | `tx()` Constructs a new `DriverRemoteTransaction`.
    `static DriverRemoteConnection` | `using(Client client)` Creates a `DriverRemoteConnection` using an existing `Client` object.
    `static DriverRemoteConnection` | `using(Client client, String remoteTraversalSourceName)` Creates a `DriverRemoteConnection` using an existing `Client` object.
    `static DriverRemoteConnection` | `using(Cluster cluster)` Creates a `DriverRemoteConnection` from an existing `Cluster` instance.
    `static DriverRemoteConnection` | `using(Cluster cluster, String remoteTraversalSourceName)` Creates a `DriverRemoteConnection` from an existing `Cluster` instance.
    `static DriverRemoteConnection` | `using(Configuration conf)` Creates a `DriverRemoteConnection` using an Apache `Configuration` object.
    `static DriverRemoteConnection` | `using(String clusterConfFile)` Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied configuration file.
    `static DriverRemoteConnection` | `using(String host, int port)` Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied host and port and binds it to a remote `GraphTraversalSource` named "g".
    `static DriverRemoteConnection` | `using(String host, int port, String remoteTraversalSourceName)` Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied host port and aliases it to the specified remote `GraphTraversalSource`.
    `static DriverRemoteConnection` | `using(String clusterConfFile, String remoteTraversalSourceName)` Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied configuration file.

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

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

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

      `from`

- - ### Field Detail

    - #### GREMLIN_REMOTE_DRIVER_CLUSTERFILE

          public static final String GREMLIN_REMOTE_DRIVER_CLUSTERFILE

      See Also:
        Constant Field Values

    - #### GREMLIN_REMOTE_DRIVER_SOURCENAME

          public static final String GREMLIN_REMOTE_DRIVER_SOURCENAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DriverRemoteConnection

          public DriverRemoteConnection(Configuration conf)

  - ### Method Detail

    - #### using

          public static DriverRemoteConnection using(Client client)

      Creates a `DriverRemoteConnection` using an existing `Client` object. The `Client` will not be closed on calls to `close()`.

    - #### using

          public static DriverRemoteConnection using(Client client,
                                                     String remoteTraversalSourceName)

      Creates a `DriverRemoteConnection` using an existing `Client` object. The `Client` will not be closed on calls to `close()`.

    - #### using

          public static DriverRemoteConnection using(String host,
                                                     int port)

      Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied host and port and binds it to a remote `GraphTraversalSource` named "g". When `close()` is called, this new `Cluster` is also closed. By default, this method will bind the `RemoteConnection` to a graph on the server named "graph".

    - #### using

          public static DriverRemoteConnection using(String host,
                                                     int port,
                                                     String remoteTraversalSourceName)

      Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied host port and aliases it to the specified remote `GraphTraversalSource`. When `close()` is called, this new `Cluster` is also closed. By default, this method will bind the `RemoteConnection` to the specified graph traversal source name.

    - #### using

          public static DriverRemoteConnection using(Cluster cluster)

      Creates a `DriverRemoteConnection` from an existing `Cluster` instance. When `close()` is called, the `Cluster` is left open for the caller to close. By default, this method will bind the `RemoteConnection` to a graph on the server named "graph".

    - #### using

          public static DriverRemoteConnection using(Cluster cluster,
                                                     String remoteTraversalSourceName)

      Creates a `DriverRemoteConnection` from an existing `Cluster` instance. When `close()` is called, the `Cluster` is left open for the caller to close.

    - #### using

          public static DriverRemoteConnection using(String clusterConfFile)

      Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied configuration file. When `close()` is called, this new `Cluster` is also closed. By default, this method will bind the `RemoteConnection` to a graph on the server named "graph".

    - #### using

          public static DriverRemoteConnection using(String clusterConfFile,
                                                     String remoteTraversalSourceName)

      Creates a `DriverRemoteConnection` using a new `Cluster` instance created from the supplied configuration file. When `close()` is called, this new `Cluster` is also closed.

    - #### using

          public static DriverRemoteConnection using(Configuration conf)

      Creates a `DriverRemoteConnection` using an Apache `Configuration` object. The `Configuration` object should contain one of two required keys, either: `clusterConfigurationFile` or `clusterConfiguration`. The `clusterConfigurationFile` key is a pointer to a file location containing a configuration for a `Cluster`. The `clusterConfiguration` should contain the actual contents of a configuration that would be used by a `Cluster`. This `configuration` may also contain the optional, but likely necessary, `remoteTraversalSourceName` which tells the `DriverServerConnection` which graph on the server to bind to.

    - #### submitAsync

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

      Description copied from interface: `RemoteConnection`
      Submits `Traversal` `Bytecode` to a server and returns a promise of 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:
        `submitAsync` in interface `RemoteConnection`
      Throws:
        `RemoteConnectionException`

    - #### getRequestOptions

          protected static RequestOptions getRequestOptions(Bytecode bytecode)

    - #### close

          public void close()
                     throws Exception

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

    - #### tx

          public Transaction tx()

      Constructs a new `DriverRemoteTransaction`.
      Specified by:
        `tx` in interface `RemoteConnection`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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