|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.framework.jdto.finder.ServiceFinder
This class Follows the ServiceLocator Design Pattern. its a SingleTon Class. its basically used for Locating the DataSource provided its DataSourceJNDIName, InitialContextFactory and ProviderURL using setter Methods or in jdto.properties. If User set these in jdto.properties it should be available in the classpath. Once these values are set, all the DAO's and TransactionContextManager takes care of locating the DataSource. This also lets the user set an existing DataSource using setDataSource method. if the user Sets the DataSource using setDataSource Method, this class picks that DataSource for Transaction Handling. In this Case JDTO Properties is not Required.
This is provided to enable the WebServer users to use any opensource DataSources like Commons DBCP, as the lookup mechanism only works with Application Servers.
Method Summary | |
DataSource |
getDataSource()
Returns the DataSource object for the JNDI Name which is set in jdto.properties or set by using setDataSource method of this class. |
DataSource |
getDataSource(String jndiName)
Returns the DataSource object of the corresponding JNDI Name or the datasourceKeyName that is passed during the call to setDataSource method. |
static ServiceFinder |
getInstance()
This method maintains the Singleton instance of the class. |
static void |
setDatasource(String datasourceKeyName,
DataSource ds)
This method can be used to set the datasource to the framework if you already have one. |
void |
setDatasourceJNDIName(String datasourceJNDIName)
|
void |
setInitialContextFactory(String initialContextFactory)
|
void |
setProviderURL(String providerURL)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ServiceFinder getInstance()
public DataSource getDataSource() throws NamingException
NamingException
- if JNDI name that is set using setDatasourceJNDIName method is not found or can not be resolved.public DataSource getDataSource(String jndiName) throws NamingException
jndiName
-
NamingException
- if JNDI name is not found or can not be resolved.public static void setDatasource(String datasourceKeyName, DataSource ds)
datasourceKeyName
- ds
- public void setDatasourceJNDIName(String datasourceJNDIName)
public void setInitialContextFactory(String initialContextFactory)
public void setProviderURL(String providerURL)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |