com.tensegrity.wpalo.server.dbconnection
Class SqlDbConnection
java.lang.Object
com.tensegrity.wpalo.server.dbconnection.SqlDbConnection
- All Implemented Interfaces:
- org.palo.viewapi.DbConnection
- Direct Known Subclasses:
- HSqlDbConnection, MySqlDbConnection
public abstract class SqlDbConnection
- extends java.lang.Object
- implements org.palo.viewapi.DbConnection
SqlDbConnection
Abstract base class for sql based database connections.
- Version:
- $Id: SqlDbConnection.java,v 1.2 2009/12/17 16:14:20 PhilippBouillon Exp $
Method Summary |
protected java.lang.String |
buildQuery(java.util.Properties props,
java.lang.String key,
java.lang.String... params)
|
void |
connect()
|
void |
disconnect()
|
java.sql.Connection |
getConnection()
|
java.util.Properties |
getSqlCommands()
|
protected abstract java.lang.String |
getSqlHomeDir()
Specifies the home directory of where to sql commands and the database
credentials properties files are stored. |
protected abstract void |
initialize()
Initialises the newly created connection. |
boolean |
isConnected()
|
protected java.util.Properties |
loadProperties(java.lang.String fromFile)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
connection
protected java.sql.Connection connection
commands
protected final java.util.Properties commands
credentials
protected final java.util.Properties credentials
SqlDbConnection
protected SqlDbConnection()
connect
public void connect()
throws java.sql.SQLException
- Specified by:
connect
in interface org.palo.viewapi.DbConnection
- Throws:
java.sql.SQLException
disconnect
public void disconnect()
- Specified by:
disconnect
in interface org.palo.viewapi.DbConnection
getConnection
public final java.sql.Connection getConnection()
- Specified by:
getConnection
in interface org.palo.viewapi.DbConnection
getSqlCommands
public final java.util.Properties getSqlCommands()
- Specified by:
getSqlCommands
in interface org.palo.viewapi.DbConnection
isConnected
public final boolean isConnected()
- Specified by:
isConnected
in interface org.palo.viewapi.DbConnection
getSqlHomeDir
protected abstract java.lang.String getSqlHomeDir()
- Specifies the home directory of where to sql commands and the database
credentials properties files are stored.
- Returns:
- the home directory without an ending '/'
initialize
protected abstract void initialize()
- Initialises the newly created connection.
loadProperties
protected java.util.Properties loadProperties(java.lang.String fromFile)
buildQuery
protected final java.lang.String buildQuery(java.util.Properties props,
java.lang.String key,
java.lang.String... params)