net.jxta.impl.protocol
Class PresenceAdv

java.lang.Object
  |
  +--net.jxta.document.Advertisement
        |
        +--net.jxta.protocol.PresenceAdvertisement
              |
              +--net.jxta.impl.protocol.PresenceAdv

public class PresenceAdv
extends PresenceAdvertisement

An implementation of the PresenceAdvertisement abstract class. This class is responsible for parsing and formatting the XML document used to define presence information for a peer.


Nested Class Summary
static class PresenceAdv.Instantiator
          An Instantiator used by the AdvertisementFactory to instantiate this class in an abstract fashion.
 
Field Summary
 
Fields inherited from class net.jxta.document.Advertisement
expiration
 
Constructor Summary
PresenceAdv()
          Creates a new presence advertisement.
PresenceAdv(net.jxta.document.Element document)
          Creates a new presence advertisement by parsing the given document.
PresenceAdv(java.io.InputStream stream)
          Creates a new presence advertisement by parsing the given stream.
 
Method Summary
 net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
          Returns a Document object containing the advertisement's document tree.
 void readAdvertisement(net.jxta.document.TextElement document)
          Parses the given document tree for the presence advertisement.
 java.lang.String toString()
          Returns an XML String representation of the advertisement.
 
Methods inherited from class net.jxta.protocol.PresenceAdvertisement
getAdvertisementType, getEmailAddress, getID, getName, getPeerID, getPresenceStatus, setEmailAddress, setName, setPeerID, setPresenceStatus
 
Methods inherited from class net.jxta.document.Advertisement
clone, getLocalExpirationTime
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PresenceAdv

public PresenceAdv()
Creates a new presence advertisement.


PresenceAdv

public PresenceAdv(java.io.InputStream stream)
            throws java.io.IOException
Creates a new presence advertisement by parsing the given stream.

Parameters:
stream - the InputStream source of the advertisement data.
Throws:
java.io.IOException - if the advertisement can't be parsed from the stream.

PresenceAdv

public PresenceAdv(net.jxta.document.Element document)
            throws java.lang.IllegalArgumentException
Creates a new presence advertisement by parsing the given document.

Parameters:
document - the source of the advertisement data.
Method Detail

getDocument

public net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
                                       throws java.lang.IllegalArgumentException
Returns a Document object containing the advertisement's document tree.

Specified by:
getDocument in class net.jxta.document.Advertisement
Parameters:
asMimeType - the desired MIME type for the advertisement rendering.
Returns:
the Document containing the advertisement's document object tree.
Throws:
java.lang.IllegalArgumentException - thrown if either the email address or the peer ID is null.

readAdvertisement

public void readAdvertisement(net.jxta.document.TextElement document)
                       throws java.lang.IllegalArgumentException
Parses the given document tree for the presence advertisement.

Parameters:
document - the object containing the presence advertisement data.
Throws:
java.lang.IllegalArgumentException - if the document is not a presence advertisement, as expected.

toString

public java.lang.String toString()
Returns an XML String representation of the advertisement.

Overrides:
toString in class java.lang.Object
Returns:
the XML String representing this advertisement.