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

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

?? jndiconfiguration.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package net.myvietnam.mvncore.configuration;
/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *    any, must include the following acknowledgement:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgement may appear in the software itself,
 *    if and wherever such third-party acknowledgements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used to endorse or promote products derived
 *    from this software without prior written permission. For written
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Vector;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
 * This Configuration class allows you to interface with a JNDI datasource.
 *
 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
 * @version $Id: JNDIConfiguration.java,v 1.2 2004/05/28 22:02:58 skoehler Exp $
 */
public class JNDIConfiguration
    extends BaseConfiguration
    implements Configuration
{
    private static Log log = LogFactory.getLog(JNDIConfiguration.class);
    private String prefix;
    private Context envCtx;
    private List clearedProperties = new ArrayList();
    /**
     * Creates an empty JNDIConfiguration object which can then
     * be added some other Configuration files
     */
    public JNDIConfiguration()
    {
    }
    /**
     * JNDIConfigurations can not be added to
     *
     * @param key The Key to add the property to.
     * @param token The Value to add.
     */
    public void addProperty(String key, Object token)
    {
        throw new Error("This operation is not supported");
    }
    /**
     * This method recursive traverse the JNDI tree, looking for Context objects.
     * When it finds them, it traverses them as well.  Otherwise it just adds the
     * values to the list of keys found.
     * @param keys All the keys that have been found.
     * @param enum An enumeration of all the elements found at a specific context
     * @param key What key we are building on.
     * @throws NamingException If JNDI has an issue.
     */
    private void recursiveGetKeys(
        List keys,
        NamingEnumeration enum,
        String key)
        throws NamingException
    {
        while (enum.hasMoreElements())
        {
            Binding binding = (Binding) enum.next();
            StringBuffer newKey = new StringBuffer();
            newKey.append(key);
            if (newKey.length() > 0)
            {
                newKey.append(".");
            }
            newKey.append(binding.getName());
            if (binding.getObject() instanceof Context)
            {
                Context c = (Context) binding.getObject();
                NamingEnumeration enum2 = c.listBindings("");
                recursiveGetKeys(keys, enum2, newKey.toString());
            }
            else
            {
                if (!keys.contains(newKey.toString()))
                {
                    keys.add(newKey.toString());
                }
            }
        }
    }
    /**
     * Get the list of the keys contained in the configuration
     * repository.
     *
     * @return An Iterator.
     */
    public Iterator getKeys()
    {
        return getKeys("");
    }
    /**
     * Get the list of the keys contained in the configuration
     * repository that match a passed in beginning pattern.
     *
     * @param key the key pattern to match on.
     * @return An Iterator.
     */
    public Iterator getKeys(String key)
    {
        List keys = new ArrayList();
        try
        {
            String[] splitKeys = StringUtils.split(key, ".");
            for (int i = 0; i < splitKeys.length; i++)
            {
                keys.add(splitKeys[i]);
            }
            Context context = null;
            if (keys.size() == 0)
            {
                context = getContext();
            }
            else
            {
                context =
                    getStartingContextPoint(
                        keys,
                        getContext().listBindings(""));
            }
            if (context != null)
            {
                NamingEnumeration enum = context.listBindings("");
                recursiveGetKeys(keys, enum, key);
            }
        }
        catch (NamingException ne)
        {
            log.warn(ne);
        }
        return keys.iterator();
    }
    /**
     * Because JNDI is based on a tree configuration, we need to filter down the
     * tree, till we find the Context specified by the key to start from.
     * Otherwise return null.
     *
     * @param The key (or name) of the Context we are looking to start from.
     * @return The context at that key's location in the JNDI tree, or null if not found
     * @throws NamingException if JNDI has an issue
     */
    private Context getStartingContextPoint(List keys, NamingEnumeration enum)
        throws NamingException
    {
        String keyToSearchFor = (String) keys.get(0);
        log.debug("Key to search for is " + keyToSearchFor);
        while (enum.hasMoreElements())
        {
            Binding binding = (Binding) enum.next();
            log.debug(
                "Binding for name: "
                    + binding.getName()
                    + ", object:"
                    + binding.getObject()
                    + ", class:"
                    + binding.getClassName());
            if (binding.getObject() instanceof Context
                && binding.getName().equals(keyToSearchFor))
            {
                keys.remove(0);
                Context c = (Context) binding.getObject();
                if (keys.size() > 0)
                {
                    return getStartingContextPoint(keys, c.listBindings(""));
                }
                else
                {
                    return c;
                }
            }
        }
        return null;
    }
    /**
     * Get a list of properties associated with the given
     * configuration key.
     *
     * @param key The configuration key.
     * @return The associated properties if key is found.
     * @throws ClassCastException is thrown if the key maps to an
     * object that is not a String/Vector.
     * @throws IllegalArgumentException if one of the tokens is
     * malformed (does not contain an equals sign).
     * @see #getProperties(String, Properties)
     */
    public Properties getProperties(String key)
    {
        throw new Error("This operation is not supported");
    }
    public boolean isEmpty()
    {
        try
        {
            NamingEnumeration enum = getContext().listBindings("");
            return !enum.hasMore();
        }
        catch (NamingException ne)
        {
            log.warn(ne);
            return true;
        }
    }
    /**
     *  Gets a property from the configuration.
     *
     *  @param key property to retrieve
     *  @return value as object. Will return user value if exists,
     *          if not then default value if exists, otherwise null
     */
    public Object getProperty(String key)
    {
        throw new Error("This operation is not supported");
    }
    /**
     * Set a property, this will replace any previously
     * set values. Set values is implicitly a call
     * to clearProperty(key), addProperty(key,value).
     *
     * @param key
     * @param value
     */
    public void setProperty(String key, Object value)
    {
        throw new Error("This operation is not supported");
    }
    /**
     * Clear a property in the configuration.  Just marks it as cleared,
     * doesn't change the underlying JNDI data source.
     *
     * @param key the key to remove along with corresponding value.
     */
    public void clearProperty(String key)
    {
        if (!clearedProperties.contains(key))
        {
            clearedProperties.add(key);
        }
    }
    /**
     * check if the configuration contains the key, or the key
     * has been removed.
     */
    public boolean containsKey(String key)
    {
        if (clearedProperties.contains(key))
        {
            return false;
        }
        key = StringUtils.replace(key, ".", "/");
        try
        {
        	// throws a NamingException if JNDI doesn't contain the key.
            getContext().lookup(key);
            return true;
        }
        catch (javax.naming.NamingException ne)
        {
            return false;
        }
    }
    /**
     * Create an ExtendedProperties object that is a subset
     * of this one. Take into account duplicate keys
     * by using the setProperty() in ExtendedProperties.
     *
     * @param prefix
     */
    public Configuration subset(String prefix)
    {
        BaseConfiguration c = new BaseConfiguration();
        Iterator keys = this.getKeys();
        boolean validSubset = false;
        while (keys.hasNext())
        {
            Object key = keys.next();
            if (key instanceof String && ((String) key).startsWith(prefix))
            {
                if (!validSubset)
                {
                    validSubset = true;
                }
                String newKey = null;
                /*
                 * Check to make sure that c.subset(prefix) doesn't blow up when
                 * there is only a single property with the key prefix. This is
                 * not a useful subset but it is a valid subset.
                 */
                if (((String) key).length() == prefix.length())
                {
                    newKey = prefix;
                }
                else
                {
                    newKey = ((String) key).substring(prefix.length() + 1);
                }
                /*
                 * use addPropertyDirect() - this will plug the data as is into
                 * the Map, but will also do the right thing re key accounting
                 */
                Object value = getValueFromJNDI(key.toString());
                if (value instanceof String)
                {
                    c.addPropertyDirect(newKey, interpolate((String) value));
                }
                else
                {
                    c.addPropertyDirect(newKey, value);
                }
            }
        }
        if (validSubset)
        {
            return c;
        }
        else
        {
            return null;
        }
    }

    /**
     * Get a boolean associated with the given configuration key.
     *
     * @param key The configuration key.
     * @param defaultValue The default value.
     * @return The associated boolean if key is found and has valid
     * format, default value otherwise.
     * @throws ClassCastException is thrown if the key maps to an
     * object that is not a Boolean.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人在线网站| 欧美羞羞免费网站| 色视频成人在线观看免| 欧美一区二区视频观看视频| 亚洲天堂2014| 九九精品一区二区| 欧美日韩精品一区视频| 国产精品久久久久一区| 久久 天天综合| 3d成人h动漫网站入口| 亚洲欧美一区二区不卡| 国产一区二区三区免费在线观看| 欧美日韩视频在线第一区| 中文字幕高清不卡| 国产精品中文字幕欧美| 亚洲国产精品精华液ab| 久草这里只有精品视频| 91精品国产综合久久久久久漫画| 亚洲男人天堂一区| 99热99精品| 国产精品二三区| 东方欧美亚洲色图在线| 国产欧美日本一区二区三区| 久久成人精品无人区| 欧美精品日韩精品| 秋霞午夜av一区二区三区| 欧美色网站导航| 午夜国产不卡在线观看视频| 91国产成人在线| 一区二区在线观看视频在线观看| 99re在线视频这里只有精品| 欧美国产精品专区| 99在线视频精品| 亚洲欧美日韩小说| 日本乱码高清不卡字幕| 一二三区精品视频| 欧美二区在线观看| 麻豆成人久久精品二区三区红 | 国产一区美女在线| 精品国产电影一区二区| 韩国精品免费视频| 亚洲国产精品v| 91女人视频在线观看| 亚洲精品日韩一| 欧美日韩精品一区二区三区蜜桃| 午夜久久久久久| 精品国产免费视频| av激情成人网| 一区二区三区成人在线视频| 欧美日韩国产成人在线91| 日韩精品成人一区二区在线| 日韩视频免费观看高清完整版| 麻豆精品久久久| 国产午夜精品在线观看| 91美女视频网站| 日本在线不卡视频一二三区| 国产亚洲一区二区在线观看| 91在线视频在线| 日韩av网站免费在线| 久久久夜色精品亚洲| 99国内精品久久| 日韩精品一级二级| 国产精品久久久久9999吃药| 欧美日韩一区小说| 国产在线精品一区二区不卡了| 国产精品久久久久久久久久久免费看 | 日韩成人免费看| 国产亚洲综合色| 欧美日韩高清一区| 国产成人精品aa毛片| 亚洲线精品一区二区三区八戒| 精品久久一二三区| 91精品办公室少妇高潮对白| 精品中文字幕一区二区小辣椒| 国产精品美女久久久久av爽李琼| 欧美日韩一级片在线观看| 久久99精品久久久久久| 韩国av一区二区三区四区| 国产精品久久久一本精品| 欧美日韩欧美一区二区| 高清不卡一二三区| 麻豆精品一区二区三区| 一区二区三区欧美在线观看| 日韩欧美成人一区二区| 欧美专区日韩专区| 国产高清久久久| 麻豆精品视频在线| 午夜精品123| 亚洲免费高清视频在线| 久久久久久久久久久久电影| 欧美乱妇23p| 在线亚洲精品福利网址导航| 国产精品一区二区男女羞羞无遮挡 | 日韩中文字幕麻豆| 一区二区在线电影| 国产精品污网站| 国产日产欧美一区二区视频| 欧美丰满高潮xxxx喷水动漫| 色天使色偷偷av一区二区| 成人动漫视频在线| 懂色中文一区二区在线播放| 精品一区二区影视| 蜜臀国产一区二区三区在线播放| 一区二区三区欧美| 亚洲区小说区图片区qvod| 欧美国产1区2区| 国产欧美一区二区三区网站 | 欧美高清在线精品一区| 久久久久99精品一区| 精品久久久三级丝袜| 欧美变态凌虐bdsm| 欧美电影免费观看高清完整版在| 欧美一区二区三区婷婷月色| 欧美妇女性影城| 欧美一卡二卡三卡| 精品少妇一区二区| 精品成人在线观看| 久久精品一区二区三区不卡牛牛| 精品国产免费视频| 久久久久国产精品麻豆ai换脸 | a亚洲天堂av| 不卡的av在线播放| 色美美综合视频| 精品视频在线看| 欧美一区二区日韩| 久久久精品日韩欧美| 国产精品久久久久久久久免费丝袜 | 久久久久久99久久久精品网站| 久久只精品国产| 91精品国产高清一区二区三区蜜臀| 欧美情侣在线播放| 日韩精品最新网址| 国产日韩亚洲欧美综合| 国产精品国产自产拍高清av王其 | av动漫一区二区| 在线观看成人小视频| 欧美丰满少妇xxxxx高潮对白| 日韩久久精品一区| 中文在线一区二区| 亚洲小说春色综合另类电影| 久久电影网站中文字幕| 国产一区999| 欧美在线综合视频| 亚洲成人黄色影院| 精品一区二区三区久久| 99久久777色| 欧美一区二区精美| 最新热久久免费视频| 婷婷国产在线综合| 国产成人免费在线视频| 在线视频你懂得一区二区三区| 日韩欧美成人午夜| 亚洲免费在线播放| 激情文学综合网| 欧美三级视频在线观看| 精品三级在线观看| 一区二区免费视频| 国产精品亚洲午夜一区二区三区| 色视频一区二区| 2020国产精品自拍| 亚洲一区二区三区四区在线观看| 国产一区二区在线观看视频| 99精品视频在线观看免费| 欧美一区二区观看视频| 亚洲欧美日韩小说| 国产高清久久久| 日韩一区二区三区在线| 亚洲精品国产一区二区精华液 | 精品污污网站免费看| 久久亚洲一区二区三区明星换脸 | 亚洲欧洲av在线| 美女在线一区二区| 欧美在线视频不卡| 亚洲欧美日韩在线| 国产成人啪免费观看软件| 日韩欧美自拍偷拍| 亚洲成人免费看| 色悠久久久久综合欧美99| 久久久蜜桃精品| 久久激情五月激情| 欧美军同video69gay| 亚洲自拍偷拍欧美| 99精品视频一区二区| 久久精品在线观看| 国产在线播精品第三| 日韩欧美在线网站| 日本视频一区二区三区| 欧美日韩精品一区二区天天拍小说 | 69堂成人精品免费视频| 亚洲一区二区三区四区在线| 色综合天天综合网国产成人综合天 | 亚洲影视在线观看| 91丝袜美女网| 综合久久综合久久| 91麻豆.com| 亚洲男帅同性gay1069| 色94色欧美sute亚洲线路一ni| 国产精品久久久久四虎| 成人av网站免费| 最新日韩av在线|