Package com.graphdbapi.driver
Class GraphDb
- java.lang.Object
-
- com.graphdbapi.driver.GraphDb
-
public class GraphDb extends Object
图服务入口- Version:
- 3.3.0
-
-
Constructor Summary
Constructors Constructor Description GraphDb()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.graphdbapi.driver.v1.Driverconnect(String uri, String username, String password)连接到数据库static com.graphdbapi.driver.v1.Driverconnect(String uri, String username, String password, Config config)获取driverstatic com.graphdbapi.driver.v1.DriverconnectCluster(String uris, String username, String password)多IP连接路由driverstatic com.graphdbapi.driver.v1.DriverconnectCluster(String uris, String username, String password, Config config)多IP连接路由driverstatic com.graphdbapi.driver.v1.DriverconnectCluster(Set<String> uris, String username, String password)多IP连接路由driverstatic com.graphdbapi.driver.v1.DriverconnectCluster(Set<String> uris, String username, String password, Config config)多IP连接路由driverstatic Graphdriver(com.graphdbapi.driver.v1.Driver driver, String graphName)连接到图服务static Graphdriver(com.graphdbapi.driver.v1.Driver driver, String graphName, LoadBalancingStrategy graphStrategy)通过自定义策略实现不同的负载均衡分发的图(创建driver时应该使用的是cluster协议)static com.graphdbapi.driver.v1.Driverdriver(URI uri, com.graphdbapi.driver.v1.AuthToken token, Config config)static GraphdriverByIndex(com.graphdbapi.driver.v1.Driver driver, int graphIndex)通过图index获取图服务。通过服务端进行验证。static GraphdriverByIndex(com.graphdbapi.driver.v1.Driver driver, int graphIndex, LoadBalancingStrategy graphStrategy)通过图index、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。static GraphdriverByName(com.graphdbapi.driver.v1.Driver driver, String graphName)通过图名字获取图服务。通过服务端进行验证。static GraphdriverByName(com.graphdbapi.driver.v1.Driver driver, String graphName, LoadBalancingStrategy graphStrategy)通过图名字、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。static com.graphdbapi.driver.v1.DriverdriverByRoutingTable(Set<String> uris, String username, String password)根据指定路由表获取路由driver(不允许使用AutoPartitionLoadBalancingStrategy策略)static StringgetDriverVersion()获取driver版本static GraphGroupgetGraphGroup(com.graphdbapi.driver.v1.Driver driver, String... graphNames)连接到图组static Collection<String>graphs(com.graphdbapi.driver.v1.Driver driver)获取图名字static List<MetricInfo>metrics(com.graphdbapi.driver.v1.Driver driver)获取节点的metric信息static GraphnewGraph(com.graphdbapi.driver.v1.Driver driver, String graphName)新建一个图
-
-
-
Method Detail
-
getGraphGroup
public static GraphGroup getGraphGroup(com.graphdbapi.driver.v1.Driver driver, String... graphNames)
连接到图组- Parameters:
driver- 连接graphNames- 图组中图名字- Returns:
- 图组
-
connect
public static com.graphdbapi.driver.v1.Driver connect(String uri, String username, String password)
连接到数据库- Parameters:
uri- 链接地址username- 用户名password- 密码- Returns:
Driver
-
connect
public static com.graphdbapi.driver.v1.Driver connect(String uri, String username, String password, Config config)
获取driver- Parameters:
uri- 链接地址username- 用户名password- 密码config- 配置信息- Returns:
Driver
-
driverByRoutingTable
public static com.graphdbapi.driver.v1.Driver driverByRoutingTable(Set<String> uris, String username, String password)
根据指定路由表获取路由driver(不允许使用AutoPartitionLoadBalancingStrategy策略)- Parameters:
uris- 链接地址集合(格式:127.0.0.1:7687)username- 用户名password- 密码- Returns:
Graph
-
connectCluster
public static com.graphdbapi.driver.v1.Driver connectCluster(Set<String> uris, String username, String password) throws UnknownHostException
多IP连接路由driver- Parameters:
uris- 连接的ip地址集合(例:["192.168.10.125:7687", "192.168.10.126:7687"])username- 用户名password- 密码- Returns:
Driver- Throws:
UnknownHostException
-
connectCluster
public static com.graphdbapi.driver.v1.Driver connectCluster(Set<String> uris, String username, String password, Config config) throws UnknownHostException
多IP连接路由driver- Parameters:
uris- 连接的ip地址集合(例:["192.168.10.125:7687", "192.168.10.126:7687"])username- 用户名password- 密码config-Config配置- Returns:
Driver- Throws:
UnknownHostException
-
connectCluster
public static com.graphdbapi.driver.v1.Driver connectCluster(String uris, String username, String password) throws UnknownHostException
多IP连接路由driver- Parameters:
uris- 多IP的uri字符串(例:"cluster://192.168.10.125:7687,192.168.10.126:7687")username- 用户名password- 密码- Returns:
Driver- Throws:
UnknownHostException
-
connectCluster
public static com.graphdbapi.driver.v1.Driver connectCluster(String uris, String username, String password, Config config) throws UnknownHostException
多IP连接路由driver- Parameters:
uris- 多IP的uri字符串(例:"cluster://192.168.10.125:7687,192.168.10.126:7687")username- 用户名password- 密码config-Config配置- Returns:
Driver- Throws:
UnknownHostException
-
driver
public static Graph driver(com.graphdbapi.driver.v1.Driver driver, String graphName)
连接到图服务- Parameters:
driver- 链接graphName- 图名称- Returns:
Graph
-
driverByName
public static Graph driverByName(com.graphdbapi.driver.v1.Driver driver, String graphName)
通过图名字获取图服务。通过服务端进行验证。- Parameters:
driver- 链接graphName- 图名字- Returns:
Graph
-
driverByName
public static Graph driverByName(com.graphdbapi.driver.v1.Driver driver, String graphName, LoadBalancingStrategy graphStrategy)
通过图名字、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。- Parameters:
driver- 链接(使用的时候保证为routingDriver)graphName- 图名字graphStrategy- 图级别策略- Returns:
Graph
-
driverByIndex
public static Graph driverByIndex(com.graphdbapi.driver.v1.Driver driver, int graphIndex)
通过图index获取图服务。通过服务端进行验证。- Parameters:
driver- 链接graphIndex- 图index- Returns:
Graph
-
driverByIndex
public static Graph driverByIndex(com.graphdbapi.driver.v1.Driver driver, int graphIndex, LoadBalancingStrategy graphStrategy)
通过图index、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。- Parameters:
driver- 链接(使用的时候保证为routingDriver)graphIndex- 图indexgraphStrategy- 图级别策略- Returns:
Graph
-
driver
public static Graph driver(com.graphdbapi.driver.v1.Driver driver, String graphName, LoadBalancingStrategy graphStrategy) throws NoSuchFieldException
通过自定义策略实现不同的负载均衡分发的图(创建driver时应该使用的是cluster协议)- Parameters:
driver- 链接(使用的时候保证为routingDriver)graphName- 图名称graphStrategy- 自定义策略- Returns:
Graph- Throws:
NoSuchFieldException- 使用协议不正确时抛出
-
newGraph
public static Graph newGraph(com.graphdbapi.driver.v1.Driver driver, String graphName)
新建一个图- Parameters:
driver- 链接graphName- 图名称- Returns:
Graph
-
graphs
public static Collection<String> graphs(com.graphdbapi.driver.v1.Driver driver)
获取图名字- Parameters:
driver- 连接- Returns:
- 图名称列表
-
getDriverVersion
public static String getDriverVersion()
获取driver版本- Returns:
- driver版本
-
metrics
public static List<MetricInfo> metrics(com.graphdbapi.driver.v1.Driver driver)
获取节点的metric信息- Parameters:
driver- 连接- Returns:
- 图名称列表
-
-