Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime.api
Class DataSourceHelper

java.lang.Object
  extended by org.nuxeo.runtime.api.DataSourceHelper

public class DataSourceHelper
extends java.lang.Object

Helper class to look up DataSources without having to deal with vendor-specific JNDI prefixes.

Author:
Thierry Delprat, Florent Guillaume

Field Summary
static java.lang.String DEFAULT_PREFIX
           
static java.lang.String PREFIX_PROPERTY
           
 
Method Summary
static void autodetectPrefix()
           
static javax.sql.DataSource getDataSource(java.lang.String partialName)
          Look up a datasource given a partial name.
static java.lang.String getDataSourceJNDIName(java.lang.String partialName)
          Look up a datasource JNDI name given a partial name.
static java.lang.String getDataSourceJNDIPrefix()
          Get the JNDI prefix used for DataSource lookups.
static javax.naming.Context getDefaultInitCtx()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_PROPERTY

public static final java.lang.String PREFIX_PROPERTY
See Also:
Constant Field Values

DEFAULT_PREFIX

public static final java.lang.String DEFAULT_PREFIX
See Also:
Constant Field Values
Method Detail

autodetectPrefix

public static void autodetectPrefix()

getDefaultInitCtx

public static javax.naming.Context getDefaultInitCtx()

getDataSourceJNDIPrefix

public static java.lang.String getDataSourceJNDIPrefix()
Get the JNDI prefix used for DataSource lookups.


getDataSourceJNDIName

public static java.lang.String getDataSourceJNDIName(java.lang.String partialName)
Look up a datasource JNDI name given a partial name.

For a datasource "jdbc/foo", then it's sufficient to pass "foo" to this method.

Parameters:
partialName - the partial name
Returns:
the datasource JNDI name

getDataSource

public static javax.sql.DataSource getDataSource(java.lang.String partialName)
                                          throws javax.naming.NamingException
Look up a datasource given a partial name.

For a datasource "jdbc/foo", then it's sufficient to pass "foo" to this method.

Parameters:
partialName - the partial name
Returns:
the datasource
Throws:
javax.naming.NamingException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.