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

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

?? abstractconfiguration.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
package net.myvietnam.mvncore.configuration;

/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 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.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Abstract configuration class. Provide basic functionality but does not
 * store any data. If you want to write your own Configuration class
 * then you should implement only abstract methods from this class.
 *
 * @author <a href="mailto:ksh@scand.com">Konstantin Shaposhnikov</a>
 * @author <a href="mailto:oliver.heger@t-online.de">Oliver Heger</a>
 * @version $Id: AbstractConfiguration.java,v 1.4 2004/06/01 13:25:39 skoehler Exp $
 */
public abstract class AbstractConfiguration implements Configuration
{
    /** how big the initial arraylist for splitting up name value pairs */
    private static final int INITIAL_LIST_SIZE = 2;

    private static Log log = LogFactory.getLog(AbstractConfiguration.class);
    /**
     * stores the configuration key-value pairs
     */
    protected Configuration defaults = null;

    /** start token */
    protected static final String START_TOKEN = "${";
    /** end token */
    protected static final String END_TOKEN = "}";

    /**
     * Empty constructor.
     */
    public AbstractConfiguration()
    {
    }

    /**
     * Creates an empty AbstractConfiguration object with
     * a Super-Object which is queries for every key.
     *
     * @param defaults Configuration defaults to use if key not in file
     */
    public AbstractConfiguration(Configuration defaults)
    {
        this();
        this.defaults = defaults;
    }

    /**
     * Add a property to the configuration. If it already exists then the value
     * stated here will be added to the configuration entry. For example, if
     *
     * resource.loader = file
     *
     * is already present in the configuration and you
     *
     * addProperty("resource.loader", "classpath")
     *
     * Then you will end up with a Vector like the following:
     *
     * ["file", "classpath"]
     *
     * @param key The Key to add the property to.
     * @param token The Value to add.
     */
    public void addProperty(String key, Object token)
    {
        if (token instanceof String)
        {
            for(Iterator it = processString((String) token).iterator();
            it.hasNext();)
            {
                addPropertyDirect(key, it.next());
            }
        }
        else if (token instanceof Collection)
        {
            for (Iterator it = ((Collection) token).iterator(); it.hasNext();)
            {
                addProperty(key, it.next());
            }
        }
        else
        {
            addPropertyDirect(key, token);
        }
    }

    /**
     * Read property. Should return <code>null</code> if the key doesn't
     * map to an existing object.
     *
     * @param key key to use for mapping
     *
     * @return object associated with the given configuration key.
     */
    protected abstract Object getPropertyDirect(String key);

    /**
     * Adds a key/value pair to the Configuration. Override this method to
     * provide write acces to underlying Configuration store.
     *
     * @param key key to use for mapping
     * @param obj object to store
     */
    protected abstract void addPropertyDirect(String key, Object obj);

    /**
     * interpolate key names to handle ${key} stuff
     *
     * @param base string to interpolate
     *
     * @return returns the key name with the ${key} substituted
     */
    protected String interpolate(String base)
    {
        return (interpolateHelper(base, null));
    }

    /**
     * Recursive handler for multple levels of interpolation.
     *
     * When called the first time, priorVariables should be null.
     *
     * @param base string with the ${key} variables
     * @param priorVariables serves two purposes: to allow checking for
     * loops, and creating a meaningful exception message should a loop
     * occur.  It's 0'th element will be set to the value of base from
     * the first call.  All subsequent interpolated variables are added
     * afterward.
     *
     * @return the string with the interpolation taken care of
     */
    protected String interpolateHelper(String base, List priorVariables)
    {
        if (base == null)
        {
            return null;
        }

        // on the first call initialize priorVariables
        // and add base as the first element
        if (priorVariables == null)
        {
            priorVariables = new ArrayList();
            priorVariables.add(base);
        }

        int begin = -1;
        int end = -1;
        int prec = 0 - END_TOKEN.length();
        String variable = null;
        StringBuffer result = new StringBuffer();

        // FIXME: we should probably allow the escaping of the start token
        while (((begin = base.indexOf(START_TOKEN, prec + END_TOKEN.length()))
            > -1)
            && ((end = base.indexOf(END_TOKEN, begin)) > -1))
        {
            result.append(base.substring(prec + END_TOKEN.length(), begin));
            variable = base.substring(begin + START_TOKEN.length(), end);

            // if we've got a loop, create a useful exception message and throw
            if (priorVariables.contains(variable))
            {
                String initialBase = priorVariables.remove(0).toString();
                priorVariables.add(variable);
                StringBuffer priorVariableSb = new StringBuffer();

                // create a nice trace of interpolated variables like so:
                // var1->var2->var3
                for (Iterator it = priorVariables.iterator(); it.hasNext();)
                {
                    priorVariableSb.append(it.next());
                    if (it.hasNext())
                    {
                        priorVariableSb.append("->");
                    }
                }

                throw new IllegalStateException(
                    "infinite loop in property interpolation of "
                        + initialBase
                        + ": "
                        + priorVariableSb.toString());
            }
            // otherwise, add this variable to the interpolation list.
            else
            {
                priorVariables.add(variable);
            }

            //QUESTION: getProperty or getPropertyDirect
            Object value = getProperty(variable);
            if (value != null)
            {
                result.append(interpolateHelper(value.toString(),
                    priorVariables));

                // pop the interpolated variable off the stack
                // this maintains priorVariables correctness for
                // properties with multiple interpolations, e.g.
                // prop.name=${some.other.prop1}/blahblah/${some.other.prop2}
                priorVariables.remove(priorVariables.size() - 1);
            }
            else if (defaults != null && defaults.getString(variable,
                null) != null)
            {
                result.append(defaults.getString(variable));
            }
            else
            {
                //variable not defined - so put it back in the value
                result.append(START_TOKEN).append(variable).append(END_TOKEN);
            }
            prec = end;
        }
        result.append(base.substring(prec + END_TOKEN.length(), base.length()));

        return result.toString();
    }

    /**
     * Returns a Vector of Strings built from the supplied
     * String. Splits up CSV lists. If no commas are in the
     * String, simply returns a Vector with the String as its
     * first element
     *
     * @param token The String to tokenize
     *
     * @return A List of Strings
     */
    protected List processString(String token)
    {
        List retList = new ArrayList(INITIAL_LIST_SIZE);

        if (token.indexOf(PropertiesTokenizer.DELIMITER) > 0)
        {
            PropertiesTokenizer tokenizer =
                new PropertiesTokenizer(token);

            while (tokenizer.hasMoreTokens())
            {
                String value = tokenizer.nextToken();
                retList.add(value);
            }
        }
        else
        {
            retList.add(token);
        }

        //
        // We keep the sequence of the keys here and
        // we also keep it in the Container. So the
        // Keys are added to the store in the sequence that
        // is given in the properties
        return retList;
    }


    /**
     * Test whether the string represent by value maps to a boolean
     * value or not. We will allow <code>true</code>, <code>on</code>,
     * and <code>yes</code> for a <code>true</code> boolean value, and
     * <code>false</code>, <code>off</code>, and <code>no</code> for
     * <code>false</code> boolean values. Case of value to test for
     * boolean status is ignored.
     *
     * @param value The value to test for boolean state.
     * @return <code>true</code> or <code>false</code> if the supplied
     * text maps to a boolean value, or <code>null</code> otherwise.
     */
    protected final Boolean testBoolean(String value)
    {
        String s = value.toLowerCase();

        if (s.equals("true") || s.equals("on") || s.equals("yes"))
        {
            return Boolean.TRUE;
        }
        else if (s.equals("false") || s.equals("off") || s.equals("no"))
        {
            return Boolean.FALSE;
        }
        else
        {
            return null;
        }
    }

    /**
     * Create an BaseConfiguration object that is a subset
     * of this one.
     *
     * @param prefix prefix string for keys
     *
     * @return subset of configuration if there is keys, that match
     * given prefix, or <code>null</code> if there is no such keys.
     */
    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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲日韩在线| 欧美精品1区2区| 91一区在线观看| 国产欧美一区二区三区网站| 国产不卡在线一区| 国产精品久久久久影院老司| av成人免费在线| 亚洲视频图片小说| 欧美无人高清视频在线观看| 日日摸夜夜添夜夜添精品视频 | 中文字幕乱码亚洲精品一区| 国产成人一级电影| 亚洲欧美日韩国产一区二区三区| 欧美日韩中文一区| 老司机免费视频一区二区 | 国产精品久久毛片a| 日本道色综合久久| 另类小说视频一区二区| 国产精品嫩草久久久久| 欧美日本在线视频| 国产69精品久久777的优势| 亚洲精品国产视频| 精品少妇一区二区三区日产乱码 | 久久99精品国产麻豆婷婷| 国产精品你懂的在线欣赏| 在线观看91精品国产入口| 日韩激情一二三区| 精品欧美一区二区久久| av男人天堂一区| 亚洲国产精品精华液ab| 91在线高清观看| 婷婷国产v国产偷v亚洲高清| 久久老女人爱爱| 91亚洲精品久久久蜜桃| 日韩不卡一区二区三区| 久久久777精品电影网影网 | 一区二区三区高清不卡| 欧美精品自拍偷拍动漫精品| 国产一区二区三区日韩| 亚洲精品视频在线看| 欧美一区日韩一区| 国产精品一二三区在线| 欧美精品一区在线观看| 欧美三级韩国三级日本三斤| 国内精品视频666| 一区二区三区美女视频| 欧美videofree性高清杂交| 成人avav在线| 裸体健美xxxx欧美裸体表演| 亚洲欧洲成人av每日更新| 欧美一区二区在线看| 成人高清视频在线观看| 日韩av电影免费观看高清完整版| 国产精品久久毛片av大全日韩| 欧美一个色资源| 色综合天天天天做夜夜夜夜做| 奇米一区二区三区| 亚洲三级在线免费观看| 精品99一区二区| 色婷婷国产精品久久包臀| 精品制服美女久久| 日韩经典一区二区| 一区二区三区在线高清| 国产无一区二区| 日韩免费看的电影| 在线亚洲一区二区| 粉嫩高潮美女一区二区三区| 免费观看在线综合| 亚洲永久精品大片| 中文字幕亚洲一区二区va在线| 精品久久人人做人人爽| 欧美老肥妇做.爰bbww| 色综合久久久网| 97se亚洲国产综合自在线| 激情欧美一区二区三区在线观看| 婷婷中文字幕综合| 亚洲成人动漫在线观看| 国产精品久久影院| 最近日韩中文字幕| 国产日产精品一区| 久久久久99精品国产片| 久久久久久久久97黄色工厂| 欧美一级黄色片| 欧美一级欧美一级在线播放| 欧美日韩精品欧美日韩精品| 欧美亚洲综合色| 91久久香蕉国产日韩欧美9色| 99精品欧美一区二区蜜桃免费| 国产成人在线视频网址| 国产精品一区二区免费不卡| 国产一区二区女| 国产在线播放一区二区三区| 久久黄色级2电影| 午夜久久久久久| 亚洲一区二区三区爽爽爽爽爽| 亚洲日本电影在线| 一区二区三区小说| 亚洲高清免费在线| 性做久久久久久| 奇米888四色在线精品| 蜜桃精品视频在线| 黑人精品欧美一区二区蜜桃 | 色嗨嗨av一区二区三区| 91视频一区二区三区| 色国产综合视频| 欧美日本韩国一区二区三区视频| 欧美日韩一区成人| 日韩亚洲欧美高清| 精品国产免费人成电影在线观看四季| 2021久久国产精品不只是精品| 国产女同性恋一区二区| 亚洲欧美色一区| 国产精品女上位| 一区二区三区在线播放| 三级久久三级久久| 韩国精品主播一区二区在线观看 | 国产美女精品一区二区三区| 国产成人精品免费视频网站| av亚洲精华国产精华精| 欧美色综合影院| 精品少妇一区二区三区| 国产精品丝袜黑色高跟| 亚洲综合在线观看视频| 亚洲一卡二卡三卡四卡五卡| 亚洲伦理在线精品| 久久精品久久精品| av在线综合网| 日韩午夜激情视频| 国产精品乱人伦| 午夜免费欧美电影| 成人一区在线观看| 在线这里只有精品| 5566中文字幕一区二区电影| 精品伦理精品一区| 亚洲一二三区不卡| 国产精品一区二区视频| 欧美午夜片在线看| 国产日韩欧美一区二区三区综合| 国产精品美女久久久久aⅴ国产馆| 亚洲精品久久久久久国产精华液| 麻豆91在线看| 欧美色综合网站| 中文一区在线播放| 奇米影视一区二区三区| 91成人免费在线视频| 国产亚洲成av人在线观看导航| 亚洲sss视频在线视频| 成人激情小说网站| 欧美一二三区在线观看| 一区二区三区四区五区视频在线观看 | 欧美日本一区二区在线观看| 国产清纯美女被跳蛋高潮一区二区久久w | 国产精品久久久久久久第一福利| 亚洲综合小说图片| av午夜一区麻豆| 2021久久国产精品不只是精品| 亚洲成av人影院在线观看网| 一本大道综合伊人精品热热| 精品久久久三级丝袜| 亚洲国产日日夜夜| 99riav久久精品riav| 久久精品一区二区三区不卡 | 成人免费毛片aaaaa**| 日韩三级在线免费观看| 日日摸夜夜添夜夜添亚洲女人| av在线综合网| 国产精品欧美综合在线| 日本在线观看不卡视频| 91亚洲国产成人精品一区二三 | 日本韩国欧美一区二区三区| 久久综合久久综合久久| 爽好多水快深点欧美视频| 欧美日产国产精品| 亚洲成精国产精品女| 91成人国产精品| 亚洲影院理伦片| 欧美中文字幕亚洲一区二区va在线 | 狠狠色丁香婷综合久久| 精品国产自在久精品国产| 蜜乳av一区二区| 欧美一区日韩一区| 久久国产精品第一页| 日韩一二三区视频| 精品一区二区三区久久| 欧美性猛交xxxxxx富婆| 一区二区高清免费观看影视大全 | 国产精品麻豆视频| 不卡区在线中文字幕| 国产日韩欧美麻豆| 91免费在线看| 亚洲一区二区三区自拍| 欧美日韩亚州综合| 无吗不卡中文字幕| 日韩欧美久久久| 国产精品一二三四五| 国产精品久久午夜| 日本久久电影网| 日韩精品欧美成人高清一区二区| 91精品国产综合久久久久| 久久不见久久见免费视频7|