DatabaseServiceFactory
DatabaseServiceFactory provides a mechanism to connect to the database server and get the handle of Jooq's DSLContext. To know in detail about Jooq please refer https://www.jooq.org/learn/.
Value parameters
- actorSystem
-
component's actor system, used for 1) reading the database configurations and 2) schedule the task of database connection
- values
-
used for testing purposes, to manually set the values for credentials instead of reading from env vars
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Constructors
Creates the DatabaseServiceFactory. It is not injected in CswContext
like other csw services. Instead developers are expected to create an instance of DatabaseServiceFactory and then use it.
Creates the DatabaseServiceFactory. It is not injected in CswContext
like other csw services. Instead developers are expected to create an instance of DatabaseServiceFactory and then use it.
Value parameters
- actorSystem
-
component's actor system, used for 1) reading the database configurations and 2) schedule the task of database connection
Attributes
- Returns
-
DatabaseServiceFactory
Concrete methods
A java method to create connection to database with default read access. The username and password for read access is picked from environment variables set on individual's machine i.e. DB_READ_USERNAME
and DB_READ_PASSWORD
. It is expected that developers set these variables before calling this method.
A java method to create connection to database with default read access. The username and password for read access is picked from environment variables set on individual's machine i.e. DB_READ_USERNAME
and DB_READ_PASSWORD
. It is expected that developers set these variables before calling this method.
Value parameters
- dbName
-
used to connect to the database
- locationService
-
used to locate the database server
Attributes
- Returns
-
a CompletableFuture that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
.
A java method to create the connection to database with credentials picked from environment variables. Names of these environment variables is expected as method parameters and developers are expected to set these variables before calling this method.
A java method to create the connection to database with credentials picked from environment variables. Names of these environment variables is expected as method parameters and developers are expected to set these variables before calling this method.
Value parameters
- dbName
-
used to connect to the database
- locationService
-
used to locate the database server
- passwordHolder
-
name of env variable from which the password will be read
- usernameHolder
-
name of env variable from which the username will be read
Attributes
- Returns
-
a CompletableFuture that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
.
A java method to Creates a connection to database using the configuration read from application.conf. Refer the reference.conf/database documentation to know how to provide database connection properties.
A java method to Creates a connection to database using the configuration read from application.conf. Refer the reference.conf/database documentation to know how to provide database connection properties.
Attributes
- Returns
-
a CompletableFuture that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
. - Note
-
This method is strongly recommended to use for testing purposes only
Creates connection to database with default read access. The username and password for read access is picked from environment variables set on individual's machine i.e. DB_READ_USERNAME
and DB_READ_PASSWORD
. It is expected that developers set these variables before calling this method.
Creates connection to database with default read access. The username and password for read access is picked from environment variables set on individual's machine i.e. DB_READ_USERNAME
and DB_READ_PASSWORD
. It is expected that developers set these variables before calling this method.
Value parameters
- dbName
-
used to connect to the database
- locationService
-
used to locate the database server
Attributes
- Returns
-
a Future that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
.
Creates connection to database with credentials picked from environment variables. Names of these environment variables is expected as method parameters and developers are expected to set these variables before calling this method.
Creates connection to database with credentials picked from environment variables. Names of these environment variables is expected as method parameters and developers are expected to set these variables before calling this method.
Value parameters
- dbName
-
used to connect to the database
- locationService
-
used to locate the database server
- passwordHolder
-
name of env variable from which the password will be read
- usernameHolder
-
name of env variable from which the username will be read
Attributes
- Returns
-
a Future that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
.
Creates a connection to database using the configuration read from application.conf. Refer the reference.conf/database documentation to know how to provide database connection properties.
Creates a connection to database using the configuration read from application.conf. Refer the reference.conf/database documentation to know how to provide database connection properties.
Attributes
- Returns
-
a Future that completes with Jooq's
DSLContext
or fails with csw.database.exceptions.DatabaseException. DSLContext provide methods likefetchAsync
,executeAsync
,executeBatch
, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq'sDSLContext
. - Note
-
This method is strongly recommended to use for testing purposes only