|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.osmosis.core.apidb.common.DatabaseContext2
public class DatabaseContext2
This class manages the lifecycle of JDBC objects to minimise the risk of connection leaks and to support a consistent approach to database access.
Constructor Summary | |
---|---|
DatabaseContext2(DatabaseLoginCredentials loginCredentials)
Creates a new instance. |
Method Summary | |
---|---|
void |
disableIndexes(java.util.List<java.lang.String> tables)
Disables the indexes of the specified tables. |
boolean |
doesColumnExist(java.lang.String tableName,
java.lang.String columnName)
Indicates if the specified column exists in the database. |
boolean |
doesTableExist(java.lang.String tableName)
Indicates if the specified table exists in the database. |
void |
enableIndexes(java.util.List<java.lang.String> tables)
Enables the indexes of the specified tables. |
java.lang.Object |
executeWithinTransaction(org.springframework.transaction.support.TransactionCallback txnCallback)
Invokes the provided callback code within a transaction. |
protected void |
finalize()
Enforces cleanup of any remaining resources during garbage collection. |
DatabaseType |
getDatabaseType()
Returns the database type currently in use. |
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate()
Gets the jdbc template which provides access to database functions. |
long |
getLastInsertId()
Gets the last inserted identity column value. |
long |
getLastSequenceId(java.lang.String sequenceName)
Gets the last retrieved sequence value. |
org.springframework.jdbc.core.simple.SimpleJdbcTemplate |
getSimpleJdbcTemplate()
Gets the jdbc template which provides simple access to database functions. |
void |
lockTables(java.util.List<java.lang.String> tables)
Locks the specified tables for exclusive access. |
void |
release()
Releases all database resources. |
void |
truncateTables(java.util.List<java.lang.String> tables)
Truncates the contents of the specified tables. |
void |
unlockTables(java.util.List<java.lang.String> tables)
Unlocks the specified tables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseContext2(DatabaseLoginCredentials loginCredentials)
loginCredentials
- Contains all information required to connect to the database.Method Detail |
---|
public org.springframework.jdbc.core.simple.SimpleJdbcTemplate getSimpleJdbcTemplate()
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
public java.lang.Object executeWithinTransaction(org.springframework.transaction.support.TransactionCallback txnCallback)
txnCallback
- The logic to be invoked within a transaction.
public DatabaseType getDatabaseType()
public void truncateTables(java.util.List<java.lang.String> tables)
tables
- The tables to be truncated.public void disableIndexes(java.util.List<java.lang.String> tables)
tables
- The tables to disable indexes on.public void enableIndexes(java.util.List<java.lang.String> tables)
tables
- The tables to enable indexes on.public void lockTables(java.util.List<java.lang.String> tables)
tables
- The tables to lock.public void unlockTables(java.util.List<java.lang.String> tables)
tables
- The tables to unlock.public long getLastInsertId()
public long getLastSequenceId(java.lang.String sequenceName)
sequenceName
- The name of the sequence.
public void release()
public boolean doesColumnExist(java.lang.String tableName, java.lang.String columnName)
tableName
- The table to check for.columnName
- The column to check for.
public boolean doesTableExist(java.lang.String tableName)
tableName
- The table to check for.
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- If a problem occurs during finalization.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |