Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.driver
Interface EnsemblDriver

All Known Subinterfaces:
  ComparaDriver, CoreDriver, Driver, VariationDriver

public interface EnsemblDriver

An ensembl driver provides access to an ensembl database through it's adaptors.

Author:
  Craig Melsopp

Method Summary
`Adaptor` | `addAdaptor(Adaptor adaptor)` Attempts to connects to the database if not already connected.
`void` | `backupAndClearTable(java.lang.String tableName)` Make a backup copy of the table and empty the original table.
`void` | `backupAndClearTables()` Backs up and clears all tables returned by fetchTableNames().
`void` | `backupAndClearTables(java.lang.String[] tableNames)` Backup the tables and empty the originals.
`void` | `backupTable(java.lang.String tableName)` Backup the table.
`void` | `backupTables()` Backup all tables returned by fetchTableNames().
`void` | `backupTables(java.lang.String[] tableNames)` Backup all the tableNames.
`void` | `clearAllCaches()` Clears all caches.
`void` | `clearTable(java.lang.String tableName)` Empties the table.
`void` | `clearTables()` Clears all tables returned by fetchTableNames(); Note: this method might not work with all database servers, it has only been tested with MySQL.
`void` | `clearTables(java.lang.String[] tableNames)` Empties all the tables.
`void` | `closeAllConnections()` Closes all connections opened by the driver and it's adapotors.
`void` | `deleteDatabase()` Delete the database this driver wraps.
`java.lang.String` | `fetchDatabaseName()` Returns the database name.
`java.lang.String[]` | `fetchDatabaseNames()` Lists databases available on this server.
`java.lang.String` | `fetchDatabaseSchemaVersion()` Returns the schema version for the database this driver wraps.
`java.util.List` | `fetchMetaValues(java.lang.String metaKey)` Returns zero or more values from the meta table matching the specified meta_key.
`java.lang.String[]` | `fetchTableNames()` Return list of database tables excluding backup tables.
`java.lang.String[]` | `fetchTableNames(boolean includeBackups)` Returns list of tables in database with or without backup tables.
`Adaptor` | `getAdaptor(java.lang.String type)`
`Adaptor[]` | `getAdaptors()`
`java.util.Properties` | `getConfiguration()`
`java.sql.Connection` | `getConnection()`
`javax.sql.DataSource` | `getDatasource()` Datasource this driver gets connections from.
`ServerDriverFactory` | `getServerFactory()` If two EnsemblDrivers wrap databases on the same database server then setting the same ServerDriverFactory on both will enable them to share connections.
`void` | `initialise(java.util.Properties configuration)` Initialises the driver and it's adaptor with the configuration.
`boolean` | `isConnected()` Deprecated. Since ensj 30.3. Use testConnection() instead.
`void` | `removeAdaptor(Adaptor adaptor)`
`void` | `removeAdaptor(java.lang.String type)`
`void` | `removeAllAdaptors()`
`void` | `restoreTable(java.lang.String tableName)` Restores the table from a backup table.
`void` | `restoreTables()` Restores all the tables returned by fetchTableNames().
`void` | `restoreTables(java.lang.String[] tableNames)` Restores all the tables from their respective backups.
`void` | `setServerDriverFactory(ServerDriverFactory cacheManager)` If two EnsemblDrivers wrap databases on the same database server then setting the same ServerDriverFactory on both will enable them to share connections.
`boolean` | `testConnection()` Checks whether a connection can be made to the database.

Method Detail

### initialise

    public void initialise(java.util.Properties configuration)
                    throws ConfigurationException,
                           AdaptorException

  Initialises the driver and it's adaptor with the configuration.

  Parameters:
    `configuration` - parameters specifying the database and any additional datasource specific settings.
  Throws:
    `ConfigurationException`
    `AdaptorException`

### getConfiguration

    public java.util.Properties getConfiguration()

  Returns:
    configuration provided to initialise(Properties) plus any locally made modifications.
  See Also:
    `initialise(Properties)`

### getAdaptor

    public Adaptor getAdaptor(java.lang.String type)
                       throws AdaptorException

  Returns:
    Adaptor of the specified type, or null if no such driver available.
  Throws:
    `AdaptorException`

### getAdaptors

    public Adaptor[] getAdaptors()
                          throws AdaptorException

  Returns:
    array of zero or more Adaptors.
  Throws:
    `AdaptorException`

### testConnection

    public boolean testConnection()

  Checks whether a connection can be made to the database. Useful for checking if a driver has been correctly configured. Note: This method might leave an open connection in a connection pool so you should call closeAllConnections() if you want to ensure all connections are closed.

  Returns:
    true if driver can connect to it's persistent store, otherwise false.
  See Also:
    `closeAllConnections()`

### isConnected

    public boolean isConnected()

  Deprecated. Since ensj 30.3. Use testConnection() instead.

  Checks whether a connection can be made to the database. Useful for checking if a driver has been correctly configured. Note: This method might leave an open connection in a connection pool so you should call closeAllConnections() if you want to ensure all connections are closed.

  Returns:
    true if driver can connect to it's persistent store, otherwise false.
  See Also:
    `closeAllConnections()`

### fetchDatabaseNames

    public java.lang.String[] fetchDatabaseNames()
                                          throws AdaptorException

  Lists databases available on this server. This method does not require the database or database_prefix to specified in the configuration. This means that you can connect to a database server and retrieve the database names without having to first know one of them.

  Returns:
    zero or more database names available on the same server as this driver instance.
  Throws:
    `AdaptorException`

### addAdaptor

    public Adaptor addAdaptor(Adaptor adaptor)
                       throws AdaptorException

  Attempts to connects to the database if not already connected. Useful for checking if a driver has been correctly configured.

  Returns:
    true if driver can connect to it's persistent store, otherwise false.
  Throws:
    `AdaptorException`

### removeAdaptor

    public void removeAdaptor(Adaptor adaptor)
                       throws AdaptorException

  Throws:
    `AdaptorException`

### removeAdaptor

    public void removeAdaptor(java.lang.String type)

### removeAllAdaptors

    public void removeAllAdaptors()
                           throws AdaptorException

  Throws:
    `AdaptorException`

### getConnection

    public java.sql.Connection getConnection()
                                      throws AdaptorException

  Throws:
    `AdaptorException`

### clearAllCaches

    public void clearAllCaches()
                        throws AdaptorException

  Clears all caches.

  Throws:
    `AdaptorException` - if a problem occurs closing the connections.

### closeAllConnections

    public void closeAllConnections()
                             throws AdaptorException

  Closes all connections opened by the driver and it's adapotors.

  Throws:
    `AdaptorException`

### getDatasource

    public javax.sql.DataSource getDatasource()
                                       throws AdaptorException

  Datasource this driver gets connections from.

  Returns:
    datasource this driver gets connections from.
  Throws:
    `AdaptorException`

### getServerFactory

    public ServerDriverFactory getServerFactory()

  If two EnsemblDrivers wrap databases on the same database server then setting the same ServerDriverFactory on both will enable them to share connections.

  Returns:
    factory if set,otherwise null.

### setServerDriverFactory

    public void setServerDriverFactory(ServerDriverFactory cacheManager)

  If two EnsemblDrivers wrap databases on the same database server then setting the same ServerDriverFactory on both will enable them to share connections.

### fetchTableNames

    public java.lang.String[] fetchTableNames()
                                       throws AdaptorException

  Return list of database tables excluding backup tables. Calls fetchTableNames(false).

  Returns:
    all table names in associated database excluding backup tables.
  Throws:
    `AdaptorException`
  See Also:
    `fetchTableNames(boolean)`

### fetchTableNames

    public java.lang.String[] fetchTableNames(boolean includeBackups)
                                       throws AdaptorException

  Returns list of tables in database with or without backup tables.

  Parameters:
    `includeBackups` - whether to include backup tables.
  Returns:
    zero or more table names.
  Throws:
    `AdaptorException`

### backupTables

    public void backupTables()
                      throws AdaptorException

  Backup all tables returned by fetchTableNames(). Calls backup(String) for each table returned by fetchTableNames(). Note: this method might not work with all database servers, it has only been tested with MySQL.

  Throws:
    `AdaptorException`
  See Also:
    `fetchTableNames()`, `backupTable(String)`

### backupTable

    public void backupTable(java.lang.String tableName)
                     throws AdaptorException

  Backup the table. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableName` - name of table to be backed up.
  Throws:
    `AdaptorException`

### backupTables

    public void backupTables(java.lang.String[] tableNames)
                      throws AdaptorException

  Backup all the tableNames. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableNames` - tables to be backed up.
  Throws:
    `AdaptorException`

### clearTables

    public void clearTables()
                     throws AdaptorException

  Clears all tables returned by fetchTableNames(); Note: this method might not work with all database servers, it has only been tested with MySQL. Calls clear(String) for all tables returned by fetchTableNames().

  Throws:
    `AdaptorException`

### clearTable

    public void clearTable(java.lang.String tableName)
                    throws AdaptorException

  Empties the table. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableName` - table name.
  Throws:
    `AdaptorException`

### clearTables

    public void clearTables(java.lang.String[] tableNames)
                     throws AdaptorException

  Empties all the tables. Note: this method might not work with all database servers, it has only been tested with MySQL. Calls clear(String) for all tableNames.

  Parameters:
    `tableNames` - tables to to cleared.
  Throws:
    `AdaptorException`

### backupAndClearTables

    public void backupAndClearTables()
                              throws AdaptorException

  Backs up and clears all tables returned by fetchTableNames(). Calls backupAndClear(String) for all tables returned by fetchTableNames(). Note: this method might not work with all database servers, it has only been tested with MySQL.

  Throws:
    `AdaptorException`
  See Also:
    `fetchTableNames()`

### backupAndClearTable

    public void backupAndClearTable(java.lang.String tableName)
                             throws AdaptorException

  Make a backup copy of the table and empty the original table. Calls backup(tableName) and clear(tableName). Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableName` - table to be backed up and cleared.
  Throws:
    `AdaptorException`

### backupAndClearTables

    public void backupAndClearTables(java.lang.String[] tableNames)
                              throws AdaptorException

  Backup the tables and empty the originals. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableNames` - tables to be backed up and cleared.
  Throws:
    `AdaptorException`
  See Also:
    `backupAndClearTable(String)`

### restoreTables

    public void restoreTables()
                       throws AdaptorException

  Restores all the tables returned by fetchTableNames(). that have backup copies. Calls restore(String) for each table. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Throws:
    `AdaptorException`
  See Also:
    `restoreTable(String)`

### restoreTable

    public void restoreTable(java.lang.String tableName)
                      throws AdaptorException

  Restores the table from a backup table. Restoring means copying the rows from the backup table into the table, replacing any original data.

  Parameters:
    `tableName` - table to be restored.
  Throws:
    `AdaptorException`

### restoreTables

    public void restoreTables(java.lang.String[] tableNames)
                       throws AdaptorException

  Restores all the tables from their respective backups. Calls restore(String) for each table. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Parameters:
    `tableNames` - tables to be restored.
  Throws:
    `AdaptorException`

### deleteDatabase

    public void deleteDatabase()
                        throws AdaptorException

  Delete the database this driver wraps. Uses getConfiguration.getProperty("database") to determine the database name. Does nothing if it is null. Note: this method might not work with all database servers, it has only been tested with MySQL.

  Throws:
    `AdaptorException`

### fetchDatabaseSchemaVersion

    public java.lang.String fetchDatabaseSchemaVersion()
                                                throws AdaptorException

  Returns the schema version for the database this driver wraps. The schema version is determined by these values, in this order:
  1. If available the attribute driver.getConfiguration().getProperty("schema_version") is used.
  2. If this driver wraps a specific database name derived from the penultimate "number" in the database name. e.g. in homo_sapiens_core_34_35g the schema version is 34.

  Returns:
    the schema version for the database this driver wraps, null if it can not be determined.
  Throws:
    `AdaptorException`

### fetchMetaValues

    public java.util.List fetchMetaValues(java.lang.String metaKey)
                                   throws AdaptorException

  Returns zero or more values from the meta table matching the specified meta_key.

  Parameters:
    `metaKey` - meta_key filter.
  Returns:
    zero or more meta attributes as Strings.
  Throws:
    `AdaptorException`

### fetchDatabaseName

    public java.lang.String fetchDatabaseName()
                                       throws AdaptorException

  Returns the database name.

  Returns:
    name of the database this driver wraps, null if it does not wrap a specific database.
  Throws:
    `AdaptorException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD