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:
connectionInitSqlsmust be passed to this factory as a single String using semi-colon to delimit the statements whereasBasicDataSourcerequires a collection of Strings.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]private static final org.datanucleus.util.NucleusLoggerprivate static final Stringprivate static final Stringprivate static final StringObsolete properties from DBCP 1.x.private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final StringThe property name for connectionInitSqls.private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final StringValue string must be of the form [STATE_CODE,]*private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final StringSilent Properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BasicDataSourcecreateDataSource(Properties properties) Creates and configures aBasicDataSourceinstance based on the given properties.getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) Create and return a newBasicDataSourceinstance.private static PropertiesgetProperties(String propText) Parse properties from the string.private static Collection<String> Parse list of property values from a delimited stringprivate voidCollects 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
-
SILENT_PROPERTIES
-
-
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
BasicDataSourceinstance. If no instance can be created, returnnullinstead.- Specified by:
getObjectInstancein 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 tonameCtxnameCtx- The context relative to which thenameparameter is specified, ornullifnameis 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 aBasicDataSourceinstance based on the given properties.- Parameters:
properties- The data source configuration properties.- Returns:
- A new a
BasicDataSourceinstance 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
-