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

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

?? jndidatasourcefactory.java

?? 另外一種持久性o/m軟件
?? JAVA
字號:
package org.apache.torque.dsfactory;/* * 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.util.Hashtable;import java.util.Iterator;import java.util.Map;import java.util.StringTokenizer;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NameAlreadyBoundException;import javax.naming.NamingException;import javax.sql.DataSource;import org.apache.commons.configuration.Configuration;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.torque.TorqueException;/** * A factory that looks up the DataSource from JNDI.  It is also able * to deploy the DataSource based on properties found in the * configuration. * * This factory tries to avoid excessive context lookups to improve speed. * The time between two lookups can be configured. The default is 0 (no cache). * * @author <a href="mailto:jmcnally@apache.org">John McNally</a> * @author <a href="mailto:thomas@vandahl.org">Thomas Vandahl</a> * @version $Id: JndiDataSourceFactory.java,v 1.9 2005/07/02 07:22:33 tfischer Exp $ */public class JndiDataSourceFactory    extends AbstractDataSourceFactory    implements DataSourceFactory{    /** The log. */    private static Log log = LogFactory.getLog(JndiDataSourceFactory.class);    /** The path to get the resource from. */    private String path;    /** The context to get the resource from. */    private Context ctx;    /** A locally cached copy of the DataSource */    private DataSource ds = null;    /** Time of last actual lookup action */    private long lastLookup = 0;    /** Time between two lookups */    private long ttl = 0; // ms    /**     * @see org.apache.torque.dsfactory.DataSourceFactory#getDataSource     */    public DataSource getDataSource() throws TorqueException    {        long time = System.currentTimeMillis();                if (ds == null || time - lastLookup > ttl)        {            try            {                ds = ((DataSource) ctx.lookup(path));                lastLookup = time;            }            catch (Exception e)            {                throw new TorqueException(e);            }        }        return ds;    }    /**     * @see org.apache.torque.dsfactory.DataSourceFactory#initialize     */    public void initialize(Configuration configuration) throws TorqueException    {        super.initialize(configuration);        initJNDI(configuration);        initDataSource(configuration);    }    /**     * Initializes JNDI.     *     * @param configuration where to read the settings from     * @throws TorqueException if a property set fails     */    private void initJNDI(Configuration configuration) throws TorqueException    {        log.debug("Starting initJNDI");        Configuration c = configuration.subset("jndi");        if (c == null || c.isEmpty())        {            throw new TorqueException(                "JndiDataSourceFactory requires a jndi "                    + "path property to lookup the DataSource in JNDI.");        }        try        {            Hashtable env = new Hashtable();            for (Iterator i = c.getKeys(); i.hasNext(); )            {                String key = (String) i.next();                if (key.equals("path"))                {                    path = c.getString(key);                    if (log.isDebugEnabled())                    {                        log.debug("JNDI path: " + path);                    }                }                else if (key.equals("ttl"))                {                    ttl = c.getLong(key, ttl);                    if (log.isDebugEnabled())                    {                        log.debug("Time between context lookups: " + ttl);                    }                }                else                {                    String value = c.getString(key);                    env.put(key, value);                    if (log.isDebugEnabled())                    {                        log.debug("Set jndi property: " + key + "=" + value);                    }                }            }            ctx = new InitialContext(env);            log.debug("Created new InitialContext");            debugCtx(ctx);        }        catch (Exception e)        {            log.error("", e);            throw new TorqueException(e);        }    }    /**     * Initializes the DataSource.     *     * @param configuration where to read the settings from     * @throws TorqueException if a property set fails     */    private void initDataSource(Configuration configuration)        throws TorqueException    {        log.debug("Starting initDataSource");        try        {            Object ds = null;            Configuration c = configuration.subset("datasource");            if (c != null)            {                for (Iterator i = c.getKeys(); i.hasNext(); )                {                    String key = (String) i.next();                    if (key.equals("classname"))                    {                        String classname = c.getString(key);                        if (log.isDebugEnabled())                        {                            log.debug("Datasource class: " + classname);                        }                                                Class dsClass = Class.forName(classname);                        ds = dsClass.newInstance();                    }                    else                    {                        if (ds != null)                        {                            if (log.isDebugEnabled())                            {                                log.debug("Setting datasource property: " + key);                            }                            setProperty(key, c, ds);                        }                        else                        {                            log.error("Tried to set property " + key + " without Datasource definition!");                        }                    }                }            }            if (ds != null)            {                bindDStoJndi(ctx, path, ds);            }        }        catch (Exception e)        {            log.error("", e);            throw new TorqueException(e);        }    }    /**     * Does nothing. We do not want to close a dataSource retrieved from Jndi,     * because other applications might use it as well.     */    public void close()    {        // do nothing    }        /**     *     * @param ctx the context     * @throws NamingException     */    private void debugCtx(Context ctx) throws NamingException    {        log.debug("InitialContext -------------------------------");        Map env = ctx.getEnvironment();        Iterator qw = env.keySet().iterator();        log.debug("Environment properties:" + env.size());        while (qw.hasNext())        {            Object prop = qw.next();            log.debug("    " + prop + ": " + env.get(prop));        }        log.debug("----------------------------------------------");    }    /**     *     * @param ctx     * @param path     * @param ds     * @throws Exception     */    private void bindDStoJndi(Context ctx, String path, Object ds)        throws Exception    {        debugCtx(ctx);        // add subcontexts, if not added already        int start = path.indexOf(':') + 1;        if (start > 0)        {            path = path.substring(start);        }        StringTokenizer st = new StringTokenizer(path, "/");        while (st.hasMoreTokens())        {            String subctx = st.nextToken();            if (st.hasMoreTokens())            {                try                {                    ctx.createSubcontext(subctx);                    log.debug("Added sub context: " + subctx);                }                catch (NameAlreadyBoundException nabe)                {                    // ignore                }                catch (NamingException ne)                {                    // even though there is a specific exception                    // for this condition, some implementations                    // throw the more general one.                    /*                      if (ne.getMessage().indexOf("already bound") == -1 )                      {                      throw ne;                      }                    */                    // ignore                }                ctx = (Context) ctx.lookup(subctx);            }            else            {                // not really a subctx, it is the ds name                ctx.bind(subctx, ds);            }        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久**毛片大全| 欧美一区二区日韩| 国产99精品在线观看| 国产乱码精品一区二区三区忘忧草| 美女www一区二区| 美女网站一区二区| 精品中文字幕一区二区| 国产在线视频不卡二| 国产大陆a不卡| 91捆绑美女网站| 欧美在线视频日韩| 欧美日韩高清不卡| 日韩一级二级三级精品视频| 精品国内片67194| 国产精品免费久久| 亚洲美女电影在线| 日韩福利电影在线| 狠狠色丁香久久婷婷综合丁香| 国产传媒久久文化传媒| av网站免费线看精品| 欧美性xxxxx极品少妇| 欧美一二三区在线观看| 国产欧美日韩精品一区| 一区二区三区在线影院| 天堂久久久久va久久久久| 麻豆91在线看| 91亚洲精华国产精华精华液| 538在线一区二区精品国产| 欧美精品一区二区三| 亚洲日本电影在线| 美国毛片一区二区三区| 欧美在线|欧美| 日韩免费视频一区二区| 中文字幕一区二区三区不卡| 日本欧美加勒比视频| 国产麻豆欧美日韩一区| 欧美主播一区二区三区美女| 精品国产三级a在线观看| 亚洲精品视频在线观看网站| 久久成人麻豆午夜电影| 91视频91自| 久久久99精品久久| 婷婷成人激情在线网| 床上的激情91.| 宅男在线国产精品| 伊人性伊人情综合网| 激情久久五月天| 7777精品伊人久久久大香线蕉经典版下载| 国产日韩欧美亚洲| 青椒成人免费视频| 欧美三级午夜理伦三级中视频| 国产日本一区二区| 久久精品国产亚洲a| 欧美日韩一区在线| 亚洲视频一二三| 国产成人av一区二区三区在线 | 亚洲成av人片一区二区梦乃| 国产一区在线观看视频| 欧美日韩免费一区二区三区视频| 国产精品伦理一区二区| 激情欧美一区二区三区在线观看| 欧美四级电影在线观看| 亚洲男人的天堂网| 99久久国产综合色|国产精品| 久久久久青草大香线综合精品| 老鸭窝一区二区久久精品| 欧美日韩国产不卡| 视频在线观看国产精品| 欧美日韩高清在线播放| 日韩电影一区二区三区| 欧美巨大另类极品videosbest| 亚洲综合色区另类av| 在线观看欧美精品| 亚洲综合999| 欧美高清性hdvideosex| 日韩精品欧美精品| 欧美成人官网二区| 精品一区免费av| 久久久久国产免费免费| 国产成人综合视频| 中国av一区二区三区| 不卡区在线中文字幕| 1区2区3区国产精品| 色综合色综合色综合| 亚洲午夜久久久久久久久电影院| 欧美欧美午夜aⅴ在线观看| 爽好久久久欧美精品| 国产亚洲污的网站| 国产激情精品久久久第一区二区| 国产欧美日韩在线观看| 不卡的av中国片| 午夜在线电影亚洲一区| 欧美一级精品在线| 成人精品视频一区二区三区尤物| 亚洲图片另类小说| 欧美精品乱码久久久久久| 精品一区二区三区香蕉蜜桃| 国产婷婷一区二区| 欧美日韩在线亚洲一区蜜芽| 美女任你摸久久 | 一区二区三区四区国产精品| 欧美日韩一级片在线观看| 美女久久久精品| 亚洲色图一区二区三区| 日韩一区二区在线看| 成人av电影观看| 五月综合激情网| 国产精品网站在线| 欧美喷潮久久久xxxxx| 国产精品白丝jk黑袜喷水| 亚洲一区二区在线观看视频 | 国产亚洲精品bt天堂精选| 99久久综合色| 欧美aaaaaa午夜精品| 亚洲欧洲日韩综合一区二区| 欧美高清www午色夜在线视频| 国产不卡高清在线观看视频| 亚洲五码中文字幕| 国产精品美女久久久久久久久 | 欧美男生操女生| 成人黄色电影在线| 免费精品99久久国产综合精品| 国产精品白丝在线| 欧美一级午夜免费电影| 91国内精品野花午夜精品| 懂色av一区二区在线播放| 奇米影视一区二区三区| 一区二区在线看| 国产精品久久看| 精品国一区二区三区| 69av一区二区三区| 在线观看一区日韩| 97国产一区二区| 东方欧美亚洲色图在线| 激情综合色丁香一区二区| 五月激情丁香一区二区三区| 亚洲黄色免费电影| 亚洲男人的天堂在线aⅴ视频| 中日韩免费视频中文字幕| 国产亚洲欧美日韩日本| 欧美v日韩v国产v| 日韩欧美视频一区| 91精品国产综合久久福利| 欧美日韩免费高清一区色橹橹 | 六月丁香综合在线视频| 日韩中文字幕不卡| 日韩高清不卡一区二区| 日韩av不卡在线观看| 天天综合色天天综合色h| 亚洲国产日韩a在线播放性色| 亚洲精选视频在线| 亚洲精品中文在线影院| 亚洲精品视频观看| 一区二区理论电影在线观看| 亚洲精品中文在线| 亚洲国产一区二区三区| 亚洲国产成人高清精品| 天天av天天翘天天综合网色鬼国产| 亚洲国产成人tv| 男女激情视频一区| 国产呦精品一区二区三区网站| 国产成人在线电影| av电影在线不卡| 欧美系列一区二区| 日韩亚洲欧美成人一区| 国产肉丝袜一区二区| 综合欧美亚洲日本| 日韩精品免费视频人成| 国产一区日韩二区欧美三区| 成人综合婷婷国产精品久久蜜臀| 99久久精品国产一区二区三区 | 粉嫩av一区二区三区| 91在线看国产| 在线播放亚洲一区| 精品国产自在久精品国产| 国产精品麻豆99久久久久久| 亚洲九九爱视频| 久久99久久99精品免视看婷婷| 高清在线不卡av| 欧美三级蜜桃2在线观看| 日韩一卡二卡三卡四卡| 国产欧美日韩另类一区| 亚洲国产视频a| 国产毛片精品视频| 在线观看国产一区二区| 日韩欧美国产一区二区在线播放| 国产亚洲欧美一级| 日韩中文字幕亚洲一区二区va在线 | 欧美日韩免费观看一区三区| 久久―日本道色综合久久| 亚洲男人天堂av网| 国产乱对白刺激视频不卡| 欧美视频自拍偷拍| 国产欧美日韩三级| 麻豆精品久久久| 91论坛在线播放| 国产精品女同一区二区三区| 青青国产91久久久久久| 色综合激情五月| 国产午夜精品美女毛片视频|