JXTA

net.jxta.impl.protocol
Class DiscoveryQuery

java.lang.Object
  extended by net.jxta.protocol.DiscoveryQueryMsg
      extended by net.jxta.impl.protocol.DiscoveryQuery

public class DiscoveryQuery
extends DiscoveryQueryMsg

Implements the Discovery Query Message according to the schema defined by the standard JXTA Peer Discovery Protocol (PDP).

 <xs:element name="DiscoveryQuery" type="jxta:DiscoveryQuery"/>
 

<xsd:simpleType name="DiscoveryQueryType"> <xsd:restriction base="xsd:string"> <!-- peer --> <xsd:enumeration value="0"/> <!-- group --> <xsd:enumeration value="1"/> <!-- adv --> <xsd:enumeration value="2"/> </xsd:restriction> </xsd:simpleType>

<xs:complexType name="DiscoveryQuery"> <xs:sequence> <xs:element name="Type" type="jxta:DiscoveryQueryType"/> <xs:element name="Threshold" type="xs:unsignedInt" minOccurs="0"/> <xs:element name="Attr" type="xs:string" minOccurs="0"/> <xs:element name="Value" type="xs:string" minOccurs="0"/> <!-- The following should refer to a peer adv, but is instead a whole doc for historical reasons --> <xs:element name="PeerAdv" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType>

See Also:
DiscoveryService, DiscoveryServiceImpl, JXTA Protocols Specification : Peer Discovery Protocol

Constructor Summary
DiscoveryQuery()
          Default constructor
DiscoveryQuery(Element doc)
          Construct from a StructuredDocument
 
Method Summary
 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.
protected  boolean handleElement(XMLElement elem)
          Process an individual element from the document during parse.
protected  void initialize(Element root)
          Intialize a Discovery Query from a portion of a structured document.
 String toString()
          Deprecated. should not be used. use getDocument().toString() instead.
 
Methods inherited from class net.jxta.protocol.DiscoveryQueryMsg
getAdvertisementType, getAttr, getDiscoveryType, getPeerAdv, getPeerAdvertisement, getThreshold, getValue, setAttr, setDiscoveryType, setPeerAdvertisement, setThreshold, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscoveryQuery

public DiscoveryQuery()
Default constructor


DiscoveryQuery

public DiscoveryQuery(Element doc)
Construct from a StructuredDocument

Parameters:
doc - the element
Method Detail

handleElement

protected boolean handleElement(XMLElement elem)
Process an individual element from the document during parse. Normally, implementations will allow the base advertisments a chance to handle the element before attempting ot handle the element themselves. ie.


  protected boolean handleElement(Element elem) {
 

if (super.handleElement()) { // it's been handled. return true; }

... handle elements here ...

// we don't know how to handle the element return false; }

Parameters:
elem - the element to be processed.
Returns:
true if the element was recognized, otherwise false.

initialize

protected void initialize(Element root)
Intialize a Discovery Query from a portion of a structured document.

Parameters:
root - document to intialize from

getDocument

public 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/text" encodes the document in a form nice for printing out, and "text/xml" which provides an XML representation.

Specified by:
getDocument in class DiscoveryQueryMsg
Parameters:
asMimeType - mime-type format requested
Returns:
Document representation of the document as an advertisement

toString

@Deprecated
public String toString()
Deprecated. should not be used. use getDocument().toString() instead.

return the string representaion of this doc

Overrides:
toString in class Object

JXSE