|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.sqlunit.ConnectionRegistry
public final class ConnectionRegistry
A Singelton object which stores database Connection objects in a HashMap and returns them to the application on demand. The properties are kept in a backup HashMap so they can be regenerated on demand.
Method Summary | |
---|---|
static java.sql.Connection |
getConnection(java.lang.String id)
Returns the Connection object associated with a given connection-id. |
static java.lang.String |
getServerName()
Returns the server name (supplied explicitly as an attribute to the Connection element or implicitly derived from the DatabaseMetaData) for the current thread. |
static boolean |
hasTransactionSupport(java.lang.String id)
Checks to see if the transaction-support feature is enabled for the specified connection id parameter. |
static void |
invalidate(java.lang.String id)
Invalidates the Connection at connection-id attribute in the Connection registry in case of an exception. |
static boolean |
isTransactionSupportImplicit(java.lang.String id)
Checks to see if the transaction support feature is set to implicit. |
static boolean |
reconnectOnFailure(java.lang.String id)
Checks to see if the reconnect-on-failure is enabled for the specified connection id parameter. |
static void |
releaseConnections()
Closes all the connections in the registry and marks the registry as ready for garbage collection. |
static void |
safelyCommit(java.lang.String id,
java.sql.Connection conn)
Issues a COMMIT on the specified connection only if transaction-support is turned on for the connection. |
static void |
safelyRollback(java.lang.String id,
java.sql.Connection conn)
Issues a ROLLBACK on the specified connection only if transaction-support is turned on for the connection. |
static void |
setConnection(java.sql.Connection conn)
Sets the default connection object by specifying an actual Connection object. |
static void |
setConnection(java.lang.String id,
java.util.Map props)
Sets a Connection keyed by a Map of connection properties supplied in the connection element for the given Connection id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.sql.Connection getConnection(java.lang.String id) throws SQLUnitException
id
- the value of the connection-id attribute.
SQLUnitException
- if there was a problem getting the connection.public static java.lang.String getServerName()
public static void setConnection(java.sql.Connection conn)
conn
- the Connection object to use.public static void setConnection(java.lang.String id, java.util.Map props) throws java.lang.Exception
id
- the value of the connection-id attribute.props
- the Connection properties for the Connection object.
java.lang.Exception
- if there was a problem setting the connection.public static boolean reconnectOnFailure(java.lang.String id)
id
- the connection id.
public static boolean hasTransactionSupport(java.lang.String id)
id
- the connection id.
public static boolean isTransactionSupportImplicit(java.lang.String id)
id
- the connection id.
public static void invalidate(java.lang.String id)
id
- the value of the connection-id attribute.public static void releaseConnections()
public static void safelyCommit(java.lang.String id, java.sql.Connection conn)
id
- the Connection id.conn
- the Connection.public static void safelyRollback(java.lang.String id, java.sql.Connection conn)
id
- the Connection id.conn
- the Connection.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |