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 inPoolingDataSourceshould 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=ZFabrikPoolingDataSourceconfiguration 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. SeePoolingDataSourcefor more details. - ds.dataSourceJNDIName
- If
ds.dataSourceClassis 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=ZFabrikPoolingDataSourceconfiguration 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. SeePoolingDataSourcefor more details. - ds.enlist
- This can be either workUnit, jta, or none.
If set to workUnit, connections will be enlisted with the
WorkUnitand 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 noWorkUnitis currently active, a non-enlisted connection will be returned.If set to jta connections will be enlisted with the
WorkUnitas 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
setAbcwill 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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringComponent type of the resourcestatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tprotected static ClassLoadergetClassLoader(String name) getName()voidMethods inherited from class com.zfabrik.resources.provider.Resource
as, handle, init, withHandle
-
Field Details
-
TYPE
Component type of the resource- See Also:
-
STRING
- See Also:
-
INT
- See Also:
-
BOOLEAN
- See Also:
-
DS_PROP_TYPE_PREFIX
- See Also:
-
DS_PROP_PREFIX
- See Also:
-
DS_TEMPLATE_COMPONENT
- See Also:
-
DS_TYPE
- See Also:
-
DS_CLASS
- See Also:
-
DS_JNDI
- See Also:
-
TYPE_COMBO
- See Also:
-
TYPE_NATIVE
- See Also:
-
TYPE_ZFABRIK
- See Also:
-
DS_ENLIST
- See Also:
-
-
Constructor Details
-
DataSourceResource
-
-
Method Details
-
getEnlistment
-
getDataSource
-
getName
-
as
-
getClassLoader
-
invalidate
- Overrides:
invalidatein classResource- Throws:
ResourceBusyException
-