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

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

?? xmlrpcconfiguration.java

?? java 與 xml 技術的確融合
?? JAVA
字號:
/*--

 Copyright (C) 2000 Brett McLaughlin. All rights reserved.

 Redistribution and use in source and binary forms, with or without modifica-
 tion, 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, the disclaimer that follows these conditions,
    and/or other materials provided with the distribution.

 3. Products derived from this software may not be called "Java and XML", nor may
    "Java and XML" appear in their name, without prior written permission from
    Brett McLaughlin (brett@newInstance.com).

 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
 JDOM PROJECT  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 was originally created by Brett McLaughlin <brett@newInstance.com>.
 For more  information on "Java and XML", please see <http://www.oreilly.com/catalog/javaxml/>
 or <http://www.newInstance.com>.

 */
package com.oreilly.xml;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;

import org.jdom.DocType;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Namespace;
import org.jdom.input.Builder;
import org.jdom.input.DOMBuilder;
import org.jdom.output.XMLOutputter;

/**
 * <b><code>XmlRpcConfiguration</code></b> is a utility class
 *   that will load configuration information for XML-RPC servers
 *   and clients to use.
 *
 * @author Brett McLaughlin
 * @version 1.0
 */
public class XmlRpcConfiguration {

    /** The stream to read the XML configuration from */
    private InputStream in;

    /** Port number server runs on */
    private int portNumber;

    /** Hostname server runs on */
    private String hostname;

    /** SAX Driver Class to load */
    private String driverClass;

    /** Handlers to register in XML-RPC server */
    private Hashtable handlers;

    /** JDOM Document tied to underlying XML */
    private Document doc;

    /**
     * <p>
     * This will set a filename to read configuration
     *   information from.
     * </p>
     *
     * @param filename <code>String</code> name of
     *                 XML configuration file.
     */
    public XmlRpcConfiguration(String filename)
        throws IOException {

        this(new FileInputStream(filename));
    }

    /**
     * <p>
     * This will set a filename to read configuration
     *   information from.
     * </p>
     *
     * @param in <code>InputStream</code> to read
     *           configuration information from.
     */
    public XmlRpcConfiguration(InputStream in)
        throws IOException {

        this.in = in;
        portNumber = 0;
        hostname = "";
        handlers = new Hashtable();

        // Parse the XML configuration information
        parseConfiguration();
    }

    /**
     * <p>
     * This returns the port number the server listens on.
     * </p>
     *
     * @return <code>int</code> - number of server port.
     */
    public int getPortNumber() {
        return portNumber;
    }

    /**
     * <p>
     * This will set the port number to listen to.
     * </p>
     *
     * @param portNumber <code>int</code> port to listen to.
     */
    public void setPortNumber(int portNumber) {
        this.portNumber = portNumber;
    }

    /**
     * <p>
     * This returns the hostname the server listens on.
     * </p>
     *
     * @return <code>String</code> - hostname of server.
     */
    public String getHostname() {
        return hostname;
    }

    /**
     * <p>
     * This will set the hostname for the server to listen to.
     * </p>
     *
     * @param hostname <code>String</code> name of server's host.
     */
    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    /**
     * <p>
     * This returns the SAX driver class to load.
     * </p>
     *
     * @return <code>String</code> - name of SAX driver class.
     */
    public String getDriverClass() {
        return driverClass;
    }

    /**
     * <p>
     * This will set the driver class for parsing.
     * </p>
     *
     * @param driverClass <code>String</code> name of parser class.
     */
    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    /**
     * <p>
     * This returns the handlers the server should register.
     * </p>
     *
     * @return <code>Hashtable</code> of handlers.
     */
    public Hashtable getHandlers() {
        return handlers;
    }

    /**
     * <p>
     * This will set the handlers to register.
     * </p>
     *
     * @param handlers <code>Hashtable</code> of handler to register.
     */
    public void setHandlers(Hashtable handlers) {
        this.handlers = handlers;
    }

    /**
     * <p>
     * Parse the XML configuration information and
     *   make it available to clients.
     * </p>
     *
     * @throws <code>IOException</code> when errors occur.
     */
    private void parseConfiguration() throws IOException {

        try {
            // Request DOM Implementation and Xerces Parser
            Builder builder =
                new DOMBuilder("org.jdom.adapters.XercesDOMAdapter");

            // Get the Configuration Document, with validation
            doc = builder.build(in);

            // Get the root element
            Element root = doc.getRootElement();

            // Get the JavaXML namespace
            Namespace ns = Namespace.getNamespace("JavaXML",
                           "http://www.oreilly.com/catalog/javaxml/");

            // Load the hostname, port, and handler class
            hostname = root.getChild("hostname", ns).getContent();
            driverClass = root.getChild("parserClass", ns).getContent();
            portNumber =
                Integer.parseInt(root.getChild("port", ns).getContent());

            // Get the handlers
            List handlerElements =
                root.getChild("xmlrpc-server", ns)
                    .getChild("handlers", ns)
                    .getChildren("handler", ns);

            Iterator i = handlerElements.iterator();
            while (i.hasNext()) {
                Element current = (Element)i.next();
                handlers.put(current.getChild("identifier", ns).getContent(),
                             current.getChild("class", ns).getContent());
            }
        } catch (JDOMException e) {
            throw new IOException(e.getMessage());
        }
    }

    /**
     * <p>
     * This will save the current state out to the XML-RPC configuration
     *   file.
     * </p>
     *
     * @throws <code>IOException</code> - when errors occur in saving.
     */
    public synchronized void saveConfiguration(String filename)
        throws IOException {

        saveConfigurationFromScratch(new FileOutputStream(filename));
    }

    /**
     * <p>
     * This will save the current state out to the specified
     *   <code>OutputStream</code>.
     * </p>
     *
     * @throws <code>IOException</code> - when errors occur in saving.
     */
    public synchronized void saveConfiguration(OutputStream out)
        throws IOException {

        try {
            Element root = doc.getRootElement();

            // Get the JavaXML namespace
            Namespace ns = Namespace.getNamespace("JavaXML",
                           "http://www.oreilly.com/catalog/javaxml/");

            // Update the hostname
            root.getChild("hostname", ns)
                .setContent(hostname);

            // Update the SAX driver class
            root.getChild("parserClass", ns)
                .setContent(driverClass);

            // Update the port number
            root.getChild("port", ns)
                .setContent(portNumber + "");

            // Easier to remove and re-add handlers
            Element handlersElement =
                root.getChild("xmlrpc-server", ns)
                    .getChild("handlers", ns);
            handlersElement.removeChildren("handler", ns);

            // Add new handlers
            Enumeration handlerIDs = handlers.keys();
            while (handlerIDs.hasMoreElements()) {
                String handlerID =
                    (String)handlerIDs.nextElement();

                // Ensure we don't register any blank string
                if (handlerID.trim().equals("")) {
                    continue;
                }

                String handlerClass =
                    (String)handlers.get(handlerID);

                handlersElement.addChild(
                    new Element("handler", ns)
                        .addChild(
                            new Element("identifier", ns)
                                .setContent(handlerID))
                        .addChild(
                            new Element("class", ns)
                                .setContent(handlerClass))
                        );
            }

            // Output the document, use standard formatter
            XMLOutputter fmt = new XMLOutputter();
            fmt.output(doc, out);

        } catch (JDOMException e) {
            // Log an error
            throw new IOException(e.getMessage());
        }
    }

    /**
     * <p>
     * This will save the current state out to the specified
     *   <code>OutputStream</code>.
     * </p>
     *
     * @throws <code>IOException</code> - when errors occur in saving.
     */
    public synchronized void saveConfigurationFromScratch(OutputStream out)
        throws IOException {

        // Get the JavaXML namespace
        Namespace ns = Namespace.getNamespace("JavaXML",
                       "http://www.oreilly.com/catalog/javaxml/");

        // Create the root element
        Element root = new Element("xmlrpc-config", ns);
        Document doc = new Document(root);
        doc.setDocType(new DocType("JavaXML:xmlrpc-config",
                                   "DTD/XmlRpc.dtd"));

        root.addChild(new Element("hostname", ns)
                .setContent(hostname))
            .addChild(new Element("port", ns)
                .addAttribute("type", "unprotected")
                .setContent(portNumber + ""))
            .addChild(new Element("parserClass", ns)
                .setContent(driverClass));

        Element handlersElement = new Element("handlers", ns);
        Enumeration e = handlers.keys();
        while (e.hasMoreElements()) {
            String handlerID = (String)e.nextElement();
            String handlerClass = (String)handlers.get(handlerID);

            handlersElement.addChild(new Element("handler", ns)
                .addChild(new Element("identifier", ns)
                    .setContent(handlerID))
                .addChild(new Element("class", ns)
                    .setContent(handlerClass))
                );
        }

        root.addChild(new Element("xmlrpc-server", ns)
                .addChild(handlersElement));

        // Output the document, use standard formatter
        XMLOutputter fmt = new XMLOutputter();
        fmt.output(doc, out);
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜不卡av在线| 欧美极品另类videosde| 免费观看成人av| 欧美日韩一区二区不卡| 国产成人欧美日韩在线电影| 亚洲成人精品影院| 国产精品久久一卡二卡| 精品国产凹凸成av人导航| av一本久道久久综合久久鬼色| 亚欧色一区w666天堂| 一区二区三区在线观看动漫 | 亚洲一区二区视频在线观看| 精品精品欲导航| av影院午夜一区| 精品国产一区二区三区四区四| 国产91丝袜在线播放| 国产精品一区二区三区四区| 午夜久久久久久久久| 亚洲欧美一区二区不卡| 国产精品色在线| 欧美成人r级一区二区三区| 欧美日韩一区二区三区在线| 国产成a人亚洲| 国产91丝袜在线18| 狠狠色丁香久久婷婷综| 韩国中文字幕2020精品| 国产剧情一区在线| 不卡视频一二三| 欧美午夜电影在线播放| 4438成人网| 亚洲国产精品黑人久久久| 亚洲欧洲综合另类| 首页欧美精品中文字幕| 精品一区二区三区久久久| 国产91精品精华液一区二区三区 | 激情图区综合网| 成人午夜av在线| 欧美在线free| 久久精品视频网| 亚洲自拍偷拍麻豆| 国产一区二区在线视频| 色综合久久中文综合久久97| 日韩欧美中文字幕一区| 成人免费在线观看入口| 日本免费新一区视频| 99精品国产热久久91蜜凸| 欧美一区二区三区成人| 亚洲天堂2014| 国内精品国产成人| 5858s免费视频成人| 中文字幕日韩av资源站| 国内欧美视频一区二区 | 成人激情小说网站| 精品福利视频一区二区三区| 亚洲福利一区二区| 99riav久久精品riav| 久久影视一区二区| 韩国午夜理伦三级不卡影院| 欧美精品久久一区二区三区| 亚洲精品一卡二卡| 91在线国产观看| 亚洲午夜精品久久久久久久久| 国产精品福利电影一区二区三区四区 | www..com久久爱| 亚洲视频小说图片| 欧美一区日本一区韩国一区| 亚洲综合在线视频| 91电影在线观看| 日韩美女啊v在线免费观看| 成人性色生活片| 精品国产自在久精品国产| 免费在线观看一区二区三区| 91福利资源站| 香港成人在线视频| 欧美精品高清视频| 日本欧美韩国一区三区| 91精品国产91久久久久久最新毛片| 亚洲一区二区三区四区的| 色视频成人在线观看免| 亚洲欧美日韩系列| 在线精品观看国产| 亚洲不卡在线观看| 国产欧美中文在线| 欧美男生操女生| 国产福利电影一区二区三区| 亚洲一区二区精品3399| 精品国产一区二区在线观看| 91免费版在线| 久久福利资源站| 亚洲女同ⅹxx女同tv| 欧美电影精品一区二区| 91免费国产视频网站| 国内精品久久久久影院一蜜桃| 亚洲欧美日韩在线不卡| 精品捆绑美女sm三区| 色激情天天射综合网| 日韩av一级片| 亚洲免费av观看| 国产精品婷婷午夜在线观看| 欧美大片一区二区三区| 欧美一二三在线| 成人动漫视频在线| 综合激情网...| 亚洲青青青在线视频| 亚洲成人自拍网| 麻豆成人综合网| 国产.精品.日韩.另类.中文.在线.播放| 国产精品18久久久久久久久久久久| 天天免费综合色| 日韩av一区二| 狠狠狠色丁香婷婷综合激情| 麻豆中文一区二区| 丝袜国产日韩另类美女| 天堂精品中文字幕在线| 天堂一区二区在线| 日韩国产欧美在线播放| 午夜精品免费在线| 三级精品在线观看| 秋霞午夜av一区二区三区| 奇米影视在线99精品| 青青草国产精品亚洲专区无| 日韩av一级片| 激情成人午夜视频| 丁香激情综合五月| 欧美亚洲自拍偷拍| 日韩免费观看2025年上映的电影 | 一本大道久久a久久综合| 91色九色蝌蚪| 欧美精品三级日韩久久| 日韩精品一区二区三区老鸭窝 | 日韩午夜激情视频| 精品成人一区二区三区| 国产精品卡一卡二卡三| 亚洲精品ww久久久久久p站| 日韩国产精品久久| 国内精品自线一区二区三区视频| 国产精品一区一区三区| 99久久精品国产一区二区三区| 欧美手机在线视频| 欧美激情一区二区三区在线| 一区二区三区欧美日韩| 免费成人结看片| 播五月开心婷婷综合| 在线不卡一区二区| 亚洲天堂a在线| 成人一区在线观看| 69p69国产精品| 亚洲欧洲99久久| 国产一区二区久久| 久久久亚洲精华液精华液精华液 | 国产精品一区在线观看你懂的| 91精品久久久久久蜜臀| 亚洲成a人在线观看| 99视频精品在线| 久久久99精品免费观看| 偷拍与自拍一区| 国产一区不卡在线| 精品99999| 日韩高清不卡一区二区三区| 99久久国产综合色|国产精品| 91精品婷婷国产综合久久| 亚洲欧美激情插| 粗大黑人巨茎大战欧美成人| 欧美高清性hdvideosex| |精品福利一区二区三区| 99视频一区二区三区| 久久久亚洲精品一区二区三区| 视频一区欧美日韩| 欧美日本国产一区| 亚洲一区二区成人在线观看| 99在线精品视频| 国产精品嫩草久久久久| 成人精品视频一区二区三区尤物| 欧美成人一区二区三区片免费| 午夜av一区二区| 欧美哺乳videos| 老色鬼精品视频在线观看播放| 欧美日精品一区视频| 午夜av一区二区| 6080日韩午夜伦伦午夜伦| 免费高清在线一区| 欧美精品一区二区三区四区| 国内成人精品2018免费看| 日韩精品在线看片z| 成人激情黄色小说| 一区二区三区在线视频观看| 欧美性猛交xxxx黑人交| 日韩黄色小视频| 国产日本欧美一区二区| 国产成人欧美日韩在线电影| 亚洲黄色性网站| 欧美人狂配大交3d怪物一区| 奇米影视一区二区三区小说| 久久日一线二线三线suv| 91丨九色丨黑人外教| 美女www一区二区| 国产精品久久久久久亚洲伦| 欧美日韩高清不卡| 国产69精品久久久久毛片| 亚洲韩国一区二区三区|