Class DataSourceProviderImpl
java.lang.Object
org.exoplatform.services.jdbc.impl.DataSourceProviderImpl
- All Implemented Interfaces:
DataSourceProvider
The default implementation of
DataSourceProvider. It allows you
to define a data source as managed thanks to the configuration of this
component. When the data source is declared as managed, the DataSource
object will be wrap into a ManagedDataSource.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates that all the data sources are managedprotected booleanIndicates if the data source needs to check if a tx is active to decide if the provided connection needs to be managed or not.A set of all the data sources that are managedprotected static final StringThe name of the parameter to know if the data sources are always managed.protected static final StringThe name of the parameter to know if the tx has to be checked or not.protected static final StringThe name of the parameter of all the managed data sources.protected final javax.transaction.TransactionManagerThe transaction manager -
Constructor Summary
ConstructorsConstructorDescriptionDataSourceProviderImpl(org.exoplatform.container.xml.InitParams params) The default constructorDataSourceProviderImpl(org.exoplatform.container.xml.InitParams params, TransactionService tService) The default constructor -
Method Summary
Modifier and TypeMethodDescriptiongetDataSource(String dataSourceName) Try to get the data source from a lookup, if it can't aNamingExceptionwill be thrownbooleanIndicates whether or not the given data source is managed
-
Field Details
-
PARAM_CHECK_TX
The name of the parameter to know if the tx has to be checked or not.- See Also:
-
PARAM_ALWAYS_MANAGED
The name of the parameter to know if the data sources are always managed.- See Also:
-
PARAM_MANAGED_DS
The name of the parameter of all the managed data sources.- See Also:
-
tm
protected final javax.transaction.TransactionManager tmThe transaction manager -
checkIfTxActive
protected boolean checkIfTxActiveIndicates if the data source needs to check if a tx is active to decide if the provided connection needs to be managed or not. If it is set to false, the data source will provide only managed connections if the data source itself is managed. -
alwaysManaged
protected boolean alwaysManagedIndicates that all the data sources are managed -
managedDS
A set of all the data sources that are managed
-
-
Constructor Details
-
DataSourceProviderImpl
public DataSourceProviderImpl(org.exoplatform.container.xml.InitParams params) The default constructor -
DataSourceProviderImpl
public DataSourceProviderImpl(org.exoplatform.container.xml.InitParams params, TransactionService tService) The default constructor
-
-
Method Details
-
getDataSource
Description copied from interface:DataSourceProviderTry to get the data source from a lookup, if it can't aNamingExceptionwill be thrown- Specified by:
getDataSourcein interfaceDataSourceProvider- Parameters:
dataSourceName- the name of the data source to lookup- Returns:
- the
DataSourcefound thanks to the lookup. The original object could be wrap to anotherDataSourcein order to support managed data source. - Throws:
NamingException- See Also:
-
isManaged
Description copied from interface:DataSourceProviderIndicates whether or not the given data source is managed- Specified by:
isManagedin interfaceDataSourceProvider- Parameters:
dataSourceName- the data source to check- Returns:
trueif the data source is managed,falseotherwise- See Also:
-