${header}

meteor.dht
Class QueryMessage

java.lang.Object
  extended bymeteor.dht.QueryMessage

public class QueryMessage
extends java.lang.Object

The METEOR query message, which will be wrapped by a Resolver query message to send the query to other peers. QueryMessage contains information about the querying peer as well as the response to the query added by the responding peer this allows to maintain full state of the query once returned to the querying peer.

Author:
Vincent Matossian vincentm@caip.rutgers.edu January 2004

Field Summary
static int ASYNCH
           
static int OVERLAY
           
static int SQUID
           
static int SYNCH
           
static int USER
           
 
Constructor Summary
QueryMessage(java.io.InputStream stream)
          Creates a query object by parsing the given input stream.
QueryMessage(java.lang.String qt, java.math.BigInteger t, java.math.BigInteger cID, java.lang.String jID)
          Constructor with 4 params used for notify messages
QueryMessage(java.lang.String qt, java.math.BigInteger t, java.math.BigInteger cID, java.lang.String jID, int o)
          Constructor with 5 params
QueryMessage(java.lang.String qt, java.math.BigInteger cID, java.lang.String jID)
          Constructor with 3 params used for notify messages
QueryMessage(java.lang.String qt, int mod, java.math.BigInteger t, java.math.BigInteger cID, java.lang.String jID)
          Constructor with 5 params used for bootstrap messages
QueryMessage(java.lang.String qt, int mod, java.math.BigInteger t, java.math.BigInteger cID, java.lang.String jID, int own)
          Constructor with 6 params used for bootstrap messages
 
Method Summary
 net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
          Returns a Document representation of the query.
 java.lang.String getJxtaResponse()
           
 int getLevel()
           
 int getMode()
           
 int getOwner()
           
 java.lang.String getQueryingJxtaID()
           
 java.math.BigInteger getQueryingNodeID()
           
 java.lang.String getQueryType()
           
 java.lang.String getRespondingJxtaID()
           
 java.math.BigInteger getRespondingNodeID()
           
 java.math.BigInteger getResponse()
           
 java.lang.String getSquidQuery()
           
 java.lang.String getSquidResponse()
           
 java.math.BigInteger getTarget()
           
 void setJxtaResponse(java.lang.String r)
           
 void setLevel(int l)
           
 void setMode(int mod)
           
 void setOwner(int o)
           
 void setQueryType(java.lang.String type)
           
 void setRespondingJxtaID(java.lang.String resp)
           
 void setRespondingNodeID(java.math.BigInteger resp)
           
 void setResponse(java.math.BigInteger resp)
           
 void setSquidQuery(java.lang.String q)
           
 void setSquidResponse(java.lang.String q)
           
 java.lang.String toString()
          Returns an XML String representation of the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OVERLAY

public static final int OVERLAY
See Also:
Constant Field Values

USER

public static final int USER
See Also:
Constant Field Values

SQUID

public static final int SQUID
See Also:
Constant Field Values

SYNCH

public static final int SYNCH
See Also:
Constant Field Values

ASYNCH

public static final int ASYNCH
See Also:
Constant Field Values
Constructor Detail

QueryMessage

public QueryMessage(java.lang.String qt,
                    java.math.BigInteger t,
                    java.math.BigInteger cID,
                    java.lang.String jID,
                    int o)
Constructor with 5 params

Parameters:
qt - the Query Type : find_successor, predecessor or notify
t - the Target identifier in the query
cID - the Overlay Identifier of the querying node
jID - the JxtaID identifier of the querying node
o - the Owner of this query, USER or OVERLAY (system)

QueryMessage

public QueryMessage(java.lang.String qt,
                    java.math.BigInteger cID,
                    java.lang.String jID)
Constructor with 3 params used for notify messages

Parameters:
qt - the Query Type : find_successor, predecessor or notify
cID - the Overlay Identifier of the querying node
jID - the JxtaID identifier of the querying node

QueryMessage

public QueryMessage(java.lang.String qt,
                    java.math.BigInteger t,
                    java.math.BigInteger cID,
                    java.lang.String jID)
Constructor with 4 params used for notify messages

Parameters:
qt - the Query Type : find_successor, predecessor or notify
t - the Target identifier in the query
cID - the Overlay Identifier of the querying node
jID - the JxtaID identifier of the querying node

QueryMessage

public QueryMessage(java.lang.String qt,
                    int mod,
                    java.math.BigInteger t,
                    java.math.BigInteger cID,
                    java.lang.String jID)
Constructor with 5 params used for bootstrap messages

Parameters:
qt - the Query Type : find_successor, predecessor or notify
t - the Target identifier in the query
cID - the Overlay Identifier of the querying node
jID - the JxtaID identifier of the querying node
mod - the type of message SYNCH or ASYNCH

QueryMessage

public QueryMessage(java.lang.String qt,
                    int mod,
                    java.math.BigInteger t,
                    java.math.BigInteger cID,
                    java.lang.String jID,
                    int own)
Constructor with 6 params used for bootstrap messages

Parameters:
qt - the Query Type : find_successor, predecessor or notify
t - the Target identifier in the query
cID - the Overlay Identifier of the querying node
jID - the JxtaID identifier of the querying node
mod - the type of message SYNCH or ASYNCH
own - the owner of the message, USER or OVERLAY

QueryMessage

public QueryMessage(java.io.InputStream stream)
             throws java.lang.Exception
Creates a query object by parsing the given input stream.

Parameters:
stream - the InputStream source of the query data.
Throws:
java.lang.Exception - if the message can't be parsed from the stream.
Method Detail

getDocument

public net.jxta.document.Document getDocument(net.jxta.document.MimeMediaType asMimeType)
                                       throws java.lang.Exception
Returns a Document representation of the query.

Parameters:
asMimeType - the desired MIME type representation for the query.
Returns:
a Document form of the query in the specified MIME representation.
Throws:
java.lang.Exception - if the document can't be created.

getQueryType

public java.lang.String getQueryType()

setQueryType

public void setQueryType(java.lang.String type)

getTarget

public java.math.BigInteger getTarget()

getQueryingNodeID

public java.math.BigInteger getQueryingNodeID()

getQueryingJxtaID

public java.lang.String getQueryingJxtaID()

getResponse

public java.math.BigInteger getResponse()

setResponse

public void setResponse(java.math.BigInteger resp)

getJxtaResponse

public java.lang.String getJxtaResponse()

setJxtaResponse

public void setJxtaResponse(java.lang.String r)

getRespondingNodeID

public java.math.BigInteger getRespondingNodeID()

setRespondingNodeID

public void setRespondingNodeID(java.math.BigInteger resp)

getRespondingJxtaID

public java.lang.String getRespondingJxtaID()

setLevel

public void setLevel(int l)

getLevel

public int getLevel()

setRespondingJxtaID

public void setRespondingJxtaID(java.lang.String resp)

getMode

public int getMode()

setMode

public void setMode(int mod)

getOwner

public int getOwner()

setOwner

public void setOwner(int o)

setSquidQuery

public void setSquidQuery(java.lang.String q)

getSquidQuery

public java.lang.String getSquidQuery()

setSquidResponse

public void setSquidResponse(java.lang.String q)

getSquidResponse

public java.lang.String getSquidResponse()

toString

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

Returns:
the XML String representing this query.

${header}