@NotThreadSafe
public abstract class DseSessionBuilderBase<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
extends com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT,SessionT>
Modifier and Type | Field and Description |
---|---|
protected DseProgrammaticArguments.Builder |
dseProgrammaticArgumentsBuilder |
Modifier | Constructor and Description |
---|---|
protected |
DseSessionBuilderBase() |
Modifier and Type | Method and Description |
---|---|
protected com.datastax.oss.driver.api.core.context.DriverContext |
buildContext(com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader,
List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> typeCodecs,
com.datastax.oss.driver.api.core.metadata.NodeStateListener nodeStateListener,
com.datastax.oss.driver.api.core.metadata.schema.SchemaChangeListener schemaChangeListener,
com.datastax.oss.driver.api.core.tracker.RequestTracker requestTracker,
Map<String,String> localDatacenters,
Map<String,Predicate<com.datastax.oss.driver.api.core.metadata.Node>> nodeFilters,
ClassLoader classLoader)
Deprecated.
|
protected com.datastax.oss.driver.api.core.context.DriverContext |
buildContext(com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader,
com.datastax.oss.driver.api.core.session.ProgrammaticArguments programmaticArguments) |
protected com.datastax.oss.driver.api.core.config.DriverConfigLoader |
defaultConfigLoader() |
SelfT |
withApplicationName(String applicationName)
The name of the application using the created session.
|
SelfT |
withApplicationVersion(String applicationVersion)
The version of the application using the created session.
|
SelfT |
withAuthCredentials(String username,
String password)
Configures the session to use DSE plaintext authentication with the given username and
password.
|
SelfT |
withAuthCredentials(String username,
String password,
String authorizationId)
Configures the session to use DSE plaintext authentication with the given username and
password, and perform proxy authentication with the given authorization id.
|
SelfT |
withClientId(UUID clientId)
A unique identifier for the created session.
|
SelfT |
withConfigLoader(com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader)
Sets the configuration loader to use.
|
addContactEndPoint, addContactEndPoints, addContactPoint, addContactPoints, addTypeCodecs, build, buildAsync, buildDefaultSessionAsync, withAuthProvider, withClassLoader, withCloudProxyAddress, withCloudSecureConnectBundle, withCloudSecureConnectBundle, withCloudSecureConnectBundle, withKeyspace, withKeyspace, withLocalDatacenter, withLocalDatacenter, withNodeFilter, withNodeFilter, withNodeStateListener, withRequestTracker, withSchemaChangeListener, withSslContext, withSslEngineFactory, wrap
protected DseProgrammaticArguments.Builder dseProgrammaticArgumentsBuilder
@NonNull public SelfT withClientId(@Nullable UUID clientId)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
If you don't call this method, the driver will generate an identifier with Uuids.random()
.
@NonNull public SelfT withApplicationName(@Nullable String applicationName)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
This can also be defined in the driver configuration with the option basic.application.name
; if you specify both, this method takes precedence and the
configuration option will be ignored.
@NonNull public SelfT withApplicationVersion(@Nullable String applicationVersion)
It will be sent in the STARTUP
protocol message for each new connection established
by the driver, and may be used by future DSE versions for monitoring purposes.
This can also be defined in the driver configuration with the option basic.application.version
; if you specify both, this method takes precedence and the
configuration option will be ignored.
@NonNull public SelfT withConfigLoader(@Nullable com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader)
Note that this loader must produce a configuration that includes the DSE-specific options:
if you're using one of the built-in implementations provided by the driver, use the static
factory methods from DseDriverConfigLoader
(not the ones from DriverConfigLoader
).
If you don't call this method, the builder will use the default implementation, based on the Typesafe config library. More precisely, configuration properties are loaded and merged from the following (first-listed are higher priority):
application.conf
(all resources on classpath with this name)
application.json
(all resources on classpath with this name)
application.properties
(all resources on classpath with this name)
dse-reference.conf
(all resources on classpath with this name). In particular,
this will load the dse-reference.conf
included in the core DSE driver JAR, that
defines default options for all DSE-specific mandatory options.
reference.conf
(all resources on classpath with this name). In particular, this
will load the reference.conf
included in the core driver JAR, that defines
default options for all mandatory options.
datastax-java-driver
section.
This default loader will honor the reload interval defined by the option basic.config-reload-interval
.
withConfigLoader
in class com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
@NonNull public SelfT withAuthCredentials(@NonNull String username, @NonNull String password)
This methods calls SessionBuilder.withAuthProvider(AuthProvider)
to register a special provider
implementation. Therefore calling it overrides the configuration (that is, the advanced.auth-provider.class
option will be ignored).
Note that this approach holds the credentials in clear text in memory, which makes them
vulnerable to an attacker who is able to perform memory dumps. If this is not acceptable for
you, consider writing your own AuthProvider
implementation (the internal class PlainTextAuthProviderBase
is a good starting point), and providing it either with SessionBuilder.withAuthProvider(AuthProvider)
or via the configuration (advanced.auth-provider.class
).
withAuthCredentials
in class com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
@NonNull public SelfT withAuthCredentials(@NonNull String username, @NonNull String password, @NonNull String authorizationId)
This methods calls SessionBuilder.withAuthProvider(AuthProvider)
to register a special provider
implementation. Therefore calling it overrides the configuration (that is, the advanced.auth-provider.class
option will be ignored).
Note that this approach holds the credentials in clear text in memory, which makes them
vulnerable to an attacker who is able to perform memory dumps. If this is not acceptable for
you, consider writing your own AuthProvider
implementation (the internal class PlainTextAuthProviderBase
is a good starting point), and providing it either with SessionBuilder.withAuthProvider(AuthProvider)
or via the configuration (advanced.auth-provider.class
).
protected com.datastax.oss.driver.api.core.context.DriverContext buildContext(com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader, com.datastax.oss.driver.api.core.session.ProgrammaticArguments programmaticArguments)
buildContext
in class com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
@Deprecated protected com.datastax.oss.driver.api.core.context.DriverContext buildContext(com.datastax.oss.driver.api.core.config.DriverConfigLoader configLoader, List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> typeCodecs, com.datastax.oss.driver.api.core.metadata.NodeStateListener nodeStateListener, com.datastax.oss.driver.api.core.metadata.schema.SchemaChangeListener schemaChangeListener, com.datastax.oss.driver.api.core.tracker.RequestTracker requestTracker, Map<String,String> localDatacenters, Map<String,Predicate<com.datastax.oss.driver.api.core.metadata.Node>> nodeFilters, ClassLoader classLoader)
buildContext
in class com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
@NonNull protected com.datastax.oss.driver.api.core.config.DriverConfigLoader defaultConfigLoader()
defaultConfigLoader
in class com.datastax.oss.driver.api.core.session.SessionBuilder<SelfT extends DseSessionBuilderBase<SelfT,SessionT>,SessionT>
Copyright © 2017–2019. All rights reserved.