public class DataSourceHelper extends Object
DataSource
s without having to deal with vendor-specific JNDI prefixes.Modifier and Type | Method and Description |
---|---|
static DataSource |
getDataSource(String partialName)
Look up a datasource given a partial name.
|
static <T> T |
getDataSource(String name,
Class<T> clazz) |
static String |
getDataSourceJNDIName(String name)
Look up a datasource JNDI name given a partial name.
|
static String |
getDataSourceJNDIPrefix()
Get the JNDI prefix used for DataSource lookups.
|
static String |
getDataSourceRepositoryJNDIName(String repositoryName) |
static Map<String,DataSource> |
getDatasources() |
static XADataSource |
getXADataSource(String partialName) |
public static String getDataSourceJNDIPrefix()
public static String getDataSourceJNDIName(String name)
For a datasource "jdbc/foo"
, then it's sufficient to pass "foo"
to this method.
partialName
- the partial namepublic static DataSource getDataSource(String partialName) throws NamingException
For a datasource "jdbc/foo"
, then it's sufficient to pass "foo"
to this method.
partialName
- the partial nameNamingException
public static XADataSource getXADataSource(String partialName) throws NamingException
NamingException
public static <T> T getDataSource(String name, Class<T> clazz) throws NamingException
NamingException
public static Map<String,DataSource> getDatasources() throws NamingException
NamingException
Copyright © 2015 Nuxeo SA. All rights reserved.