|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.pool.JdbcConnectionPoolFactory
public class JdbcConnectionPoolFactory
Generates JDBC Connections from a configuration properties. The connections have default autocommit = false, readonly = false. Usage in a servlet: ObjectPool lConnectionObjectPool = null; Connection lConnection = null; try { lConnectionObjectPool = JdbcConnectionPoolFactory.getConnectionPool(request, "WPS", null); // poolname = "WPS", applicationname (for configuration properties) = null lConnection = (Connection)lConnectionObjectPool.borrowObject(); ... } finally { if (lConnection != null) lConnectionObjectPool.returnObject(lConnection); if (lConnectionObjectPool != null) lConnectionObjectPool.close(); } This will create or retrieve a pool (stored in getServletContext aka application context). It is custom to have some kind of storage for created pools, a regular application could use a static Map based on the poolname. org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.JdbcDriver=com.nilostep.xlsql.jdbc.xlDriver org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.JdbcUrl=jdbc:nilostep:excel:C:/DOCUME~1/tom/MYDOCU~1/kp/jars/jars/container/Util.jar/libtest org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.JdbcUser=TBEEUTIL org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.JdbcPassword=TBEEUTIL org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.maxActive=15 org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.maxIdle=-1 org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.whenExhaustedAction=FAIL org.tbee.util.pool.JdbcConnectionPoolFactory.TEST.exhaustedWaitMax=-1
| Field Summary | |
|---|---|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
JdbcConnectionPoolFactory(String poolname,
ConfigurationProperties configurationProperties)
initialize the JDBC connection pool factory |
|
JdbcConnectionPoolFactory(String poolname,
String applicationname)
initialize the JDBC connection pool factory |
|
| Method Summary | |
|---|---|
void |
activateObject(Object arg0)
|
static JdbcConnectionPool |
createConnectionPool(String poolname)
|
static JdbcConnectionPool |
createConnectionPool(String poolname,
ConfigurationProperties configurationProperties)
Create a factory and a pool (using the GenericObjectPool) |
static JdbcConnectionPool |
createConnectionPool(String poolname,
ConfigurationProperties configurationProperties,
JdbcConnectionPoolFactory jdbcConnectionPoolFactory)
Create a pool (using the GenericObjectPool) |
static JdbcConnectionPool |
createConnectionPool(String poolname,
String applicationname)
Create a factory and a pool (using the GenericObjectPool) |
static JdbcConnectionPool |
createConnectionPool(String poolname,
String applicationname,
JdbcConnectionPoolFactory jdbcConnectionPoolFactory)
Create a pool (using the GenericObjectPool) |
void |
destroyObject(Object arg0)
|
boolean |
getAutoCommit()
|
static JdbcConnectionPool |
getConnectionPool(Map storage,
String poolname)
|
static JdbcConnectionPool |
getConnectionPool(Map storage,
String poolname,
ConfigurationProperties configurationProperties)
Get the database pool from a map or create one |
static JdbcConnectionPool |
getConnectionPool(Map storage,
String poolname,
String applicationname)
Get the database pool from a map or create one |
static JdbcConnectionPool |
getConnectionPool(String poolname)
|
static JdbcConnectionPool |
getConnectionPool(String poolname,
ConfigurationProperties configurationProperties)
Get the database pool from the embedded map |
static JdbcConnectionPool |
getConnectionPool(String poolname,
String applicationname)
Get the database pool from the embedded map |
boolean |
getLogging()
|
String |
getPoolname()
|
String |
getPoolnameDescription()
|
boolean |
getReadOnly()
|
Object |
makeObject()
|
void |
passivateObject(Object arg0)
|
void |
setAutoCommit(boolean value)
|
void |
setLogging(boolean value)
|
protected void |
setPoolname(String value)
|
void |
setReadOnly(boolean value)
|
boolean |
validateObject(Object arg0)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
| Constructor Detail |
|---|
public JdbcConnectionPoolFactory(String poolname,
String applicationname)
public JdbcConnectionPoolFactory(String poolname,
ConfigurationProperties configurationProperties)
| Method Detail |
|---|
public String getPoolname()
protected void setPoolname(String value)
public String getPoolnameDescription()
public Object makeObject()
makeObject in interface PoolableObjectFactorypublic void destroyObject(Object arg0)
destroyObject in interface PoolableObjectFactorypublic boolean validateObject(Object arg0)
validateObject in interface PoolableObjectFactorypublic void activateObject(Object arg0)
activateObject in interface PoolableObjectFactorypublic void passivateObject(Object arg0)
passivateObject in interface PoolableObjectFactorypublic boolean getAutoCommit()
public void setAutoCommit(boolean value)
public boolean getReadOnly()
public void setReadOnly(boolean value)
public boolean getLogging()
public void setLogging(boolean value)
public static JdbcConnectionPool createConnectionPool(String poolname,
String applicationname)
public static JdbcConnectionPool createConnectionPool(String poolname,
ConfigurationProperties configurationProperties)
public static JdbcConnectionPool createConnectionPool(String poolname,
String applicationname,
JdbcConnectionPoolFactory jdbcConnectionPoolFactory)
public static JdbcConnectionPool createConnectionPool(String poolname,
ConfigurationProperties configurationProperties,
JdbcConnectionPoolFactory jdbcConnectionPoolFactory)
public static JdbcConnectionPool createConnectionPool(String poolname)
public static JdbcConnectionPool getConnectionPool(Map storage,
String poolname,
String applicationname)
public static JdbcConnectionPool getConnectionPool(Map storage,
String poolname,
ConfigurationProperties configurationProperties)
public static JdbcConnectionPool getConnectionPool(Map storage,
String poolname)
public static JdbcConnectionPool getConnectionPool(String poolname,
String applicationname)
public static JdbcConnectionPool getConnectionPool(String poolname,
ConfigurationProperties configurationProperties)
public static JdbcConnectionPool getConnectionPool(String poolname)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||