|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.intermine.sql.precompute.PrecomputedTableManager
public class PrecomputedTableManager
Manages all the Precomputed tables in a given database.
| Field Summary | |
|---|---|
protected java.sql.Connection |
conn
|
protected Database |
database
|
protected static java.util.Map<java.lang.Object,PrecomputedTableManager> |
instances
|
protected java.util.TreeSet<PrecomputedTable> |
precomputedTables
|
protected static java.lang.String |
TABLE_INDEX
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,PrecomputedTable>> |
types
|
| Constructor Summary | |
|---|---|
protected |
PrecomputedTableManager(java.sql.Connection conn)
Create a PrecomputedTableManager for a given Connection. |
protected |
PrecomputedTableManager(Database database)
Create a PrecomputedTableManager for the given underlying database. |
| Method Summary | |
|---|---|
void |
add(PrecomputedTable pt)
Add a precomputed table to the underlying database. |
void |
add(PrecomputedTable pt,
java.util.Collection<java.lang.String> indexes)
Add a precomputed table to the underlying database. |
protected void |
addIndex(java.lang.String table,
java.lang.String field,
java.sql.Connection con)
Adds an index to the given table on the given field. |
void |
addTableToDatabase(PrecomputedTable pt,
java.util.Collection<java.lang.String> indexes,
boolean record)
Add a PrecomputedTable to the database. |
protected static java.util.Set<java.lang.String> |
canonicaliseIndexes(java.util.Collection<java.lang.String> indexes)
Takes a collection of index strings, and removes redundant entries. |
void |
delete(PrecomputedTable pt)
Delete a precomputed table from the underlying database. |
void |
deleteTableFromDatabase(java.lang.String name)
Delete a PrecomputedTable from the database. |
void |
dropAffected(java.util.Set<java.lang.String> tablesAltered)
Deletes all precomputed tables that would be affected by changes in any table in a given list of table names. |
void |
dropEverything()
Deletes every single precomputed table. |
static PrecomputedTableManager |
getInstance(java.sql.Connection conn)
Gets a PrecomputedTableManager instance for the given underlying Connection. |
static PrecomputedTableManager |
getInstance(Database database)
Gets a PrecomputedTableManager instance for the given underlying database. |
java.util.Set<PrecomputedTable> |
getPrecomputedTables()
Get all the precomputed tables in the underlying database. |
java.util.Map<java.lang.String,PrecomputedTable> |
lookupCategory(java.lang.String category)
Returns a Map from original SQL to PrecomputedTable for a given category in the manager. |
PrecomputedTable |
lookupSql(java.lang.String sql)
Returns a PrecomputedTable object if one exists in the manager with the given original SQL string. |
PrecomputedTable |
lookupSql(java.lang.String category,
java.lang.String sql)
Returns a PrecomputedTable object if one exists in the manager with the given category and original SQL string. |
protected void |
setupDatabase(java.sql.Connection con)
Sets up the database for storing precomputed tables |
protected void |
synchroniseWithDatabase(java.sql.Connection con)
Synchronise with the underlying database |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.TreeSet<PrecomputedTable> precomputedTables
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,PrecomputedTable>> types
protected Database database
protected java.sql.Connection conn
protected static final java.lang.String TABLE_INDEX
protected static java.util.Map<java.lang.Object,PrecomputedTableManager> instances
| Constructor Detail |
|---|
protected PrecomputedTableManager(java.sql.Connection conn)
throws java.sql.SQLException
conn - the underlying database connection
java.sql.SQLException - if an error occurs in the underlying database
protected PrecomputedTableManager(Database database)
throws java.sql.SQLException
database - the underlying database
java.sql.SQLException - if an error occurs in the underlying database| Method Detail |
|---|
public static PrecomputedTableManager getInstance(java.sql.Connection conn)
throws java.sql.SQLException
conn - the underlying database connection
java.lang.IllegalArgumentException - if connection is invalid
java.sql.SQLException - if an error occurs in the underlying database
public static PrecomputedTableManager getInstance(Database database)
throws java.sql.SQLException
database - the underlying database
java.lang.IllegalArgumentException - if database is invalid
java.sql.SQLException - if an error occurs in the underlying database
public void add(PrecomputedTable pt)
throws java.sql.SQLException
pt - the PrecomputedTable to add
java.sql.SQLException - if an error occurs in the underlying database
java.lang.NullPointerException - if pt is null
public void add(PrecomputedTable pt,
java.util.Collection<java.lang.String> indexes)
throws java.sql.SQLException
pt - the PrecomputedTable to addindexes - the extra fields to index - a Collection of Strings. Each String can be a
comma-separated list of fields that will be indexed as a multi-column index. The field
names should be names of columns in the precomputed table - so they are the aliases
specified in the PrecomputedTable
java.sql.SQLException - if an error occurs in the underlying database
java.lang.NullPointerException - if pt is null
java.lang.IllegalArgumentException - if the precomputed table already exists
public void dropEverything()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong
public void dropAffected(java.util.Set<java.lang.String> tablesAltered)
throws java.sql.SQLException
tablesAltered - a Set of table names that may have alterations
java.sql.SQLException - if something goes wrong
public void delete(PrecomputedTable pt)
throws java.sql.SQLException
pt - the PrecomputedTable to delete
java.sql.SQLException - if an error occurs in the underlying database
java.lang.NullPointerException - if pt is null
java.lang.IllegalArgumentException - if pt is not a valid tablepublic java.util.Set<PrecomputedTable> getPrecomputedTables()
public void addTableToDatabase(PrecomputedTable pt,
java.util.Collection<java.lang.String> indexes,
boolean record)
throws java.sql.SQLException
pt - the PrecomputedTable to addindexes - a Collection of Strings that are indexes to createrecord - whether to record this table in the index
java.sql.SQLException - if an error occurs in the underlying databaseprotected static java.util.Set<java.lang.String> canonicaliseIndexes(java.util.Collection<java.lang.String> indexes)
indexes - the Collection of index strings
public void deleteTableFromDatabase(java.lang.String name)
throws java.sql.SQLException
name - the name of the PrecomputedTable to delete
java.sql.SQLException - if an error occurs in the underlying database
protected void addIndex(java.lang.String table,
java.lang.String field,
java.sql.Connection con)
table - the name of the tablefield - the name of the fieldcon - a Connection to use
protected void synchroniseWithDatabase(java.sql.Connection con)
throws java.sql.SQLException
con - a Connection to the database we are synchronising with
java.sql.SQLException - if there is a problem in the underlying database
protected void setupDatabase(java.sql.Connection con)
throws java.sql.SQLException
con - the Connection to use
java.sql.SQLException - if there is a problem in the underlying database
public PrecomputedTable lookupSql(java.lang.String category,
java.lang.String sql)
category - a Stringsql - the original SQL string used to create the PrecomputedTable
public PrecomputedTable lookupSql(java.lang.String sql)
sql - the original SQL string used to create the PrecomputedTable
public java.util.Map<java.lang.String,PrecomputedTable> lookupCategory(java.lang.String category)
category - a String
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||