Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.runtime.api
Class DataSourceHelper

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

public class DataSourceHelper
extends Object

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

Author:
Thierry Delprat, Florent Guillaume

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

Field Detail

PREFIX_PROPERTY

public static final String PREFIX_PROPERTY
See Also:
Constant Field Values

DEFAULT_PREFIX

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

autodetectPrefix

public static void autodetectPrefix()

getDataSourceJNDIPrefix

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


getDataSourceJNDIName

public static String getDataSourceJNDIName(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 DataSource getDataSource(String partialName)
                                throws 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:
NamingException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.