Package com.arangodb
Class ArangoDB.Builder
- java.lang.Object
-
- com.arangodb.ArangoDB.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArangoDB.BuilderacquireHostList(Boolean acquireHostList)Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single server with active failover.ArangoDB.BuilderacquireHostListInterval(Integer acquireHostListInterval)Setting the Interval for acquireHostListArangoDB.BuilderasyncExecutor(Executor executor)Sets the downstream async executor that will be used to consume the responses of the async API, that are returned asCompletableFutureArangoDBbuild()Returns an instance ofArangoDB.ArangoDB.BuilderchunkSize(Integer chunkSize)Sets the chunk size whenProtocol.VSTis used.ArangoDB.BuilderconnectionTtl(Long connectionTtl)Set the maximum time to life of a connection.protected com.arangodb.internal.net.HostHandlercreateHostHandler(com.arangodb.internal.net.HostResolver hostResolver)protected Collection<com.arangodb.internal.net.Host>createHostList(com.arangodb.internal.net.ConnectionFactory connectionFactory)protected com.arangodb.internal.net.HostResolvercreateHostResolver(Collection<com.arangodb.internal.net.Host> hosts, com.arangodb.internal.net.ConnectionFactory connectionFactory)ArangoDB.Builderhost(String host, int port)Adds a host to connect to.ArangoDB.Builderjwt(String jwt)Sets the JWT for the user authentication.ArangoDB.BuilderkeepAliveInterval(Integer keepAliveInterval)Set the keep-alive interval for VST connections.ArangoDB.BuilderloadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)Sets the load balancing strategy to be used in an ArangoDB cluster setup.ArangoDB.BuilderloadProperties(ArangoConfigProperties properties)ArangoDB.BuildermaxConnections(Integer maxConnections)Sets the maximum number of connections the built in connection pool will open per host.ArangoDB.Builderpassword(String password)Sets the password for the user for authentication.ArangoDB.Builderprotocol(Protocol protocol)protected com.arangodb.internal.net.ProtocolProviderprotocolProvider(Protocol protocol)ArangoDB.BuilderresponseQueueTimeSamples(Integer responseQueueTimeSamples)Setting the amount of samples kept for queue time metricsArangoDB.Builderserde(ArangoSerde serde)Sets the serde for the user data.ArangoDB.BuildersslContext(SSLContext sslContext)Sets the SSL context to be used whentrueis passed throughuseSsl(Boolean).ArangoDB.Buildertimeout(Integer timeout)Sets the connection and request timeout in milliseconds.ArangoDB.Builderuser(String user)Sets the username to use for authentication.ArangoDB.BuilderuseSsl(Boolean useSsl)If set totrueSSL will be used when connecting to an ArangoDB server.ArangoDB.BuilderverifyHost(Boolean verifyHost)Set whether hostname verification is enabled
-
-
-
Method Detail
-
loadProperties
public ArangoDB.Builder loadProperties(ArangoConfigProperties properties)
-
protocol
public ArangoDB.Builder protocol(Protocol protocol)
-
host
public ArangoDB.Builder host(String host, int port)
Adds a host to connect to. Multiple hosts can be added to provide fallbacks.- Parameters:
host- address of the hostport- port of the host- Returns:
ArangoDB.Builder
-
timeout
public ArangoDB.Builder timeout(Integer timeout)
Sets the connection and request timeout in milliseconds.- Parameters:
timeout- timeout in milliseconds- Returns:
ArangoDB.Builder
-
user
public ArangoDB.Builder user(String user)
Sets the username to use for authentication.- Parameters:
user- the user in the database (default:root)- Returns:
ArangoDB.Builder
-
password
public ArangoDB.Builder password(String password)
Sets the password for the user for authentication.- Parameters:
password- the password of the user in the database (default:null)- Returns:
ArangoDB.Builder
-
jwt
public ArangoDB.Builder jwt(String jwt)
Sets the JWT for the user authentication.- Parameters:
jwt- token to use (default:null)- Returns:
ArangoDB.Builder
-
useSsl
public ArangoDB.Builder useSsl(Boolean useSsl)
If set totrueSSL will be used when connecting to an ArangoDB server.- Parameters:
useSsl- whether or not use SSL (default:false)- Returns:
ArangoDB.Builder
-
sslContext
public ArangoDB.Builder sslContext(SSLContext sslContext)
Sets the SSL context to be used whentrueis passed throughuseSsl(Boolean).- Parameters:
sslContext- SSL context to be used- Returns:
ArangoDB.Builder
-
verifyHost
public ArangoDB.Builder verifyHost(Boolean verifyHost)
Set whether hostname verification is enabled- Parameters:
verifyHost-trueif enabled- Returns:
ArangoDB.Builder
-
chunkSize
public ArangoDB.Builder chunkSize(Integer chunkSize)
Sets the chunk size whenProtocol.VSTis used.- Parameters:
chunkSize- size of a chunk in bytes- Returns:
ArangoDB.Builder
-
maxConnections
public ArangoDB.Builder maxConnections(Integer maxConnections)
Sets the maximum number of connections the built in connection pool will open per host.Defaults:
Protocol.VST== 1Protocol.HTTP_JSON== 20Protocol.HTTP_VPACK== 20- Parameters:
maxConnections- max number of connections- Returns:
ArangoDB.Builder
-
connectionTtl
public ArangoDB.Builder connectionTtl(Long connectionTtl)
Set the maximum time to life of a connection. After this time the connection will be closed automatically.- Parameters:
connectionTtl- the maximum time to life of a connection in milliseconds- Returns:
ArangoDB.Builder
-
keepAliveInterval
public ArangoDB.Builder keepAliveInterval(Integer keepAliveInterval)
Set the keep-alive interval for VST connections. If set, every VST connection will perform a no-op request everykeepAliveIntervalseconds, to avoid to be closed due to inactivity by the server (or by the external environment, eg. firewall, intermediate routers, operating system).- Parameters:
keepAliveInterval- interval in seconds- Returns:
ArangoDB.Builder
-
acquireHostList
public ArangoDB.Builder acquireHostList(Boolean acquireHostList)
Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single server with active failover. In case of Active-Failover deployment set totrueto enable automatic master discovery.The host list will be used for failover and load balancing.
- Parameters:
acquireHostList- whether automatically acquire a list of available hosts (default: false)- Returns:
ArangoDB.Builder
-
acquireHostListInterval
public ArangoDB.Builder acquireHostListInterval(Integer acquireHostListInterval)
Setting the Interval for acquireHostList- Parameters:
acquireHostListInterval- Interval in milliseconds- Returns:
ArangoDB.Builder
-
loadBalancingStrategy
public ArangoDB.Builder loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)
Sets the load balancing strategy to be used in an ArangoDB cluster setup. In case of Active-Failover deployment set toLoadBalancingStrategy.NONEor not set at all, since that would be the default.- Parameters:
loadBalancingStrategy- the load balancing strategy to be used (default:LoadBalancingStrategy.NONE- Returns:
ArangoDB.Builder
-
responseQueueTimeSamples
public ArangoDB.Builder responseQueueTimeSamples(Integer responseQueueTimeSamples)
Setting the amount of samples kept for queue time metrics- Parameters:
responseQueueTimeSamples- amount of samples to keep- Returns:
ArangoDB.Builder
-
serde
public ArangoDB.Builder serde(ArangoSerde serde)
Sets the serde for the user data. This is used to serialize and deserialize all the data payload such as: - documents, vertexes, edges - AQL bind vars - body payload of requests and responses inArangoDB.execute(Request, Class)However, note that the following types will always be serialized and deserialized using the internal serde: -
JsonNode-RawJson-RawBytes-BaseDocument-BaseEdgeDocument- Parameters:
serde- custom serde for the user data- Returns:
ArangoDB.Builder
-
asyncExecutor
public ArangoDB.Builder asyncExecutor(Executor executor)
Sets the downstream async executor that will be used to consume the responses of the async API, that are returned asCompletableFuture- Parameters:
executor- async downstream executor- Returns:
ArangoDB.Builder
-
protocolProvider
protected com.arangodb.internal.net.ProtocolProvider protocolProvider(Protocol protocol)
-
createHostHandler
protected com.arangodb.internal.net.HostHandler createHostHandler(com.arangodb.internal.net.HostResolver hostResolver)
-
createHostResolver
protected com.arangodb.internal.net.HostResolver createHostResolver(Collection<com.arangodb.internal.net.Host> hosts, com.arangodb.internal.net.ConnectionFactory connectionFactory)
-
createHostList
protected Collection<com.arangodb.internal.net.Host> createHostList(com.arangodb.internal.net.ConnectionFactory connectionFactory)
-
-