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

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

?? advertisementfactory.java

?? jxta平臺的開發包
?? JAVA
字號:
/* * Copyright (c) 2001 Sun Microsystems, Inc.  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 acknowledgment: *       "This product includes software developed by the *       Sun Microsystems, Inc. for Project JXTA." *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. * * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact Project JXTA at http://www.jxta.org. * * 5. Products derived from this software may not be called "JXTA", *    nor may "JXTA" appear in their name, without prior written *    permission of Sun. * * 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 SUN MICROSYSTEMS 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 Project JXTA.  For more * information on Project JXTA, please see * <http://www.jxta.org/>. * * This license is based on the BSD license adopted by the Apache Foundation. * * $Id: AdvertisementFactory.java,v 1.35 2005/06/17 02:18:49 bondolo Exp $ */package net.jxta.document;import java.io.InputStream;import java.io.Reader;import java.util.HashMap;import java.util.Map;import java.io.IOException;import java.util.NoSuchElementException;import java.util.MissingResourceException;import org.apache.log4j.Logger;import org.apache.log4j.Level;import net.jxta.util.ClassFactory;/** * A Factory class for Advertisements. This class abstracts the * the implementations used to represent and create advertisements. * * <p/>Advertisements are core objects that are used to advertise a Peer, a * PeerGroup, a Service, or a PipeServiceImpl. The Advertisement class provides * a platform independent representation of core objects that can be exchanged * between different implementations (Java, C). * * <p/>The AdvertisementFactory extends the ClassFactory to register the various * types of adverstisements into a static hastable. The factory is called with * the Advertisement type requested to create the corresponding advertisement * type. * * <p/>The initial set of Advertisement instances is loaded from the java * property "net.jxta.impl.config.AdvertisementInstanceTypes" * * <p/>It would be nice to have "newAdvertisement" methods for "Document" and * "TextDocument", but this is not feasible because "TextElement" got there *  first. * * @see net.jxta.document.Advertisement * @see net.jxta.document.Document * @see net.jxta.document.MimeMediaType * @see net.jxta.peergroup.PeerGroup * @see net.jxta.protocol.PeerAdvertisement * @see net.jxta.protocol.PeerGroupAdvertisement * @see net.jxta.protocol.PipeAdvertisement **/public class AdvertisementFactory extends ClassFactory {    /**     *  Log4J categorgy     **/    private static final Logger LOG = Logger.getLogger( AdvertisementFactory.class.getName());        /**     *  Interface for instantiators of Advertisements     **/    public interface Instantiator {                /**         * Returns the identifying type of this Advertisement.         *         * @return String the type of advertisement         **/        String getAdvertisementType( );                /**         * Constructs an instance of {@link Advertisement} matching the type         * specified by the <CODE>advertisementType</CODE> parameter.         *         *         * @return The instance of {@link Advertisement}.         **/        Advertisement newInstance( );                /**         * Constructs an instance of {@link Advertisement} matching the type         * specified by the <CODE>advertisementType</CODE> parameter.         *         * @param root Specifies a portion of a @link StructuredDocument} which         * will be converted into an Advertisement.         * @return The instance of {@link Advertisement}.         **/        Advertisement newInstance( net.jxta.document.Element root );    }        /**     *  This class is a singleton. This is the instance that backs the     *  static methods.     **/    private final static AdvertisementFactory factory = new AdvertisementFactory();        /**     *  This is the map of mime-types and constructors used by     *  <CODE>newStructuredDocument</CODE>.     **/    private final Map  encodings = new HashMap();        /**     *  If true then the pre-defined set of StructuredDocument sub-classes has     *  been registered from the property containing them.     **/    private boolean loadedProperty = false;        /**     *  Private constructor. This class is not meant to be instantiated except     *  by itself.     *     **/    private AdvertisementFactory() {}        /**     *  Registers the pre-defined set of StructuredDocument sub-classes so that     *  this factory can construct them.     *     *     *  @return true if at least one of the StructuredDocument sub-classes could     *  be registered otherwise false.     **/    private boolean doLoadProperty() {        try {            return registerFromResources( "net.jxta.impl.config", "AdvertisementInstanceTypes" );        } catch ( MissingResourceException notFound ) {            if (LOG.isEnabledFor(Level.FATAL)) {                LOG.fatal( "Could not find net.jxta.impl.config properties file!" );            }            return false;        }    }        /**     *  {@inheritDoc}     **/    protected Map getAssocTable() {        return encodings;    }        /**     *  {@inheritDoc}     **/    public Class getClassOfInstantiators() {        // our key is the doctype names.        return Instantiator.class;    }        /**     *  {@inheritDoc}     **/    public Class getClassForKey() {        // our key is the doctype names.        return java.lang.String.class;    }        /**     *  {@inheritDoc}     **/    protected boolean registerAssoc( String className ) {        boolean registeredSomething = false;                try {            Class advClass = Class.forName( className + "$Instantiator" );                        Instantiator instantiator = (Instantiator) advClass.newInstance();                        String advType = instantiator.getAdvertisementType( );                        registeredSomething = registerAdvertisementInstance( advType, instantiator );        } catch( Exception all ) {            if (LOG.isEnabledFor(Level.DEBUG)) {                LOG.debug( "Failed to register '" + className + "'", all );            }        }                return registeredSomething;    }        /**     *  Register an instantiator for and advertisement type to allow instances     *  of that type to be created.     *     *  @param rootType  the identifying value for this advertisement instance     *   type     *  @param instantiator   the instantiator to use in constructing objects     *   of this rootType.     *  @return boolean  true if the rootType type is registered. If there is     *   already a constructor for this type then false will be returned.     **/    public static boolean registerAdvertisementInstance( String rootType, Instantiator instantiator ) {        boolean result = factory.registerAssoc( rootType, instantiator );                return result;    }        /**     * Constructs a new instance of {@link Advertisement} matching the type     * specified by the <CODE>advertisementType</CODE> parameter.     *     * @param advertisementType Specifies the type of advertisement to create.     * @return The instance of {@link Advertisement}.     * @throws NoSuchElementException if there is no matching advertisement type.     **/    public static Advertisement newAdvertisement( String advertisementType ) {        if( ! factory.loadedProperty ) {            factory.loadedProperty = factory.doLoadProperty();        }                Instantiator instantiator =        (Instantiator) factory.getInstantiator( advertisementType );                Advertisement a = instantiator.newInstance( );                return a;    }        /**     * Constructs an instance of {@link Advertisement} from the provided     * <code>InputStream</code>. The content type of the stream is declared via     * the <code>mimetype</code> parameter.     *     * @deprecated Please convert your code to construct an XML document using     * StructuredDocumentFactory before calling AdvertisementFactory.     *     * @param mimetype Specifies the mime media type of the stream being read.     * @param stream imput stream used to read data to construct the advertisement     * @return The instance of {@link Advertisement}     * @throws IOException error reading message from input stream     * @throws NoSuchElementException if there is no matching advertisement type     * for the type of document read in.     * @throws UnsupportedOperationException if the specified mime type is not     *  associated with a text oriented document type.     **/    public static Advertisement newAdvertisement( MimeMediaType mimetype, InputStream stream )    throws IOException {                StructuredTextDocument doc = (StructuredTextDocument)        StructuredDocumentFactory.newStructuredDocument( mimetype, stream );                return newAdvertisement( (TextElement) doc );    }        /**     * Reconstructs an instance of {@link Advertisement} from the provided     * <code>Reader</code>. The content type of the reader is declared via the     * <code>mimetype</code> parameter.     *     * @deprecated Please convert your code to construct an XML document using     * StructuredDocumentFactory before calling AdvertisementFactory.     *     * @param mimetype Specifies the mime media type of the stream being read.     * @param source used to read data to construct the advertisement.     * @return The instance of {@link Advertisement}     * @throws IOException error reading message from input stream     * @throws NoSuchElementException if there is no matching advertisement type     * for the type of document read in.     * @throws UnsupportedOperationException if the specified mime type is not     *  associated with a text oriented document type.     **/    public static Advertisement newAdvertisement( MimeMediaType mimetype, Reader source )    throws IOException {        StructuredTextDocument doc = (StructuredTextDocument)        StructuredDocumentFactory.newStructuredDocument( mimetype, source );                return newAdvertisement( (TextElement) doc );    }        /**     * Reconstructs an instance of {@link Advertisement} matching the type     * specified by the <CODE>root</CODE> parameter.     *     * @deprecated Advertisements must be encoded in XML. This is a legacy     * static constructor. You should convert your code to use the      * {@link net.jxta.document.XMLElement} version.     *     * @param root Specifies a portion of a StructuredDocument which will be     * converted into an Advertisement.     * @return The instance of {@link Advertisement}.     * @throws NoSuchElementException if there is no advertisement type     * matching the type of the root node.     **/    public static Advertisement newAdvertisement( TextElement root ) {        if( !(root instanceof XMLElement)) {            throw new IllegalArgumentException( "Advertisements must be XML" );        }                return newAdvertisement( (XMLElement) root );    }    /**     * Reconstructs an instance of {@link Advertisement} matching the type     * specified by the <CODE>root</CODE> parameter.     *     * @param root Specifies a portion of a StructuredDocument which will be     * converted into an Advertisement.     * @return The instance of {@link Advertisement}.     * @throws NoSuchElementException if there is no advertisement type     * matching the type of the root node.     **/    public static Advertisement newAdvertisement( XMLElement root ) {        if( ! factory.loadedProperty ) {            factory.loadedProperty = factory.doLoadProperty();        }                Instantiator instantiator = null;                // The base type of the advertisement may be overridden by a type        // declaration. If this is the case, then we try to use that as the        // key rather than the root name.        if( root instanceof Attributable ) {            Attribute type = ((Attributable)root).getAttribute( "type" );                        if( null != type ) {                try {                    instantiator = (Instantiator) factory.getInstantiator( type.getValue() );                } catch( NoSuchElementException notThere ) {                    // do nothing, its not fatal                    ;                }            }        }                // Don't have an instantiator for the type attribute, try the root name        if( null == instantiator ) {            instantiator = (Instantiator) factory.getInstantiator( root.getName() );        }                Advertisement a = instantiator.newInstance( root );                return a;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区在线看| 日韩一区二区三区四区 | 欧美日韩高清一区二区三区| 国产亚洲成年网址在线观看| 国产精品久久久久久久久免费桃花 | 亚洲国产综合91精品麻豆| 99久久国产综合精品色伊| 国产拍欧美日韩视频二区| 国内精品自线一区二区三区视频| 欧美色图免费看| 日精品一区二区| 日韩亚洲欧美在线观看| 免费在线观看一区| 欧美va在线播放| 麻豆精品精品国产自在97香蕉| 555www色欧美视频| 久久er精品视频| 国产情人综合久久777777| 国产·精品毛片| 亚洲婷婷在线视频| 色婷婷综合中文久久一本| 一区二区三区免费观看| 欧美日韩成人综合| 免费观看一级欧美片| 欧美va在线播放| 成人高清视频在线观看| 国产欧美精品一区aⅴ影院| 99精品视频在线播放观看| 亚洲人吸女人奶水| 欧美日本韩国一区二区三区视频| 免费人成精品欧美精品| 日韩欧美国产一区二区三区| 国产精品资源站在线| 亚洲欧美影音先锋| 欧美日韩一区二区在线视频| 免费看日韩a级影片| 久久精品一区二区三区不卡| 99综合电影在线视频| 天天色综合成人网| 久久先锋影音av鲁色资源网| 91丨porny丨国产入口| 亚洲gay无套男同| 久久久久国产精品麻豆| 91黄色激情网站| 国产一区二区三区| 亚洲激情av在线| 日韩精品一区二区三区视频播放| 成人小视频在线| 午夜国产精品一区| 国产欧美视频在线观看| 欧美中文一区二区三区| 免费国产亚洲视频| 亚洲视频综合在线| 精品久久久网站| 在线观看免费成人| 蜜臀av在线播放一区二区三区| 国产女同互慰高潮91漫画| 欧美日韩免费高清一区色橹橹| 国产精品18久久久久久久久 | 亚洲成人免费视频| 国产色综合久久| 一本一道综合狠狠老| 国产一区二区电影| 日韩av一级电影| 亚洲精品乱码久久久久久久久 | 亚洲一区欧美一区| 中文在线一区二区 | 一个色妞综合视频在线观看| 久久理论电影网| 91麻豆精品国产91久久久资源速度| 成人av电影在线观看| 久草热8精品视频在线观看| 亚洲精品菠萝久久久久久久| 国产目拍亚洲精品99久久精品| 日韩一区二区三区四区| 91国偷自产一区二区三区观看 | 精品国产一区久久| 4438成人网| 成人性生交大片免费看中文网站| 亚洲最新在线观看| 亚洲欧美成aⅴ人在线观看 | 国产精品麻豆一区二区| 26uuu成人网一区二区三区| 欧美精品在线观看播放| 国产乱人伦偷精品视频不卡| 蜜桃在线一区二区三区| 日韩精品一区第一页| 午夜免费欧美电影| 亚洲视频综合在线| 国产亚洲成av人在线观看导航| 欧美成人精品高清在线播放| 7777女厕盗摄久久久| 欧美吞精做爰啪啪高潮| eeuss鲁片一区二区三区在线观看| 国产资源精品在线观看| 日本va欧美va精品发布| 亚洲综合免费观看高清完整版在线 | 欧美日韩不卡在线| 69堂成人精品免费视频| 欧美电影一区二区| 欧美精品在线一区二区三区| 欧美男人的天堂一二区| 在线不卡中文字幕| 日韩一区二区在线观看视频| 欧美大片免费久久精品三p | 在线观看视频一区| 欧美日韩三级一区二区| 在线视频国内自拍亚洲视频| 欧美日韩免费电影| 日韩亚洲欧美成人一区| 精品粉嫩超白一线天av| 国产欧美精品一区aⅴ影院| 国产精品丝袜久久久久久app| 国产精品私人自拍| 亚洲欧美日韩系列| 自拍偷拍亚洲激情| 青青草视频一区| 国产黄色91视频| 91激情在线视频| 日韩午夜av一区| 国产日产欧美一区二区视频| 国产精品国产自产拍在线| 一区二区三区中文字幕在线观看| 亚洲无线码一区二区三区| 玖玖九九国产精品| 成人av综合在线| 欧美在线小视频| 欧美精品一区男女天堂| 中文字幕亚洲区| 日韩和欧美一区二区三区| 狠狠色丁香久久婷婷综合丁香| 成人性生交大片免费看视频在线| 在线一区二区三区| 日韩午夜激情av| 亚洲丝袜制服诱惑| 免费成人结看片| 成人av电影在线网| 久久综合色之久久综合| 一区二区三区在线观看视频 | 日韩精品一区二区三区swag| 精品国产自在久精品国产| 国产性天天综合网| 亚洲午夜免费视频| 国产精品一二一区| 欧美美女视频在线观看| 国产精品毛片无遮挡高清| 亚洲免费av高清| 成人av网址在线观看| 欧美一级免费大片| 国产精品理伦片| 天天av天天翘天天综合网| 成人av中文字幕| 欧美变态凌虐bdsm| 亚洲综合久久久| 国产凹凸在线观看一区二区| 正在播放一区二区| 国产欧美精品一区二区色综合| 美国毛片一区二区三区| 欧美性受xxxx| 成人免费视频在线观看| 国产在线国偷精品免费看| 欧美精品一二三区| 伊人开心综合网| 99久久99久久精品免费观看| 久久综合资源网| 视频一区二区三区在线| 91极品视觉盛宴| 日韩理论电影院| 成人黄色网址在线观看| 久久夜色精品一区| 亚洲成av人片在www色猫咪| 精品1区2区3区| 悠悠色在线精品| av亚洲精华国产精华精华| 久久久青草青青国产亚洲免观| 日日欢夜夜爽一区| 欧美日韩一区久久| 亚洲狠狠爱一区二区三区| av不卡在线播放| 日韩久久一区二区| 国产福利不卡视频| 国产精品女主播av| 成人午夜电影小说| 国产欧美日韩在线看| 国产成人一区在线| 精品国产99国产精品| 国产成人av电影免费在线观看| 久久久一区二区三区| 国产a精品视频| 中文字幕av一区二区三区高| 狠狠色丁香久久婷婷综合丁香| 久久蜜桃av一区二区天堂| 国产伦精品一区二区三区免费| 欧美成人性战久久| 国产一区三区三区| 国产亚洲精品中文字幕| 国产在线播放一区三区四| 久久久亚洲欧洲日产国码αv| 国产精品乡下勾搭老头1| 国产精品色在线观看|