|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecthelma.objectmodel.db.DbSource
public class DbSource
This class describes a releational data source (URL, driver, user and password).
| Field Summary | |
|---|---|
protected java.lang.String |
url
|
| Constructor Summary | |
|---|---|
DbSource(java.lang.String name,
ResourceProperties props)
Creates a new DbSource object. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
java.sql.Connection |
getConnection()
Get a JDBC connection to the db source. |
protected DbMapping |
getDbMapping(java.lang.String tablename)
Look up a DbMapping instance for the given table name. |
java.lang.String |
getDriverName()
Return the class name of the JDBC driver |
java.lang.String |
getName()
Return the name of the db dource |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isH2()
Check if this DbSource represents a H2 database |
boolean |
isMySQL()
Check if this DbSource represents a MySQL database |
boolean |
isOracle()
Check if this DbSource represents an Oracle database |
boolean |
isPostgreSQL()
Check if this DbSource represents a PostgreSQL database |
protected void |
registerDbMapping(DbMapping dbmap)
Register a dbmapping by its table name. |
static void |
setDefaultProps(ResourceProperties props)
Set the default (server-wide) properties |
ResourceProperties |
switchProperties(ResourceProperties newProps)
Set the db properties to newProps, and return the old properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String url
| Constructor Detail |
|---|
public DbSource(java.lang.String name,
ResourceProperties props)
throws java.lang.ClassNotFoundException
name - the db source nameprops - the properties
java.lang.ClassNotFoundException - if the JDBC driver couldn't be loaded| Method Detail |
|---|
public java.sql.Connection getConnection()
throws java.lang.ClassNotFoundException,
java.sql.SQLException
java.lang.ClassNotFoundException - if the JDBC driver couldn't be loaded
java.sql.SQLException - if the connection couldn't be created
public ResourceProperties switchProperties(ResourceProperties newProps)
throws java.lang.ClassNotFoundException
newProps - the new properties to use for this db source
java.lang.ClassNotFoundException - if jdbc driver class couldn't be foundpublic java.lang.String getDriverName()
public java.lang.String getName()
public static void setDefaultProps(ResourceProperties props)
props - server default db.propertiespublic boolean isOracle()
public boolean isMySQL()
public boolean isPostgreSQL()
public boolean isH2()
protected void registerDbMapping(DbMapping dbmap)
dbmap - the DbMapping instance to registerprotected DbMapping getDbMapping(java.lang.String tablename)
tablename - the table name
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||