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

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

?? abstractconfiguration.java

?? 解觖java技術中后臺無法上傳數(shù)給的情況
?? 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一区二区三区免费野_久草精品视频
中国av一区二区三区| 国产欧美日韩另类视频免费观看| 国产精品免费网站在线观看| 免费成人在线播放| 久久精品一区二区三区av | 激情综合色播激情啊| 欧美日韩你懂的| 亚洲成人av免费| 欧美日韩精品三区| 日韩成人午夜电影| 日韩免费高清av| 国产伦精品一区二区三区免费| 日韩欧美国产成人一区二区| 国产亚洲一区字幕| 国产精品影视网| 一区二区三区高清不卡| 麻豆专区一区二区三区四区五区| 欧美va日韩va| jizzjizzjizz欧美| 亚洲大片免费看| 久久久久久久久久久久电影 | 丝袜美腿一区二区三区| 精品久久人人做人人爰| 91麻豆免费观看| 成人精品小蝌蚪| 亚洲一区二区三区自拍| 91精品久久久久久蜜臀| 成人午夜在线播放| 久久99热这里只有精品| 中文字幕一区二区三区av| 欧美日韩成人综合| 成人午夜在线播放| 韩国女主播成人在线| 一区二区三区日本| 欧洲精品一区二区三区在线观看| 中文字幕免费观看一区| 欧美麻豆精品久久久久久| 国产不卡视频在线观看| 日韩精品高清不卡| 五月天久久比比资源色| 亚洲免费观看高清在线观看| 天天影视网天天综合色在线播放| 日本va欧美va瓶| 一区二区高清免费观看影视大全| 国产视频视频一区| 26uuu亚洲综合色欧美| 欧美一区二区日韩| 日韩一级片在线观看| 欧美一级免费观看| 欧美成人性战久久| 欧美大片一区二区三区| 精品少妇一区二区三区在线播放| 蜜臀久久99精品久久久久宅男| 亚洲午夜在线视频| 香蕉乱码成人久久天堂爱免费| 国产三级精品三级在线专区| 日韩欧美在线影院| 欧美一级淫片007| 日韩欧美综合一区| 美女视频一区二区| 亚洲狠狠爱一区二区三区| 亚洲成人三级小说| 九一九一国产精品| 丁香婷婷综合激情五月色| 色综合久久88色综合天天| 在线观看三级视频欧美| 欧美精品xxxxbbbb| 久久久久久**毛片大全| 亚洲美女淫视频| 麻豆精品视频在线| 亚洲欧美激情视频在线观看一区二区三区 | 成人av免费在线播放| 欧美亚洲图片小说| 国产亚洲精品bt天堂精选| 一区二区三区蜜桃| 欧美日韩亚洲综合一区 | 人人狠狠综合久久亚洲| 国产一区二区三区在线观看免费| 91视频一区二区| 久久综合一区二区| 日韩电影在线一区| 一本色道久久加勒比精品| 26uuu国产在线精品一区二区| 综合激情成人伊人| 国产一区二区福利| 麻豆精品一区二区三区| 欧美优质美女网站| 一色屋精品亚洲香蕉网站| 国精品**一区二区三区在线蜜桃| 欧美性一级生活| 亚洲激情一二三区| 成人免费视频caoporn| 国产一区高清在线| 午夜精品aaa| 九九**精品视频免费播放| 欧美日韩黄色影视| 亚洲成a人片综合在线| 91国产福利在线| 一区二区三区在线视频免费| 精品在线观看免费| 精品粉嫩超白一线天av| 久久成人羞羞网站| 久久精品视频一区二区三区| 免费的国产精品| 国产女人18水真多18精品一级做 | 一区二区三区在线视频免费观看| 成年人网站91| 亚洲一区二区视频在线观看| 日韩精品成人一区二区三区| 7777女厕盗摄久久久| 激情图区综合网| 国产精品国产三级国产a| www.在线成人| 亚洲香蕉伊在人在线观| 欧美sm极限捆绑bd| 成人免费看视频| 99久久99久久免费精品蜜臀| 日韩免费看的电影| 成人a区在线观看| 视频在线观看一区| 中文字幕乱码久久午夜不卡| 在线中文字幕不卡| 亚洲精品成a人| 久久久蜜桃精品| 欧美午夜精品一区二区三区| 激情文学综合插| 天天亚洲美女在线视频| 国产婷婷色一区二区三区| 在线观看成人小视频| 国产成+人+日韩+欧美+亚洲| 爽好多水快深点欧美视频| 成人黄动漫网站免费app| 日韩激情一区二区| 亚洲综合在线五月| 国产精品狼人久久影院观看方式| 欧美一区二区三区电影| 欧洲生活片亚洲生活在线观看| 丰满放荡岳乱妇91ww| 久久er99热精品一区二区| 爽好多水快深点欧美视频| 国产精品亚洲а∨天堂免在线| 久久久精品天堂| 久久久久97国产精华液好用吗| 欧美精品 日韩| 91精品国产综合久久香蕉的特点 | 日韩美女精品在线| 国产偷国产偷亚洲高清人白洁| 91精品啪在线观看国产60岁| zzijzzij亚洲日本少妇熟睡| 不卡av在线免费观看| 欧美激情一区二区三区不卡| 国产精品美女www爽爽爽| 精品少妇一区二区三区在线播放 | 日韩理论电影院| 一二三区精品视频| 亚洲国产成人av| 悠悠色在线精品| 国产欧美一区二区精品秋霞影院 | 成人一区二区三区中文字幕| 国产精品99久| 色哟哟一区二区| 欧美一区二区三区人| 中文字幕av一区二区三区| 亚洲三级小视频| 极品少妇xxxx偷拍精品少妇| 蜜桃av噜噜一区| 粉嫩绯色av一区二区在线观看| 99国产精品久久久久久久久久久| 亚洲国产日韩一区二区| 国产成人精品亚洲777人妖| 色悠悠久久综合| 久久精品一区二区三区不卡牛牛| 亚洲精品视频观看| 国产精品99久久久久久宅男| 欧洲色大大久久| 综合av第一页| 久久99国产精品麻豆| 欧美日韩一区二区三区四区| 青娱乐精品视频| 岛国av在线一区| 欧美成人女星排名| 日韩高清在线一区| 欧美三区免费完整视频在线观看| 国产三级欧美三级日产三级99| 天堂va蜜桃一区二区三区漫画版| 99久久伊人久久99| 国产三级精品三级在线专区| 精品国产百合女同互慰| 亚洲一级二级在线| 91久久精品日日躁夜夜躁欧美| 国产精品毛片高清在线完整版| 精品一区二区三区在线观看国产| 热久久免费视频| 欧美本精品男人aⅴ天堂| 日韩高清在线观看| 中文字幕免费观看一区| 婷婷久久综合九色综合绿巨人| 在线精品观看国产| 水野朝阳av一区二区三区| 911精品国产一区二区在线|