public class DseDriverConfigLoader extends Object
Note that this class only exists to expose those methods in a way that is symmetric to its OSS
counterpart DriverConfigLoader
. It does not extend it, DSE-specific loaders are regular
instances of the OSS type.
Modifier and Type | Method and Description |
---|---|
static com.datastax.oss.driver.api.core.config.DriverConfigLoader |
fromClasspath(String resourceBaseName)
Builds an instance using the driver's default implementation (based on Typesafe config), except
that application-specific options are loaded from a classpath resource with a custom name.
|
static com.datastax.oss.driver.api.core.config.DriverConfigLoader |
fromFile(File file)
Builds an instance using the driver's default implementation (based on Typesafe config), except
that application-specific options are loaded from the given file.
|
static com.datastax.oss.driver.api.core.config.DriverConfigLoader |
fromUrl(URL url)
Builds an instance using the driver's default implementation (based on Typesafe config), except
that application-specific options are loaded from the given URL.
|
static com.datastax.oss.driver.api.core.config.ProgrammaticDriverConfigLoaderBuilder |
programmaticBuilder()
Starts a builder that allows configuration options to be overridden programmatically.
|
@NonNull public static com.datastax.oss.driver.api.core.config.DriverConfigLoader fromClasspath(@NonNull String resourceBaseName)
More precisely, configuration properties are loaded and merged from the following (first-listed are higher priority):
<resourceBaseName>.conf
(all resources on classpath with this name)
<resourceBaseName>.json
(all resources on classpath with this name)
<resourceBaseName>.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 OSS driver JAR, that defines
default options for all mandatory options common to OSS and DSE.
datastax-java-driver
section.
The returned loader will honor the reload interval defined by the option basic.config-reload-interval
.
@NonNull public static com.datastax.oss.driver.api.core.config.DriverConfigLoader fromFile(@NonNull File file)
More precisely, configuration properties are loaded and merged from the following (first-listed are higher priority):
file
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 OSS driver JAR, that defines
default options for all mandatory options common to OSS and DSE.
datastax-java-driver
section.
The returned loader will honor the reload interval defined by the option basic.config-reload-interval
.
@NonNull public static com.datastax.oss.driver.api.core.config.DriverConfigLoader fromUrl(@NonNull URL url)
More precisely, configuration properties are loaded and merged from the following (first-listed are higher priority):
url
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 OSS driver JAR, that defines
default options for all mandatory options common to OSS and DSE.
datastax-java-driver
section.
The returned loader will honor the reload interval defined by the option basic.config-reload-interval
.
@NonNull public static com.datastax.oss.driver.api.core.config.ProgrammaticDriverConfigLoaderBuilder programmaticBuilder()
Sample usage:
DriverConfigLoader loader =
DriverConfigLoader.programmaticBuilder()
.withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds(5))
.startProfile("slow")
.withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds(30))
.endProfile()
.build();
The resulting loader still uses the driver's default implementation (based on Typesafe config),
except that the programmatic configuration takes precedence. 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 OSS driver JAR, that defines
default options for all mandatory options common to OSS and DSE.
application.*
is entirely optional, you may choose to only rely on the
driver's built-in reference.conf
and programmatic overrides.
The resulting configuration is expected to contain a datastax-java-driver
section.
The loader will honor the reload interval defined by the option basic.config-reload-interval
.
Note that the returned builder is not thread-safe.
Copyright © 2017–2019. All rights reserved.