|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.intermine.sql.Database
public class Database
Class that represents a physical SQL database
| Field Summary | |
|---|---|
protected javax.sql.DataSource |
datasource
|
protected java.lang.String |
driver
|
protected int |
parallel
The number of worker threads to use for background SQL statements |
protected java.lang.String |
platform
|
protected java.util.Properties |
settings
|
| Constructor Summary | |
|---|---|
protected |
Database()
No argument constructor for testing purposes |
protected |
Database(java.util.Properties props)
Constructs a Database object from a set of properties |
| Method Summary | |
|---|---|
protected void |
configure(java.util.Properties props)
Configures a datasource from a Properties object |
void |
executeSqlInParallel(java.lang.String sql)
Executes an SQL statement on the database in a separate thread. |
void |
finalize()
|
java.lang.String |
getColumnTypeString(java.lang.Class<?> c)
Return the SQL type used to store objects of the given Class. |
java.sql.Connection |
getConnection()
Gets a Connection to this Database |
javax.sql.DataSource |
getDataSource()
Gets the DataSource object for this Database |
java.lang.String |
getDriver()
Gets the driver this Database |
java.lang.String |
getName()
Gets the database name only, not the full URL. |
java.lang.String |
getPassword()
Gets the password for this Database |
java.lang.String |
getPlatform()
Gets the platform of this Database |
java.lang.String |
getURL()
Gets the URL from this database |
java.lang.String |
getUser()
Gets the username for this Database |
void |
shutdown()
Logs stuff |
java.lang.String |
toString()
|
void |
waitForCurrentJobs()
Blocks until all the current pending jobs are finished. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected javax.sql.DataSource datasource
protected java.lang.String platform
protected java.lang.String driver
protected int parallel
protected java.util.Properties settings
| Constructor Detail |
|---|
protected Database()
protected Database(java.util.Properties props)
throws java.lang.ClassNotFoundException
props - the properties by which this Database is configured
java.lang.ClassNotFoundException - if there is a class in props that cannot be found| Method Detail |
|---|
public javax.sql.DataSource getDataSource()
public java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLException - if there is a problem in the underlying databasepublic void shutdown()
shutdown in interface Shutdownable
public void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String getPlatform()
public java.lang.String getDriver()
public java.lang.String getUser()
public java.lang.String getPassword()
public java.lang.String getURL()
public java.lang.String getName()
protected void configure(java.util.Properties props)
throws java.lang.ClassNotFoundException
props - the properties for configuring the Database
java.lang.ClassNotFoundException - if the class given in the properties file cannot be found
java.lang.IllegalArgumentException - if the configuration properties are empty
java.lang.NullPointerException - if props is nullpublic java.lang.String getColumnTypeString(java.lang.Class<?> c)
c - the Class representing the java type
public java.lang.String toString()
toString in class java.lang.Object
public void executeSqlInParallel(java.lang.String sql)
throws java.sql.SQLException
sql - an SQL string.
java.sql.SQLException - if an error has been reported by a previous operation - however, this
does not cancel the current operation.
public void waitForCurrentJobs()
throws java.sql.SQLException
java.sql.SQLException - if an error has been reported by a previous operation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||