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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hierarchicalconfiguration.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
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.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;

import org.apache.commons.collections.SequencedHashMap;
import org.apache.commons.lang.StringUtils;

/**
 * <p>A specialized configuration class that extends its base class by the
 * ability of keeping more structure in the stored properties.</p>
 * <p>There are some sources of configuration data that cannot be stored
 * very well in a <code>BaseConfiguration</code> object because then their
 * structure is lost. This is especially true for XML documents. This class
 * can deal with such structured configuration sources by storing the
 * properties in a tree-like organization.</p>
 * <p>The internal used storage form allows for a more sophisticated access to
 * single properties. As an example consider the following XML document:</p>
 * <p><pre>
 * &lt;database&gt;
 *   &lt;tables&gt;
 *     &lt;table&gt;
 *       &lt;name&gt;users&lt;/name&gt;
 *       &lt;fields&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;lid&lt;/name&gt;
 *           &lt;type&gt;long&lt;/name&gt;
 *         &lt;/field&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;usrName&lt;/name&gt;
 *           &lt;type&gt;java.lang.String&lt;/type&gt;
 *         &lt;/field&gt;
 *        ...
 *       &lt;/fields&gt;
 *     &lt;/table&gt;
 *     &lt;table&gt;
 *       &lt;name&gt;documents&lt;/name&gt;
 *       &lt;fields&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;docid&lt;/name&gt;
 *           &lt;type&gt;long&lt;/type&gt;
 *         &lt;/field&gt;
 *         ...
 *       &lt;/fields&gt;
 *     &lt;/table&gt;
 *     ...
 *   &lt;/tables&gt;
 * &lt;/database&gt;
 * </pre></p>
 * <p>If this document is parsed and stored in a
 * <code>HierarchicalConfiguration</code> object (which can be done by one of
 * the sub classes), there are enhanced possibilities of accessing properties.
 * The keys for querying information can contain indices that select a certain
 * element if there are multiple hits.</p>
 * <p>For instance the key <code>tables.table(0).name</code> can be used to
 * find out the name of the first table. In opposite
 * <code>tables.table.name</code> would return a collection with the names of
 * all available tables. Similarily the key
 * <code>tables.table(1).fields.field.name</code> returns a collection with the
 * names of all fields of the second table. If another index is added after the
 * <code>field</code> element, a single field can be accessed:
 * <code>tables.table(1).fields.field(0).name</code>.</p>
 * <p>There is a <code>getMaxIndex()</code> method that returns the maximum
 * allowed index that can be added to a given property key. This method can be
 * used to iterate over all values defined for a certain property.</p>
 *
 * @author <a href="mailto:oliver.heger@t-online.de">Oliver Heger</a>
 * @version $Id: HierarchicalConfiguration.java,v 1.1 2003/12/09 08:25:30 huumai Exp $
 */
public class HierarchicalConfiguration extends AbstractConfiguration
{
    /** Constant for a new dummy key.*/
    private static final String NEW_KEY = "newKey";

    /** Stores the root node of this configuration.*/
    private Node root = new Node();

    /**
     * Creates a new instance of <code>HierarchicalConfiguration</code>.
     */
    public HierarchicalConfiguration()
    {
        super();
    }

    /**
     * Creates a new instance of <code>HierarchicalConfiguration</code>
     * and initializes it with default properties.
     * @param defaults default properties to be used
     */
    public HierarchicalConfiguration(Configuration defaults)
    {
        super(defaults);
    }

    /**
     * Returns the root node of this hierarchical configuration.
     * @return the root node
     */
    public Node getRoot()
    {
        return root;
    }

    /**
     * Sets the root node of this hierarchical configuration.
     * @param node the root node
     */
    public void setRoot(Node node)
    {
        if (node == null)
        {
            throw new IllegalArgumentException("Root node must not be null!");
        } /* if */
        root = node;
    }

    /**
     * Fetches the specified property. Performs a recursive lookup in the
     * tree with the configuration properties.
     * @param key the key to be looked up
     * @return the found value
     */
    protected Object getPropertyDirect(String key)
    {
        List nodes = fetchNodeList(key);

        if (nodes.size() == 0)
        {
            return null;
        } /* if */
        else
        {
            Container cont = new Container();
            for (Iterator it = nodes.iterator(); it.hasNext();)
            {
                Node nd = (Node) it.next();
                if (nd.getValue() != null)
                {
                    cont.add(nd.getValue());
                } /* if */
            } /* for */

            if (cont.size() < 1)
            {
                return null;
            } /* if */
            else
            {
                return (cont.size() == 1) ? cont.get(0) : cont;
            } /* else */
        } /* else */
    }

    /**
     * <p>Adds the property with the specified key.</p>
     * <p>To be able to deal with the structure supported by this configuration
     * implementation the passed in key is of importance, especially the
     * indices it might contain. The following example should clearify this:
     * Suppose the actual configuration contains the following elements:</p>
     * <p><pre>
     * tables
     *    +-- table
     *            +-- name = user
     *            +-- fields
     *                    +-- field
     *                            +-- name = uid
     *                    +-- field
     *                            +-- name = firstName
     *                    ...
     *    +-- table
     *            +-- name = documents
     *            +-- fields
     *                   ...
     * </pre></p>
     * <p>In this example a database structure is defined, e.g. all fields of
     * the first table could be accessed using the key
     * <code>tables.table(0).fields.field.name</code>. If now properties are
     * to be added, it must be exactly specified at which position in the
     * hierarchy the new property is to be inserted. So to add a new field name
     * to a table it is not enough to say just</p>
     * <p><pre>
     * config.addProperty("tables.table.fields.field.name", "newField");
     * </pre></p>
     * <p>The statement given above contains some ambiguity. For instance
     * it is not clear, to which table the new field should be added. If this
     * method finds such an ambiguity, it is resolved by following the last
     * valid path. Here this would be the last table. The same is true for the
     * <code>field</code>; because there are multiple fields and no explicit
     * index is provided, a new <code>name</code> property would be
     * added to the last field - which is propably not what was desired.</p>
     * <p>To make things clear explicit indices should be provided whenever
     * possible. In the example above the exact table could be specified by
     * providing an index for the <code>table</code> element as in
     * <code>tables.table(1).fields</code>. By specifying an index it can also
     * be expressed that at a given position in the configuration tree a new
     * branch should be added. In the example above we did not want to add
     * an additional <code>name</code> element to the last field of the table,
     * but we want a complete new <code>field</code> element. This can be
     * achieved by specifying an invalid index (like -1) after the element
     * where a new branch should be created. Given this our example would run:
     * </p><p><pre>
     * config.addProperty("tables.table(1).fields.field(-1).name", "newField");
     * </pre></p>
     * <p>With this notation it is possible to add new branches everywhere.
     * We could for instance create a new <code>table</code> element by
     * specifying</p>
     * <p><pre>
     * config.addProperty("tables.table(-1).fields.field.name", "newField2");
     * </pre></p>
     * <p>(Note that because after the <code>table</code> element a new
     * branch is created indices in following elements are not relevant; the
     * branch is new so there cannot be any ambiguities.)</p>
     * @param key the key of the new property
     * @param obj the value of the new property
     */
    protected void addPropertyDirect(String key, Object obj)
    {
        ConfigurationKey.KeyIterator it = new ConfigurationKey(key).iterator();
        Node parent = fetchAddNode(it, getRoot());

        Node child = new Node(it.currentKey(true));
        child.setValue(obj);
        parent.addChild(child);
    }

    /**
     * Adds a collection of nodes at the specified position of the
     * configuration tree. This method works similar to
     * <code>addProperty()</code>, but instead of a single property a whole
     * collection of nodes can be added - and thus complete configuration
     * sub trees. E.g. with this method it is possible to add parts of
     * another <code>HierarchicalConfiguration</code> object to this object.
     * @param key the key where the nodes are to be added; can be <b>null</b>,
     * then they are added to the root node
     * @param nodes a collection with the <code>Node</code> objects to be
     * added
     */
    public void addNodes(String key, Collection nodes)
    {
        if (nodes == null || nodes.isEmpty())
        {
            return;
        } /* if */

        Node parent;
        if (StringUtils.isEmpty(key))
        {
            parent = getRoot();
        } /* if */
        else
        {
            ConfigurationKey.KeyIterator kit =
                new ConfigurationKey(key).iterator();
            parent = fetchAddNode(kit, getRoot());

            // fetchAddNode() does not really fetch the last component,
            // but one before. So we must perform an additional step.
            ConfigurationKey keyNew =
                new ConfigurationKey(kit.currentKey(true));
            keyNew.append(NEW_KEY);
            parent = fetchAddNode(keyNew.iterator(), parent);
        } /* else */

        for (Iterator it = nodes.iterator(); it.hasNext();)
        {
            parent.addChild((Node) it.next());
        } /* for */
    }

    /**
     * Checks if this configuration is empty. Empty means that there are
     * no keys with any values, though there can be some (empty) nodes.
     * @return a flag if this configuration is empty
     */
    public boolean isEmpty()
    {
        return !nodeDefined(getRoot());
    }

    /**
     * Checks if the specified key is contained in this configuration.
     * Note that for this configuration the term &quot;contained&quot; means
     * that the key has an associated value. If there is a node for this key
     * that has no value but children (either defined or undefined), this
     * method will still return <b>false</b>.
     * @param key the key to be chekced
     * @return a flag if this key is contained in this configuration
     */
    public boolean containsKey(String key)
    {
        return getPropertyDirect(key) != null;
    }

    /**
     * Removes all values of the property with the given name.
     * @param key the key of the property to be removed
     */
    public void clearProperty(String key)
    {
        List nodes = fetchNodeList(key);

        for (Iterator it = nodes.iterator(); it.hasNext();)
        {
            removeNode((Node) it.next());
        } /* for */
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆久久一区二区| 国产高清一区日本| 国产精品久久久久婷婷| 久久伊99综合婷婷久久伊| 欧美激情中文字幕一区二区| 国产精品乱码久久久久久| 91精品国产福利在线观看| 色哟哟在线观看一区二区三区| 久久精品国产一区二区| av电影一区二区| 欧美精品aⅴ在线视频| 欧美一区二区三区人| 7777精品伊人久久久大香线蕉的| 色成人在线视频| 丁香激情综合五月| 久久国产精品99久久久久久老狼| 亚洲欧美激情视频在线观看一区二区三区 | 国产三级三级三级精品8ⅰ区| 老司机精品视频在线| 精品视频1区2区3区| 奇米888四色在线精品| 亚洲免费资源在线播放| 欧美午夜电影在线播放| 香蕉影视欧美成人| 色天使久久综合网天天| 久久嫩草精品久久久精品一| 亚洲精品日韩专区silk| 国产馆精品极品| 亚洲精品在线免费观看视频| 日韩精品一二三区| 色噜噜狠狠一区二区三区果冻| 精品视频一区二区三区免费| 久久久久9999亚洲精品| 日本亚洲电影天堂| 久久精品日产第一区二区三区高清版| 精品乱人伦小说| 国产欧美综合在线| 国产精品不卡一区二区三区| 午夜电影久久久| 午夜激情一区二区三区| 国产成人综合视频| 亚洲精品在线观看视频| 国产成人在线视频播放| 国产精品免费人成网站| 国产性做久久久久久| 欧美日韩久久久| 99国内精品久久| jlzzjlzz亚洲日本少妇| 91国内精品野花午夜精品| 99精品国产91久久久久久| 丰满放荡岳乱妇91ww| 成人一级片在线观看| 亚洲a一区二区| 欧美国产成人精品| 欧美丰满少妇xxxbbb| 国产黄色成人av| 蜜桃精品视频在线| 亚洲已满18点击进入久久| 在线视频一区二区免费| 免费成人在线视频观看| 欧美挠脚心视频网站| 性做久久久久久免费观看| 欧美久久一区二区| 精品国产伦一区二区三区观看体验| 欧美国产日韩精品免费观看| 精品中文字幕一区二区| 亚洲人成电影网站色mp4| 2014亚洲片线观看视频免费| 在线欧美小视频| 日韩精品一区二区三区三区免费| 欧美视频自拍偷拍| 日韩美一区二区三区| 欧美电影精品一区二区| 一区二区三区在线播| 亚洲第一狼人社区| 国产精品一级在线| 一本色道a无线码一区v| 欧美最新大片在线看| jizzjizzjizz欧美| 色综合久久中文字幕综合网| 国产一区二三区| 国产在线精品一区二区不卡了| 日韩电影在线免费观看| 夜夜精品视频一区二区| 日韩美女啊v在线免费观看| 国产日韩av一区| 久久久久久亚洲综合影院红桃 | 欧美日韩国产三级| 在线一区二区观看| 欧美日韩在线三区| 6080午夜不卡| 337p粉嫩大胆色噜噜噜噜亚洲| 精品美女在线播放| 中文字幕av免费专区久久| 国产精品私房写真福利视频| 国产精品传媒入口麻豆| 亚洲精品综合在线| 香蕉久久夜色精品国产使用方法| 天堂精品中文字幕在线| 激情综合色综合久久综合| 国产精品一区二区三区四区| 成人美女视频在线看| 色88888久久久久久影院野外| 精品乱人伦小说| 亚洲伦在线观看| 欧美日韩视频专区在线播放| 色婷婷综合久久| 欧美日韩国产中文| 日韩欧美一级特黄在线播放| 国产精品美日韩| 免费在线观看日韩欧美| 欧美中文一区二区三区| 国产一区二区精品久久91| 日韩一区二区三区高清免费看看| 久久成人久久爱| 国产欧美日韩视频一区二区| 色婷婷一区二区| 日本欧美在线观看| 国产精品麻豆久久久| 国产99久久久国产精品潘金| 亚洲午夜精品在线| 欧美另类z0zxhd电影| 国产精品成人一区二区艾草 | 136国产福利精品导航| 国产一区二区三区四区五区入口| 91蜜桃网址入口| 中国av一区二区三区| 精品一区二区在线免费观看| 欧美挠脚心视频网站| 蜜臀久久99精品久久久久久9| 丝袜美腿高跟呻吟高潮一区| 国产麻豆一精品一av一免费| 欧美影院一区二区三区| 久久久噜噜噜久久人人看| 亚洲线精品一区二区三区八戒| 国产电影一区二区三区| 欧美日韩国产影片| 最新日韩av在线| 国产毛片精品视频| 日韩区在线观看| 一区二区三区在线不卡| 成人免费视频网站在线观看| 91精品国产色综合久久 | 久久这里都是精品| 亚洲国产精品久久久男人的天堂| jizz一区二区| 国产免费成人在线视频| 美女精品一区二区| 欧美精品在线观看一区二区| 18成人在线观看| 成人性视频免费网站| 久久影院午夜论| 久久国产精品99久久久久久老狼| 欧美日韩精品二区第二页| 欧美a级理论片| 亚洲福利电影网| 亚洲国产精品久久久男人的天堂| 精品美女一区二区| 成人毛片在线观看| 一区二区三区欧美日韩| 久久九九99视频| 日韩欧美国产一区二区三区 | 亚洲精品国产无套在线观| 亚洲三级在线播放| 午夜成人在线视频| 美女任你摸久久| zzijzzij亚洲日本少妇熟睡| 99riav一区二区三区| 欧美日本乱大交xxxxx| 精品成人一区二区| 一区二区三区在线视频观看| 国产三级欧美三级| 一区在线中文字幕| 欧美激情在线一区二区三区| 7777精品伊人久久久大香线蕉超级流畅 | 精品视频1区2区| 成人国产精品视频| 亚洲高清视频在线| 99re热这里只有精品视频| 亚洲婷婷在线视频| 91蝌蚪porny九色| 一区二区三区自拍| 欧美精品欧美精品系列| 日本欧美一区二区| 精品少妇一区二区| 国产精品538一区二区在线| 亚洲国产精品精华液2区45| 成人听书哪个软件好| 国产精品久久久久久久浪潮网站| 99精品久久只有精品| 亚洲一区电影777| 日韩一区二区三区免费观看| 国产成人精品免费看| 亚洲男人的天堂在线观看| 精品视频999| 国产精品影视在线| 亚洲女人小视频在线观看| 欧美人狂配大交3d怪物一区| 国产在线麻豆精品观看| 国产精品久久久久久福利一牛影视|