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
Class ServerDriver

    java.lang.Object
      org.ensembl.driver.ServerDriver

public class ServerDriver
extends java.lang.Object

Driver providing access to an ensembl database server. Provides a database connection pool specific to the server and a cached list of database names. Sharing instances of ServerDriver amongst EnsemblDrivers can reduce the number of connections and queries made to a database server.

Author:
  Craig Melsopp
See Also:
  `ServerDriverFactory`

Constructor Summary
`ServerDriver(java.util.Properties config)` Lazy loading cache of database names.

Method Summary
`void` | `clear()` Clears the cache.
`boolean` | `contains(java.lang.String databaseName)` Returns whether databaseName is in getDatabaseNames().
`boolean` | `containsPrefix(java.lang.String prefix)` Determines if at least one database beginning with the _prefix_ is included in _databaseNames()_.
`java.lang.String[]` | `databaseNames()`
`java.lang.String[]` | `filterDatabaseNames(java.lang.String filter)` Return database names matching the filter string.
`java.lang.String[]` | `filterDatabaseNamesAndReverseSort(java.lang.String filter)` Same as _filterDatabaseNames(String)_ but returns reverse sorted array.
`java.sql.Connection` | `getConnection()`
`java.sql.Connection` | `getConnection(java.lang.String catalog)`
`javax.sql.DataSource` | `getDataSource()`
`javax.sql.DataSource` | `getDataSource(java.lang.String catalog)`
`EnsemblDriver` | `getEnsemblDriver()`
`java.lang.String` | `highestVersionedDatabaseName(java.lang.String prefix)` Searches the database names in the cache for the one that begins with _prefix_ and has the highest version.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ServerDriver

    public ServerDriver(java.util.Properties config)

  Lazy loading cache of database names. Ignores "database" parameter so we can connect to a database server without a specific database.

Method Detail

### getDataSource

    public javax.sql.DataSource getDataSource()
                                       throws AdaptorException

  Throws:
    `AdaptorException`

### getDataSource

    public javax.sql.DataSource getDataSource(java.lang.String catalog)
                                       throws AdaptorException

  Throws:
    `AdaptorException`

### getConnection

    public java.sql.Connection getConnection()
                                      throws AdaptorException,
                                             java.sql.SQLException

  Throws:
    `AdaptorException`
    `java.sql.SQLException`

### getConnection

    public java.sql.Connection getConnection(java.lang.String catalog)
                                      throws AdaptorException,
                                             java.sql.SQLException

  Throws:
    `AdaptorException`
    `java.sql.SQLException`

### clear

    public void clear()

  Clears the cache.

### contains

    public boolean contains(java.lang.String databaseName)
                     throws AdaptorException

  Returns whether databaseName is in getDatabaseNames().

  Parameters:
    `databaseName` - name of database to find in getDatabaseNames().
  Returns:
    true if databaseName is in getDatabaseNames().
  Throws:
    `AdaptorException`

### filterDatabaseNames

    public java.lang.String[] filterDatabaseNames(java.lang.String filter)
                                           throws AdaptorException

  Return database names matching the filter string.

  Parameters:
    `filter` - String regexp specifiying which database names , if any, should be returned.
  Returns:
    sorted array of zero or more database names matching the filter.
  Throws:
    `AdaptorException`

### filterDatabaseNamesAndReverseSort

    public java.lang.String[] filterDatabaseNamesAndReverseSort(java.lang.String filter)
                                                         throws AdaptorException

  Same as _filterDatabaseNames(String)_ but returns reverse sorted array. This convenience method puts the higest versioned database name at the start of the array. e.g. `String latestDB = filterDatabaseNamesAndReversSort("homo_sapiens_core.*");`

  Parameters:
    `filter` - String regexp specifiying which database names , if any, should be returned.
  Throws:
    `AdaptorException`
  See Also:
    `filterDatabaseNames(String)`

### highestVersionedDatabaseName

    public java.lang.String highestVersionedDatabaseName(java.lang.String prefix)
                                                  throws AdaptorException

  Searches the database names in the cache for the one that begins with _prefix_ and has the highest version.

  Parameters:
    `prefix` - database name prefix.
  Returns:
    database name from cache beginning with _prefix_ and with the highest version, or null if none begin with _prefix_.
  Throws:
    `AdaptorException`

### containsPrefix

    public boolean containsPrefix(java.lang.String prefix)
                           throws AdaptorException

  Determines if at least one database beginning with the _prefix_ is included in _databaseNames()_.

  Parameters:
    `prefix` - beginning of a database name.
  Returns:
    true if _databaseNames()_ contains a database that begins with the prefix, otherwise false.
  Throws:
    `AdaptorException`
  See Also:
    `databaseNames()`

### getEnsemblDriver

    public EnsemblDriver getEnsemblDriver()
                                   throws AdaptorException

  Returns:
    Returns the ensemblDriver.
  Throws:
    `AdaptorException`

### databaseNames

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

  Returns:
    zero or more databases available on the db server.
  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