Project JXTA

net.jxta.impl.protocol
Class DiscoveryQuery

java.lang.Object
  extended bynet.jxta.protocol.DiscoveryQueryMsg
      extended bynet.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)
          
protected  boolean handleElement(Element raw)
          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, setPeerAdv, 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

Method Detail

handleElement

protected boolean handleElement(Element raw)
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;
      }
  

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)


toString

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

return the string representaion of this doc


JXTA J2SE