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

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

?? 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一区二区三区免费野_久草精品视频
97久久人人超碰| 日韩国产精品久久久久久亚洲| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美日韩在线播放一区| 91免费小视频| 精品国产乱码久久久久久牛牛| 久久一夜天堂av一区二区三区| 国产欧美一区二区三区在线老狼| 日韩精品一卡二卡三卡四卡无卡| 欧美三级在线播放| 91国偷自产一区二区三区成为亚洲经典| av在线播放成人| 美国十次了思思久久精品导航| 激情六月婷婷综合| 成人精品一区二区三区四区 | 精品国产乱码久久| 91视频91自| 国产激情视频一区二区三区欧美 | 琪琪久久久久日韩精品| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 久久精品亚洲精品国产欧美| 91精选在线观看| 日韩亚洲欧美高清| 337p日本欧洲亚洲大胆色噜噜| 欧美一区2区视频在线观看| 日韩欧美亚洲国产另类| 久久久久久久综合狠狠综合| 国产日产欧美一区| 一区二区三区色| 日韩不卡免费视频| 国产黄色成人av| 欧美丝袜第三区| 欧美tickling挠脚心丨vk| 国产情人综合久久777777| 亚洲三级电影网站| 国产一区在线不卡| 欧美日韩国产影片| 久久精品无码一区二区三区| 中文子幕无线码一区tr| 爽好多水快深点欧美视频| 成人美女视频在线观看| 欧美日韩你懂的| 国产精品久久国产精麻豆99网站| 亚洲免费电影在线| 国产成人aaa| 欧洲亚洲精品在线| 国产亚洲一区二区三区四区| 五月婷婷综合网| 美女一区二区三区在线观看| 国产一区欧美二区| 欧美一区二区三区免费视频| 欧美国产成人精品| 免费观看日韩电影| 成人激情校园春色| 日韩免费电影网站| 美女国产一区二区| 日本高清不卡一区| 亚洲美女在线一区| 欧美在线三级电影| 日本欧美大码aⅴ在线播放| 丰满放荡岳乱妇91ww| 精品国产乱码久久久久久夜甘婷婷| 亚洲成av人**亚洲成av**| 欧美在线999| 丝袜美腿高跟呻吟高潮一区| 欧美在线免费观看视频| 中文字幕制服丝袜一区二区三区| 成人av片在线观看| 亚洲欧美综合另类在线卡通| 色综合中文综合网| 欧美日韩国产综合视频在线观看 | 热久久免费视频| 欧美久久久影院| 久久成人av少妇免费| 久久午夜电影网| 91丨九色丨尤物| 婷婷国产在线综合| 国产亚洲一区二区三区在线观看| 成人在线一区二区三区| 综合中文字幕亚洲| 日韩午夜激情视频| 国产成人av电影在线| 中文字幕av资源一区| 欧美精品一二三| 99国产精品久久久久久久久久久| 自拍偷拍欧美精品| 综合分类小说区另类春色亚洲小说欧美| 在线观看亚洲精品视频| 极品少妇xxxx偷拍精品少妇| 丝袜诱惑制服诱惑色一区在线观看| 国产精品午夜在线| 亚洲女同女同女同女同女同69| 中文字幕欧美一区| 亚洲一区二区免费视频| 日韩国产欧美在线视频| 日韩电影在线观看一区| 久久不见久久见免费视频1| 韩国视频一区二区| 色综合久久99| 91精品中文字幕一区二区三区| 欧美精品一区二区三| 7777精品伊人久久久大香线蕉超级流畅 | 日韩精品中文字幕在线一区| 91亚洲永久精品| 色哟哟在线观看一区二区三区| 欧美精品18+| 国产欧美日韩麻豆91| 亚洲一区二区三区视频在线播放| 成人激情黄色小说| 欧美国产丝袜视频| 91网站在线播放| 亚洲在线免费播放| 91精品免费在线观看| 国产一区二区在线观看视频| 国产日韩成人精品| 国内精品久久久久影院薰衣草 | 久久精品一区蜜桃臀影院| 欧美日本不卡视频| 久久精品网站免费观看| 亚洲国产精品麻豆| 91丝袜高跟美女视频| 国产精品美日韩| 欧美电影在线免费观看| 在线成人午夜影院| 中文av一区二区| 亚洲成人av中文| 国产成人综合视频| 欧美探花视频资源| 国产欧美视频在线观看| 亚洲成人动漫在线免费观看| 黑人巨大精品欧美黑白配亚洲| 日本精品视频一区二区三区| 精品欧美一区二区久久| 一区二区高清免费观看影视大全| 狠狠色狠狠色综合日日91app| 91视频xxxx| 久久蜜臀中文字幕| 亚洲欧洲综合另类| 免费三级欧美电影| 99视频精品在线| 911国产精品| 久久综合精品国产一区二区三区 | 亚洲国产精品久久人人爱| 日韩av一级片| 国产精品一区二区x88av| 欧美日韩国产综合一区二区三区| www一区二区| 亚洲已满18点击进入久久| 三级欧美在线一区| 在线观看亚洲a| 久久久天堂av| 日韩福利视频导航| 99久久综合色| 中文字幕av一区二区三区| 视频一区在线视频| 99久久久久免费精品国产| 日韩视频不卡中文| 日韩精品免费专区| 99久久夜色精品国产网站| 日韩欧美成人一区| 亚洲综合色在线| 91国产精品成人| 久久嫩草精品久久久精品一| 亚洲国产精品自拍| 91免费观看视频在线| 日韩欧美在线网站| 亚洲国产视频直播| 色狠狠av一区二区三区| 欧美激情一区二区三区四区| 亚洲男人电影天堂| 在线观看一区二区精品视频| 国产精品卡一卡二| 高清视频一区二区| 欧洲人成人精品| 亚洲高清免费视频| 91香蕉视频mp4| 国产精品视频一二| 精品一区二区三区蜜桃| 2014亚洲片线观看视频免费| 午夜精品一区二区三区三上悠亚| 色婷婷综合久久久| 国产精品全国免费观看高清| 不卡一区二区在线| 国产精品免费观看视频| 国产精品一级在线| 国产视频一区在线观看| 国产最新精品免费| 久久综合久久99| 国产suv一区二区三区88区| 久久久久久日产精品| 韩国精品久久久| 久久久电影一区二区三区| 极品少妇一区二区| 久久精品亚洲乱码伦伦中文| 国产a久久麻豆| 亚洲精品欧美二区三区中文字幕| 99久久久无码国产精品| 亚洲精品免费在线| 99精品视频在线观看| 亚洲午夜久久久久久久久久久 |