/**
 * 
 * 
 * 
 * 
 */
package com.github.vovas11.courses.dao;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DaoFactory {
    static DaoFactory factory = new DaoFactory();
    DataSource datasrc;
    
    private DaoFactory() {
	try {
	    InitialContext initContext = new InitialContext();
	    datasrc = (DataSource) initContext.lookup("java:comp/env/jdbc/dbcoursetest2");
	} catch (NamingException e) {
	    e.printStackTrace();
	}
    }
    
    public static DaoFactory getInstance() {
	return factory;
    }
    
    public UserDao getUserDao() {
	UserDao users = new UserDao(datasrc);
	return users;
    }
    public CourseDao getCourseDao() {
	return new CourseDao(datasrc);
    }
}

@@ -1,34 +1,4 @@
-/**%0D%0A * %0D%0A * %0D%0A * %0D%0A * %0D%0A */%0D%0A
 pack
@@ -147,446 +147,1167 @@
 %0D%0A%0D%0A
-public class DaoFactory %7B%0D%0A    static DaoFactory factory = new DaoFactory();%0D%0A    DataSource datasrc;%0D%0A    %0D%0A    private DaoFactory() %7B%0D%0A%09try %7B%0D%0A%09    InitialContext initContext = new InitialContext();%0D%0A%09    datasrc = (DataSource) initContext.lookup(%22java:comp/env/jdbc/dbcoursetest2%22);%0D%0A%09%7D catch (NamingException e) %7B%0D%0A%09    e.printStackTrace();%0D%0A%09%7D%0D%0A    %7D%0D%0A    %0D%0A    public static DaoFactory getInstance() %7B%0D%0A%09return factory;%0D%0A    %7D%0D%0A    
+/**%0D%0A * %7B@code DaoFactory%7D is a factory (design pattern) that creates instances%0D%0A * of the data access objects (DAO).%0D%0A * %0D%0A * @author vovas11%0D%0A * @see CourseDao%0D%0A * @see UserDao%0D%0A */%0D%0Apublic class DaoFactory %7B%0D%0A    %0D%0A    /* stores the link to the single instance (Singleton) */%0D%0A    static DaoFactory factory = new DaoFactory();%0D%0A    %0D%0A    /* stores the link to the common data source */%0D%0A    DataSource datasrc;%0D%0A    %0D%0A    /* forbids the instantiation of the class outside and receives the link to datasource%0D%0A     * by Initial Context */%0D%0A    private DaoFactory() %7B%0D%0A%09try %7B%0D%0A%09    InitialContext initContext = new InitialContext();%0D%0A%09    datasrc = (DataSource) initContext.lookup(%22java:comp/env/jdbc/dbcoursetest2%22);%0D%0A%09%7D catch (NamingException e) %7B%0D%0A%09    e.printStackTrace();%0D%0A%09%7D%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Returns to the link to single instance of the DaoFactory class%0D%0A     * @return link to single instance of the class%0D%0A     */%0D%0A    public static DaoFactory getInstance() %7B%0D%0A%09return factory;%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Creates the instance of the UserDao class and returns the link%0D%0A     * %0D%0A     * @return link to the instance of UserDao%0D%0A     */
 %0D%0A  
@@ -1344,23 +1344,14 @@
 %7B%0D%0A%09
-UserDao users =
+return
  new
@@ -1374,29 +1374,169 @@
 );%0D%0A
-%09return users;
+    %7D%0D%0A    %0D%0A    /**%0D%0A     * Creates the instance of the CourseDao class and returns the link%0D%0A     * %0D%0A     * @return link to the instance of CourseDao
 %0D%0A    
-%7D
+ */
 %0D%0A  

Add comments into DaoFactory.java