Class SQLDispatcher
- java.lang.Object
-
- com.alessiodp.core.common.storage.dispatchers.SQLDispatcher
-
- All Implemented Interfaces:
IDatabaseDispatcher
public abstract class SQLDispatcher extends Object implements IDatabaseDispatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionFactoryconnectionFactoryprotected @NotNull ADPPluginpluginprotected @NotNull StorageTypestorageType
-
Constructor Summary
Constructors Constructor Description SQLDispatcher()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intgetBackwardMigration()Get the backward migration filevoidinit()Initialize the database dispatcherprotected abstract ConnectionFactoryinitConnectionFactory()Initialize the SQL connection factorybooleanisFailed()Is failed to start the database?protected TreeSet<String>lookupMigrateScripts()Lookup for Migrator scriptsprotected voidmigrateTables(Migrator migrator)Start Migrator.migratevoidperformMigration(org.jdbi.v3.core.Handle transaction, LinkedList<String> queries, int version)Perform a migration in this databaseprotected MigratorConfigurationprepareMigrator()Prepare the Migrator classvoidstop()Stop the database dispatcher
-
-
-
Field Detail
-
plugin
@NotNull protected final @NotNull ADPPlugin plugin
-
storageType
@NotNull protected final @NotNull StorageType storageType
-
connectionFactory
protected ConnectionFactory connectionFactory
-
-
Method Detail
-
stop
public final void stop()
Description copied from interface:IDatabaseDispatcherStop the database dispatcher- Specified by:
stopin interfaceIDatabaseDispatcher
-
isFailed
public final boolean isFailed()
Description copied from interface:IDatabaseDispatcherIs failed to start the database?- Specified by:
isFailedin interfaceIDatabaseDispatcher- Returns:
- true if the initialization has failed
-
init
public void init()
Description copied from interface:IDatabaseDispatcherInitialize the database dispatcher- Specified by:
initin interfaceIDatabaseDispatcher
-
initConnectionFactory
protected abstract ConnectionFactory initConnectionFactory()
Initialize the SQL connection factory- Returns:
- the initialized connection factory
-
prepareMigrator
protected MigratorConfiguration prepareMigrator()
Prepare the Migrator class- Returns:
- the Migrator configuration
-
lookupMigrateScripts
protected TreeSet<String> lookupMigrateScripts()
Lookup for Migrator scripts- Returns:
- a set of migrate scripts
-
migrateTables
protected void migrateTables(Migrator migrator)
Start Migrator.migrate- Parameters:
migrator- the Migrator instance
-
getBackwardMigration
protected int getBackwardMigration()
Get the backward migration file- Returns:
- the migration file number, -1 to disable
-
performMigration
public void performMigration(org.jdbi.v3.core.Handle transaction, LinkedList<String> queries, int version)Perform a migration in this database- Parameters:
transaction- the database transactionqueries- the list of queries of the migrationversion- the version of the database
-
-