|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.cambio.cds.model.util.sql.DataSourceLocator
public class DataSourceLocator
Caches references to DataSources
. It allows to register
explicitally a DataSource
under a name, and get a reference to
it by its name (using JNDI, if not already registered or cached).
Field Summary | |
---|---|
static String |
JNDI_PREFIX
The recommended JNDI context name for all DataSources :
java:comp/env/jdbc/ |
Method Summary | |
---|---|
static void |
addDataSource(String name,
DataSource dataSource)
Allows to register explicitally a DataSource with a
given name. |
static DataSource |
getDataSource(String name)
Gets a reference to the DataSource with the given
name . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String JNDI_PREFIX
DataSources
:
java:comp/env/jdbc/
Method Detail |
---|
public static void addDataSource(String name, DataSource dataSource)
DataSource
with a
given name. This method should only be used when
DataSources
are not accessible through JNDI (for example
when using an application server providing only servlets and JSP).
public static DataSource getDataSource(String name) throws InternalErrorException
DataSource
with the given
name
. If the reference has been explicitally registered
(with addDataSource(String, DataSource)
) or is cached, it
is returned immediatelly. Otherwise, JNDI is used to get a reference to
it (caching it for the next time) using the JNDI name:
JNDI_PREFIX + name
. This allows an easy transition from
an application server not providing DataSources
registered
under JNDI to one providing them.
InternalErrorException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |