eXo Kernel :: Component :: Common Service 2.4.0-CR2

org.exoplatform.services.jdbc.impl
Class DataSourceProviderImpl

java.lang.Object
  extended by org.exoplatform.services.jdbc.impl.DataSourceProviderImpl
All Implemented Interfaces:
DataSourceProvider

public class DataSourceProviderImpl
extends Object
implements 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
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 Summary
DataSourceProviderImpl(InitParams params)
          The default constructor
DataSourceProviderImpl(InitParams params, TransactionService tService)
          The default constructor
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


managedDS

protected final Set<String> managedDS
A set of all the data sources that are managed

Constructor Detail

DataSourceProviderImpl

public DataSourceProviderImpl(InitParams params)
The default constructor


DataSourceProviderImpl

public DataSourceProviderImpl(InitParams params,
                              TransactionService tService)
The default constructor

Method Detail

getDataSource

public DataSource getDataSource(String dataSourceName)
                         throws NamingException
Description copied from interface: DataSourceProvider
Try to get the data source from a lookup, if it can't a NamingException will be thrown

Specified by:
getDataSource in interface DataSourceProvider
Parameters:
dataSourceName - the name of the data source to lookup
Returns:
the DataSource found thanks to the lookup. The original object could be wrap to another DataSource in 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: DataSourceProvider
Indicates whether or not the given data source is managed

Specified by:
isManaged in interface DataSourceProvider
Parameters:
dataSourceName - the data source to check
Returns:
true if the data source is managed, false otherwise
See Also:
DataSourceProvider.isManaged(java.lang.String)

eXo Kernel :: Component :: Common Service 2.4.0-CR2

Copyright © 2012 eXo Platform SAS. All Rights Reserved.