Class DataSourceProviderImpl
- java.lang.Object
-
- org.exoplatform.services.jdbc.impl.DataSourceProviderImpl
-
- All Implemented Interfaces:
DataSourceProvider
public class DataSourceProviderImpl extends Object implements DataSourceProvider
The default implementation ofDataSourceProvider. 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, theDataSourceobject will be wrap into aManagedDataSource.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalwaysManagedIndicates that all the data sources are managedprotected booleancheckIfTxActiveIndicates if the data source needs to check if a tx is active to decide if the provided connection needs to be managed or not.protected Set<String>managedDSA set of all the data sources that are managedprotected static StringPARAM_ALWAYS_MANAGEDThe name of the parameter to know if the data sources are always managed.protected static StringPARAM_CHECK_TXThe name of the parameter to know if the tx has to be checked or not.protected static StringPARAM_MANAGED_DSThe name of the parameter of all the managed data sources.protected TransactionManagertmThe transaction manager
-
Constructor Summary
Constructors Constructor Description DataSourceProviderImpl(org.exoplatform.container.xml.InitParams params)The default constructorDataSourceProviderImpl(org.exoplatform.container.xml.InitParams params, TransactionService tService)The default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSourcegetDataSource(String dataSourceName)Try to get the data source from a lookup, if it can't aNamingExceptionwill be thrownbooleanisManaged(String dataSourceName)Indicates whether or not the given data source is managed
-
-
-
Field Detail
-
PARAM_CHECK_TX
protected static final String PARAM_CHECK_TX
The name of the parameter to know if the tx has to be checked or not.- See Also:
- Constant Field Values
-
PARAM_ALWAYS_MANAGED
protected static final String PARAM_ALWAYS_MANAGED
The name of the parameter to know if the data sources are always managed.- See Also:
- Constant Field Values
-
PARAM_MANAGED_DS
protected static final String PARAM_MANAGED_DS
The name of the parameter of all the managed data sources.- See Also:
- Constant Field Values
-
tm
protected final TransactionManager tm
The transaction manager
-
checkIfTxActive
protected boolean checkIfTxActive
Indicates 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 alwaysManaged
Indicates that all the data sources are managed
-
-
Constructor Detail
-
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 Detail
-
getDataSource
public DataSource getDataSource(String dataSourceName) throws NamingException
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:
DataSourceProvider.getDataSource(java.lang.String)
-
isManaged
public boolean isManaged(String dataSourceName)
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:
DataSourceProvider.isManaged(java.lang.String)
-
-