Class DriverRemoteConnection
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
-
- All Implemented Interfaces:
AutoCloseable
,RemoteConnection
public class DriverRemoteConnection extends Object implements RemoteConnection
ARemoteConnection
implementation for Gremlin Server. EachDriverServerConnection
is bound to one graph instance hosted in Gremlin Server.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
-
-
Field Summary
Fields Modifier and Type Field 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 Description DriverRemoteConnection(org.apache.commons.configuration2.Configuration conf)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
<E> CompletableFuture<RemoteTraversal<?,E>>
submitAsync(Bytecode bytecode)
String
toString()
Transaction
tx()
Constructs a newDriverRemoteTransaction
.static DriverRemoteConnection
using(String clusterConfFile)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied configuration file.static DriverRemoteConnection
using(String host, int port)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied host and port and binds it to a remoteGraphTraversalSource
named "g".static DriverRemoteConnection
using(String host, int port, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied host port and aliases it to the specified remoteGraphTraversalSource
.static DriverRemoteConnection
using(String clusterConfFile, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied configuration file.static DriverRemoteConnection
using(org.apache.commons.configuration2.Configuration conf)
Creates aDriverRemoteConnection
using an ApacheConfiguration
object.static DriverRemoteConnection
using(Client client)
Creates aDriverRemoteConnection
using an existingClient
object.static DriverRemoteConnection
using(Client client, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using an existingClient
object.static DriverRemoteConnection
using(Cluster cluster)
Creates aDriverRemoteConnection
from an existingCluster
instance.static DriverRemoteConnection
using(Cluster cluster, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
from an existingCluster
instance.
-
-
-
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
-
-
Method Detail
-
using
public static DriverRemoteConnection using(Client client)
Creates aDriverRemoteConnection
using an existingClient
object. TheClient
will not be closed on calls toclose()
.
-
using
public static DriverRemoteConnection using(Client client, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using an existingClient
object. TheClient
will not be closed on calls toclose()
.
-
using
public static DriverRemoteConnection using(String host, int port)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied host and port and binds it to a remoteGraphTraversalSource
named "g". Whenclose()
is called, this newCluster
is also closed. By default, this method will bind theRemoteConnection
to a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(String host, int port, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied host port and aliases it to the specified remoteGraphTraversalSource
. Whenclose()
is called, this newCluster
is also closed. By default, this method will bind theRemoteConnection
to the specified graph traversal source name.
-
using
public static DriverRemoteConnection using(Cluster cluster)
Creates aDriverRemoteConnection
from an existingCluster
instance. Whenclose()
is called, theCluster
is left open for the caller to close. By default, this method will bind theRemoteConnection
to a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(Cluster cluster, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
from an existingCluster
instance. Whenclose()
is called, theCluster
is left open for the caller to close.
-
using
public static DriverRemoteConnection using(String clusterConfFile)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied configuration file. Whenclose()
is called, this newCluster
is also closed. By default, this method will bind theRemoteConnection
to a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(String clusterConfFile, String remoteTraversalSourceName)
Creates aDriverRemoteConnection
using a newCluster
instance created from the supplied configuration file. Whenclose()
is called, this newCluster
is also closed.
-
using
public static DriverRemoteConnection using(org.apache.commons.configuration2.Configuration conf)
Creates aDriverRemoteConnection
using an ApacheConfiguration
object. TheConfiguration
object should contain one of two required keys, either:clusterConfigurationFile
orclusterConfiguration
. TheclusterConfigurationFile
key is a pointer to a file location containing a configuration for aCluster
. TheclusterConfiguration
should contain the actual contents of a configuration that would be used by aCluster
. Thisconfiguration
may also contain the optional, but likely necessary,remoteTraversalSourceName
which tells theDriverServerConnection
which graph on the server to bind to.
-
submitAsync
public <E> CompletableFuture<RemoteTraversal<?,E>> submitAsync(Bytecode bytecode) throws RemoteConnectionException
Description copied from interface:RemoteConnection
SubmitsTraversal
Bytecode
to a server and returns a promise of aRemoteTraversal
. TheRemoteTraversal
is an abstraction over two types of results that can be returned as part of the response from the server: the results of theTraversal
itself and the side-effects that it produced.- Specified by:
submitAsync
in interfaceRemoteConnection
- Throws:
RemoteConnectionException
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
tx
public Transaction tx()
Constructs a newDriverRemoteTransaction
.- Specified by:
tx
in interfaceRemoteConnection
-
-