DatabaseServiceFactory

csw.database.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 Object
trait Matchable
class 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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

def jMakeDsl(): CompletableFuture[DSLContext]

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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

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 like fetchAsync, executeAsync, executeBatch, etc. Moreover, see csw.database.javadsl.JooqHelper for java and csw.database.scaladsl.JooqExtentions for scala which provides wrapper methods on Jooq's DSLContext.

Note

This method is strongly recommended to use for testing purposes only