Class DataSourceResource
WorkUnit
).
A component of type javax.sql.DataSource can be configured in various ways, controlled by the following parameters:
- ds.type
- This can be either ZFabrikPoolingDataSource or NativeDataSource. In the first case, the data source will be pooled
using
PoolingDataSource
. In that case the pool configuration parameters inPoolingDataSource
should be applied - ds.dataSourceClass
- If set, the specified data source class will be loaded as data source implementation using the private class loader
of the Java module of the component holding the data source definition. When specifying this class in conjunction with the
ds.type=ZFabrikPoolingDataSource
configuration properties will be applied to both and the pool will request new connections from the specified data source. Alternatively, the pool may be configured to use a driver class. SeePoolingDataSource
for more details. - ds.dataSourceJNDIName
- If
ds.dataSourceClass
is not set, this JNDI name will be tried to lookup a data source that will serve as connection provider. During lookup the thread context class loader will be set to the private class loader of the Java module of the component holding the data source definition. When specifying this class in conjunction with theds.type=ZFabrikPoolingDataSource
configuration properties will be applied to both and the pool will request new connections from the specified data source. Alternatively, the pool may be configured to use a driver class. SeePoolingDataSource
for more details. - ds.enlist
- This can be either workUnit, jta, or none.
If set to workUnit, connections will be enlisted with the
WorkUnit
and only committed, rolled back, or closed when the unit of work was completed. Transparently this integrates with Z2's pseudo-distributed JTA implementation. Please check the Wiki at for more information. If noWorkUnit
is currently active, a non-enlisted connection will be returned.If set to jta connections will be enlisted with the
WorkUnit
as above but removed after commit or rollback. This prevents, that a connection will be visible for longer than a transaction and it will instead be reinitialized with the pool before it is provided again. If no JTA transaction is currently active, a non-enlisted connection will be returned. This prevents that any non-transactional code may effect connection state (in particular such as auto commit settings) for transactional connections.If set to none connections will not be enlisted but simply handed out from the data source.
It is recommended to use jta.
- ds.prop.abc
- Attempts to set the bean property abc on the data source (and on PoolingDataSource, if used). A setter method
setAbc
will be used for that. The property ds.propType.abc defines the signature required. - ds.propType.abc
- Defines the type of a configuration property as in ds.prop.abc. Can be any of int,string, or boolean. Defaults to string.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
protected static ClassLoader
getClassLoader(String name)
getName()
void
-
Field Details
-
TYPE
Component type of the resource- See Also:
- Constant Field Values
-
STRING
- See Also:
- Constant Field Values
-
INT
- See Also:
- Constant Field Values
-
BOOLEAN
- See Also:
- Constant Field Values
-
DS_PROP_TYPE_PREFIX
- See Also:
- Constant Field Values
-
DS_PROP_PREFIX
- See Also:
- Constant Field Values
-
DS_TEMPLATE_COMPONENT
- See Also:
- Constant Field Values
-
DS_TYPE
- See Also:
- Constant Field Values
-
DS_CLASS
- See Also:
- Constant Field Values
-
DS_JNDI
- See Also:
- Constant Field Values
-
TYPE_COMBO
- See Also:
- Constant Field Values
-
TYPE_NATIVE
- See Also:
- Constant Field Values
-
TYPE_ZFABRIK
- See Also:
- Constant Field Values
-
DS_ENLIST
- See Also:
- Constant Field Values
-
-
Constructor Details
-
DataSourceResource
-
-
Method Details
-
getEnlistment
-
getDataSource
-
getName
-
as
-
getClassLoader
-
invalidate
- Overrides:
invalidate
in classResource
- Throws:
ResourceBusyException
-