public class DataSourceProviderImpl extends Object implements DataSourceProvider
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.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
alwaysManaged
Indicates that all the data sources are managed
|
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.
|
protected Set<String> |
managedDS
A set of all the data sources that are managed
|
protected static String |
PARAM_ALWAYS_MANAGED
The name of the parameter to know if the data sources are always managed.
|
protected static String |
PARAM_CHECK_TX
The name of the parameter to know if the tx has to be checked or not.
|
protected static String |
PARAM_MANAGED_DS
The name of the parameter of all the managed data sources.
|
protected TransactionManager |
tm
The transaction manager
|
| Constructor and Description |
|---|
DataSourceProviderImpl(InitParams params)
The default constructor
|
DataSourceProviderImpl(InitParams params,
TransactionService tService)
The default constructor
|
| Modifier and Type | Method and Description |
|---|---|
DataSource |
getDataSource(String dataSourceName)
Try to get the data source from a lookup, if it can't a
NamingException
will be thrown |
boolean |
isManaged(String dataSourceName)
Indicates whether or not the given data source is managed
|
protected static final String PARAM_CHECK_TX
protected static final String PARAM_ALWAYS_MANAGED
protected static final String PARAM_MANAGED_DS
protected final TransactionManager tm
protected boolean checkIfTxActive
protected boolean alwaysManaged
public DataSourceProviderImpl(InitParams params)
public DataSourceProviderImpl(InitParams params, TransactionService tService)
public DataSource getDataSource(String dataSourceName) throws NamingException
DataSourceProviderNamingException
will be throwngetDataSource in interface DataSourceProviderdataSourceName - the name of the data source to lookupDataSource found thanks to the lookup. The original
object could be wrap to another DataSource in order to support
managed data source.NamingExceptionDataSourceProvider.getDataSource(java.lang.String)public boolean isManaged(String dataSourceName)
DataSourceProviderisManaged in interface DataSourceProviderdataSourceName - the data source to checktrue if the data source is managed,
false otherwiseDataSourceProvider.isManaged(java.lang.String)Copyright © 2019 eXo Platform SAS. All Rights Reserved.