Project JXTA

net.jxta.document
Class Advertisement

java.lang.Object
  |
  +--net.jxta.document.Advertisement
Direct Known Subclasses:
EndpointAdvertisement, ModuleClassAdvertisement, ModuleImplAdvertisement, ModuleSpecAdvertisement, PeerAdvertisement, PeerGroupAdvertisement, PipeAdvertisement, RdvAdvertisement, TransportAdvertisement

public abstract class Advertisement
extends java.lang.Object

Advertisements are core JXTA objects that are used to advertise Peers, PeerGroups, Services, Pipes or other JXTA resources. Advertisements provide a platform independent representation of core platform objects that can be exchanged between different platform implementations (Java, C, etc.).

Each Advertisement holds a document that represents the advertisement. Advertisements are typically represented as a text document (XML). The getDocument(mimetype) method is used to generate representations of the advertisement. Different representations are available via mime type selection. Typical mime types are "text/xml" or "text/plain" that generate textual representations for the Advertisements.

Advertisements are created via AdvertisementFactory. This is done because public Advertisement sub-classes are normally abstract with private sub-classes unique to the implementation.

Since:
JXTA 1.0
Version:
$Revision: 1.20 $
See Also:
AdvertisementFactory, ID, Document, MimeMediaType, PeerGroup, PeerAdvertisement, PeerGroupAdvertisement, PipeAdvertisement

Constructor Summary
Advertisement()
           
 
Method Summary
 java.lang.Object clone()
          {@inheritDoc}
static java.lang.String getAdvertisementType()
          Returns the identifying type of this Advertisement.
abstract  Document getDocument(MimeMediaType asMimeType)
          Write advertisement into a document.
abstract  ID getID()
          Returns a unique ID for that advertisement.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Advertisement

public Advertisement()
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
{@inheritDoc}
Overrides:
clone in class java.lang.Object

getAdvertisementType

public static java.lang.String getAdvertisementType()
Returns the identifying type of this Advertisement.
Returns:
String the type of advertisement
Since:
JXTA 1.0

getDocument

public abstract Document getDocument(MimeMediaType asMimeType)
Write advertisement into a document. asMimeType is a mime media-type specification and provides the form of the document which is being requested. Two standard document forms are defined. "text/plain" encodes the document in "pretty-print" format for human viewing and "text/xml" which provides an XML format.
Parameters:
asMimeType - MimeMediaType format representation requested
Returns:
Document the document to be used in the construction
Since:
JXTA 1.0

getID

public abstract ID getID()
Returns a unique ID for that advertisement. The ID is supposed to be unique and is not guaranteed to be of any particular subclass of ID. Each class of advertisement is responsible for the choice of ID to return. That may be any ID already used in the advertisement for other purposes, as long as it defines the unicity of the advertisement to the satisfaction of the implementor. This ID is mainly used for indexing, therefore two advertisements that return the same ID will be considered identical and one them may be ignored by an indexing system.
Returns:
ID An ID that uniquely identifies the advertisement.
Since:
JXTA 1.0

Project JXTA