Package com.jk.data.datasource
Class JKDataSourceFactory
java.lang.Object
com.jk.data.datasource.JKDataSourceFactory
This class is a factory for creating and managing JKDataSource instances.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose()This method closes allJKDataSourceinstances and de-registers JDBC drivers associated with them.static voidThis method de-registers all JDBC drivers that have been registered with theDriverManager.static JKDataSourcecreateDataSource(String driver, String url, String userName, String password, Class<?> dialect, String datasourceName) This method creates a newJKDataSourceinstance with the provided database configuration.static JKDataSourcecreateDataSource(String name, Properties prop) This method creates a new JKDataSource instance with the provided name and properties.static JKDataSourcegetDataSource(String prefix) This method retrieves aJKDataSourceinstance with the specified prefix.static JKDataSourceThis method gets the default data source. 
- 
Constructor Details
- 
JKDataSourceFactory
public JKDataSourceFactory() 
 - 
 - 
Method Details
- 
getDefaultDataSource
This method gets the default data source.- Returns:
 - the default data source.
 
 - 
getDataSource
This method retrieves aJKDataSourceinstance with the specified prefix.- Parameters:
 prefix- Specifies the prefix used to identify the data source configuration.- Returns:
 - a 
JKDataSourceinstance configured with the specified prefix. 
 - 
createDataSource
public static JKDataSource createDataSource(String driver, String url, String userName, String password, Class<?> dialect, String datasourceName) This method creates a newJKDataSourceinstance with the provided database configuration.- Parameters:
 driver- Specifies the JDBC driver class name.url- Specifies the JDBC URL for the database connection.userName- Specifies the database user name used for authentication.password- Specifies the database password used for authentication.dialect- Specifies the dialect class for the database.datasourceName- Specifies the name of the data source.- Returns:
 - the newly created 
JKDataSourceinstance. 
 - 
createDataSource
This method creates a new JKDataSource instance with the provided name and properties.- Parameters:
 name- Specifies the name of the data source.prop- Specifies the properties containing database configuration.- Returns:
 - the newly created 
JKDataSourceinstance. 
 - 
close
public static void close()This method closes allJKDataSourceinstances and de-registers JDBC drivers associated with them. - 
closeDrivers
public static void closeDrivers()This method de-registers all JDBC drivers that have been registered with theDriverManager. 
 -