JXTA

net.jxta.protocol
Class DiscoveryResponseMsg

java.lang.Object
  extended by net.jxta.protocol.DiscoveryResponseMsg

public abstract class DiscoveryResponseMsg
extends Object

This class defines the DiscoveryService message "Response".

The default behavior of this abstract class is simply a place holder for the generic resolver query fields. This message is the response to the DiscoveryQueryMsg.

See Also:
DiscoveryService, DiscoveryQueryMsg

Field Summary
protected  List<Advertisement> advertisements
          The advertisement responses deserialized.
protected  String attr
          attribute used by the query
protected  List<Long> expirations
          Expirations
protected  PeerAdvertisement peerAdvertisement
          Responding peer's advertisement
protected  List<String> responses
          The advertisement responses serialized into strings.
protected  int type
          Advertisement type used by the query

FIXME 20040514 bondolo@jxta.org not a great default...

protected  String value
          Value used by the query
 
Constructor Summary
DiscoveryResponseMsg()
           
 
Method Summary
 Enumeration<Advertisement> getAdvertisements()
          Get the responses to the query as advertisements.
static String getAdvertisementType()
          All messages have a type(in xml this is !
 int getDiscoveryType()
          Get the response type
abstract  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.
 Enumeration<Long> getExpirations()
          Gets the expirations attribute of the DiscoveryResponseMsg object
 PeerAdvertisement getPeerAdvertisement()
          returns the responding peer's advertisement
 String getQueryAttr()
          returns the attributes used by the query
 String getQueryValue()
          returns the value used by the query
 int getResponseCount()
          Get the response count
 Enumeration<String> getResponses()
          returns the response(s)
 void setDiscoveryType(int type)
          set the Response type whether it's peer, or group discovery
 void setExpirations(List<Long> expirations)
          set the expirations for this query
 void setPeerAdvertisement(PeerAdvertisement newAdv)
          Sets the responding peer's advertisement
 void setQueryAttr(String attr)
          Set the attribute used by the query
 void setQueryValue(String value)
          Set the value used by the query
 void setResponses(List responses)
          Set the responses to the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attr

protected String attr
attribute used by the query


peerAdvertisement

protected PeerAdvertisement peerAdvertisement
Responding peer's advertisement


responses

protected final List<String> responses
The advertisement responses serialized into strings.


advertisements

protected final List<Advertisement> advertisements
The advertisement responses deserialized.


expirations

protected final List<Long> expirations
Expirations


type

protected int type
Advertisement type used by the query

FIXME 20040514 bondolo@jxta.org not a great default...


value

protected String value
Value used by the query

Constructor Detail

DiscoveryResponseMsg

public DiscoveryResponseMsg()
Method Detail

getAdvertisementType

public static String getAdvertisementType()
All messages have a type(in xml this is !doctype) which identifies the message

Returns:
String "jxta:ResolverResponse"

getDiscoveryType

public int getDiscoveryType()
Get the response type

Returns:
int type of discovery message PEER, GROUP or ADV discovery type response

setDiscoveryType

public void setDiscoveryType(int type)
set the Response type whether it's peer, or group discovery

Parameters:
type - int representing the type

getDocument

public abstract 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 format.

Parameters:
asMimeType - mime-type requested
Returns:
Document document that represents the advertisement

getPeerAdvertisement

public PeerAdvertisement getPeerAdvertisement()
returns the responding peer's advertisement

Returns:
the Peer's advertisement

setPeerAdvertisement

public void setPeerAdvertisement(PeerAdvertisement newAdv)
Sets the responding peer's advertisement

Parameters:
newAdv - the responding Peer's advertisement

getQueryAttr

public String getQueryAttr()
returns the attributes used by the query

Returns:
String attribute of the query

getQueryValue

public String getQueryValue()
returns the value used by the query

Returns:
String value used by the query

getResponseCount

public int getResponseCount()
Get the response count

Returns:
int count

getExpirations

public Enumeration<Long> getExpirations()
Gets the expirations attribute of the DiscoveryResponseMsg object

Returns:
The expirations value

setExpirations

public void setExpirations(List<Long> expirations)
set the expirations for this query

Parameters:
expirations - the expirations for this query

getResponses

public Enumeration<String> getResponses()
returns the response(s)

Returns:
Enumeration of String responses

setResponses

public void setResponses(List responses)
Set the responses to the query. The responses may be either Advertisement, String or InputStream.

Parameters:
responses - List of responses

setQueryAttr

public void setQueryAttr(String attr)
Set the attribute used by the query

Parameters:
attr - query attribute

setQueryValue

public void setQueryValue(String value)
Set the value used by the query

Parameters:
value - Query value

getAdvertisements

public Enumeration<Advertisement> getAdvertisements()
Get the responses to the query as advertisements.

Returns:
The response advertisements.

JXSE