⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 liberatordaofactory.java

📁 Chinaxp 论坛源代码
💻 JAVA
字号:
/* * Copyright 2003 by Redsoft Factory Inc., * Apt 738, 68 Corporate Drive, Toronto, Ontario, Canada * All rights reserved. * * This software is the confidential and proprietary information * of Redsoft Factory Inc. ("Confidential Information").  You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Redsoft Factory. */package org.redsoft.forum.dao.jdo;import java.io.IOException;import java.io.InputStream;import java.util.Properties;import javax.jdo.JDOHelper;import javax.jdo.PersistenceManager;import javax.jdo.PersistenceManagerFactory;import org.redsoft.forum.ForumActionServlet;import org.redsoft.forum.dao.AccountDAO;import org.redsoft.forum.dao.DAOFactory;import org.redsoft.forum.dao.ThreadDAO;/** * A DAO factory to create JDO DAO implementation using Liberator JDO * * @author Charles Huang * Date: 22-Feb-2004 * $Id: LiberatorDAOFactory.java,v 1.3 2004/04/10 19:56:59 cinc Exp $ */public class LiberatorDAOFactory extends DAOFactory {    private PersistenceManagerFactory pmf;    public LiberatorDAOFactory() {        final Properties p = new Properties();        InputStream in = null;        try {            in = ForumActionServlet.class.getResourceAsStream("jdo.properties");            if (in == null)                throw new RuntimeException( "jdo.properties not on classpath");            p.load(in);            pmf = JDOHelper.getPersistenceManagerFactory(p);        } catch (IOException e) {            e.printStackTrace();        } finally {            try{            if (in != null)                in.close();            }catch( final IOException ioe ){                // do nothing            }        }    }    /**     * Return Thread DAO object     */    public ThreadDAO getThreadDAO() {        return new ThreadDAOJDO( pmf );    }    /**     *  Return Account DAO object     */    public AccountDAO getAccountDAO() {        return new AccountDAOJDO( pmf );    }    /**     * Return a persistence manager     *     * @return PersistenceManager     */    public PersistenceManager getPersistenceManager(){        return pmf.getPersistenceManager();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -