@Immutable public abstract class GraphStatementBase<SelfT extends GraphStatement<SelfT>> extends Object implements GraphStatement<SelfT>
ASYNC, SYNC
Modifier | Constructor and Description |
---|---|
protected |
GraphStatementBase(Boolean isIdempotent,
Duration timeout,
Node node,
long timestamp,
DriverExecutionProfile executionProfile,
String executionProfileName,
Map<String,ByteBuffer> customPayload,
String graphName,
String traversalSource,
String subProtocol,
ConsistencyLevel consistencyLevel,
ConsistencyLevel readConsistencyLevel,
ConsistencyLevel writeConsistencyLevel) |
Modifier and Type | Method and Description |
---|---|
ConsistencyLevel |
getConsistencyLevel()
Returns the consistency level to use for the statement.
|
Map<String,ByteBuffer> |
getCustomPayload() |
DriverExecutionProfile |
getExecutionProfile() |
String |
getExecutionProfileName() |
String |
getGraphName()
The name of the graph to use for this statement.
|
Node |
getNode() |
ConsistencyLevel |
getReadConsistencyLevel()
The consistency level to use for the internal read queries that will be produced by this
statement.
|
String |
getSubProtocol()
The DSE graph sub-protocol to use for this statement.
|
Duration |
getTimeout() |
long |
getTimestamp()
Get the timestamp set on the statement.
|
String |
getTraversalSource()
The name of the traversal source to use for this statement.
|
ConsistencyLevel |
getWriteConsistencyLevel()
The consistency level to use for the internal write queries that will be produced by this
statement.
|
Boolean |
isIdempotent() |
protected abstract SelfT |
newInstance(Boolean isIdempotent,
Duration timeout,
Node node,
long timestamp,
DriverExecutionProfile executionProfile,
String executionProfileName,
Map<String,ByteBuffer> customPayload,
String graphName,
String traversalSource,
String subProtocol,
ConsistencyLevel consistencyLevel,
ConsistencyLevel readConsistencyLevel,
ConsistencyLevel writeConsistencyLevel) |
SelfT |
setConsistencyLevel(ConsistencyLevel newConsistencyLevel)
Sets the consistency level to use for this statement.
|
SelfT |
setCustomPayload(Map<String,ByteBuffer> newCustomPayload)
Sets the custom payload to use for execution.
|
SelfT |
setExecutionProfile(DriverExecutionProfile newExecutionProfile)
Sets the configuration profile to use for execution.
|
SelfT |
setExecutionProfileName(String newExecutionProfileName)
Sets the name of the driver configuration profile that will be used for execution.
|
SelfT |
setGraphName(String newGraphName)
Sets the graph name.
|
SelfT |
setIdempotent(Boolean newIdempotence)
Set the idempotence to use for execution.
|
SelfT |
setNode(Node newNode)
Sets the
Node that should handle this query. |
SelfT |
setReadConsistencyLevel(ConsistencyLevel newReadConsistencyLevel)
Sets the read consistency level.
|
SelfT |
setSubProtocol(String newSubProtocol)
Sets the sub-protocol.
|
SelfT |
setTimeout(Duration newTimeout)
Sets how long to wait for this request to complete.
|
SelfT |
setTimestamp(long newTimestamp)
Set the timestamp to use for execution.
|
SelfT |
setTraversalSource(String newTraversalSource)
Sets the traversal source.
|
SelfT |
setWriteConsistencyLevel(ConsistencyLevel newWriteConsistencyLevel)
Sets the write consistency level.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getKeyspace, getRoutingKey, getRoutingKeyspace, getRoutingToken, isTracing
protected GraphStatementBase(Boolean isIdempotent, Duration timeout, Node node, long timestamp, DriverExecutionProfile executionProfile, String executionProfileName, Map<String,ByteBuffer> customPayload, String graphName, String traversalSource, String subProtocol, ConsistencyLevel consistencyLevel, ConsistencyLevel readConsistencyLevel, ConsistencyLevel writeConsistencyLevel)
protected abstract SelfT newInstance(Boolean isIdempotent, Duration timeout, Node node, long timestamp, DriverExecutionProfile executionProfile, String executionProfileName, Map<String,ByteBuffer> customPayload, String graphName, String traversalSource, String subProtocol, ConsistencyLevel consistencyLevel, ConsistencyLevel readConsistencyLevel, ConsistencyLevel writeConsistencyLevel)
public Boolean isIdempotent()
isIdempotent
in interface Request
@NonNull public SelfT setIdempotent(@Nullable Boolean newIdempotence)
GraphStatement
Idempotence defines whether it will be possible to speculatively re-execute the statement,
based on a SpeculativeExecutionPolicy
.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setIdempotent
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
newIdempotence
- a boolean instance to set a statement-specific value, or null
to use
the default idempotence defined in the configuration.@Nullable public Duration getTimeout()
GraphStatement
Note that, if this method returns null
, graph statements fall back to a dedicated
configuration option: basic.graph.timeout
. See reference.conf
in the DSE driver
distribution for more details.
getTimeout
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
getTimeout
in interface Request
@NonNull public SelfT setTimeout(@Nullable Duration newTimeout)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setTimeout
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
newTimeout
- the timeout to use, or null
to use the default value defined in the
configuration.GraphStatement.getTimeout()
@NonNull public SelfT setNode(@Nullable Node newNode)
GraphStatement
Node
that should handle this query.
In the general case, use of this method is heavily discouraged and should only be used in specific cases, such as applying a series of schema changes, which may be advantageous to execute in sequence on the same node.
Configuring a specific node causes the configured LoadBalancingPolicy
to be
completely bypassed. However, if the load balancing policy dictates that the node is at
distance NodeDistance.IGNORED
or there is no active connectivity to the node, the
request will fail with a NoNodeAvailableException
.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setNode
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
newNode
- The node that should be used to handle executions of this statement or null to
delegate to the configured load balancing policy.public long getTimestamp()
GraphStatement
By default, if left unset, the value returned by this is Long.MIN_VALUE
, which means
that the timestamp will be set via the Timestamp Generator.
getTimestamp
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setTimestamp(long newTimestamp)
GraphStatement
By default the timestamp generator (see reference config file) will be used for timestamps, unless set explicitly via this method.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setTimestamp
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@Nullable public DriverExecutionProfile getExecutionProfile()
getExecutionProfile
in interface Request
@NonNull public SelfT setExecutionProfile(@Nullable DriverExecutionProfile newExecutionProfile)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setExecutionProfile
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@Nullable public String getExecutionProfileName()
getExecutionProfileName
in interface Request
@NonNull public SelfT setExecutionProfileName(@Nullable String newExecutionProfileName)
GraphStatement
For all the driver's built-in implementations, this method has no effect if GraphStatement.setExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile)
has been called with a non-null argument.
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setExecutionProfileName
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public Map<String,ByteBuffer> getCustomPayload()
getCustomPayload
in interface Request
@NonNull public SelfT setCustomPayload(@NonNull Map<String,ByteBuffer> newCustomPayload)
GraphStatement
This is intended for advanced use cases, such as tools with very advanced knowledge of DSE Graph, and reserved for internal settings like transaction settings. Note that the driver also adds graph-related options to the payload, in addition to the ones provided here; it won't override any option that is already present.
All the driver's built-in statement implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
Note that it's your responsibility to provide a thread-safe map. This can be achieved with a concurrent or immutable implementation, or by making it effectively immutable (meaning that it's never modified after being set on the statement).
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setCustomPayload
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@Nullable public String getGraphName()
GraphStatement
This is the programmatic equivalent of the configuration option basic.graph.name
,
and takes precedence over it. That is, if this property is non-null, then the configuration
will be ignored.
getGraphName
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setGraphName(@Nullable String newGraphName)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setGraphName
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
GraphStatement.getGraphName()
@Nullable public String getTraversalSource()
GraphStatement
This is the programmatic equivalent of the configuration option basic.graph.traversal-source
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
getTraversalSource
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setTraversalSource(@Nullable String newTraversalSource)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setTraversalSource
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
GraphStatement.getTraversalSource()
@Nullable public String getSubProtocol()
GraphStatement
This is the programmatic equivalent of the configuration option advanced.graph.sub-protocol
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
getSubProtocol
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setSubProtocol(@Nullable String newSubProtocol)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setSubProtocol
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
GraphStatement.getSubProtocol()
@Nullable public ConsistencyLevel getConsistencyLevel()
GraphStatement
This is the programmatic equivalent of the configuration option basic.request.consistency
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
getConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
public SelfT setConsistencyLevel(@Nullable ConsistencyLevel newConsistencyLevel)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
newConsistencyLevel
- the consistency level to use, or null to use the default value
defined in the configuration.GraphStatement.getConsistencyLevel()
@Nullable public ConsistencyLevel getReadConsistencyLevel()
GraphStatement
This is the programmatic equivalent of the configuration option basic.graph.read-consistency-level
, and takes precedence over it. That is, if this property is
non-null, then the configuration will be ignored.
If this property isn't set here or in the configuration, the default consistency level will
be used (GraphStatement.getConsistencyLevel()
or basic.request.consistency
).
getReadConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setReadConsistencyLevel(@Nullable ConsistencyLevel newReadConsistencyLevel)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setReadConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
GraphStatement.getReadConsistencyLevel()
@Nullable public ConsistencyLevel getWriteConsistencyLevel()
GraphStatement
This is the programmatic equivalent of the configuration option basic.graph.write-consistency-level
, and takes precedence over it. That is, if this property
is non-null, then the configuration will be ignored.
If this property isn't set here or in the configuration, the default consistency level will
be used (GraphStatement.getConsistencyLevel()
or basic.request.consistency
).
getWriteConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
@NonNull public SelfT setWriteConsistencyLevel(@Nullable ConsistencyLevel newWriteConsistencyLevel)
GraphStatement
All the driver's built-in implementations are immutable, and return a new instance from this method. However custom implementations may choose to be mutable and return the same instance.
setWriteConsistencyLevel
in interface GraphStatement<SelfT extends GraphStatement<SelfT>>
GraphStatement.getWriteConsistencyLevel()
Copyright © 2017–2019. All rights reserved.