|
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
rather than
through use of constructors. This is done because public the Advertisement
sub-classes are typically abstract. The actual implementations are provided
by private sub-classes.
AdvertisementFactory
,
ExtendableAdvertisement
,
ID
,
Document
,
MimeMediaType
Constructor Summary | |
---|---|
Advertisement()
|
Method Summary | |
---|---|
Advertisement |
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 this advertisement into a document of the requested type. |
abstract ID |
getID()
Returns an ID which identifies this Advertisement as uniquely as
possible. |
abstract String[] |
getIndexFields()
Returns the element names on which this advertisement should be indexed. |
String |
toString()
Return a string representation 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 Advertisement clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public String toString()
toString
in class Object
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
Advertisement.getAdvertisementType()
no matter what the real
type of the advertisement.
public String getAdvType()
getAdvertisementType()
this method will return the correct
runtime type of an Advertisement object.
This implementation is provided for existing advertisements which do not
provide their own implementation. In most cases you should provide your
own implementation for efficiency reasons.
public abstract Document getDocument(MimeMediaType asMimeType)
"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:
- The
Advertisement
represented as a Document
of
the requested MIME Media Type.
public abstract ID getID()
Advertisement
as uniquely as
possible. This ID is typically used as the primary key for indexing of
the Advertisement within databases.
Each advertisement sub-class must choose an appropriate implementation
which returns canonical and relatively unique ID values for it's
instances. Since this ID is commonly used for indexing, the IDs returned
must be as unique as possible to avoid collisions. The value for the ID
returned can either be:
IllegalStateException
should be
thrown.
ID.nullID
if this advertisement is of a type that is not
normally indexed.public abstract String[] getIndexFields()
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |