public class DataSourceFactory extends Object implements 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.Constructor and Description |
---|
DataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
DataSource |
createDataSource(Properties properties)
Creates and configures a
DataSource instance based on the
given properties. |
DataSource |
createDataSource(Properties properties,
Context context,
boolean XA) |
Object |
getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable<?,?> environment)
Create and return a new
BasicDataSource instance. |
protected static Properties |
getProperties(String propText)
Parse properties from the string.
|
static PoolConfiguration |
parsePoolProperties(Properties properties) |
void |
performJNDILookup(Context context,
PoolConfiguration poolProperties) |
protected static final String PROP_DEFAULTAUTOCOMMIT
protected static final String PROP_DEFAULTREADONLY
protected static final String PROP_DEFAULTTRANSACTIONISOLATION
protected static final String PROP_DEFAULTCATALOG
protected static final String PROP_DRIVERCLASSNAME
protected static final String PROP_PASSWORD
protected static final String PROP_URL
protected static final String PROP_USERNAME
protected static final String PROP_MAXACTIVE
protected static final String PROP_MAXIDLE
protected static final String PROP_MINIDLE
protected static final String PROP_INITIALSIZE
protected static final String PROP_MAXWAIT
protected static final String PROP_MAXAGE
protected static final String PROP_TESTONBORROW
protected static final String PROP_TESTONRETURN
protected static final String PROP_TESTWHILEIDLE
protected static final String PROP_TESTONCONNECT
protected static final String PROP_VALIDATIONQUERY
protected static final String PROP_VALIDATIONQUERY_TIMEOUT
protected static final String PROP_VALIDATOR_CLASS_NAME
protected static final String PROP_NUMTESTSPEREVICTIONRUN
protected static final String PROP_TIMEBETWEENEVICTIONRUNSMILLIS
protected static final String PROP_MINEVICTABLEIDLETIMEMILLIS
protected static final String PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED
protected static final String PROP_REMOVEABANDONED
protected static final String PROP_REMOVEABANDONEDTIMEOUT
protected static final String PROP_LOGABANDONED
protected static final String PROP_ABANDONWHENPERCENTAGEFULL
protected static final String PROP_POOLPREPAREDSTATEMENTS
protected static final String PROP_MAXOPENPREPAREDSTATEMENTS
protected static final String PROP_CONNECTIONPROPERTIES
protected static final String PROP_INITSQL
protected static final String PROP_INTERCEPTORS
protected static final String PROP_VALIDATIONINTERVAL
protected static final String PROP_JMX_ENABLED
protected static final String PROP_FAIR_QUEUE
protected static final String PROP_USE_EQUALS
protected static final String PROP_USE_CON_LOCK
protected static final String PROP_DATASOURCE
protected static final String PROP_DATASOURCE_JNDI
protected static final String PROP_SUSPECT_TIMEOUT
protected static final String PROP_ALTERNATE_USERNAME_ALLOWED
protected static final String PROP_COMMITONRETURN
protected static final String PROP_ROLLBACKONRETURN
protected static final String PROP_USEDISPOSABLECONNECTIONFACADE
protected static final String PROP_LOGVALIDATIONERRORS
protected static final String PROP_PROPAGATEINTERRUPTSTATE
protected static final String PROP_IGNOREEXCEPTIONONPRELOAD
public static final int UNKNOWN_TRANSACTIONISOLATION
public static final String OBJECT_NAME
protected static final String[] ALL_PROPERTIES
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
Create and return a new BasicDataSource
instance. If no
instance can be created, return null
instead.
getObjectInstance
in interface 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 objectException
- if an exception occurs creating the instancepublic static PoolConfiguration parsePoolProperties(Properties properties)
public DataSource createDataSource(Properties properties) throws Exception
DataSource
instance based on the
given properties.properties
- the datasource configuration propertiesException
- if an error occurs creating the data sourcepublic DataSource createDataSource(Properties properties, Context context, boolean XA) throws Exception
Exception
public void performJNDILookup(Context context, PoolConfiguration poolProperties)
protected static Properties getProperties(String propText)
propText
- The properties stringCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.