LimeWire Consolidated API

com.limegroup.gnutella.messages
Interface QueryRequestFactory

All Known Implementing Classes:
QueryRequestFactoryImpl

public interface QueryRequestFactory


Method Summary
 QueryRequest createDoNotProxyQuery(QueryRequest qr)
          Copies a query request and marks it to not be proxied.
 QueryRequest createMulticastQuery(byte[] guid, QueryRequest qr)
          Creates a new QueryRequest instance for multicast queries.
 QueryRequest createNetworkQuery(byte[] guid, byte ttl, byte hops, byte[] payload, Message.Network network)
          Creates a new query from the network.
 QueryRequest createNonFirewalledQuery(String query, byte ttl)
          Specialized constructor used to create a query without the firewalled bit set.
 QueryRequest createOutOfBandQuery(byte[] guid, String query, String xmlQuery)
          Creates a new query for the specified file name and the designated XML.
 QueryRequest createOutOfBandQuery(byte[] guid, String query, String xmlQuery, MediaType type)
          Creates a new query for the specified file name and the designated XML.
 QueryRequest createOutOfBandQuery(String query, byte[] ip, int port)
          Creates a new query for the specified file name, with no XML.
 QueryRequest createProxyQuery(QueryRequest qr, byte[] guid)
          Creates a new OOBquery from the existing query with the specified guid (which should be address encoded).
 QueryRequest createQuery(byte[] guid, String query, String xmlQuery)
          Creates a new query with the specified guid, query string, and xml query string.
 QueryRequest createQuery(byte[] guid, String query, String xmlQuery, MediaType type)
          Creates a new query with the specified guid, query string, and xml query string.
 QueryRequest createQuery(QueryRequest qr, byte ttl)
          Creates a new query from the existing query with the specified ttl.
 QueryRequest createQuery(Set<? extends URN> urnSet)
          Creates a new query for the specified URN set.
 QueryRequest createQuery(String query)
          Creates a new query for the specified file name, with no XML.
 QueryRequest createQuery(String query, byte ttl)
          Creates a new query for the specified file name, with no XML.
 QueryRequest createQuery(String query, String xmlQuery)
          Creates a new query for the specified file name, with no XML.
 QueryRequest createQuery(URN sha1)
          Creates a new query for the specified SHA1 value.
 QueryRequest createQuery(URN sha1, String filename)
          Creates a new query for the specified SHA1 value with file name thrown in for good measure (or at least until \ works as a query).
 QueryRequest createQueryKeyQuery(QueryRequest qr, AddressSecurityToken key)
          Creates a new QueryRequest that is a copy of the input query, except that it includes the specified query key.
 QueryRequest createQueryKeyQuery(String query, AddressSecurityToken key)
          Creates a new query with the specified query key for use in GUESS-style UDP queries.
 QueryRequest createQueryKeyQuery(URN sha1, AddressSecurityToken key)
          Creates a new query with the specified query key for use in GUESS-style UDP queries.
 QueryRequest createQueryRequest(byte[] guid, byte ttl, int minSpeed, String query, String richQuery, Set<? extends URN> queryUrns, AddressSecurityToken addressSecurityToken, boolean isFirewalled, Message.Network network, boolean canReceiveOutOfBandReplies, int featureSelector, boolean doNotProxy, int metaFlagMask)
          Builds a new query from scratch but you can flag it as a Requery, if needed.
 QueryRequest createQueryRequest(byte[] guid, byte ttl, int minSpeed, String query, String richQuery, Set<? extends URN> queryUrns, AddressSecurityToken addressSecurityToken, boolean isFirewalled, Message.Network network, boolean canReceiveOutOfBandReplies, int featureSelector, boolean doNotProxy, int metaFlagMask, boolean normalize)
          Builds a new query from scratch but you can flag it as a Requery, if needed.
 QueryRequest createQueryRequest(byte[] guid, byte ttl, String query, String richQuery, Set<? extends URN> queryUrns, AddressSecurityToken addressSecurityToken, boolean isFirewalled, Message.Network network, boolean canReceiveOutOfBandReplies, int featureSelector)
          Builds a new query from scratch but you can flag it as a Requery, if needed.
 QueryRequest createQueryRequest(byte[] guid, byte ttl, String query, String richQuery, Set<? extends URN> queryUrns, AddressSecurityToken addressSecurityToken, boolean isFirewalled, Message.Network network, boolean canReceiveOutOfBandReplies, int featureSelector, boolean doNotProxy, int metaFlagMask)
          Builds a new query from scratch but you can flag it as a Requery, if needed.
 QueryRequest createRequery(String query)
          Creates a requery for when we don't know the hash of the file -- we don't know the hash.
 QueryRequest createRequery(URN sha1)
          Creates a new requery for the specified SHA1 value.
 QueryRequest createRequery(URN sha1, byte ttl)
          Creates a new requery for the specified SHA1 value and the specified firewall boolean.
 QueryRequest createWhatIsNewOOBQuery(byte[] guid, byte ttl)
          Creates a new 'What is new'? OOB query with the specified guid and ttl.
 QueryRequest createWhatIsNewOOBQuery(byte[] guid, byte ttl, MediaType type)
          Creates a new 'What is new'? OOB query with the specified guid and ttl.
 QueryRequest createWhatIsNewQuery(byte[] guid, byte ttl)
          Creates a new 'What is new'? query with the specified guid and ttl.
 QueryRequest createWhatIsNewQuery(byte[] guid, byte ttl, MediaType type)
          Creates a new 'What is new'? query with the specified guid and ttl.
 QueryRequest unmarkOOBQuery(QueryRequest qr)
          Creates a new query from the existing query and loses the OOB marking.
 

Method Detail

createRequery

QueryRequest createRequery(URN sha1)
Creates a new requery for the specified SHA1 value.

Parameters:
sha1 - the URN of the file to search for
Returns:
a new QueryRequest for the specified SHA1 value
Throws:
NullPointerException - if the sha1 argument is null

createQuery

QueryRequest createQuery(URN sha1)
Creates a new query for the specified SHA1 value.

Parameters:
sha1 - the URN of the file to search for
Returns:
a new QueryRequest for the specified SHA1 value
Throws:
NullPointerException - if the sha1 argument is null

createQuery

QueryRequest createQuery(URN sha1,
                         String filename)
Creates a new query for the specified SHA1 value with file name thrown in for good measure (or at least until \ works as a query).

Parameters:
sha1 - the URN of the file to search for
Returns:
a new QueryRequest for the specified SHA1 value
Throws:
NullPointerException - if the sha1 argument is null

createRequery

QueryRequest createRequery(URN sha1,
                           byte ttl)
Creates a new requery for the specified SHA1 value and the specified firewall boolean.

Parameters:
sha1 - the URN of the file to search for
ttl - the time to live (ttl) of the query
Returns:
a new QueryRequest for the specified SHA1 value
Throws:
NullPointerException - if the sha1 argument is null
IllegalArgumentException - if the ttl value is negative or greater than the maximum allowed value

createQuery

QueryRequest createQuery(Set<? extends URN> urnSet)
Creates a new query for the specified URN set.

Parameters:
urnSet - the Set of URNss to request.
Returns:
a new QueryRequest for the specied UrnTypes and URNs
Throws:
NullPointerException - if either sets are null.

createRequery

QueryRequest createRequery(String query)
Creates a requery for when we don't know the hash of the file -- we don't know the hash.

Parameters:
query - the query string
Returns:
a new QueryRequest for the specified query
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createQuery

QueryRequest createQuery(String query)
Creates a new query for the specified file name, with no XML.

Parameters:
query - the file name to search for
Returns:
a new QueryRequest for the specified query
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createOutOfBandQuery

QueryRequest createOutOfBandQuery(byte[] guid,
                                  String query,
                                  String xmlQuery)
Creates a new query for the specified file name and the designated XML.

Parameters:
query - the file name to search for
guid - I trust that this is a address encoded guid. Your loss if it isn't....
Returns:
a new QueryRequest for the specified query that has encoded the input ip and port into the GUID and appropriate marked the query to signify out of band support.
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createOutOfBandQuery

QueryRequest createOutOfBandQuery(byte[] guid,
                                  String query,
                                  String xmlQuery,
                                  MediaType type)
Creates a new query for the specified file name and the designated XML.

Parameters:
query - the file name to search for
guid - I trust that this is a address encoded guid. Your loss if it isn't....
type - can be null - the type of results you want.
Returns:
a new QueryRequest for the specified query that has encoded the input ip and port into the GUID and appropriate marked the query to signify out of band support AND specifies a file type category.
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createOutOfBandQuery

QueryRequest createOutOfBandQuery(String query,
                                  byte[] ip,
                                  int port)
Creates a new query for the specified file name, with no XML.

Parameters:
query - the file name to search for
Returns:
a new QueryRequest for the specified query that has encoded the input ip and port into the GUID and appropriate marked the query to signify out of band support.
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createWhatIsNewQuery

QueryRequest createWhatIsNewQuery(byte[] guid,
                                  byte ttl)
Creates a new 'What is new'? query with the specified guid and ttl.

Parameters:
ttl - the desired ttl of the query.
guid - the desired guid of the query.

createWhatIsNewQuery

QueryRequest createWhatIsNewQuery(byte[] guid,
                                  byte ttl,
                                  MediaType type)
Creates a new 'What is new'? query with the specified guid and ttl.

Parameters:
ttl - the desired ttl of the query.
guid - the desired guid of the query.

createWhatIsNewOOBQuery

QueryRequest createWhatIsNewOOBQuery(byte[] guid,
                                     byte ttl)
Creates a new 'What is new'? OOB query with the specified guid and ttl.

Parameters:
ttl - the desired ttl of the query.
guid - the desired guid of the query.

createWhatIsNewOOBQuery

QueryRequest createWhatIsNewOOBQuery(byte[] guid,
                                     byte ttl,
                                     MediaType type)
Creates a new 'What is new'? OOB query with the specified guid and ttl.

Parameters:
ttl - the desired ttl of the query.
guid - the desired guid of the query.

createQuery

QueryRequest createQuery(String query,
                         String xmlQuery)
Creates a new query for the specified file name, with no XML.

Parameters:
query - the file name to search for
Returns:
a new QueryRequest for the specified query
Throws:
NullPointerException - if the query argument is null or if the xmlQuery argument is null
IllegalArgumentException - if the query argument and the xml query are both zero-length (empty)

createQuery

QueryRequest createQuery(String query,
                         byte ttl)
Creates a new query for the specified file name, with no XML.

Parameters:
query - the file name to search for
ttl - the time to live (ttl) of the query
Returns:
a new QueryRequest for the specified query and ttl
Throws:
NullPointerException - if the query argument is null
IllegalArgumentException - if the query argument is zero-length (empty)
IllegalArgumentException - if the ttl value is negative or greater than the maximum allowed value

createQuery

QueryRequest createQuery(byte[] guid,
                         String query,
                         String xmlQuery)
Creates a new query with the specified guid, query string, and xml query string.

Parameters:
guid - the message GUID for the query
query - the query string
xmlQuery - the xml query string
Returns:
a new QueryRequest for the specified query, xml query, and guid
Throws:
NullPointerException - if the query argument is null, if the xmlQuery argument is null, or if the guid argument is null
IllegalArgumentException - if the guid length is not 16, if both the query strings are empty, or if the XML does not appear to be valid

createQuery

QueryRequest createQuery(byte[] guid,
                         String query,
                         String xmlQuery,
                         MediaType type)
Creates a new query with the specified guid, query string, and xml query string.

Parameters:
guid - the message GUID for the query
query - the query string
xmlQuery - the xml query string
Returns:
a new QueryRequest for the specified query, xml query, and guid
Throws:
NullPointerException - if the query argument is null, if the xmlQuery argument is null, or if the guid argument is null
IllegalArgumentException - if the guid length is not 16, if both the query strings are empty, or if the XML does not appear to be valid

createProxyQuery

QueryRequest createProxyQuery(QueryRequest qr,
                              byte[] guid)
Creates a new OOBquery from the existing query with the specified guid (which should be address encoded).

Parameters:
qr - the QueryRequest to copy
Returns:
a new QueryRequest with the specified guid that is now OOB marked.
Throws:
IllegalArgumentException - thrown if guid is not right size of if query is bad.

createDoNotProxyQuery

QueryRequest createDoNotProxyQuery(QueryRequest qr)
Copies a query request and marks it to not be proxied.

Throws:
IllegalArgumentException - if the payload is not modifiable
IllegalArgumentException - if the query request is not from a LimeWire
IllegalArgumentException - if #isOriginated() is false

createQuery

QueryRequest createQuery(QueryRequest qr,
                         byte ttl)
Creates a new query from the existing query with the specified ttl.

Parameters:
qr - the QueryRequest to copy
ttl - the new ttl
Returns:
a new QueryRequest with the specified ttl

unmarkOOBQuery

QueryRequest unmarkOOBQuery(QueryRequest qr)
Creates a new query from the existing query and loses the OOB marking. This should only be used for messages that originated from this client.

Parameters:
qr - the QueryRequest to copy
Returns:
a new QueryRequest with no OOB marking
Throws:
IllegalArgumentException - if the payload is not modifiable
IllegalArgumentException - if the query request is not from a LimeWire

createQueryKeyQuery

QueryRequest createQueryKeyQuery(String query,
                                 AddressSecurityToken key)
Creates a new query with the specified query key for use in GUESS-style UDP queries.

Parameters:
query - the query string
key - the query key
Returns:
a new QueryRequest instance with the specified query string and query key
Throws:
NullPointerException - if the query argument is null or if the key argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createQueryKeyQuery

QueryRequest createQueryKeyQuery(URN sha1,
                                 AddressSecurityToken key)
Creates a new query with the specified query key for use in GUESS-style UDP queries.

Parameters:
sha1 - the URN
key - the query key
Returns:
a new QueryRequest instance with the specified URN request and query key
Throws:
NullPointerException - if the query argument is null or if the key argument is null
IllegalArgumentException - if the query argument is zero-length (empty)

createMulticastQuery

QueryRequest createMulticastQuery(byte[] guid,
                                  QueryRequest qr)
Creates a new QueryRequest instance for multicast queries. This is necessary due to the unique properties of multicast queries, such as the firewalled bit not being set regardless of whether or not the node is truly firewalled/NATted to the world outside the subnet.

Parameters:
qr - the QueryRequest instance containing all the data necessary to create a multicast query
Returns:
a new QueryRequest instance with bits set for multicast -- a min speed bit in particular
Throws:
NullPointerException - if the qr argument is null

createQueryKeyQuery

QueryRequest createQueryKeyQuery(QueryRequest qr,
                                 AddressSecurityToken key)
Creates a new QueryRequest that is a copy of the input query, except that it includes the specified query key.

Parameters:
qr - the QueryRequest to use
key - the AddressSecurityToken to add
Returns:
a new QueryRequest from the specified query and key

createNonFirewalledQuery

QueryRequest createNonFirewalledQuery(String query,
                                      byte ttl)
Specialized constructor used to create a query without the firewalled bit set. This should primarily be used for testing.

Parameters:
query - the query string
Returns:
a new QueryRequest with the specified query string and without the firewalled bit set

createNetworkQuery

QueryRequest createNetworkQuery(byte[] guid,
                                byte ttl,
                                byte hops,
                                byte[] payload,
                                Message.Network network)
                                throws BadPacketException
Creates a new query from the network.

Parameters:
guid - the GUID of the query
ttl - the time to live of the query
hops - the hops of the query
payload - the query payload
Returns:
a new QueryRequest instance from the specified data
Throws:
BadPacketException

createQueryRequest

QueryRequest createQueryRequest(byte[] guid,
                                byte ttl,
                                String query,
                                String richQuery,
                                Set<? extends URN> queryUrns,
                                AddressSecurityToken addressSecurityToken,
                                boolean isFirewalled,
                                Message.Network network,
                                boolean canReceiveOutOfBandReplies,
                                int featureSelector)
Builds a new query from scratch but you can flag it as a Requery, if needed. If you need to make a query that accepts out-of-band results, be sure to set the guid correctly (see GUID.makeAddressEncodedGUI) and set canReceiveOutOfBandReplies .

Parameters:
queryUrns - Set of URN instances requested for this query, which may be empty or null if no URNs were requested
Throws:
IllegalArgumentException - if the query string, the xml query string, and the urns are all empty, or if the feature selector is bad

createQueryRequest

QueryRequest createQueryRequest(byte[] guid,
                                byte ttl,
                                String query,
                                String richQuery,
                                Set<? extends URN> queryUrns,
                                AddressSecurityToken addressSecurityToken,
                                boolean isFirewalled,
                                Message.Network network,
                                boolean canReceiveOutOfBandReplies,
                                int featureSelector,
                                boolean doNotProxy,
                                int metaFlagMask)
Builds a new query from scratch but you can flag it as a Requery, if needed. If you need to make a query that accepts out-of-band results, be sure to set the guid correctly (see GUID.makeAddressEncodedGUI) and set canReceiveOutOfBandReplies .

Parameters:
queryUrns - Set of URN instances requested for this query, which may be empty or null if no URNs were requested
Throws:
IllegalArgumentException - if the query string, the xml query string, and the urns are all empty, or if the feature selector is bad

createQueryRequest

QueryRequest createQueryRequest(byte[] guid,
                                byte ttl,
                                int minSpeed,
                                String query,
                                String richQuery,
                                Set<? extends URN> queryUrns,
                                AddressSecurityToken addressSecurityToken,
                                boolean isFirewalled,
                                Message.Network network,
                                boolean canReceiveOutOfBandReplies,
                                int featureSelector,
                                boolean doNotProxy,
                                int metaFlagMask)
Builds a new query from scratch but you can flag it as a Requery, if needed. If you need to make a query that accepts out-of-band results, be sure to set the guid correctly (see GUID.makeAddressEncodedGUI) and set canReceiveOutOfBandReplies .

Parameters:
queryUrns - Set of URN instances requested for this query, which may be empty or null if no URNs were requested
Throws:
IllegalArgumentException - if the query string, the xml query string, and the urns are all empty, or if the capability selector is bad

createQueryRequest

QueryRequest createQueryRequest(byte[] guid,
                                byte ttl,
                                int minSpeed,
                                String query,
                                String richQuery,
                                Set<? extends URN> queryUrns,
                                AddressSecurityToken addressSecurityToken,
                                boolean isFirewalled,
                                Message.Network network,
                                boolean canReceiveOutOfBandReplies,
                                int featureSelector,
                                boolean doNotProxy,
                                int metaFlagMask,
                                boolean normalize)
Builds a new query from scratch but you can flag it as a Requery, if needed. If you need to make a query that accepts out-of-band results, be sure to set the guid correctly (see GUID.makeAddressEncodedGUI) and set canReceiveOutOfBandReplies .

Parameters:
queryUrns - Set of URN instances requested for this query, which may be empty or null if no URNs were requested
Throws:
IllegalArgumentException - if the query string, the xml query string, and the urns are all empty, or if the capability selector is bad

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.