-
- All Implemented Interfaces:
public class DatabaseConnector
Database connector for easy connection with ebean databases.
-
-
Field Summary
Fields Modifier and Type Field Description private Database
database
private final DataSourceConfig
dataSourceConfig
private final MigrationConfig
migrationConfig
private final DatabaseConfig
dbConfig
private DatabaseConfig
config
-
Constructor Summary
Constructors Constructor Description DatabaseConnector(boolean defaultServer)
Get a database connector. DatabaseConnector()
Get a database connector.
-
Method Summary
Modifier and Type Method Description Database
getDatabase()
DataSourceConfig
getDataSourceConfig()
MigrationConfig
getMigrationConfig()
DatabaseConfig
getDbConfig()
DatabaseConfig
getConfig()
static void
loadDatabaseDrivers()
Load and initialize the database drivers. synchronized void
connectToDatabase(DatabaseConfig config)
Connect to a database. synchronized void
runMigrations()
Run database migrations. boolean
isStarted()
boolean
isDebug()
boolean
isMigrated()
-
-
Method Detail
-
getDatabase
Database getDatabase()
-
getDataSourceConfig
DataSourceConfig getDataSourceConfig()
-
getMigrationConfig
MigrationConfig getMigrationConfig()
-
getDbConfig
DatabaseConfig getDbConfig()
-
getConfig
DatabaseConfig getConfig()
-
loadDatabaseDrivers
static void loadDatabaseDrivers()
Load and initialize the database drivers. Execute this once before connecting to a database.
-
connectToDatabase
synchronized void connectToDatabase(DatabaseConfig config)
Connect to a database.
- Parameters:
config
- The DatabaseConfig with all important values for the connection.
-
runMigrations
synchronized void runMigrations()
Run database migrations.
-
isStarted
boolean isStarted()
-
isDebug
boolean isDebug()
-
isMigrated
boolean isMigrated()
-
-
-
-