|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jfw.database.ConnectionBroker
public final class ConnectionBroker
Distribute database connections.
The connections are get from connection pools, datasource and specific
connection management, as defined in jfw.properties.
The method get(java.lang.String)
is used to get a connection and the method
release(java.lang.String, java.sql.Connection)
for release the connection.
Is a singleton, the instance is returned from method getInstance()
.
Is an observer of UpdateObservable
.
Field Summary | |
---|---|
static java.lang.String |
DATA_SOURCE
Indicates a data source. |
static java.lang.String |
FREE
Indicates a proprietary connection management. |
static java.lang.String |
POOL
Indicates a connection pool. |
Method Summary | |
---|---|
java.sql.Connection |
get(java.lang.String resource)
Return an java.sql.Connection object. |
static ConnectionBroker |
getInstance()
Return the unique instance. |
void |
release(java.lang.String resource,
java.sql.Connection connection)
Release a connection. |
void |
update(java.util.Observable observable,
java.lang.Object obj)
Call method initialize() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DATA_SOURCE
public static final java.lang.String POOL
public static final java.lang.String FREE
Method Detail |
---|
public static ConnectionBroker getInstance()
public java.sql.Connection get(java.lang.String resource) throws java.lang.Exception
resource
- the resource name (connection pool or data source) that
manage the connection.
java.lang.Exception
public void release(java.lang.String resource, java.sql.Connection connection) throws java.lang.Exception
resource
- the resource name (connection pool or data source) that
manage the connection.connection
- the connection returned by method get(java.lang.String)
.
java.lang.Exception
public void update(java.util.Observable observable, java.lang.Object obj)
initialize()
. The method is called asynchronously by
UpdateObservable
.
update
in interface java.util.Observer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |