Dashboard Builder Commons 6.0.0.Beta3

org.jboss.dashboard.database
Class DataSourceManager

java.lang.Object
  extended by org.jboss.dashboard.database.DataSourceManager

@ApplicationScoped
public class DataSourceManager
extends Object

Manager used to access the DataSource instances configured in the current installation.


Field Summary
protected static ThreadLocal currentThreadDataSources
          Set of data sources used by the current thread.
static String DEFAULT_DATASOURCE_NAME
           
 
Constructor Summary
DataSourceManager()
           
 
Method Summary
 boolean checkDriverClassAvailable(String driverClassName)
           
protected  DataSource getCurrentThreadDataSource(String name)
          Retrieve a data sources being used by the current thread.
protected  Map<String,DataSource> getCurrentThreadDataSources()
          Retrieve the data sources being used by the current thread.
 DataSource getDatasource(String name)
          Get a datasource given its name
 List<DataSourceEntry> getDataSourceEntries()
          Get all registered datasource entries
 DataSourceEntry getDataSourceEntryByName(String name)
           
 List<String> getDataSourceNames()
          Get all registered datasource names
protected  void setCurrentThreadDataSource(String name, DataSource ds)
          Store a data source as used by the current thread.
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATASOURCE_NAME

public static final String DEFAULT_DATASOURCE_NAME
See Also:
Constant Field Values

currentThreadDataSources

protected static transient ThreadLocal currentThreadDataSources
Set of data sources used by the current thread. this thread local is required to support distributed transactions.

Constructor Detail

DataSourceManager

public DataSourceManager()
Method Detail

start

@PostConstruct
public void start()
           throws Exception
Throws:
Exception

checkDriverClassAvailable

public boolean checkDriverClassAvailable(String driverClassName)

getDataSourceNames

public List<String> getDataSourceNames()
Get all registered datasource names


getDataSourceEntries

public List<DataSourceEntry> getDataSourceEntries()
Get all registered datasource entries


getDataSourceEntryByName

public DataSourceEntry getDataSourceEntryByName(String name)
                                         throws Exception
Throws:
Exception

getDatasource

public DataSource getDatasource(String name)
                         throws Exception
Get a datasource given its name

Throws:
Exception

getCurrentThreadDataSource

protected DataSource getCurrentThreadDataSource(String name)
                                         throws Exception
Retrieve a data sources being used by the current thread.

Throws:
Exception

setCurrentThreadDataSource

protected void setCurrentThreadDataSource(String name,
                                          DataSource ds)
                                   throws Exception
Store a data source as used by the current thread.

Throws:
Exception

getCurrentThreadDataSources

protected Map<String,DataSource> getCurrentThreadDataSources()
                                                      throws Exception
Retrieve the data sources being used by the current thread.

Throws:
Exception

Dashboard Builder Commons 6.0.0.Beta3

Copyright © 2012-2013 JBoss by Red Hat. All Rights Reserved.