亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? torqueinstance.java

?? 另外一種持久性o/m軟件
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package org.apache.torque;/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */import java.sql.Connection;import java.sql.SQLException;import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import org.apache.commons.configuration.Configuration;import org.apache.commons.configuration.ConfigurationException;import org.apache.commons.configuration.PropertiesConfiguration;import org.apache.commons.lang.StringUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.torque.adapter.DB;import org.apache.torque.adapter.DBFactory;import org.apache.torque.dsfactory.AbstractDataSourceFactory;import org.apache.torque.dsfactory.DataSourceFactory;import org.apache.torque.manager.AbstractBaseManager;import org.apache.torque.map.DatabaseMap;import org.apache.torque.map.TableMap;import org.apache.torque.oid.IDBroker;import org.apache.torque.oid.IDGeneratorFactory;import org.apache.torque.util.BasePeer;/** * The core of Torque's implementation.  Both the classic {@link * org.apache.torque.Torque} static wrapper and the {@link * org.apache.torque.avalon.TorqueComponent} <a * href="http://avalon.apache.org/">Avalon</a> implementation leverage * this class. * * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> * @author <a href="mailto:magnus@handtolvur.is">Magn?s ??r Torfason</a> * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a> * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a> * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> * @author <a href="mailto:kschrader@karmalab.org">Kurt Schrader</a> * @version $Id: TorqueInstance.java,v 1.13 2005/07/08 17:53:34 tfischer Exp $ */public class TorqueInstance{    /** Logging */    private static Log log = LogFactory.getLog(TorqueInstance.class);    /** The db name that is specified as the default in the property file */    private String defaultDBName = null;    /** The global cache of database maps */    private Map dbMaps;    /** The cache of DataSourceFactory's */    private Map dsFactoryMap;    /** The cache of DB adapter keys */    private Map adapterMap;    /** A repository of Manager instances. */    private Map managers;    /** Torque-specific configuration. */    private Configuration conf;    /** flag to set to true once this class has been initialized */    private boolean isInit = false;    /**     * Store mapbuilder classnames for peers that have been referenced prior     * to Torque being initialized.  This can happen if torque om/peer objects     * are serialized then unserialized prior to Torque being reinitialized.     * This condition exists in a normal catalina restart.     */    private List mapBuilders = null;    /**     * Creates a new instance with default configuration.     *     * @see #resetConfiguration()     */    public TorqueInstance()    {        resetConfiguration();    }    /**     * Initializes this instance of Torque.     *     * @see org.apache.stratum.lifecycle.Initializable     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    private synchronized void initialize() throws TorqueException    {        log.debug("initialize()");        if (isInit)        {            log.debug("Multiple initializations of Torque attempted");            return;        }        if (conf == null || conf.isEmpty())        {            throw new TorqueException("Torque cannot be initialized without "                    + "a valid configuration. Please check the log files "                    + "for further details.");        }        // Now that we have dealt with processing the log4j properties        // that may be contained in the configuration we will make the        // configuration consist only of the remain torque specific        // properties that are contained in the configuration. First        // look for properties that are in the "torque" namespace.        Configuration subConf = conf.subset(Torque.TORQUE_KEY);        if (subConf == null || subConf.isEmpty())        {            String error = ("Invalid configuration. No keys starting with "                    + Torque.TORQUE_KEY                     + " found in configuration");            log.error(error);            throw new TorqueException(error);        }        setConfiguration(subConf);        initDefaultDbName(conf);        initAdapters(conf);        initDataSourceFactories(conf);        dbMaps = new HashMap();        for (Iterator i = mapBuilders.iterator(); i.hasNext();)        {            //this will add any maps in this builder to the proper database map            BasePeer.getMapBuilder((String) i.next());        }        // any further mapBuilders will be called/built on demand        mapBuilders = null;        // setup manager mappings        initManagerMappings(conf);        isInit = true;    }            /**     * initializes the name of the default database     * @param conf the configuration representing the torque section      *        of the properties file     * @throws TorqueException if the appropriate key is not set     */    private final void initDefaultDbName(Configuration conf)            throws TorqueException    {        // Determine default database name.        defaultDBName =                conf.getString(                        Torque.DATABASE_KEY                         + "."                        + Torque.DEFAULT_KEY);        if (defaultDBName == null)        {            String error = "Invalid configuration: Key "                    + Torque.TORQUE_KEY                    + "."                    + Torque.DATABASE_KEY                     + "."                    + Torque.DEFAULT_KEY                    + " not set";            log.error(error);            throw new TorqueException(error);        }    }    /**     *     * @param conf the Configuration representing the torque section of the     *        properties file     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    private final void initAdapters(Configuration conf)            throws TorqueException    {        log.debug("initAdapters(" + conf + ")");        adapterMap = new HashMap();        Configuration c = conf.subset(Torque.DATABASE_KEY);        if (c == null || c.isEmpty())        {            String error = "Invalid configuration : "                    + "No keys starting with "                    + Torque.TORQUE_KEY                    + "."                    + Torque.DATABASE_KEY                    + " found in configuration";            log.error(error);            throw new TorqueException(error);        }                try        {            for (Iterator it = c.getKeys(); it.hasNext(); )            {                String key = (String) it.next();                if (key.endsWith(DB.ADAPTER_KEY))                {                    String adapter = c.getString(key);                    String handle = key.substring(0, key.indexOf('.'));                    DB db = DBFactory.create(adapter);                    // register the adapter for this name                    adapterMap.put(handle, db);                    log.debug("Adding " + adapter + " -> " + handle + " as Adapter");                }            }        }        catch (Exception e)        {            log.error("Error reading configuration seeking database "                      + "adapters", e);            throw new TorqueException(e);        }                if (adapterMap.get(Torque.getDefaultDB()) == null)        {            String error = "Invalid configuration : "                    + "No adapter definition found for default DB "                    + "An adapter must be defined under "                    + Torque.TORQUE_KEY                    + "."                    + Torque.DATABASE_KEY                    + "."                    + Torque.getDefaultDB()                    + "."                    + DB.ADAPTER_KEY;            log.error(error);            throw new TorqueException(error);        }    }    /**     *     * @param conf the Configuration representing the properties file     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    private void initDataSourceFactories(Configuration conf)            throws TorqueException    {        log.debug("initDataSourceFactories(" + conf + ")");        dsFactoryMap = new HashMap();                Configuration c = conf.subset(DataSourceFactory.DSFACTORY_KEY);        if (c == null || c.isEmpty())        {            String error = "Invalid configuration: "                    + "No keys starting with "                    + Torque.TORQUE_KEY                    + "."                    + DataSourceFactory.DSFACTORY_KEY                    + " found in configuration";            log.error(error);            throw new TorqueException(error);        }        try        {            for (Iterator it = c.getKeys(); it.hasNext();)            {                String key = (String) it.next();                if (key.endsWith(DataSourceFactory.FACTORY_KEY))                {                    String classname = c.getString(key);                    String handle = key.substring(0, key.indexOf('.'));                    log.debug("handle: " + handle                            + " DataSourceFactory: " + classname);                    Class dsfClass = Class.forName(classname);                    DataSourceFactory dsf =                            (DataSourceFactory) dsfClass.newInstance();                    dsf.initialize(c.subset(handle));                    dsFactoryMap.put(handle, dsf);                }            }        }        catch (Exception e)        {            log.error("Error reading adapter configuration", e);            throw new TorqueException(e);        }        if (dsFactoryMap.get(Torque.getDefaultDB()) == null)        {            String error = "Invalid configuration : "                    + "No DataSourceFactory definition for default DB found. "                    + "A DataSourceFactory must be defined under the key"                    + Torque.TORQUE_KEY                    + "."                    + DataSourceFactory.DSFACTORY_KEY                    + "."                    + Torque.getDefaultDB()                    + "."                    + DataSourceFactory.FACTORY_KEY;            log.error(error);            throw new TorqueException(error);        }    }    /**     * Initialization of Torque with a properties file.     *     * @param configFile The absolute path to the configuration file.     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    public void init(String configFile)            throws TorqueException    {        log.debug("init(" + configFile + ")");        try        {            Configuration conf = new PropertiesConfiguration(configFile);            log.debug("Config Object is " + conf);            init(conf);        }        catch (ConfigurationException e)        {            throw new TorqueException(e);        }    }    /**     * Initialization of Torque with a properties file.     *     * @param conf The Torque configuration.     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    public void init(Configuration conf)            throws TorqueException    {        log.debug("init(" + conf + ")");        setConfiguration(conf);        initialize();    }    /**     * Creates a mapping between classes and their manager classes.     *     * The mapping is built according to settings present in     * properties file.  The entries should have the     * following form:     *     * <pre>     * torque.managed_class.com.mycompany.Myclass.manager= \     *          com.mycompany.MyManagerImpl     * services.managed_class.com.mycompany.Myotherclass.manager= \     *          com.mycompany.MyOtherManagerImpl     * </pre>     *     * <br>     *     * Generic ServiceBroker provides no Services.     *     * @param conf the Configuration representing the properties file     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    protected void initManagerMappings(Configuration conf)            throws TorqueException    {        int pref = Torque.MANAGER_PREFIX.length();        int suff = Torque.MANAGER_SUFFIX.length();        for (Iterator it = conf.getKeys(); it.hasNext();)        {            String key = (String) it.next();            if (key.startsWith(Torque.MANAGER_PREFIX)                    && key.endsWith(Torque.MANAGER_SUFFIX))            {                String managedClassKey = key.substring(pref,                        key.length() - suff);                if (!managers.containsKey(managedClassKey))                {                    String managerClass = conf.getString(key);                    log.info("Added Manager for Class: " + managedClassKey                            + " -> " + managerClass);                    try                    {                        initManager(managedClassKey, managerClass);                    }                    catch (TorqueException e)                    {                        // the exception thrown here seems to disappear.                        // At least when initialized by Turbine, should find                        // out why, but for now make sure it is noticed.                        log.error("", e);                        e.printStackTrace();                        throw e;                    }                }            }        }    }    /**     * Initialize a manager     *     * @param name name of the manager     * @param className name of the manager class     * @throws TorqueException Any exceptions caught during processing will be     *         rethrown wrapped into a TorqueException.     */    private synchronized void initManager(String name, String className)            throws TorqueException    {        AbstractBaseManager manager = (AbstractBaseManager) managers.get(name);        if (manager == null)        {            if (className != null && className.length() != 0)            {                try                {                    manager = (AbstractBaseManager)                            Class.forName(className).newInstance();                    managers.put(name, manager);                }                catch (Exception e)                {                    throw new TorqueException("Could not instantiate "                            + "manager associated with class: "                            + name, e);                }            }        }    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产三级三级三级精品8ⅰ区| 九九**精品视频免费播放| 亚洲一卡二卡三卡四卡五卡| 蜜臀久久久久久久| 欧美性猛交xxxxxx富婆| 久久免费精品国产久精品久久久久| 亚洲国产成人porn| 99vv1com这只有精品| 国产无遮挡一区二区三区毛片日本| 亚洲第一电影网| 91精彩视频在线| 国产精品国产三级国产aⅴ入口| 国内不卡的二区三区中文字幕| 欧美色网一区二区| 亚洲精品一二三| 91香蕉视频在线| 一区精品在线播放| 不卡av电影在线播放| 欧美激情综合网| 成人涩涩免费视频| 国产欧美精品国产国产专区| 国产精品一区专区| 欧美成人a视频| 麻豆精品在线看| 日韩欧美一级二级三级| 亚洲一区二区三区视频在线播放 | 国产精品美女久久福利网站| 久草热8精品视频在线观看| 91精品国产乱| 精品一区二区免费| 精品动漫一区二区三区在线观看| 久草这里只有精品视频| 欧美精品一区男女天堂| 国产真实乱偷精品视频免| 欧美精品一区二区三区四区| 韩国理伦片一区二区三区在线播放 | 亚洲午夜一二三区视频| 在线日韩一区二区| 亚洲国产一区二区三区青草影视| 欧美偷拍一区二区| 首页欧美精品中文字幕| 日韩欧美综合一区| 国产精品一区免费在线观看| 国产精品成人在线观看| 一本大道av一区二区在线播放| 亚洲欧美成人一区二区三区| 在线观看中文字幕不卡| 男女男精品视频网| 久久久国际精品| 色综合天天狠狠| 日韩精品一级中文字幕精品视频免费观看| 在线电影院国产精品| 精品一区二区在线看| 中文天堂在线一区| 欧美色精品天天在线观看视频| 日韩黄色小视频| 日本一区二区久久| 欧美日韩色综合| 九九九久久久精品| 欧美激情一区二区| 欧美日韩精品一区二区在线播放| 久久99精品久久久久久久久久久久| 久久久久一区二区三区四区| 色综合久久久久久久久| 美女网站一区二区| 国产精品久久久久久久久久免费看| 欧美午夜宅男影院| 国产精品18久久久久久久久久久久 | 国产精品免费aⅴ片在线观看| 欧美性大战久久| 国产精品亚洲一区二区三区妖精| 亚洲免费观看视频| 欧美v日韩v国产v| 91麻豆产精品久久久久久| 日韩高清欧美激情| 亚洲欧洲性图库| 欧美大片在线观看| 欧美中文字幕一区二区三区亚洲 | 天涯成人国产亚洲精品一区av| 久久久国产精华| 欧美日本视频在线| 99久久精品一区| 激情av综合网| 老色鬼精品视频在线观看播放| 亚洲欧美区自拍先锋| 久久综合视频网| 欧美精品vⅰdeose4hd| 91视频免费播放| 国产成人在线观看| 久久99精品久久久久| 日日夜夜免费精品| 亚洲免费在线播放| 国产精品你懂的在线| 26uuu色噜噜精品一区| 欧美肥妇free| 欧美视频在线观看一区二区| 99免费精品在线| 狠狠久久亚洲欧美| 蜜桃精品视频在线| 日本免费在线视频不卡一不卡二| 亚洲一区二区三区激情| 欧美韩国一区二区| 久久蜜桃一区二区| 久久一二三国产| 精品粉嫩超白一线天av| 精品国精品国产| 日韩精品一区二区三区视频播放| 欧美剧情电影在线观看完整版免费励志电影| 成人国产免费视频| 成人免费视频caoporn| 国产成人精品一区二区三区网站观看| 九九九精品视频| 成人av资源在线| 91视频免费观看| 色视频一区二区| 精品视频在线免费观看| 欧美视频一区在线| 这里只有精品视频在线观看| 欧美欧美午夜aⅴ在线观看| 欧美片网站yy| 精品成人一区二区| 国产欧美精品日韩区二区麻豆天美| 国产午夜亚洲精品不卡| 欧美激情资源网| 一区二区三区免费| 午夜影院久久久| 精品亚洲成a人| 高清国产一区二区| 色欲综合视频天天天| 欧美日韩一区中文字幕| 日韩欧美一区二区久久婷婷| 日韩免费高清视频| 国产精品色哟哟| 亚洲va在线va天堂| 激情综合色综合久久| 国产成人综合网站| 一本色道久久综合亚洲aⅴ蜜桃| 日本高清免费不卡视频| 91精品久久久久久久久99蜜臂| 日韩精品一区二区三区四区| 中文字幕精品综合| 一区二区国产视频| 免费观看30秒视频久久| 北条麻妃国产九九精品视频| 欧美综合色免费| 精品99久久久久久| 一区二区三区精品在线| 成人动漫在线一区| 欧美日本免费一区二区三区| 久久精品日韩一区二区三区| 亚洲一区二区三区四区的| 久久99精品久久只有精品| 91浏览器入口在线观看| 日韩精品最新网址| 亚洲欧美另类小说| 国产真实乱子伦精品视频| 91精品福利视频| 国产嫩草影院久久久久| 日韩成人av影视| 91啪亚洲精品| 国产欧美一区二区精品秋霞影院| 亚洲国产精品天堂| 成人国产电影网| 精品国产第一区二区三区观看体验 | 国产精品免费久久| 另类成人小视频在线| 91在线小视频| 国产欧美一区二区精品久导航| 日韩电影在线免费看| 色综合久久综合网欧美综合网| 26uuu亚洲综合色| 首页国产丝袜综合| 在线观看视频一区二区欧美日韩| 亚洲国产精华液网站w| 极品少妇xxxx偷拍精品少妇| 欧美亚洲一区二区在线观看| 中文字幕av不卡| 国产精品正在播放| 欧美精品色综合| 亚洲一二三区在线观看| 91无套直看片红桃| 国产精品久久看| 国产69精品久久99不卡| 久久人人97超碰com| 久久精品国产秦先生| 91精品国产综合久久久久久久| 一区二区三区av电影| 一本久久精品一区二区| 日韩一区在线看| aaa欧美日韩| 1区2区3区国产精品| 99久久精品一区| 亚洲欧美日韩国产手机在线| 成人污污视频在线观看| 国产视频亚洲色图| 国产成人一级电影| 国产欧美日韩在线视频| 粉嫩嫩av羞羞动漫久久久| 欧美国产亚洲另类动漫| a亚洲天堂av|