Class RemoteGraph

java.lang.Object
org.apache.tinkerpop.gremlin.structure.RemoteGraph
All Implemented Interfaces:
AutoCloseable, Graph, Host

public class RemoteGraph extends Object implements Graph
RemoteGraph is only required for integrating with the test suite as there must be a Graph instance for the test suite to bind to. Test suites that use this must ensure that the TraversalSource be generated from their GraphProvider in via AnonymousTraversalSource.withRemote(RemoteConnection) or similar overload. See RemoteGraphProvider in the gremlin-server module for an example.
Author:
Stephen Mallette (http://stephen.genoprime.com)
  • Method Details

    • open

      public static RemoteGraph open(org.apache.commons.configuration2.Configuration conf)
      Creates a new RemoteGraph instance using the specified configuration, which allows RemoteGraph to be compliant with GraphFactory. Expects key for RemoteConnection.GREMLIN_REMOTE_CONNECTION_CLASS as well as any configuration required by the underlying RemoteConnection which will be instantiated. Note that the Configuration object is passed down without change to the creation of the RemoteConnection instance.
    • open

      public static RemoteGraph open(String configFile) throws Exception
      Throws:
      Exception
    • open

      public static RemoteGraph open(RemoteConnection connection, org.apache.commons.configuration2.Configuration conf)
      Creates a new RemoteGraph instance. RemoteGraph will attempt to call the AutoCloseable.close() method when the close() method is called on this class.
      Parameters:
      connection - the RemoteConnection instance to use RemoteConnection
    • getConnection

      public RemoteConnection getConnection()
    • close

      public void close() throws Exception
      Closes the underlying RemoteConnection.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Graph
      Throws:
      Exception
    • addVertex

      public Vertex addVertex(Object... keyValues)
      Description copied from interface: Graph
      Add a Vertex to the graph given an optional series of key/value pairs. These key/values must be provided in an even number where the odd numbered arguments are String property keys and the even numbered arguments are the related property values.
      Specified by:
      addVertex in interface Graph
      Parameters:
      keyValues - The key/value pairs to turn into vertex properties
      Returns:
      The newly created vertex
    • compute

      public <C extends GraphComputer> C compute(Class<C> graphComputerClass) throws IllegalArgumentException
      Description copied from interface: Graph
      Declare the GraphComputer to use for OLAP operations on the graph. If the graph does not support graph computer then an UnsupportedOperationException is thrown.
      Specified by:
      compute in interface Graph
      Parameters:
      graphComputerClass - The graph computer class to use.
      Returns:
      A graph computer for processing this graph
      Throws:
      IllegalArgumentException - if the provided GraphComputer class is not supported.
    • compute

      public GraphComputer compute() throws IllegalArgumentException
      Description copied from interface: Graph
      Generate a GraphComputer using the default engine of the underlying graph system. This is a shorthand method for the more involved method that uses Graph.compute(Class).
      Specified by:
      compute in interface Graph
      Returns:
      A default graph computer
      Throws:
      IllegalArgumentException - if there is no default graph computer
    • vertices

      public Iterator<Vertex> vertices(Object... vertexIds)
      This method returns an empty Iterator - it is not meant to be called directly.
      Specified by:
      vertices in interface Graph
      Parameters:
      vertexIds - the ids of the vertices to get
      Returns:
      an Iterator of vertices that match the provided vertex ids
    • edges

      public Iterator<Edge> edges(Object... edgeIds)
      This method returns an empty Iterator - it is not meant to be called directly.
      Specified by:
      edges in interface Graph
      Parameters:
      edgeIds - the ids of the edges to get
      Returns:
      an Iterator of edges that match the provided edge ids
    • tx

      public Transaction tx()
      Description copied from interface: Graph
      Configure and control the transactions for those graphs that support this feature.
      Specified by:
      tx in interface Graph
    • variables

      public Graph.Variables variables()
      Description copied from interface: Graph
      A collection of global Graph.Variables associated with the graph. Variables are used for storing metadata about the graph.
      Specified by:
      variables in interface Graph
      Returns:
      The variables associated with this graph
    • configuration

      public org.apache.commons.configuration2.Configuration configuration()
      Description copied from interface: Graph
      Get the Configuration associated with the construction of this graph. Whatever configuration was passed to GraphFactory.open(Configuration) is what should be returned by this method.
      Specified by:
      configuration in interface Graph
      Returns:
      the configuration used during graph construction.
    • features

      public Graph.Features features()
      Description copied from interface: Graph
      Gets the Graph.Features exposed by the underlying Graph implementation.
      Specified by:
      features in interface Graph
    • toString

      public String toString()
      Overrides:
      toString in class Object