DataSourceDAOFactory

public class DataSourceDAOFactory extends DAOFactory

The DataSourceDAOFactory has implemented the DAOFactory and provides an implementation for accessing the data source by Java DataSource. Notice that the DAO created by the createDAO() method is a DataSourceDAO object since this factory is a DataSourceDAOFactory.

Author:Hugo Y. K. Lam

Constructors

DataSourceDAOFactory

public DataSourceDAOFactory()

Creates a new instance of DataSourceDAOFactory.

Methods

createTransaction

public Transaction createTransaction()

Creates a data source transaction.

Throws:
  • TransactionException – if unable to create the data source transaction.
Returns:

a new data source transaction.

See also: hk.hku.cecid.piazza.commons.dao.DAOFactory.createTransaction()

getDataSource

protected DataSource getDataSource()

Gets the underlying DataSource object.

Returns:the underlying DataSource object.

initDAO

protected void initDAO(DAO dao)

Initializes the given DAO.

Parameters:
  • dao – the DAO.
Throws:

initFactory

public void initFactory()

Initializes this DAOFactory.

setDataSource

protected void setDataSource(DataSource source)

Sets the underlying DataSource object.

Parameters:
  • source – the underlying DataSource object.