package com.eactive.eai.adapter.wca.jdbc; 

/** 
* 1. 기능 : 
* 2. 처리 개요 : 
* *     - 
* 3. 주의사항 
*
* @author  : 
* @version : v 1.0.0
* @see : 관련 기능을 참조
* @since   : 
*/
public class JDBCFactory 
{ 
    private JDBCFactory() {        
    }    

    public static JDBCFactory newInstance() {
        return new JDBCFactory();   
    }

    public BaseJDBC create(String jdbcClassName) throws JDBCException {
       Class wrapperClass = null;
       try {
            wrapperClass = Class.forName(jdbcClassName);
       } 
       catch (Exception e) {
            throw new JDBCException("Cannot find the DAO Class. - "+jdbcClassName);
       }
       
       BaseJDBC wrapper = null;
       try {
            wrapper = (BaseJDBC)wrapperClass.newInstance();
       } 
       catch (Exception e) {
            throw new JDBCException("Cannot create a instance of class. - "+e.getMessage());
       }
       
       return wrapper;
    }

    public BaseJDBC create(Class daoClass) throws JDBCException {
       BaseJDBC wrapper = null;
       try {
            wrapper = (BaseJDBC)daoClass.newInstance();
       } 
       catch (Exception e) {
            throw new JDBCException("Cannot create a instance of class. - "+e.getMessage());
       }
       
       return wrapper;
    }
}
