JXTA

net.jxta.protocol
Class ResolverQueryMsg

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

public abstract class ResolverQueryMsg
extends Object

Generic Resolver Service message "Query".

See Also:
ResolverService, ResolverResponseMsg, JXTA Protocols Specification : Peer Resolver Protocol

Field Summary
protected  int hopcount
          Number of times a message has been forwarded, not propagated or walked
protected  int queryid
          Query ID of this query.
 
Constructor Summary
ResolverQueryMsg()
           
 
Method Summary
static String getAdvertisementType()
          All messages have a type (in xml this is !
 StructuredDocument getCredential()
          returns the credential
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.
 String getHandlerName()
          returns the handlername
 int getHopCount()
          returns the hop count
 String getQuery()
          returns the query
 int getQueryId()
          returns queryid value
 String getSrc()
          Deprecated. Use getSrcPeer() instead.
 ID getSrcPeer()
          Returns the source of the query
 RouteAdvertisement getSrcPeerRoute()
          Returns the source route of the query
 void incrementHopCount()
          increment hop count
abstract  ResolverResponseMsg makeResponse()
          Create a ResolverResponse from a ResolverQuery message.
 void setCredential(StructuredDocument cred)
          set the credential
 void setHandlerName(String name)
          set the handlername
 void setHopCount(int newCount)
          Set hop count
 void setQuery(String Query)
          set the Query string
 void setQueryId(int id)
          set the query id.
 void setSrc(String src)
          Deprecated. Use setSrcPeer(ID) instead.
 void setSrcPeer(ID srcPeer)
          Set the source of the query
 void setSrcPeerRoute(RouteAdvertisement route)
          set the source route of the query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hopcount

protected int hopcount
Number of times a message has been forwarded, not propagated or walked


queryid

protected int queryid
Query ID of this query. Unique to the originating node only, it can be utilized to match queries to responses.

Constructor Detail

ResolverQueryMsg

public ResolverQueryMsg()
Method Detail

getCredential

public StructuredDocument getCredential()
returns the credential

Returns:
String credential

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 representation for the returned document
Returns:
Document document representing the advertisement

getHandlerName

public String getHandlerName()
returns the handlername

Returns:
String handlername name

getHopCount

public int getHopCount()
returns the hop count

Returns:
int hop count

incrementHopCount

public void incrementHopCount()
increment hop count


setHopCount

public void setHopCount(int newCount)
Set hop count

Parameters:
newCount - hop count

getQuery

public String getQuery()
returns the query

Returns:
String value of the query

getQueryId

public int getQueryId()
returns queryid value

Returns:
int queryid value

getSrc

@Deprecated
public String getSrc()
Deprecated. Use getSrcPeer() instead.

Returns the source of the query

Returns:
String the peerid of the source of the query

getSrcPeer

public ID getSrcPeer()
Returns the source of the query

Returns:
The peerid of the source of the query

getSrcPeerRoute

public RouteAdvertisement getSrcPeerRoute()
Returns the source route of the query

Returns:
RouteAdvertisement route to the issuer of the query

setCredential

public void setCredential(StructuredDocument cred)
set the credential

Parameters:
cred - string representing credential

setHandlerName

public void setHandlerName(String name)
set the handlername

Parameters:
name - handler name

setQuery

public void setQuery(String Query)
set the Query string

Parameters:
Query - string representing the query

setQueryId

public void setQueryId(int id)
set the query id. Each query has a unique id.

Parameters:
id - int id

setSrcPeerRoute

public void setSrcPeerRoute(RouteAdvertisement route)
set the source route of the query

Parameters:
route - route advertisement of the source peer

setSrc

@Deprecated
public void setSrc(String src)
Deprecated. Use setSrcPeer(ID) instead.

Set the source of the query

Parameters:
src - is a containing the peerid of the source

setSrcPeer

public void setSrcPeer(ID srcPeer)
Set the source of the query

Parameters:
srcPeer - the peerid of the source

getAdvertisementType

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

Returns:
String "jxta:ResolverQuery"

makeResponse

public abstract ResolverResponseMsg makeResponse()
Create a ResolverResponse from a ResolverQuery message. This method takes advantage of any internal information available in an incoming Resolver query to build a resolver response for that query. For instance, optional route information which may be available in the query will be used to bypass the route resolution to send the response.

WARNING: A side effect of this call is that the following fields are transfered from the query to the response: - HandlerName - QueryId

Returns:
ResolverResponseMsg resolverResponse built from the resolverQuery msg

JXSE