com.framework.jdto.finder
Class ServiceFinder

java.lang.Object
  extended bycom.framework.jdto.finder.ServiceFinder

public class ServiceFinder
extends java.lang.Object

This class Follows the ServiceLocator Design Pattern. its a SingleTon Class. its basically used for Locating the DataSource provided its DataSourceJNDIName, InitialContextFactory and ProviderURL. User need to set these in jdto.properties and should be available in the classpath. Once these values are set, all the DAO's and TransactionContextManager takes care of locating the DataSource.

Author:
msatish

Method Summary
 javax.sql.DataSource getDataSource()
          Returns the DataSource object for the JNDI Name which is set in jdto.properties.
 javax.sql.DataSource getDataSource(java.lang.String jndiName)
          Returns the DataSource object of the corresponding JNDI Name.
static ServiceFinder getInstance()
          This method maintains the Singleton instance of the class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceFinder getInstance()
This method maintains the Singleton instance of the class. User needs to call ServiceFinder.getInstance() method in order to access any other methods in this class.

Returns:
ServiceFinder

getDataSource

public javax.sql.DataSource getDataSource()
                                   throws javax.naming.NamingException
Returns the DataSource object for the JNDI Name which is set in jdto.properties. User needs to set the InitialContextFactory, ProviderURL and DataSourceJNDIName in jdto.properties.

Returns:
retObj - A javax.sql.DataSource Object.
Throws:
javax.naming.NamingException - if JNDI name that is set using setDatasourceJNDIName method is not found or can not be resolved.

getDataSource

public javax.sql.DataSource getDataSource(java.lang.String jndiName)
                                   throws javax.naming.NamingException
Returns the DataSource object of the corresponding JNDI Name. User needs to set the InitialContextFactory and ProviderURL in jdto.properties.

Parameters:
jndiName -
Returns:
datasource
Throws:
javax.naming.NamingException - if JNDI name is not found or can not be resolved.