public class DataSourceFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory
JNDI object factory that creates an instance of
BasicDataSource
that has been configured based on the
RefAddr
values of the specified Reference
,
which must match the names and data types of the
BasicDataSource
bean properties.
JdbcInterceptor
class.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String[] |
ALL_PROPERTIES |
static java.lang.String |
OBJECT_NAME |
protected static java.lang.String |
PROP_ABANDONWHENPERCENTAGEFULL |
protected static java.lang.String |
PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED |
protected static java.lang.String |
PROP_ALTERNATE_USERNAME_ALLOWED |
protected static java.lang.String |
PROP_COMMITONRETURN |
protected static java.lang.String |
PROP_CONNECTIONPROPERTIES |
protected static java.lang.String |
PROP_DATASOURCE |
protected static java.lang.String |
PROP_DATASOURCE_JNDI |
protected static java.lang.String |
PROP_DEFAULTAUTOCOMMIT |
protected static java.lang.String |
PROP_DEFAULTCATALOG |
protected static java.lang.String |
PROP_DEFAULTREADONLY |
protected static java.lang.String |
PROP_DEFAULTTRANSACTIONISOLATION |
protected static java.lang.String |
PROP_DRIVERCLASSNAME |
protected static java.lang.String |
PROP_FAIR_QUEUE |
protected static java.lang.String |
PROP_IGNOREEXCEPTIONONPRELOAD |
protected static java.lang.String |
PROP_INITIALSIZE |
protected static java.lang.String |
PROP_INITSQL |
protected static java.lang.String |
PROP_INTERCEPTORS |
protected static java.lang.String |
PROP_JMX_ENABLED |
protected static java.lang.String |
PROP_LOGABANDONED |
protected static java.lang.String |
PROP_LOGVALIDATIONERRORS |
protected static java.lang.String |
PROP_MAXACTIVE |
protected static java.lang.String |
PROP_MAXAGE |
protected static java.lang.String |
PROP_MAXIDLE |
protected static java.lang.String |
PROP_MAXOPENPREPAREDSTATEMENTS |
protected static java.lang.String |
PROP_MAXWAIT |
protected static java.lang.String |
PROP_MINEVICTABLEIDLETIMEMILLIS |
protected static java.lang.String |
PROP_MINIDLE |
protected static java.lang.String |
PROP_NUMTESTSPEREVICTIONRUN |
protected static java.lang.String |
PROP_PASSWORD |
protected static java.lang.String |
PROP_POOLPREPAREDSTATEMENTS |
protected static java.lang.String |
PROP_PROPAGATEINTERRUPTSTATE |
protected static java.lang.String |
PROP_REMOVEABANDONED |
protected static java.lang.String |
PROP_REMOVEABANDONEDTIMEOUT |
protected static java.lang.String |
PROP_ROLLBACKONRETURN |
protected static java.lang.String |
PROP_SUSPECT_TIMEOUT |
protected static java.lang.String |
PROP_TESTONBORROW |
protected static java.lang.String |
PROP_TESTONCONNECT |
protected static java.lang.String |
PROP_TESTONRETURN |
protected static java.lang.String |
PROP_TESTWHILEIDLE |
protected static java.lang.String |
PROP_TIMEBETWEENEVICTIONRUNSMILLIS |
protected static java.lang.String |
PROP_URL |
protected static java.lang.String |
PROP_USE_CON_LOCK |
protected static java.lang.String |
PROP_USE_EQUALS |
protected static java.lang.String |
PROP_USEDISPOSABLECONNECTIONFACADE |
protected static java.lang.String |
PROP_USERNAME |
protected static java.lang.String |
PROP_VALIDATIONINTERVAL |
protected static java.lang.String |
PROP_VALIDATIONQUERY |
protected static java.lang.String |
PROP_VALIDATIONQUERY_TIMEOUT |
protected static java.lang.String |
PROP_VALIDATOR_CLASS_NAME |
static int |
UNKNOWN_TRANSACTIONISOLATION |
Constructor and Description |
---|
DataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
javax.sql.DataSource |
createDataSource(java.util.Properties properties)
Creates and configures a
DataSource instance based on the
given properties. |
javax.sql.DataSource |
createDataSource(java.util.Properties properties,
javax.naming.Context context,
boolean XA) |
java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable<?,?> environment)
Create and return a new
BasicDataSource instance. |
protected static java.util.Properties |
getProperties(java.lang.String propText)
Parse properties from the string.
|
static PoolConfiguration |
parsePoolProperties(java.util.Properties properties) |
void |
performJNDILookup(javax.naming.Context context,
PoolConfiguration poolProperties) |
protected static final java.lang.String PROP_DEFAULTAUTOCOMMIT
protected static final java.lang.String PROP_DEFAULTREADONLY
protected static final java.lang.String PROP_DEFAULTTRANSACTIONISOLATION
protected static final java.lang.String PROP_DEFAULTCATALOG
protected static final java.lang.String PROP_DRIVERCLASSNAME
protected static final java.lang.String PROP_PASSWORD
protected static final java.lang.String PROP_URL
protected static final java.lang.String PROP_USERNAME
protected static final java.lang.String PROP_MAXACTIVE
protected static final java.lang.String PROP_MAXIDLE
protected static final java.lang.String PROP_MINIDLE
protected static final java.lang.String PROP_INITIALSIZE
protected static final java.lang.String PROP_MAXWAIT
protected static final java.lang.String PROP_MAXAGE
protected static final java.lang.String PROP_TESTONBORROW
protected static final java.lang.String PROP_TESTONRETURN
protected static final java.lang.String PROP_TESTWHILEIDLE
protected static final java.lang.String PROP_TESTONCONNECT
protected static final java.lang.String PROP_VALIDATIONQUERY
protected static final java.lang.String PROP_VALIDATIONQUERY_TIMEOUT
protected static final java.lang.String PROP_VALIDATOR_CLASS_NAME
protected static final java.lang.String PROP_NUMTESTSPEREVICTIONRUN
protected static final java.lang.String PROP_TIMEBETWEENEVICTIONRUNSMILLIS
protected static final java.lang.String PROP_MINEVICTABLEIDLETIMEMILLIS
protected static final java.lang.String PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED
protected static final java.lang.String PROP_REMOVEABANDONED
protected static final java.lang.String PROP_REMOVEABANDONEDTIMEOUT
protected static final java.lang.String PROP_LOGABANDONED
protected static final java.lang.String PROP_ABANDONWHENPERCENTAGEFULL
protected static final java.lang.String PROP_POOLPREPAREDSTATEMENTS
protected static final java.lang.String PROP_MAXOPENPREPAREDSTATEMENTS
protected static final java.lang.String PROP_CONNECTIONPROPERTIES
protected static final java.lang.String PROP_INITSQL
protected static final java.lang.String PROP_INTERCEPTORS
protected static final java.lang.String PROP_VALIDATIONINTERVAL
protected static final java.lang.String PROP_JMX_ENABLED
protected static final java.lang.String PROP_FAIR_QUEUE
protected static final java.lang.String PROP_USE_EQUALS
protected static final java.lang.String PROP_USE_CON_LOCK
protected static final java.lang.String PROP_DATASOURCE
protected static final java.lang.String PROP_DATASOURCE_JNDI
protected static final java.lang.String PROP_SUSPECT_TIMEOUT
protected static final java.lang.String PROP_ALTERNATE_USERNAME_ALLOWED
protected static final java.lang.String PROP_COMMITONRETURN
protected static final java.lang.String PROP_ROLLBACKONRETURN
protected static final java.lang.String PROP_USEDISPOSABLECONNECTIONFACADE
protected static final java.lang.String PROP_LOGVALIDATIONERRORS
protected static final java.lang.String PROP_PROPAGATEINTERRUPTSTATE
protected static final java.lang.String PROP_IGNOREEXCEPTIONONPRELOAD
public static final int UNKNOWN_TRANSACTIONISOLATION
public static final java.lang.String OBJECT_NAME
protected static final java.lang.String[] ALL_PROPERTIES
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,?> environment) throws java.lang.Exception
Create and return a new BasicDataSource
instance. If no
instance can be created, return null
instead.
getObjectInstance
in interface javax.naming.spi.ObjectFactory
obj
- The possibly null object containing location or
reference information that can be used in creating an objectname
- The name of this object relative to nameCtx
nameCtx
- The context relative to which the name
parameter is specified, or null
if name
is relative to the default initial contextenvironment
- The possibly null environment that is used in
creating this objectjava.lang.Exception
- if an exception occurs creating the instancepublic static PoolConfiguration parsePoolProperties(java.util.Properties properties)
public javax.sql.DataSource createDataSource(java.util.Properties properties) throws java.lang.Exception
DataSource
instance based on the
given properties.properties
- the datasource configuration propertiesjava.lang.Exception
- if an error occurs creating the data sourcepublic javax.sql.DataSource createDataSource(java.util.Properties properties, javax.naming.Context context, boolean XA) throws java.lang.Exception
java.lang.Exception
public void performJNDILookup(javax.naming.Context context, PoolConfiguration poolProperties)
protected static java.util.Properties getProperties(java.lang.String propText)
Parse properties from the string. Format of the string must be [propertyName=property;]*
propText
- java.lang.Exception
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.