⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 moduleimpladvertisement.java

📁 jxme的一些相关程序,主要是手机上程序开发以及手机和计算机通信的一些程序资料,程序编译需要Ant支持
💻 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: ModuleImplAdvertisement.java,v 1.2 2002/03/04 20:19:21 echtcherbina Exp $
 */

package net.jxta.protocol;

import net.jxta.id.ID;
import net.jxta.platform.ModuleSpecID;
import net.jxta.document.Advertisement;
import net.jxta.document.StructuredDocument;
import net.jxta.document.StructuredDocumentUtils;
import net.jxta.document.Element;

/**
 * A ModuleImplAdvertisement represents one of any number of
 * published implementation of a given specification.
 *
 * It is meant to be published via JXTA discovery.
 *
 * Module specifications are referenced by their ModuleSpecID. Given a
 * ModuleSpecID, a ModuleImplAdvertisement may be searched by means of JXTA
 * Discovery, filtered according to the compatibility statement it contains,
 * and if compatible, loaded and initialized.
 * The loadModule method of a PeerGroup implementation performs this
 * task automaticaly, given a ModuleSpecID.
 *
 * One significant example of Modules referenced and loaded in that manner
 * are the services and protocols that constitute a StdPeerGroup in the java
 * reference implementation.
 *
 * @see net.jxta.id.ID
 * @see net.jxta.platform.ModuleSpecID
 * @see net.jxta.document.Advertisement
 * @see net.jxta.document.StructuredDocument
 * @see net.jxta.document.Element
 * @see net.jxta.protocol.ModuleSpecAdvertisement
 * @see net.jxta.peergroup.PeerGroup
 */

public abstract class ModuleImplAdvertisement extends Advertisement
    implements Cloneable {

    private ModuleSpecID sid = null;

    // The group's implementation interprets it.
    private StructuredDocument compat = null;
    private String code = null;
    private String uri = null;
    private String provider = null;
    private String description = null;

    // The module interprets it.
    private StructuredDocument param = null;

    /**
     * returns the advertisement type
     * @return string type
     *
     * @version $Revision: 1.2 $
     * @since JXTA 1.0
     */

    public static String getAdvertisementType() {
        return "jxta:MIA" ;
    }

    /**
     * Clone this ModuleImplAdvertisement
     *
     * @return Object an object of class ModuleImplAdvertisement that is a
     * deep-enough copy of this one.
     * @version $Revision: 1.2 $
     * @since JXTA 1.0
     */
    public Object clone() {

        // All members are either immutable or never modified nor allowed to
        // be modified: all accessors return clones or immutable objects.
        // IDs are know to be immutable but that could change. Accessors
        // clone() them for safety; their clone method costs nothing.
        try {
            return super.clone();
        } catch (CloneNotSupportedException impossible) {
            return null;
        }
    }

    /**
     * Returns the unique ID of that advertisement for indexation purposes.
     * In that case we do not have any particular one to offer. Let the indexer
     * hash the document.
     *
     * @return ID the unique id
     *
     * @version $Revision: 1.2 $
     * @since JXTA 1.0
     */
    
    public ID getID() {
        return null;
    }
    
    /**
     * Returns the id of the spec that this implements.
     * @return ID the spec id
     *
     * @version $Revision: 1.2 $
     * @since JXTA 1.0
     */
    
    public ModuleSpecID getModuleSpecID() {
        return (sid == null ? null : (ModuleSpecID) sid.clone());
    }
    
    /**
     * Sets the id of the spec that is implemented
     * @param sid The id of the spec
     *
     * @version $Revision: 1.2 $
     * @since JXTA 1.0
     */
    
    public void setModuleSpecID(ModuleSpecID sid) {
        this.sid = (sid == null ? null : (ModuleSpecID) sid.clone());
    }
    
    /** 
     * returns the module impl. compatibility statement.
     *
     * @return StructuredDocument the statement as a StructuredDocument
     * of unspecified content.
     * 
     * @since JXTA 1.0     
     * 
     */
    
    public StructuredDocument getCompat() {
        return (compat == null ? null : StructuredDocumentUtils.copyAsDocument(compat));
    }
    
    /** 
     * sets the module impl. compatibility statement.
     *
     * @param compat Element of an unspecified content.
     * 
     * @since JXTA 1.0     
     */
    
    public void setCompat(Element compat) {
        this.compat = (compat == null ? null : StructuredDocumentUtils.copyAsDocument(compat));
    }
    
    /** 
     * returns the code; a reference to or representation of the executable code
     * advertised by this advertisement.
     * What the code realy is depends on the compatibility statement. Any compatible
     * user of this impl. adv. knows what it means. The standard group implementations
     * of the java reference implementation expect it to be a fully qualified java class
     * name.
     * @return String the code
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public String getCode() {
        return code;
    }
    
    /** 
     * sets the code
     * @param code reference to the code
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public void setCode(String code) {
        this.code = code;
    }
    
    /** 
     * returns the uri; that is a reference to or representation of a package from which
     * the executable code referenced by the getCode method may be loaded.
     * What the uri realy is depends on the compatibility statement. Any compatible
     * user of this impl. adv. knows what it means. The standard group implementations
     * of the java reference implementation expect it to be a reference to a jar file.
     * @return String uri
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public String getUri() {
        return uri;
    }
    
    /** 
     * sets the uri
     * @param uri string uri
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public void setUri(String uri) {
        this.uri = uri;
    }
    
    /** 
     * returns the provider
     * @return String the provider
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public String getProvider() {
        return provider;
    }
    
    /** 
     * sets the provider
     * @param provider the provider
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public void setProvider(String provider) {
        this.provider = provider;
    }
    
    /** 
     * returns the description
     * @return String the description
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public String getDescription() {
        return description;
    }
    
    /** 
     * sets the description
     * @param description the description
     * 
     * @version $Revision: 1.2 $
     * @since JXTA 1.0     
     */
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    /** 
     * returns the param element.
     *
     * The interpretation of the param element is entirely up to the code
     * that this advertises. One valid use of it is to enable the code to
     * be configured so that multiple specs or multiple implementations of
     * one spec may use the same code.
     * @return StructuredDocument A standalone structured document of
     * unspecified content.
     * 
     * @since JXTA 1.0     
     * 
     */
    
    public StructuredDocument getParam() {
        return (param == null ? null : StructuredDocumentUtils.copyAsDocument(param));
    }
    
    /** 
     * sets the module param
     * @param param Element of an unspecified content.
     * 
     * @since JXTA 1.0     
     */
    
    public void setParam(Element param) {
        this.param = (param == null ? null : StructuredDocumentUtils.copyAsDocument(param));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -