|
What this is
Other links
The source code/* * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/DAOFactory.java,v 1.15 2005/01/18 11:52:17 minhnn Exp $ * $Author: minhnn $ * $Revision: 1.15 $ * $Date: 2005/01/18 11:52:17 $ * * ==================================================================== * * Copyright (C) 2002-2005 by MyVietnam.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * All copyright notices regarding mvnForum MUST remain intact * in the scripts and in the outputted HTML. * The "powered by" text/logo with a link back to * http://www.mvnForum.com and http://www.MyVietnam.net in the * footer of the pages MUST remain visible when the pages * are viewed on the internet or intranet. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Support can be obtained from support forums at: * http://www.mvnForum.com/mvnforum/index * * Correspondence and Marketing Questions can be sent to: * info@MyVietnam.net * * @author: Minh Nguyen minhnn@MyVietnam.net */ package com.mvnforum.db; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.mvnforum.MVNForumFactoryConfig; import com.mvnforum.db.jdbc.*; /** * Instance that returns the right implementation for the different * DAO implementation such as JDBC or Hibernate. * * @author Minh Nguyen * @version $Revision: 1.15 $ */ public class DAOFactory { private static Log log = LogFactory.getLog(DAOFactory.class); private DAOFactory() {} private static MemberDAO memberDAO = null; private static MessageFolderDAO messageFolderDAO = null; private static MemberForumDAO memberForumDAO = null; private static MemberGroupDAO memberGroupDAO = null; private static MemberPermissionDAO memberPermissionDAO = null; private static CategoryDAO categoryDAO = null; private static ForumDAO forumDAO = null; private static FavoriteThreadDAO favoriteThreadDAO = null; private static GroupForumDAO groupForumDAO = null; private static GroupPermissionDAO groupPermissionDAO = null; private static GroupsDAO groupsDAO = null; private static AttachmentDAO attachmentDAO = null; private static ThreadDAO threadDAO = null; private static PostDAO postDAO = null; private static RankDAO rankDAO = null; private static WatchDAO watchDAO = null; private static MessageDAO messageDAO = null; private static MessageStatisticsDAO messageStatisticsDAO = null; private static PmAttachmentDAO pmAttachmentDAO = null; private static PmAttachMessageDAO pmAttachMessageDAO = null; private static CompanyDAO companyDAO = null; private static MemberTutorDAO memberTutorDAO = null; private static MemberCompanyDAO memberCompanyDAO = null; public static MemberDAO getMemberDAO() { return memberDAO; } public static MessageFolderDAO getMessageFolderDAO() { return messageFolderDAO; } public static MemberForumDAO getMemberForumDAO() { return memberForumDAO; } public static MemberGroupDAO getMemberGroupDAO() { return memberGroupDAO; } public static MemberPermissionDAO getMemberPermissionDAO() { return memberPermissionDAO; } public static CategoryDAO getCategoryDAO() { return categoryDAO; } public static ForumDAO getForumDAO() { return forumDAO; } public static FavoriteThreadDAO getFavoriteThreadDAO() { return favoriteThreadDAO; } public static GroupForumDAO getGroupForumDAO() { return groupForumDAO; } public static GroupPermissionDAO getGroupPermissionDAO() { return groupPermissionDAO; } public static GroupsDAO getGroupsDAO() { return groupsDAO; } public static AttachmentDAO getAttachmentDAO() { return attachmentDAO; } public static ThreadDAO getThreadDAO() { return threadDAO; } public static PostDAO getPostDAO() { return postDAO; } public static RankDAO getRankDAO() { return rankDAO; } public static WatchDAO getWatchDAO() { return watchDAO; } public static MessageDAO getMessageDAO() { return messageDAO; } public static MessageStatisticsDAO getMessageStatisticsDAO() { return messageStatisticsDAO; } public static PmAttachmentDAO getPmAttachmentDAO() { return pmAttachmentDAO; } public static PmAttachMessageDAO getPmAttachMessageDAO() { return pmAttachMessageDAO; } public static CompanyDAO getCompanyDAO() { return companyDAO; } public static MemberCompanyDAO getMemberCompanyDAO() { return memberCompanyDAO; } public static MemberTutorDAO getMemberTutorDAO() { return memberTutorDAO; } static { try { Class c = Class.forName(MVNForumFactoryConfig.getMemberManagerClassName()); memberDAO = (MemberDAO) c.newInstance(); log.info("memberDAO = " + memberDAO); } catch (Exception e) { log.error("Error returning the DAOFactory.", e); log.warn("Cannot init MemberDAO, about to use the default implementation."); memberDAO = new MemberDAOImplJDBC(); } messageFolderDAO = new MessageFolderDAOImplJDBC(); memberForumDAO = new MemberForumDAOImplJDBC(); memberGroupDAO = new MemberGroupDAOImplJDBC(); memberPermissionDAO = new MemberPermissionDAOImplJDBC(); categoryDAO = new CategoryDAOImplJDBC(); forumDAO = new ForumDAOImplJDBC(); favoriteThreadDAO = new FavoriteThreadDAOImplJDBC(); groupForumDAO = new GroupForumDAOImplJDBC(); groupPermissionDAO = new GroupPermissionDAOImplJDBC(); groupsDAO = new GroupsDAOImplJDBC(); attachmentDAO = new AttachmentDAOImplJDBC(); threadDAO = new ThreadDAOImplJDBC(); postDAO = new PostDAOImplJDBC(); rankDAO = new RankDAOImplJDBC(); watchDAO = new WatchDAOImplJDBC(); messageDAO = new MessageDAOImplJDBC(); messageStatisticsDAO = new MessageStatisticsDAOImplJDBC(); pmAttachmentDAO = new PmAttachmentDAOImplJDBC(); pmAttachMessageDAO = new PmAttachMessageDAOImplJDBC(); memberTutorDAO = new MemberTutorDAOImplJDBC(); companyDAO = new CompanyDAOImplJDBC(); memberCompanyDAO = new MemberCompanyDAOImplJDBC(); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.