Class BasicDataSourceFactory
java.lang.Object
org.datanucleus.store.rdbms.datasource.dbcp2.BasicDataSourceFactory
- All Implemented Interfaces:
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 with the following exceptions:
connectionInitSqls
must be passed to this factory as a single String using semi-colon to delimit the statements whereasBasicDataSource
requires a collection of Strings.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]
private static final org.datanucleus.util.NucleusLogger
private static final String
private static final String
private static final String
Obsolete properties from DBCP 1.x.private static final String
private static final String
private static final String
private static final String
private static final String
The property name for connectionInitSqls.private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
Value string must be of the form [STATE_CODE,]*private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
Silent Properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BasicDataSource
createDataSource
(Properties properties) Creates and configures aBasicDataSource
instance based on the given properties.getObjectInstance
(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) Create and return a newBasicDataSource
instance.private static Properties
getProperties
(String propText) Parse properties from the string.private static Collection
<String> Parse list of property values from a delimited stringprivate void
Collects warnings and info messages.
-
Field Details
-
log
private static final org.datanucleus.util.NucleusLogger log -
PROP_DEFAULT_AUTO_COMMIT
- See Also:
-
PROP_DEFAULT_READ_ONLY
- See Also:
-
PROP_DEFAULT_TRANSACTION_ISOLATION
- See Also:
-
PROP_DEFAULT_CATALOG
- See Also:
-
PROP_DEFAULT_SCHEMA
- See Also:
-
PROP_CACHE_STATE
- See Also:
-
PROP_DRIVER_CLASS_NAME
- See Also:
-
PROP_LIFO
- See Also:
-
PROP_MAX_TOTAL
- See Also:
-
PROP_MAX_IDLE
- See Also:
-
PROP_MIN_IDLE
- See Also:
-
PROP_INITIAL_SIZE
- See Also:
-
PROP_MAX_WAIT_MILLIS
- See Also:
-
PROP_TEST_ON_CREATE
- See Also:
-
PROP_TEST_ON_BORROW
- See Also:
-
PROP_TEST_ON_RETURN
- See Also:
-
PROP_TIME_BETWEEN_EVICTION_RUNS_MILLIS
- See Also:
-
PROP_NUM_TESTS_PER_EVICTION_RUN
- See Also:
-
PROP_MIN_EVICTABLE_IDLE_TIME_MILLIS
- See Also:
-
PROP_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
- See Also:
-
PROP_EVICTION_POLICY_CLASS_NAME
- See Also:
-
PROP_TEST_WHILE_IDLE
- See Also:
-
PROP_PASSWORD
- See Also:
-
PROP_URL
- See Also:
-
PROP_USER_NAME
- See Also:
-
PROP_VALIDATION_QUERY
- See Also:
-
PROP_VALIDATION_QUERY_TIMEOUT
- See Also:
-
PROP_JMX_NAME
- See Also:
-
PROP_CONNECTION_FACTORY_CLASS_NAME
- See Also:
-
PROP_CONNECTION_INIT_SQLS
The property name for connectionInitSqls. The associated value String must be of the form [query;]*- See Also:
-
PROP_ACCESS_TO_UNDERLYING_CONNECTION_ALLOWED
- See Also:
-
PROP_REMOVE_ABANDONED_ON_BORROW
- See Also:
-
PROP_REMOVE_ABANDONED_ON_MAINTENANCE
- See Also:
-
PROP_REMOVE_ABANDONED_TIMEOUT
- See Also:
-
PROP_LOG_ABANDONED
- See Also:
-
PROP_ABANDONED_USAGE_TRACKING
- See Also:
-
PROP_POOL_PREPARED_STATEMENTS
- See Also:
-
PROP_MAX_OPEN_PREPARED_STATEMENTS
- See Also:
-
PROP_CONNECTION_PROPERTIES
- See Also:
-
PROP_MAX_CONN_LIFETIME_MILLIS
- See Also:
-
PROP_LOG_EXPIRED_CONNECTIONS
- See Also:
-
PROP_ROLLBACK_ON_RETURN
- See Also:
-
PROP_ENABLE_AUTO_COMMIT_ON_RETURN
- See Also:
-
PROP_DEFAULT_QUERY_TIMEOUT
- See Also:
-
PROP_FAST_FAIL_VALIDATION
- See Also:
-
PROP_DISCONNECTION_SQL_CODES
Value string must be of the form [STATE_CODE,]*- See Also:
-
NUPROP_MAX_ACTIVE
- See Also:
-
NUPROP_REMOVE_ABANDONED
- See Also:
-
NUPROP_MAXWAIT
- See Also:
-
SILENT_PROP_FACTORY
- See Also:
-
SILENT_PROP_SCOPE
- See Also:
-
SILENT_PROP_SINGLETON
- See Also:
-
SILENT_PROP_AUTH
- See Also:
-
ALL_PROPERTIES
-
NUPROP_WARNTEXT
Obsolete properties from DBCP 1.x. with warning strings suggesting new properties. LinkedHashMap will guarantee that properties will be listed to output in order of insertion into map. -
SILENT_PROPERTIES
Silent Properties. These properties will not be listed as ignored - we know that they may appear in JDBC Resource references, and we will not list them as ignored.
-
-
Constructor Details
-
BasicDataSourceFactory
public BasicDataSourceFactory()
-
-
Method Details
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws ExceptionCreate and return a new
BasicDataSource
instance. If no instance can be created, returnnull
instead.- Specified by:
getObjectInstance
in interfaceObjectFactory
- Parameters:
obj
- The possibly null object containing location or reference information that can be used in creating an objectname
- The name of this object relative tonameCtx
nameCtx
- The context relative to which thename
parameter is specified, ornull
ifname
is relative to the default initial contextenvironment
- The possibly null environment that is used in creating this object- Throws:
Exception
- if an exception occurs creating the instance
-
validatePropertyNames
private void validatePropertyNames(Reference ref, Name name, List<String> warnings, List<String> infoMessages) Collects warnings and info messages. Warnings are generated when an obsolete property is set. Unknown properties generate info messages.- Parameters:
ref
- Reference to check properties ofname
- Name provided to getObjectwarnings
- container for warning messagesinfoMessages
- container for info messages
-
createDataSource
Creates and configures aBasicDataSource
instance based on the given properties.- Parameters:
properties
- The data source configuration properties.- Returns:
- A new a
BasicDataSource
instance based on the given properties. - Throws:
Exception
- Thrown when an error occurs creating the data source.
-
getProperties
Parse properties from the string. Format of the string must be [propertyName=property;]*
- Parameters:
propText
-- Returns:
- Properties
- Throws:
Exception
-
parseList
Parse list of property values from a delimited string- Parameters:
value
- delimited list of valuesdelimiter
- character used to separate values in the list- Returns:
- String Collection of values
-