Class DatabaseEngine<APIType extends DatabaseAPI>
java.lang.Object
uk.ac.manchester.spinnaker.storage.DatabaseEngine<APIType>
- Type Parameters:
APIType- The type of the higher-level access interface that can be used to work with the database this class makes connections to.
- All Implemented Interfaces:
ConnectionProvider<APIType>
- Direct Known Subclasses:
BufferManagerDatabaseEngine,DSEDatabaseEngine
public abstract class DatabaseEngine<APIType extends DatabaseAPI>
extends Object
implements ConnectionProvider<APIType>
The database engine interface. Based on SQLite.
Note that these database interfaces have their synchronisation mode set to
OFF; they are not resistant to system crashes in any way,
but they are faster when dealing with write-heavy workloads (particularly
important for the BufferManagerDatabaseEngine).
- Author:
- Donal Fellows
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate an engine interface for an in-memory database.protectedDatabaseEngine(File dbFile) Create an engine interface for a particular database.protectedDatabaseEngine(URI dbUri) Create an engine interface for a particular database. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface uk.ac.manchester.spinnaker.storage.ConnectionProvider
getStorageInterface
-
Constructor Details
-
DatabaseEngine
protected DatabaseEngine()Create an engine interface for an in-memory database. -
DatabaseEngine
Create an engine interface for a particular database.- Parameters:
dbFile- The file containing the database.
-
DatabaseEngine
Create an engine interface for a particular database.- Parameters:
dbUri- The absolute URI to the file containing the database. May contain query parameters as documented.- Throws:
IllegalArgumentException- If the URI is of an unsupported type.
-
-
Method Details
-
getConnection
Description copied from interface:ConnectionProviderGet a connection to a database, creating it if needed.- Specified by:
getConnectionin interfaceConnectionProvider<APIType extends DatabaseAPI>- Returns:
- The configured connection to the database. The database will have been seeded with DDL if necessary.
- Throws:
SQLException- If anything goes wrong.
-
getDDL
- Returns:
- The DDL for initialising this kind of database.
-