Class DriverRemoteConnection
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
-
- All Implemented Interfaces:
AutoCloseable,RemoteConnection
public class DriverRemoteConnection extends Object implements RemoteConnection
ARemoteConnectionimplementation for Gremlin Server. EachDriverServerConnectionis 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 StringGREMLIN_REMOTE_DRIVER_CLUSTERFILEstatic StringGREMLIN_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 voidclose()protected static RequestOptionsgetRequestOptions(Bytecode bytecode)<E> CompletableFuture<RemoteTraversal<?,E>>submitAsync(Bytecode bytecode)StringtoString()Transactiontx()Constructs a newDriverRemoteTransaction.static DriverRemoteConnectionusing(String clusterConfFile)Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied configuration file.static DriverRemoteConnectionusing(String host, int port)Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied host and port and binds it to a remoteGraphTraversalSourcenamed "g".static DriverRemoteConnectionusing(String host, int port, String remoteTraversalSourceName)Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied host port and aliases it to the specified remoteGraphTraversalSource.static DriverRemoteConnectionusing(String clusterConfFile, String remoteTraversalSourceName)Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied configuration file.static DriverRemoteConnectionusing(org.apache.commons.configuration2.Configuration conf)Creates aDriverRemoteConnectionusing an ApacheConfigurationobject.static DriverRemoteConnectionusing(Client client)Creates aDriverRemoteConnectionusing an existingClientobject.static DriverRemoteConnectionusing(Client client, String remoteTraversalSourceName)Creates aDriverRemoteConnectionusing an existingClientobject.static DriverRemoteConnectionusing(Cluster cluster)Creates aDriverRemoteConnectionfrom an existingClusterinstance.static DriverRemoteConnectionusing(Cluster cluster, String remoteTraversalSourceName)Creates aDriverRemoteConnectionfrom an existingClusterinstance.
-
-
-
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 aDriverRemoteConnectionusing an existingClientobject. TheClientwill not be closed on calls toclose().
-
using
public static DriverRemoteConnection using(Client client, String remoteTraversalSourceName)
Creates aDriverRemoteConnectionusing an existingClientobject. TheClientwill not be closed on calls toclose().
-
using
public static DriverRemoteConnection using(String host, int port)
Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied host and port and binds it to a remoteGraphTraversalSourcenamed "g". Whenclose()is called, this newClusteris also closed. By default, this method will bind theRemoteConnectionto a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(String host, int port, String remoteTraversalSourceName)
Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied host port and aliases it to the specified remoteGraphTraversalSource. Whenclose()is called, this newClusteris also closed. By default, this method will bind theRemoteConnectionto the specified graph traversal source name.
-
using
public static DriverRemoteConnection using(Cluster cluster)
Creates aDriverRemoteConnectionfrom an existingClusterinstance. Whenclose()is called, theClusteris left open for the caller to close. By default, this method will bind theRemoteConnectionto a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(Cluster cluster, String remoteTraversalSourceName)
Creates aDriverRemoteConnectionfrom an existingClusterinstance. Whenclose()is called, theClusteris left open for the caller to close.
-
using
public static DriverRemoteConnection using(String clusterConfFile)
Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied configuration file. Whenclose()is called, this newClusteris also closed. By default, this method will bind theRemoteConnectionto a graph on the server named "graph".
-
using
public static DriverRemoteConnection using(String clusterConfFile, String remoteTraversalSourceName)
Creates aDriverRemoteConnectionusing a newClusterinstance created from the supplied configuration file. Whenclose()is called, this newClusteris also closed.
-
using
public static DriverRemoteConnection using(org.apache.commons.configuration2.Configuration conf)
Creates aDriverRemoteConnectionusing an ApacheConfigurationobject. TheConfigurationobject should contain one of two required keys, either:clusterConfigurationFileorclusterConfiguration. TheclusterConfigurationFilekey is a pointer to a file location containing a configuration for aCluster. TheclusterConfigurationshould contain the actual contents of a configuration that would be used by aCluster. Thisconfigurationmay also contain the optional, but likely necessary,remoteTraversalSourceNamewhich tells theDriverServerConnectionwhich graph on the server to bind to.
-
submitAsync
public <E> CompletableFuture<RemoteTraversal<?,E>> submitAsync(Bytecode bytecode) throws RemoteConnectionException
Description copied from interface:RemoteConnectionSubmitsTraversalBytecodeto a server and returns a promise of aRemoteTraversal. TheRemoteTraversalis an abstraction over two types of results that can be returned as part of the response from the server: the results of theTraversalitself and the side-effects that it produced.- Specified by:
submitAsyncin interfaceRemoteConnection- Throws:
RemoteConnectionException
-
getRequestOptions
protected static RequestOptions getRequestOptions(Bytecode bytecode)
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
tx
public Transaction tx()
Constructs a newDriverRemoteTransaction.- Specified by:
txin interfaceRemoteConnection
-
-