Class SQLDB
java.lang.Object
com.djrapitops.plan.storage.database.AbstractDatabase
com.djrapitops.plan.storage.database.SQLDB
- All Implemented Interfaces:
Database
Class containing main logic for different data related save and load functionality.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.djrapitops.plan.storage.database.Database
Database.State
-
Field Summary
Modifier and TypeFieldDescriptionprotected PlanConfig
protected ClassLoader
protected ErrorLogger
protected PlanFiles
protected Locale
protected net.playeranalytics.plugin.server.PluginLogger
protected net.playeranalytics.plugin.scheduling.RunnableFactory
Fields inherited from class com.djrapitops.plan.storage.database.AbstractDatabase
accessLock
-
Constructor Summary
ModifierConstructorDescriptionprotected
SQLDB(Supplier<ServerUUID> serverUUIDSupplier, Locale locale, PlanConfig config, PlanFiles files, net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
boolean
Future<?>
executeTransaction(Transaction transaction)
Execute an SQL Transaction.abstract Connection
net.playeranalytics.plugin.server.PluginLogger
net.playeranalytics.plugin.scheduling.RunnableFactory
int
hashCode()
void
init()
Initializes the Database.<T> T
Execute an SQL Query statement to get a result.abstract void
returnToPool(Connection connection)
static void
setDownloadDriver(boolean downloadDriver)
void
setTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider)
abstract void
Set up the source for connections.Methods inherited from class com.djrapitops.plan.storage.database.AbstractDatabase
assumeNoMoreHeavyLoad, getHeavyLoadDelayMs, getState, increaseHeavyLoadDelay, isUnderHeavyLoad, setState
-
Field Details
-
locale
-
config
-
files
-
runnableFactory
protected final net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory -
logger
protected final net.playeranalytics.plugin.server.PluginLogger logger -
errorLogger
-
driverClassLoader
-
-
Constructor Details
-
SQLDB
protected SQLDB(Supplier<ServerUUID> serverUUIDSupplier, Locale locale, PlanConfig config, PlanFiles files, net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger)
-
-
Method Details
-
setDownloadDriver
public static void setDownloadDriver(boolean downloadDriver) -
getDependencyResource
-
downloadDriver
public void downloadDriver() -
init
public void init()Description copied from interface:Database
Initializes the Database.Queries can be performed after this request has completed all required transactions for the database operations.
-
setupDataSource
public abstract void setupDataSource()Set up the source for connections.- Throws:
DBInitException
- If the DataSource fails to be initialized.
-
close
public void close() -
getConnection
- Throws:
SQLException
-
returnToPool
-
query
Description copied from interface:Database
Execute an SQL Query statement to get a result.This method should only be called from an asynchronous thread.
- Type Parameters:
T
- Type of the object to be returned.- Parameters:
query
- QueryStatement to execute.- Returns:
- Result of the query.
-
executeTransaction
Description copied from interface:Database
Execute an SQL Transaction.- Parameters:
transaction
- Transaction to execute.- Returns:
- Future that is finished when the transaction has been executed.
-
equals
-
hashCode
public int hashCode() -
getServerUUIDSupplier
-
setTransactionExecutorServiceProvider
public void setTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider) -
getRunnableFactory
public net.playeranalytics.plugin.scheduling.RunnableFactory getRunnableFactory() -
getLogger
public net.playeranalytics.plugin.server.PluginLogger getLogger()
-