|
Project JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.document.Advertisement
public abstract class Advertisement
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.
AdvertisementFactory
,
ID
,
Document
,
MimeMediaType
Constructor Summary | |
---|---|
Advertisement()
|
Method Summary | |
---|---|
Object |
clone()
|
static String |
getAdvertisementType()
Returns the identifying type of this Advertisement. |
String |
getAdvType()
Returns the identifying type of this Advertisement. |
abstract Document |
getDocument(MimeMediaType asMimeType)
Write advertisement into a document. |
abstract ID |
getID()
Returns a unique ID suitable for indexing of this Advertisement. |
abstract String[] |
getIndexFields()
returns an array of String fields to index the advertisement on. |
String |
toString()
Return a string representaion of this advertisement. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Advertisement()
Method Detail |
---|
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public static String getAdvertisementType()
Advertisement adv = module.getSomeAdv();
String advType = adv.getAdvertisementType();
This is wrong and does not work the way you might expect.
This call is not polymorphic and calls
Advertiement.getAdvertisementType() no matter what the real type of the
advertisment.
public String getAdvType()
getAdvertisementType()
this method will return the correct
runtime type of an Advertisement object.
This implementation is provided so as to NOT break the code of
existing advertisements. In most cases you should provide your own
implementation for efficeiny reasons.
public abstract Document getDocument(MimeMediaType asMimeType)
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 a "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
public abstract ID getID()
java.lang.IllegalStateException
should be
thrown.
public abstract String[] getIndexFields()
public String toString()
toString
in class Object
|
JXTA J2SE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |