Class DatabaseEngineJDBCImpl
java.lang.Object
uk.ac.manchester.spinnaker.alloc.db.DatabaseEngineJDBCImpl
- All Implemented Interfaces:
- DatabaseAPI
Implementation of the 
DatabaseAPI that uses JDBC to talk to MySQL.- 
Nested Class SummaryNested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.alloc.db.DatabaseAPIDatabaseAPI.Connected, DatabaseAPI.ConnectedWithResult<T>, DatabaseAPI.Connection, DatabaseAPI.Query, DatabaseAPI.RowMapper<T>, DatabaseAPI.StatementCommon, DatabaseAPI.Transacted, DatabaseAPI.TransactedWithResult<T>, DatabaseAPI.Update
- 
Constructor SummaryConstructorsConstructorDescriptionDatabaseEngineJDBCImpl(JdbcTemplate jdbcTemplate, JdbcTemplate tombstoneJdbcTemplate, PlatformTransactionManager transactionManager) Create a new JDBC Database API.
- 
Method SummaryModifier and TypeMethodDescription<T> Texecute(boolean lockForWriting, DatabaseAPI.ConnectedWithResult<T> operation) A connection manager and transaction runner.voidexecuteVoid(boolean lockForWriting, DatabaseAPI.Connected operation) A connection manager and transaction runner.Get a connection.Get a connection to the historical database, similar to the above.booleanWhether the historical data DB is available.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface uk.ac.manchester.spinnaker.alloc.db.DatabaseAPIexecute, executeVoid
- 
Constructor Details- 
DatabaseEngineJDBCImpl@Autowired public DatabaseEngineJDBCImpl(@Qualifier("mainDatabase") JdbcTemplate jdbcTemplate, @Qualifier("historicalDatabase") JdbcTemplate tombstoneJdbcTemplate, @Qualifier("mainTransactionManager") PlatformTransactionManager transactionManager) Create a new JDBC Database API.- Parameters:
- jdbcTemplate- The connection to the main database.
- tombstoneJdbcTemplate- The connection to the historical database.
- transactionManager- The transaction manager.
 
 
- 
- 
Method Details- 
getConnectionDescription copied from interface:DatabaseAPIGet a connection. This connection is thread-bound and pooled; it must not be passed to other threads. They should get their own connections instead. The connection has auto-commit disabled; use thetransaction()method instead.- Specified by:
- getConnectionin interface- DatabaseAPI
- Returns:
- A configured initialised connection to the database.
 
- 
isHistoricalDBAvailablepublic boolean isHistoricalDBAvailable()Description copied from interface:DatabaseAPIWhether the historical data DB is available. If it isn't, you can't move any data to longer-term storage, but ordinary operations should be fine.- Specified by:
- isHistoricalDBAvailablein interface- DatabaseAPI
- Returns:
- Whether the historical data DB is available.
 
- 
getHistoricalConnectionDescription copied from interface:DatabaseAPIGet a connection to the historical database, similar to the above.- Specified by:
- getHistoricalConnectionin interface- DatabaseAPI
- Returns:
- A configured initialised connection to the historical database.
 
- 
executeVoidDescription copied from interface:DatabaseAPIA connection manager and transaction runner. If theoperationcompletes normally (and this isn't a nested use), the transaction commits. If an exception is thrown, the transaction is rolled back. The connection is closed up in any case.- Specified by:
- executeVoidin interface- DatabaseAPI
- Parameters:
- lockForWriting- Whether to lock for writing. Multiple read locks can be held at once, but only one write lock. Locks cannot be upgraded (because that causes deadlocks).
- operation- The operation to run
 
- 
executeDescription copied from interface:DatabaseAPIA connection manager and transaction runner. If theoperationcompletes normally (and this isn't a nested use), the transaction commits. If an exception is thrown, the transaction is rolled back. The connection is closed up in any case.- Specified by:
- executein interface- DatabaseAPI
- Type Parameters:
- T- The type of the result of- operation
- Parameters:
- lockForWriting- Whether to lock for writing. Multiple read locks can be held at once, but only one write lock. Locks cannot be upgraded (because that causes deadlocks).
- operation- The operation to run
- Returns:
- the value returned by operation
 
 
-