Advertisements
Let’s look now at some JXTA advertisements. Advertisements are central to JXTA; you discover JXTA peers and their resources by looking for advertisements, and you provide your own services by publishing advertisements. Therefore, working with advertisements and the documents they contain is the next step we must take in learning how to develop JXTA applications.
Advertisements are represented by the
abstract Advertisement class
(net.jxta.document.Advertisement). Each
advertisement has a unique type, which is returned by the
getAdvertisementType( ) method. The JXTA API
defines the following core advertisement types (each of which is an
abstract class in the net.jxta.protocol package):
PeerAdvertisementPeerGroupAdvertisementPipeAdvertisementPeerInfoAdvertisementEndpointAdvertisementModuleClassAdvertisement,ModuleSpecAdvertisement, andModuleImplAdver-tisement(module-related advertisements)RdvAdvertisementTransportAdvertisement
Each
advertisement object holds an object that implements the
Document interface
(net.jxta.document.Document) and represents the
advertisement. An advertisement is typically represented as an XML
document, and the JXTA protocol specification relies heavily on XML
advertisements. The getDocument( ) method of the
Advertisement class returns a representation of
the advertisement in different formats based on its
MimeMediaType argument. Typical MIME types are “text/xml” or “text/plain” (which, in fact, are the only ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access